# Workspaces (/cli/workspaces)

Read workspace access and manage reviewed fork, push, and pull operations.

`sim workspaces` is also spelled `sim workspace`.

These commands accept the [global options](/cli/commands#global-options).

## Workspace access \[#workspace-access]

### List workspaces \[#list-workspaces]

```bash
sim workspaces list [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--sort-by <value>` | No | Field used to sort the result. Do not rely on case-insensitive ordering when sorting by `name`. Defaults to "createdAt". Accepted values: `name`, `createdAt`, `updatedAt`. |
| `--sort-order <value>` | No | Sort direction. Defaults to "desc". Accepted values: `asc`, `desc`. |
| `--limit <n>` | No | Maximum items to return (0 for everything). Defaults to `0`. |

API request and response schemas: [listWorkspaces](/api-reference/workspaces/listWorkspaces).

### Get workspace \[#get-workspace]

```bash
sim workspaces get
```

API request and response schemas: [getWorkspace](/api-reference/workspaces/getWorkspace).

### Update workspace \[#update-workspace]

OAuth login or personal API key required.

```bash
sim workspaces update [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--name <value>` | No | New workspace display name. |
| `--logo-url <value>` | No | New workspace logo: a root-relative path (starting with /) or an https\:// URL. To remove the logo, send logoUrl: null through the API or MCP (--logo-url null sends the word, not JSON null). |

API request and response schemas: [updateWorkspace](/api-reference/workspaces/updateWorkspace).

### List workspace members \[#list-workspace-members]

```bash
sim workspaces members list [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--limit <n>` | No | Maximum items to return (0 for everything). Defaults to `0`. |

API request and response schemas: [listWorkspaceMembers](/api-reference/workspaces/listWorkspaceMembers).

### Update workspace member \[#update-workspace-member]

OAuth login or personal API key required.

```bash
sim workspaces members update <userId> [options]
```

**Arguments**

| Argument | Required | Description |
| - | - | - |
| `userId` | Yes | User identifier of the workspace member, as returned by List workspace members. |

**Options**

| Option | Required | Description |
| - | - | - |
| `--role <value>` | Yes | New workspace role. Inherited organization Admin access, the workspace owner, and the workspace billing account keep Admin and cannot be changed here. Accepted values: `admin`, `write`, `read`. |

API request and response schemas: [updateWorkspaceMember](/api-reference/workspaces/updateWorkspaceMember).

### Remove workspace member \[#remove-workspace-member]

OAuth login or personal API key required.

This removes the member’s workspace access. If it was their last workspace in the organization, their organization membership is removed and their sessions end.

```bash
sim workspaces members remove <userId> [options]
```

**Arguments**

| Argument | Required | Description |
| - | - | - |
| `userId` | Yes | User identifier of the workspace member, as returned by List workspace members. |

**Options**

| Option | Required | Description |
| - | - | - |
| `-y, --yes` | Yes | Confirm this operation. |

API request and response schemas: [removeWorkspaceMember](/api-reference/workspaces/removeWorkspaceMember).

### Create workspace invitations \[#create-workspace-invitations]

OAuth login or personal API key required.

```bash
sim workspaces invitations create [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--emails <value...>` | Yes | Email addresses to invite. Each address is processed separately; inspect failed for unsuccessful recipients. (space- or comma-separated, a JSON array, or @path / @- with one value per line; @@value for a literal leading @). |
| `--permission <value>` | No | Workspace permission to grant. Existing workspace access is preserved. Defaults to "read". Accepted values: `admin`, `write`, `read`. |
| `--membership <value>` | No | Organization membership: member or admin uses a seat when billing is enabled. External grants workspace access only and requires an eligible paid account when billing is enabled. Existing members of another organization remain external. Defaults to "member". Accepted values: `member`, `admin`, `external`. |

API request and response schemas: [createWorkspaceInvitations](/api-reference/workspaces/createWorkspaceInvitations).

### Get workspace permission config \[#get-workspace-permission-config]

OAuth login or personal API key required.

```bash
sim workspaces permission-config
```

API request and response schemas: [getWorkspacePermissionConfig](/api-reference/workspaces/getWorkspacePermissionConfig).

## Access requests \[#access-requests]

### Discover workspace access requests \[#discover-workspace-access-requests]

OAuth login or personal API key required.

```bash
sim workspaces access-requests discover [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--search <value>` | No | Case-insensitive substring match against the access item label. |
| `--target-kind <value>` | No | Category of access to discover. Accepted values: `feature`, `integration`, `provider`, `model`, `tool`, `knowledge_connector`, `file_share_auth`, `chat_deploy_auth`, `usage_limit`. |
| `--state <value>` | No | Filter by the acting user’s current access. Requestable items can be submitted for review. Accepted values: `allowed`, `requestable`, `unavailable`. |
| `--sort-by <value>` | No | Field used to sort the result. Defaults to "label". Accepted values: `label`. |
| `--sort-order <value>` | No | Sort direction. Defaults to "asc". Accepted values: `asc`, `desc`. |
| `--limit <n>` | No | Maximum items to return (0 for everything). Defaults to `100`. |
| `--cursor <value>` | No | Continue from nextCursor returned by a previous result. |

API request and response schemas: [discoverWorkspaceAccessRequests](/api-reference/access-requests/discoverWorkspaceAccessRequests).

### Create workspace access request \[#create-workspace-access-request]

OAuth login or personal API key required.

```bash
sim workspaces access-requests create [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--target <json\|@file>` | Yes | Target returned by Discover Workspace Access Requests or Discover Organization Access Requests. The target must currently be requestable. (JSON, or @path / @- to read a file or stdin). |
| `--reason <value>` | No | Why the acting user needs this access. Defaults to "". |

API request and response schemas: [createWorkspaceAccessRequest](/api-reference/access-requests/createWorkspaceAccessRequest).

### List my workspace access requests \[#list-my-workspace-access-requests]

OAuth login or personal API key required.

```bash
sim workspaces access-requests mine [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--status <value>` | No | Filter by request status; omit to include all statuses. Accepted values: `pending`, `fulfilled`, `declined`, `cancelled`, `closed`. |
| `--sort-by <value>` | No | Field used to sort the result. Defaults to "createdAt". Accepted values: `createdAt`, `targetLabel`. |
| `--sort-order <value>` | No | Sort direction. Defaults to "desc". Accepted values: `asc`, `desc`. |
| `--limit <n>` | No | Maximum items to return (0 for everything). Defaults to `100`. |
| `--cursor <value>` | No | Continue from nextCursor returned by a previous result. |

API request and response schemas: [listMyWorkspaceAccessRequests](/api-reference/access-requests/listMyWorkspaceAccessRequests).

### Cancel workspace access request \[#cancel-workspace-access-request]

OAuth login or personal API key required.

```bash
sim workspaces access-requests cancel <requestId>
```

**Arguments**

| Argument | Required | Description |
| - | - | - |
| `requestId` | Yes | Access request identifier. |

API request and response schemas: [cancelWorkspaceAccessRequest](/api-reference/access-requests/cancelWorkspaceAccessRequest).

## Forks and lineage \[#forks-and-lineage]

### Get workspace fork availability \[#get-workspace-fork-availability]

OAuth login or personal API key required.

```bash
sim workspaces fork-availability
```

API request and response schemas: [getWorkspaceForkAvailability](/api-reference/workspace-sync/getWorkspaceForkAvailability).

### List workspace fork resources \[#list-workspace-fork-resources]

OAuth login or personal API key required.

```bash
sim workspaces fork-resources [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--limit <n>` | No | Maximum items to return (0 for everything). Defaults to `100`. |
| `--cursor <value>` | No | Continue from nextCursor returned by a previous result. |
| `--kind <value>` | Yes | Kind of source resource to list for copy selection. Accepted values: `files`, `tables`, `knowledgeBases`, `customTools`, `skills`, `mcpServers`, `workflowMcpServers`. |
| `--sort-by <value>` | No | Supported stable sort key for this collection. Defaults to "id". Accepted values: `id`. |
| `--sort-order <value>` | No | Sort direction. Defaults to "asc". Accepted values: `asc`. |

API request and response schemas: [listWorkspaceForkResources](/api-reference/workspace-sync/listWorkspaceForkResources).

### Preview workspace fork \[#preview-workspace-fork]

OAuth login or personal API key required.

```bash
sim workspaces fork-preview [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--name <value>` | No | Display name of the workflow or workspace. |
| `--copy <json\|@file>` | No | Explicit resource selections to copy into the new fork; omitted resource kinds are not copied. (JSON, or @path / @- to read a file or stdin). |

API request and response schemas: [previewWorkspaceFork](/api-reference/workspace-sync/previewWorkspaceFork).

### Fork workspace \[#fork-workspace]

OAuth login or personal API key required.

```bash
sim workspaces fork [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--name <value>` | No | Display name of the workflow or workspace. |
| `--copy <json\|@file>` | No | Explicit resource selections to copy into the new fork; omitted resource kinds are not copied. (JSON, or @path / @- to read a file or stdin). |
| `--request-id <value>` | Yes | Stable client request ID. Reuse it with identical inputs after an uncertain response; changed inputs return 409. A new ID can apply another operation. |
| `--preview-fingerprint <value>` | Yes | Fingerprint returned by a preview with the same choices. A changed plan returns 409; preview again. The example hash is illustrative; use the actual preview value. |
| `--wait` | No | Wait for the committed operation to finish; missing configuration and failure exit nonzero. |
| `--wait-timeout <seconds>` | No | Maximum operation wait in seconds (default 3600; 0 waits indefinitely). |

API request and response schemas: [forkWorkspace](/api-reference/workspace-sync/forkWorkspace).

### Get workspace fork lineage \[#get-workspace-fork-lineage]

OAuth login or personal API key required.

```bash
sim workspaces lineage
```

API request and response schemas: [getWorkspaceForkLineage](/api-reference/workspace-sync/getWorkspaceForkLineage).

### List workspace fork children \[#list-workspace-fork-children]

OAuth login or personal API key required.

```bash
sim workspaces children [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--limit <n>` | No | Maximum items to return (0 for everything). Defaults to `100`. |
| `--cursor <value>` | No | Continue from nextCursor returned by a previous result. |
| `--sort-by <value>` | No | Supported stable sort key for this collection. Defaults to "createdAt". Accepted values: `createdAt`. |
| `--sort-order <value>` | No | Sort direction. Defaults to "desc". Accepted values: `desc`. |

API request and response schemas: [listWorkspaceForkChildren](/api-reference/workspace-sync/listWorkspaceForkChildren).

## Mappings \[#mappings]

### Get workspace fork mappings \[#get-workspace-fork-mappings]

OAuth login or personal API key required.

```bash
sim workspaces mappings get [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--other-workspace-id <value>` | Yes | Workspace on the other side of the direct fork edge. |
| `--direction <value>` | Yes | Push means current to other; pull means other to current, independent of parent/child orientation. Accepted values: `push`, `pull`. |
| `--limit <n>` | No | Maximum items to return (0 for everything). Defaults to `100`. |
| `--cursor <value>` | No | Continue from nextCursor returned by a previous result. |
| `--sort-by <value>` | No | Supported stable sort key for this collection. Defaults to "id". Accepted values: `id`. |
| `--sort-order <value>` | No | Sort direction. Defaults to "asc". Accepted values: `asc`. |

API request and response schemas: [getWorkspaceForkMappings](/api-reference/workspace-sync/getWorkspaceForkMappings).

### Update workspace fork mappings \[#update-workspace-fork-mappings]

OAuth login or personal API key required.

```bash
sim workspaces mappings update [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--other-workspace-id <value>` | Yes | Workspace on the other side of the direct fork edge. |
| `--direction <value>` | Yes | Push means current to other; pull means other to current, independent of parent/child orientation. Accepted values: `push`, `pull`. |
| `--mappings <json\|@file>` | Yes | Mapping entries addressed by resource type and `sourceId`. `targetId: null` clears a mapping. (JSON, or @path / @- to read a file or stdin). |

API request and response schemas: [updateWorkspaceForkMappings](/api-reference/workspace-sync/updateWorkspaceForkMappings).

## Push and pull \[#push-and-pull]

### Preview workspace push \[#preview-workspace-push]

OAuth login or personal API key required.

```bash
sim workspaces push-preview [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--other-workspace-id <value>` | Yes | Workspace on the other side of the direct fork edge. |
| `--mappings <json\|@file>` | No | Proposed mapping entries addressed by resource type and `sourceId`. Preview does not save them; apply commits them with the sync. (JSON, or @path / @- to read a file or stdin). |
| `--dependent-values <json\|@file>` | No | Destination-specific choices addressed by source workflow ID, source block ID, and field key. Omission keeps saved overrides; an explicit empty array clears them. (JSON, or @path / @- to read a file or stdin). |
| `--copy-resources <json\|@file>` | No | Explicit source resources to copy before syncing the workflows. (JSON, or @path / @- to read a file or stdin). |
| `--drop-references <json\|@file>` | No | Source-deleted references explicitly acknowledged for removal; live source references cannot be dropped. (JSON, or @path / @- to read a file or stdin). |
| `--trigger-mappings <json\|@file>` | No | Public trigger path choices from preview\.triggerSlots, addressed by source workflow and block IDs. Duplicate or unavailable choices are rejected. (JSON, or @path / @- to read a file or stdin). |

API request and response schemas: [previewWorkspacePush](/api-reference/workspace-sync/previewWorkspacePush).

### Push workspace \[#push-workspace]

OAuth login or personal API key required.

This replaces target workflows and may archive targets whose sources were deleted.

```bash
sim workspaces push [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--other-workspace-id <value>` | Yes | Workspace on the other side of the direct fork edge. |
| `--mappings <json\|@file>` | No | Proposed mapping entries addressed by resource type and `sourceId`. Preview does not save them; apply commits them with the sync. (JSON, or @path / @- to read a file or stdin). |
| `--dependent-values <json\|@file>` | No | Destination-specific choices addressed by source workflow ID, source block ID, and field key. Omission keeps saved overrides; an explicit empty array clears them. (JSON, or @path / @- to read a file or stdin). |
| `--copy-resources <json\|@file>` | No | Explicit source resources to copy before syncing the workflows. (JSON, or @path / @- to read a file or stdin). |
| `--drop-references <json\|@file>` | No | Source-deleted references explicitly acknowledged for removal; live source references cannot be dropped. (JSON, or @path / @- to read a file or stdin). |
| `--trigger-mappings <json\|@file>` | No | Public trigger path choices from preview\.triggerSlots, addressed by source workflow and block IDs. Duplicate or unavailable choices are rejected. (JSON, or @path / @- to read a file or stdin). |
| `--request-id <value>` | Yes | Stable client request ID. Reuse it with identical inputs after an uncertain response; changed inputs return 409. A new ID can apply another operation. |
| `--preview-fingerprint <value>` | Yes | Fingerprint returned by a preview with the same choices. A changed plan returns 409; preview again. The example hash is illustrative; use the actual preview value. |
| `--wait` | No | Wait for the committed operation to finish; missing configuration and failure exit nonzero. |
| `--wait-timeout <seconds>` | No | Maximum operation wait in seconds (default 3600; 0 waits indefinitely). |
| `-y, --yes` | Yes | Confirm this operation. |

API request and response schemas: [pushWorkspace](/api-reference/workspace-sync/pushWorkspace).

### Preview workspace pull \[#preview-workspace-pull]

OAuth login or personal API key required.

```bash
sim workspaces pull-preview [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--other-workspace-id <value>` | Yes | Workspace on the other side of the direct fork edge. |
| `--mappings <json\|@file>` | No | Proposed mapping entries addressed by resource type and `sourceId`. Preview does not save them; apply commits them with the sync. (JSON, or @path / @- to read a file or stdin). |
| `--dependent-values <json\|@file>` | No | Destination-specific choices addressed by source workflow ID, source block ID, and field key. Omission keeps saved overrides; an explicit empty array clears them. (JSON, or @path / @- to read a file or stdin). |
| `--copy-resources <json\|@file>` | No | Explicit source resources to copy before syncing the workflows. (JSON, or @path / @- to read a file or stdin). |
| `--drop-references <json\|@file>` | No | Source-deleted references explicitly acknowledged for removal; live source references cannot be dropped. (JSON, or @path / @- to read a file or stdin). |
| `--trigger-mappings <json\|@file>` | No | Public trigger path choices from preview\.triggerSlots, addressed by source workflow and block IDs. Duplicate or unavailable choices are rejected. (JSON, or @path / @- to read a file or stdin). |

API request and response schemas: [previewWorkspacePull](/api-reference/workspace-sync/previewWorkspacePull).

### Pull workspace \[#pull-workspace]

OAuth login or personal API key required.

This replaces target workflows and may archive targets whose sources were deleted.

```bash
sim workspaces pull [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--other-workspace-id <value>` | Yes | Workspace on the other side of the direct fork edge. |
| `--mappings <json\|@file>` | No | Proposed mapping entries addressed by resource type and `sourceId`. Preview does not save them; apply commits them with the sync. (JSON, or @path / @- to read a file or stdin). |
| `--dependent-values <json\|@file>` | No | Destination-specific choices addressed by source workflow ID, source block ID, and field key. Omission keeps saved overrides; an explicit empty array clears them. (JSON, or @path / @- to read a file or stdin). |
| `--copy-resources <json\|@file>` | No | Explicit source resources to copy before syncing the workflows. (JSON, or @path / @- to read a file or stdin). |
| `--drop-references <json\|@file>` | No | Source-deleted references explicitly acknowledged for removal; live source references cannot be dropped. (JSON, or @path / @- to read a file or stdin). |
| `--trigger-mappings <json\|@file>` | No | Public trigger path choices from preview\.triggerSlots, addressed by source workflow and block IDs. Duplicate or unavailable choices are rejected. (JSON, or @path / @- to read a file or stdin). |
| `--request-id <value>` | Yes | Stable client request ID. Reuse it with identical inputs after an uncertain response; changed inputs return 409. A new ID can apply another operation. |
| `--preview-fingerprint <value>` | Yes | Fingerprint returned by a preview with the same choices. A changed plan returns 409; preview again. The example hash is illustrative; use the actual preview value. |
| `--wait` | No | Wait for the committed operation to finish; missing configuration and failure exit nonzero. |
| `--wait-timeout <seconds>` | No | Maximum operation wait in seconds (default 3600; 0 waits indefinitely). |
| `-y, --yes` | Yes | Confirm this operation. |

API request and response schemas: [pullWorkspace](/api-reference/workspace-sync/pullWorkspace).

## Operation status \[#operation-status]

### List workspace operations \[#list-workspace-operations]

```bash
sim workspaces operations list [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--limit <n>` | No | Maximum items to return (0 for everything). Defaults to `100`. |
| `--cursor <value>` | No | Continue from nextCursor returned by a previous result. |
| `--request-id <value>` | No | Find an uncertain mutation by the original client request ID; keep the same filter while paging. |

API request and response schemas: [listWorkspaceOperations](/api-reference/workspace-sync/listWorkspaceOperations).

### Get workspace operation \[#get-workspace-operation]

```bash
sim workspaces operations get <operationId>
```

**Arguments**

| Argument | Required | Description |
| - | - | - |
| `operationId` | Yes | Durable operation identifier to use for polling. |

API request and response schemas: [getWorkspaceOperation](/api-reference/workspace-sync/getWorkspaceOperation).

### Wait for workspace copy and deployment readiness \[#wait-for-copy-and-deployment-readiness-exit-3-for-configuration-1-for-failure-or-4-for-timeout]

```bash
sim workspaces operations wait <operationId> [options]
```

**Arguments**

| Argument | Required | Description |
| - | - | - |
| `operationId` | Yes | Operation ID returned by import, fork, push, or pull |

**Options**

| Option | Required | Description |
| - | - | - |
| `--wait-timeout <seconds>` | No | Maximum total wait (default 3600; 0 waits indefinitely). |

Exit codes: 0 completed (including completion with warnings), 1 follow-up work failed, 3 destination configuration is required, 4 timed out. The mutation may already be committed; reconcile using the same operation or request ID rather than repeating it with a new ID.

API request and response schemas: [getWorkspaceOperation](/api-reference/workspace-sync/getWorkspaceOperation).

## Exclusions and recovery \[#exclusions-and-recovery]

### Update workspace fork exclusions \[#update-workspace-fork-exclusions]

OAuth login or personal API key required.

```bash
sim workspaces sync-exclusions [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--workflow <value...>` | Yes | Workflow identifiers in the current workspace. (space- or comma-separated, a JSON array, or @path / @- with one value per line; @@value for a literal leading @). |
| `--fork-sync-excluded <true\|false>` | Yes | Whether the named workflows should be skipped as sync sources and targets. Accepted values: `true`, `false`. |

API request and response schemas: [updateWorkspaceForkExclusions](/api-reference/workspace-sync/updateWorkspaceForkExclusions).

### Rollback workspace fork \[#rollback-workspace-fork]

OAuth login or personal API key required.

This restores the latest sync using its prior deployed versions.

```bash
sim workspaces fork-rollback [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--other-workspace-id <value>` | Yes | Workspace on the other side of the direct fork edge. |
| `-y, --yes` | Yes | Confirm this operation. |

API request and response schemas: [rollbackWorkspaceFork](/api-reference/workspace-sync/rollbackWorkspaceFork).

### Unlink workspace fork \[#unlink-workspace-fork]

OAuth login or personal API key required.

This removes the fork relationship and its persisted mappings.

```bash
sim workspaces unlink [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--other-workspace-id <value>` | Yes | Workspace on the other side of the direct fork edge. |
| `-y, --yes` | Yes | Confirm this operation. |

API request and response schemas: [unlinkWorkspaceFork](/api-reference/workspace-sync/unlinkWorkspaceFork).

## Workspace as code \[#workspace-as-code]

### Write a workspace as a source directory \[#write-a-workspace-as-a-source-directory]

```bash
sim workspaces source get [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--dir <dir>` | Yes | Directory to write the workspace source into. |
| `--only <kinds>` | No | Read only these kinds (comma-separated folders: secrets.ts, credentials.ts, tools, skills, mcp, tables, knowledge, files, workflows, deployments). |
| `--force` | No | Replace files with edits no apply has saved. |

A directory that already holds a .sim/base.json is refreshed from the workspace it was read from, whatever the profile's default workspace.

Exit codes: 0 written; 1 the command failed, the directory holds edits no apply has saved (SOURCE_LOCAL_EDITS: apply them, get into another directory, or pass --force), --workspace or SIM_WORKSPACE names another workspace than the one the directory was read from (SOURCE_OTHER_WORKSPACE), the directory is a workflow source directory (SOURCE_DIR_KIND_MISMATCH, even with --force), or a downloaded binary file does not match its listing (SOURCE_BLOB_MISMATCH: nothing was written); 9 rate limited (HTTP 429) after the CLI's retries: nothing was written, the binary files already downloaded are kept in .sim/downloads, and running the get again downloads only the rest; 10 (busy, retry) another sim workspaces source or workflows source command is using this directory or a workflow folder in it (SOURCE_DIR_BUSY): nothing was read or written, run it again once it finished; 13 not logged in, the login expired, or the server refused the credential (AUTH_REQUIRED): nothing was read or written, run `sim login` and the get again.

API request and response schemas: [getWorkspaceSource](/api-reference/workflows/getWorkspaceSource), [getSourceCatalog](/api-reference/catalog/getSourceCatalog), [getSourceResources](/api-reference/workflows/getSourceResources), [downloadFile](/api-reference/files/downloadFile), [downloadKnowledgeDocument](/api-reference/knowledge-bases/downloadKnowledgeDocument).

### Show what changed locally and on the server since the directory was read \[#show-what-changed-locally-and-on-the-server-since-the-directory-was-read]

```bash
sim workspaces source status [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--summary-file <path>` | No | Also write the plan as Markdown to this file (or set SIM_SUMMARY_FILE), replacing it each run; its first line is a comment that names the directory, for a CI step that updates one pull-request comment. |
| `--dir <dir>` | No | Workspace source directory written by `workspaces source get`. Defaults to `.`. |
| `--only <kinds>` | No | Report only these kinds (comma-separated folders: secrets.ts, credentials.ts, tools, skills, mcp, tables, knowledge, files, workflows, deployments). |
| `--offline` | No | Report local changes only, without asking the server. |
| `--json` | No | Print the machine-readable status (same as --output json). |

With --json, `plan` is what applying would do as `apply --dry --allow-delete` reports it (its errors and warnings counted the same, a conflict as an error), and `next` the command to run (with --allow-delete only when the plan deletes something).

Exit codes: 0 clean (nothing to apply, and the server changed nothing since the directory was read); a server that cannot be reached is not a failure: the status shows the local changes only and says so (exit 0 or 11); 1 the command failed; 7 the source is too large for the server to read in one dry run; 9 rate limited (HTTP 429) after the CLI's retries: wait a minute and run it again; 10 (busy, retry) another sim workspaces source or workflows source command is using this directory or a workflow folder in it (SOURCE_DIR_BUSY): nothing was read or written, run it again once it finished; 11 local changes only (applying writes them); 12 the server changed since the directory was read: drift (a resource edited, added or deleted there that the directory leaves alone) or a conflict (also changed here, so applying it is refused as stale), with or without local changes; 13 not logged in (AUTH_REQUIRED) or the credential was refused: the status shows the local changes only, then run `sim login`.

API request and response schemas: [planWorkspaceSource](/api-reference/workflows/planWorkspaceSource).

### Apply a workspace source directory \[#apply-a-workspace-source-directory]

```bash
sim workspaces source apply [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--verbose` | No | Also list the info findings hidden by default: every one with --output json, blocks placed by autolayout in the display. |
| `--summary-file <path>` | No | Also write the plan as Markdown to this file (or set SIM_SUMMARY_FILE), replacing it each run; its first line is a comment that names the directory, for a CI step that updates one pull-request comment. |
| `--dir <dir>` | No | Workspace source directory written by `workspaces source get`. Defaults to `.`. |
| `--dry` | No | Plan and check without writing anything. |
| `-y, --yes` | No | Apply without asking for confirmation. |
| `--allow-delete` | No | Delete resources, columns and data the directory no longer declares (with --to, only what it deleted since the last promotion: the target's own resources are kept). |
| `--delete-target-only` | No | With --to and --allow-delete, also delete the target's resources this directory never declared and no promotion from it left there (prod-only tables and their rows, skills made in prod). Without it a promotion keeps them, naming each with a warning. |
| `--only <kinds>` | No | Apply only these kinds (comma-separated folders: secrets.ts, credentials.ts, tools, skills, mcp, tables, knowledge, files, workflows, deployments). |
| `--to <workspaceId>` | No | Promote the directory to another workspace (dev to prod): its resources bind by key to that workspace's own and are updated in place. Only .sim/targets/\<workspaceId>.json changes, the record the next promotion compares with: a resource changed there since is kept, or refused as stale (exit 5) when the directory changed it too. |
| `--run <key=input>` | No | After the apply, dry-run workflows/\<key>/'s saved draft with this input (JSON or @file, as `sim workflows run --dry --input` takes it; `--run <key>` alone: no input). Repeat it to test more workflows. deployments/ is applied only after every run completed, and only when every draft it publishes was test-run; a run that does not complete exits 1 and leaves the applied drafts in place. Sandboxed code (Python, shell, imports) really runs in it, network requests included, and is listed in runs\[].sideEffects.unchecked. |

Exit codes: 0 applied (or a clean dry run); 1 the source has errors (each printed as file:line:column with its frame and hint), or every change it would write was held back because it uses a declared secret the workspace has no value for or a declared credential key nothing binds to (nothing was written; a dry run of such an apply exits 1 too), the directory was read from another workspace than the one --workspace or SIM_WORKSPACE names (SOURCE_OTHER_WORKSPACE: drop it, or promote it with --to; without either an apply targets the workspace the directory was read from), its base records binary files no get downloaded (SOURCE_BLOBS_NOT_FETCHED: get again first), a --run test run did not complete (the apply is written; deployments/ was not applied), or the command failed; 5 a resource changed or was deleted on the server since the directory was read (SOURCE_STALE: get it again into a fresh directory, reapply the edit, retry); 6 a resource (a workflow or its folder, a table) is locked (a locked block exits 1, E_APPLY_LOCKED_BLOCK); 7 the directory is too large; 8 the apply stopped part-way on a server failure: what was written is saved into the directory, and applying again continues. An apply a resource refused part-way (stale, locked, forbidden) saves what was written too, and exits as that refusal: 5, 6 or 1; 9 rate limited (HTTP 429) after the CLI's retries, before anything was written: wait a minute and apply again (binary files already uploaded are not sent again); 10 another apply is writing the workspace (SOURCE_BUSY), or another command is using the directory (SOURCE_DIR_BUSY): nothing was written, run the command again once the other finished; 13 not logged in, the login expired, or the server refused the credential (AUTH_REQUIRED): nothing was sent, run `sim login` (or fix or unset SIM_API_KEY when the key comes from it) and the command again; 14 without --yes and with no terminal to ask: the plan was printed with no errors and nothing was written (run the same command with --yes to apply it); 15 written in part: changes that use a declared secret the workspace has no value for, or a declared credential key nothing binds to, were held back and the rest was applied and saved (set the secret or connect the credential, then apply again); a dry run that would do so exits 15 too, having written nothing; 130 interrupted (Ctrl-C): a write already sent is finished and saved into the directory first, waiting up to 60s for its answer, and a second Ctrl-C, or no answer by then, stops at once and prints that it may have been written and how to check.

API request and response schemas: [applyWorkspaceSource](/api-reference/workflows/applyWorkspaceSource), [findMissingWorkspaceSourceBlobs](/api-reference/workflows/findMissingWorkspaceSourceBlobs), [stageWorkspaceSourceBlobs](/api-reference/workflows/stageWorkspaceSourceBlobs), [getWorkspaceSource](/api-reference/workflows/getWorkspaceSource), [getSourceCatalog](/api-reference/catalog/getSourceCatalog), [getWorkflowDeployment](/api-reference/workflows/getWorkflowDeployment), [executeWorkflow](/api-reference/workflows/executeWorkflowV2).

### Compile and type-check every workflow of a workspace source directory locally, without the server \[#compile-and-type-check-every-workflow-of-a-workspace-source-directory-locally-without-the-server]

```bash
sim workspaces source check [options]
```

**Options**

| Option | Required | Description |
| - | - | - |
| `--dir <dir>` | No | Workspace source directory: the kind folders and .sim/base.json. Defaults to `.`. |
| `--strict` | No | Fail on the warnings listed below in every block, not only new ones. |
| `--no-strict` | No | Never fail on a warning an apply saves. |
| `--no-types` | No | Skip the type check (TypeScript 7.0.2 over tsconfig.json) that runs after the compile. |
| `--verbose` | No | Also list the info findings hidden by default: every one with --output json, blocks placed by autolayout in the display. |

Compiles every workflows/\<key>/workflow\.ts (and the function files each names) with the compiler the server runs, against the workspace's block catalog the last get cached (in a fresh clone with no cache, such as CI, it downloads the catalog once with the profile's credentials). No other request is made to Sim. It checks, against what the directory declares: - env names (secrets.ts), with a did-you-mean - credential keys (credentials.ts) - the keys of tables, knowledge bases, skills, custom tools, MCP servers and workflows, with a did-you-mean, and a key holding a look-alike letter (a Cyrillic а) named by its code point - the columns and select options of a table row write - a child workflow call: an inputMapping key the child's Start trigger does not declare, and a child with no Start trigger - each tables/\<key>.rows.jsonl: a malformed line, an undeclared column, a managed key two lines share, an empty required cell, a repeated unique value, a value its column's type or options cannot hold - block names whose words mix Latin with Cyrillic, Greek, Armenian or Cherokee letters The dry run still checks what only the server knows (stored values, MCP tool names, model ids, deployments, credential bindings), so run it before applying. A check also regenerates .sim/sdk/workspace.d.ts from the declarations (so a key added since the get is typed, and each workflow's inputs) and adds the blocks the workflows now use to the CLI's tsconfig.json. Then it type-checks the directory with TypeScript 7.0.2 (the release the declarations are built for) over tsconfig.json. Each type error is an E_TYPE error, its message starting with TypeScript's code. One is left out on a line the compile already reports an error on, and in a file still as the last get or apply wrote it when that file had the same error then (against the declarations as that get or apply left them). The first check installs that release with npm into the CLI's cache, once (none when SIM_TYPESCRIPT_DIR already holds it); when it cannot (offline, no npm), the check warns W_TYPES_UNCHECKED and passes or fails on the compile alone. --no-types skips the type check.

Exit codes: 0 no errors; 1 errors (each printed as file:line:column with its frame and hint), or no cached catalog that could not be downloaded (a check downloads it once when none is cached, with the profile's credentials; 13 when there is no login to download it with). With --output json, stdout is one document that also lists every finding under diagnostics.

These warnings, which an apply saves as written, fail the check as errors on every block the lock does not bind (a block added since the get, or every block of a new workflow): W_REQUIRED_MISSING, W_UNKNOWN_OPTION, W_UNKNOWN_OUTPUT_PATH, W_VALUE_KIND, W_OUT_OF_RANGE, W_LITERAL_SECRET, W_TABLE_UNKNOWN_COLUMN, W_CHILD_INPUT_UNKNOWN, W_CHILD_RESULT_PATH, W_BRANCH_UNWIRED, W_UNRESOLVED_REF, W_REF_OUT_OF_SCOPE, W_LOOP_CONDITION_SYNTAX. --strict fails on them in every block, except W_BRANCH_UNWIRED on a block the lock binds (the stored workflow may hold it, and the server then stays quiet); --no-strict fails on none of them. In every mode, as the server refuses them: W_REF_OUT_OF_SCOPE is the error E_APPLY_REF_OUT_OF_SCOPE in any file of a block the edit added or changed; W_LOOP_CONDITION_SYNTAX is the error E_APPLY_LOOP_CONDITION_SYNTAX in any file of a block the edit added or changed; W_UNKNOWN_OPTION is the error E_APPLY_INVALID_SUBBLOCK_FIELD in workflow\.ts on a block the edit added or changed; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in workflow\.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in workflow\.ts on a block the edit added or changed; W_UNKNOWN_BLOCK_TYPE is the error E_APPLY_INVALID_BLOCK_TYPE in workflow\.ts on a block the edit added or changed; W_TYPE_NOT_ADDABLE is the error E_APPLY_TYPE_NOT_ADDABLE in workflow\.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_CODE_FILE_REF_SYNTAX is the error E_APPLY_CODE_FILE_REF_SYNTAX in a function file changed since the get. A block counts as changed when the lock does not bind it, when the source moved it into another container, or when it compiles differently than in the source the last get or apply printed (.sim/stored-edges.json records a digest of each block). That last comparison needs the catalog the source was printed with in the cache: without it, a bound block that did not move counts as unchanged, so the server may refuse what the check passes. A $ref in a function file to a block the lock binds that the source no longer declares stays a warning, unless a warning cap left findings out: the server may infer that block was renamed and rewrite the reference, and refuses it otherwise. W_JSON_REF_UNTYPED is reported, as the server reports it, only on a field the edit made store the reference anew: one whose text differs from what the printed source stored, through block renames, or where the reference was typed then, as when an edit elsewhere (a Start input, a Function's code) changes its type. Without the record or that catalog, it is reported on every block the edit added or changed; with --strict, on every block.

Exit 10 (busy, retry): another sim workspaces source or workflows source command is using this directory or a workflow folder in it (SOURCE_DIR_BUSY); nothing was read or written. Run this one again once it finished.

API request and response schemas: [getSourceCatalog](/api-reference/catalog/getSourceCatalog).

### Show the content of the changes in a workspace source directory \[#show-the-content-of-the-changes-in-a-workspace-source-directory]

```bash
sim workspaces source diff [paths...] [options]
```

**Arguments**

| Argument | Required | Description |
| - | - | - |
| `paths...` | No | Files, folders or kind:key resources to compare (default: every file) |

**Options**

| Option | Required | Description |
| - | - | - |
| `--dir <dir>` | No | Workspace source directory written by `workspaces source get`. Defaults to `.`. |
| `--server` | No | Compare with the server's current source instead of the base. |
| `--json` | No | Print the machine-readable diff (same as --output json). |

Without --server, each file created, edited or deleted since the directory was read is shown against the text it was read at. The CLI records only each file's digest, so that text is the server's current text where it still matches the digest; a file the server changed since is named instead (compare it with --server). A binary file is shown by its sizes. Paths filter by file or folder (and in a workspace directory by kind:key, such as table:leads). Exit codes: 0 the differences were shown, whether or not there were any; 7 the source is too large for the server to read; 1 the command failed.

Exit 10 (busy, retry): another sim workspaces source or workflows source command is using this directory or a workflow folder in it (SOURCE_DIR_BUSY); nothing was read or written. Run this one again once it finished.

API request and response schemas: [getWorkspaceSource](/api-reference/workflows/getWorkspaceSource).

## Related docs \[#related-docs]

- [Workspace sync](/cli/workflow-sync)
- [Workspaces](/platform/workspaces)
