Create authorization code
Create an authorization code for the PKCE flow to generate a user-controlled API key
Authorizations
API key as bearer token in Authorization header
Body
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.
"https://myapp.com/auth/callback"
PKCE code challenge for enhanced security
"E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM"
The method used to generate the code challenge
S256, plain "S256"
Optional expiration time for the API key to be created
"2027-12-31T23:59:59Z"
Optional custom label for the API key. Defaults to the app name if not provided.
100"My Custom Key"
Credit limit for the API key to be created
100
Agent identifier for spawn telemetry
"my-agent"
Cloud identifier for spawn telemetry
"aws-us-east-1"
Optional credit limit reset interval. When set, the credit limit resets on this interval.
daily, weekly, monthly "monthly"
Optional workspace ID to associate the API key with
Response
Successfully created authorization code
Auth code data
{
"app_id": 12345,
"created_at": "2025-08-24T10:30:00Z",
"id": "auth_code_xyz789"
}