Create an API key
/v1/orgs/{id}/keysUse workspaceIds to assign zero or more active Workspaces in the organization. The issuer must administer every assignment. With no assignments, the key is stateless-only and requires an organization owner/admin to issue. No Connector is required. Legacy Connector keys require the Connector owner or an organization owner/admin. The secret appears once. Direct keys are organization-owned and survive removal of their creator.
Authentication
Use your signed-in console session or a person's WorkOS access token for this setup operation. See authentication and permissions.
Request
Parameters
Body fields
Create a key with zero or more assigned Workspaces. Omit workspaceIds or send [] for stateless-only access. Each assigned Workspace grants reads and writes. Legacy Connector issuance is also supported. Labels are trimmed and capped at 120 characters.
object
labelstringrequiredMin length: 1
object
labelstringrequiredMin length: 1
connectorIdstringrequiredMin length: 1
Responses
Save the secret now; it cannot be retrieved later.
idstringalways presentPublic credential identity used in administration routes. It is not the authentication secret.
Min length: 1
labelstringalways presentHuman-readable credential name.
createdByUserIdstringalways presentPerson who issued the credential.
createdAtstringalways presentRecorded credential creation time.
scopestringconditionalScope metadata, when present.
workspaceIdsarrayconditionalAssigned Workspaces. An empty array permits one-shot Consolidate only.
Show item fields
workspaceIdstringconditionalLegacy single-Workspace assignment, when applicable.
connectorIdstringconditionalLegacy Connector-backed credential reference, when applicable.
lastActiveAtstringconditionalLast recorded authentication activity, when available.
revokedAtstringconditionalRecorded revocation time, when revoked.
secretstringalways present