You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7cc22a7
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: apps/docs/content/docs/api-reference/authentication.mdx
+18-1Lines changed: 18 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ Workspace Admins can turn off **Allow personal API keys**. The workspace policy
24
24
## Create and store a key [#generating-api-keys]
25
25
26
26
1. Open **Account settings → Sim API keys** to create a personal key, or **Workspace settings → Sim API keys** to create a workspace key.
27
-
2. Select **Create API key**, enter a name, and create it. Workspace-key creation requires workspace **Admin** access and the applicable key-management permission.
27
+
2. Select **Create API key** and enter a name. Choose its **Access**and when it **Expires**, then create it. Workspace-key creation requires workspace **Admin** access and the applicable key-management permission.
28
28
3. Copy the key and store it in a server-side environment variable such as `SIM_API_KEY`.
29
29
30
30
<Callouttype="warn">
@@ -33,6 +33,23 @@ Sim shows the complete key once, immediately after creation. Copy it before clos
33
33
34
34
Delete a key from the same settings page to revoke it. Update applications that used it with a replacement key.
35
35
36
+
### Access [#key-access]
37
+
38
+
| Access | Allows |
39
+
| --- | --- |
40
+
|**Full access**| Everything the key's identity can do: reads, changes, deploys, and workflow runs |
41
+
|**Read only**| The operations the [`api:read` scope](#oauth-access-tokens) allows, including searches sent as POST requests and search chat |
42
+
43
+
A read-only key cannot change workspace resources or run, resume, or cancel workflows. Reads can still cost credits: searches use embedding credits, and search chat uses model credits and keeps a private conversation history. Selector lookups call third-party services with your connected accounts.
44
+
45
+
A refused request fails with `403` and the message `This API key is read-only and cannot perform this operation`. Where the surface carries a code, it is `READ_ONLY_API_KEY`: in `error.details.code` on the v2 API and the Sim MCP server, in `details.code` on the v1 API and workflow execution, and in `error.data.code` on a workflow MCP server.
46
+
47
+
Access narrows a key; it never grants more than the key's identity already has. Access is fixed at creation, so create a new key to change it. Keys created before access levels existed have full access. Keys created from the deploy modal or for a workflow MCP server always have full access, because they exist to run workflows. If **Access** isn't shown when you create a key, read-only keys aren't available on your deployment yet.
48
+
49
+
### Expiration [#key-expiration]
50
+
51
+
A key expires 30 days, 90 days, or 1 year after creation, or never. The settings page defaults to never. After it expires, every request with the key fails with `401`. The v1 and v2 APIs, both MCP servers, and workflow execution answer with the message `API key has expired`. Create a replacement before then. The key list shows each key's expiration date. `GET /api/v2/meta` reports the calling key's `expiresAt` and `scopes`.
52
+
36
53
## Send an API key [#using-api-keys]
37
54
38
55
Send the key in `X-API-Key`. The v2 API accepts `Authorization: Bearer` only for [OAuth access tokens](#oauth-access-tokens), not API keys. For example, with `SIM_API_KEY` and `WORKFLOW_ID` set:
sim workflows run 3a9e21d8-5f47-4c0b-b2ea-91d7c6034ef8 --input '{"source":"nightly"}' --output json
155
155
```
156
156
157
-
The environment key overrides stored authentication. Use a workspace key only for supported workspace-scoped operations; organization audit logs and fork administration require a personal credential. Never commit credentials. `SIM_CONFIG_DIR` relocates local state when a runner has no writable home directory.
157
+
The environment key overrides stored authentication. Use a workspace key only for supported workspace-scoped operations; organization audit logs and fork administration require a personal credential. A job that runs workflows needs a **Full access** key; a **Read only** key suits jobs that only read, such as exporting logs. Choose an expiration your secret rotation covers: an expired key fails with `401` and `API key has expired`. See [key access and expiration](/api-reference/authentication#key-access). Never commit credentials. `SIM_CONFIG_DIR` relocates local state when a runner has no writable home directory.
Copy file name to clipboardExpand all lines: apps/docs/content/docs/mcp/authentication.mdx
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,8 +55,10 @@ A personal key uses your current access in the workspaces you can reach. A works
55
55
56
56
The Cursor process must receive `SIM_API_KEY` for its environment interpolation to work. For a self-hosted deployment, replace the Cloud URL in both examples with your server URL.
57
57
58
+
For an agent that only reads, create a **Read only** key: it reaches the operations `api:read` allows, and a tool call that changes something or runs a workflow fails with `403` and the code `READ_ONLY_API_KEY`. Search and search chat still use credits. See [key access](/api-reference/authentication#key-access).
59
+
58
60
<Callouttype="warn">
59
-
Keys created in Sim settings have no default expiration. Revoke a key when it is no longer needed. Prefer OAuth for an app that
61
+
Keys created in Sim settings never expire unless you choose an expiration. Revoke a key when it is no longer needed. Prefer OAuth for an app that
60
62
supports browser sign-in, and store keys in your app's secret or environment
Copy file name to clipboardExpand all lines: apps/docs/openapi-v2-resources.json
+16-5Lines changed: 16 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -4947,7 +4947,7 @@
4947
4947
"get": {
4948
4948
"operationId": "getApiMeta",
4949
4949
"summary": "Get API status",
4950
-
"description": "Get the calling credential’s typeand expiry. Requires a valid API key or OAuth access token. `v2Enabled` is true whenever this endpoint is served; the response does not enumerate resource permissions.\n\nOAuth scope: `api:read`.",
4950
+
"description": "Get the calling credential’s type, expiry, and API scopes. Requires a valid API key or OAuth access token. `v2Enabled` is true whenever this endpoint is served; the response does not enumerate resource permissions.\n\nOAuth scope: `api:read`.",
4951
4951
"x-sim-operation": "meta.capabilities.read",
4952
4952
"x-oauth-scope": "api:read",
4953
4953
"tags": ["Meta"],
@@ -4985,7 +4985,8 @@
4985
4985
"data": {
4986
4986
"v2Enabled": true,
4987
4987
"keyType": "personal",
4988
-
"expiresAt": null
4988
+
"expiresAt": null,
4989
+
"scopes": ["api:read", "api:write"]
4989
4990
}
4990
4991
}
4991
4992
}
@@ -14807,6 +14808,7 @@
14807
14808
"PERMISSION_GROUP_CAPABILITY_BLOCKED",
14808
14809
"INTEGRATION_NOT_ALLOWED",
14809
14810
"INSUFFICIENT_SCOPE",
14811
+
"READ_ONLY_API_KEY",
14810
14812
"SCIM_MANAGED_MEMBERSHIP"
14811
14813
],
14812
14814
"title": "Forbidden detail code",
@@ -18642,9 +18644,17 @@
18642
18644
}
18643
18645
],
18644
18646
"description": "ISO 8601 timestamp when the calling credential expires, or null when it does not."
18647
+
},
18648
+
"scopes": {
18649
+
"type": "array",
18650
+
"items": {
18651
+
"type": "string",
18652
+
"enum": ["api:read", "api:write", "search:read"]
18653
+
},
18654
+
"description": "API scopes the calling credential holds. A read-only API key holds only api:read: it is refused every operation that changes state and every operation that declares no API scope, so api:read alone does not authorize those. A full-access key holds api:read and api:write; an OAuth access token holds what it was granted."
0 commit comments