clerk.create_api_key
Create an API key in a connected Clerk application.
Sensitive — the returned secret is a high-privilege credential; do not log or expose it.
Call clerk.get_connected_accounts first. Pass clerk_instance_id to target a specific connection, or omit it to use the default account.
Returns the new API key summary.
Cost = 10 tokens.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Human-readable name for the new API key. | |
| claims | No | Custom claims to embed in tokens minted from this API key. | |
| scopes | No | Permission scopes to grant the API key. | |
| subject | Yes | Subject the API key is scoped to (user_... or org_...). | |
| key_type | No | API key type (typically "api_key"). | |
| created_by | No | User id to record as the creator of this API key. | |
| description | No | Optional description for the API key. | |
| clerk_instance_id | No | Clerk instance id (ins_...) from clerk.get_connected_accounts. Omit to use the default connected account. | |
| seconds_until_expiration | No | Seconds from creation until the API key expires. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_key | No | Newly created Clerk API key from the Backend API. |