Create an API key
const url = 'https://your-org.evershell.ai/v1/api-keys';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"label":"CI runner — staging","permission_set":"full_access"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://your-org.evershell.ai/v1/api-keys \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "label": "CI runner — staging", "permission_set": "full_access" }'Permissions: apikeys:write.
Provisions an org-scoped key via WorkOS and mirrors metadata
locally. The value field is the full secret — returned
exactly once in this response.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”object
Example
CI runner — stagingClosed-enum template that determines the perm list WorkOS attaches to the key. See API keys for the per-template scope sets and rationale.
Responses
Section titled “ Responses ”Created
object
Obfuscated form of the secret, safe to display
Closed-enum template that determines the perm list WorkOS attaches to the key. See API keys for the per-template scope sets and rationale.
Full secret. Returned exactly once at create time. Lose it and you revoke + reissue — there is no read-back path.
Example
{ "id": "api_key_01HZ", "label": "CI runner — staging", "prefix": "sk_live_...wxyz", "permission_set": "full_access", "value": "sk_live_abc123def456ghi789"}Validation failure
object
object
Closed-enum slug (e.g. permission_denied, validation_error, workspace_not_found)
Human-readable summary
Server-generated request id for correlating logs
Optional structured context. Validation errors land at
details.fields as a per-field map.
object
Example
{ "error": { "code": "permission_denied", "message": "caller lacks required scope", "request_id": "7f3a9c2e" }}Missing or invalid credential
object
object
Closed-enum slug (e.g. permission_denied, validation_error, workspace_not_found)
Human-readable summary
Server-generated request id for correlating logs
Optional structured context. Validation errors land at
details.fields as a per-field map.
object
Example
{ "error": { "code": "permission_denied", "message": "caller lacks required scope", "request_id": "7f3a9c2e" }}Caller lacks the required scope, or cross-org access attempted
object
object
Closed-enum slug (e.g. permission_denied, validation_error, workspace_not_found)
Human-readable summary
Server-generated request id for correlating logs
Optional structured context. Validation errors land at
details.fields as a per-field map.
object
Example
{ "error": { "code": "permission_denied", "message": "caller lacks required scope", "request_id": "7f3a9c2e" }}Tenant is past_due, decommissioning, or trial-expired
object
object
Closed-enum slug (e.g. permission_denied, validation_error, workspace_not_found)
Human-readable summary
Server-generated request id for correlating logs
Optional structured context. Validation errors land at
details.fields as a per-field map.
object
Example
{ "error": { "code": "permission_denied", "message": "caller lacks required scope", "request_id": "7f3a9c2e" }}