CreateApiKeyBody

Request body for creating an ApiKey.

Definition

TypeScript
interface CreateApiKeyBody {
  workspaceId: string;
  name: string;
  type: "private" | "public" | "session";
  scopes?:
    | {
        operations?: Array<string> | undefined;
        entityIds?: Array<string> | undefined;
      }
    | null
    | undefined;
  expiresIn?: string | undefined;
  ownerUserId?: string | undefined;
}

Fields

FieldTypeNotes
workspaceIdstringrequired — Workspace that will own the new key.
namestringrequired — Key name
type"private" | "public" | "session"required — Key type
scopes{ operations?: Array<string> | undefined; entityIds?: Array<string> | undefined; } | null | undefinedoptional — Restricts what this key may do; null/empty means full access within its key type.
expiresInstring | undefinedoptional — Duration until expiry (e.g. '30d', '1h')
ownerUserIdstring | undefinedoptional — Optional override for the user the key authenticates as. Defaults to the workspace's default service user (so headless calls auto-attribute to the service identity); falls back to the creator when no default exists. Workspace-admin-only to set; target user must be a member of the workspace.