difyctl works in one active workspace at a time, taken from a flag, an environment variable, or your stored default. For the order those take priority, see How difyctl Picks a Workspace.
difyctl get workspacelists the workspaces you belong touse workspaceswitches the active one
Workspaces apply to account users only. If you signed in through external SSO, you’re scoped to a single context with no workspace, and the commands here don’t apply. See Scope and Limitations for details.
List Your Workspaces
Flags
| Flag | Type | Default | Description |
|---|---|---|---|
-o <format> | string | none | Output format: json, yaml, name, or wide. Omit the flag for the default table. |
Examples
See your workspaces and which one is active:Output
| Format | What stdout gets |
|---|---|
| default | An aligned table. CURRENT marks your active workspace with *, and ROLE is your role in each one. |
-o wide | The same columns. Workspaces have no wide-only columns. |
-o json, -o yaml | A workspaces array, each entry carrying id, name, role, status, and current. |
-o name | The workspace IDs, one per line. |
-o json:
Exit Codes
| Code | Meaning |
|---|---|
0 | Success |
1 | Network or server error |
2 | Usage error, such as an unsupported -o value |
4 | Authentication failure |
7 | Rate limited (HTTP 429) |
Switch Your Workspace
use workspace switches your active workspace on the server first, then updates the stored default in hosts.yml. If the switch fails (the workspace doesn’t exist, or you’re not a member), your local state is left untouched.
Arguments
workspace-id: the workspace to switch to, fromget workspace. In a terminal, omit it to pick from your workspaces, the current one marked*. In a non-interactive session (script, CI, pipe), it’s required.
Flags
Only the global flags.Examples
Pick interactively from your workspaces:--workspace instead:
Output
On success, the new active workspace is confirmed on stdout:Exit Codes
| Code | Meaning |
|---|---|
0 | Success |
1 | Workspace not found, or another server error |
2 | Usage error, such as omitting workspace-id where there’s no terminal to pick in |
4 | Authentication failure, or no workspaces available when use workspace opens its picker |
7 | Rate limited (HTTP 429) |
How difyctl Picks a Workspace
Apps live in exactly one workspace, so every command that targets one needs a workspace to run against.difyctl resolves it in this order, taking the first value it finds:
- The
--workspace <id>flag on the command itself. Applies to that invocation only. - The
DIFY_WORKSPACE_IDenvironment variable. - Your stored default, written to
hosts.ymlin the config directory when you sign in and updated byuse workspace.
2.
Workspace IDs are UUIDs, so pass an ID from get workspace, not a workspace name. A value that isn’t a UUID fails as a usage error.