v126

latestOpenAPI 3.1.0MITraw.githubusercontent.com2026-08-04957391.2 MB
OAuth

Create authorization code

Create an authorization code for the PKCE flow to generate a user-controlled API key

post/auth/keys/code

Request body

callback_urlstring uri required

The callback URL to redirect to after authorization. Supports https URLs and localhost/127.0.0.1 URLs on any port for local CLI tools.

code_challengestring

PKCE code challenge for enhanced security

code_challenge_method'S256' | 'plain'

The method used to generate the code challenge

expires_atstring date-time nullable

Optional expiration time for the API key to be created

key_labelstring

Optional custom label for the API key. Defaults to the app name if not provided.

limitnumber double

Credit limit for the API key to be created

spawn_agentstring

Agent identifier for spawn telemetry

spawn_cloudstring

Cloud identifier for spawn telemetry

usage_limit_type'daily' | 'weekly' | 'monthly'

Optional credit limit reset interval. When set, the credit limit resets on this interval.

workspace_idstring uuid

Optional workspace ID to associate the API key with

Example request

{
  "callback_url": "https://myapp.com/auth/callback",
  "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
  "code_challenge_method": "S256",
  "limit": 100
}

Response

Successfully created authorization code

Example response

{
  "data": {
    "app_id": 12345,
    "created_at": "2025-08-24T10:30:00Z",
    "id": "auth_code_xyz789"
  }
}