Skip to Content
API ReferenceOAuthExchange Auth Code For API Key

Exchange authorization code for API key

POST

https://novapai.ai/api/v1/auth/keys 

POST

/api/v1/auth/keys

cURL
$curl -X POST https://novapai.ai/api/v1/auth/keys \ >-H "Authorization: Bearer <token>" \ >-H "Content-Type: application/json" \ >-d '\{ >"code": "auth_code_abc123def456", >"code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", >"code_challenge_method": "S256" >\}'
200 Successful
reference-o-auth-exchange-auth-code-for-api-key-01.json
{ "key": "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", "user_id": "user_2yOPcMpKoQhcd4bVgSMlELRaIah" }

Exchange an authorization code from the PKCE flow for a user-controlled API key

Authentication

Authorization Bearer

API key as bearer token in Authorization header

Request

This endpoint expects an object.

字段类型必填说明
codestringThe authorization code received from the OAuth redirect
code_verifierstringThe code verifier if code_challenge was used in the authorization request
code_challenge_methodenum or nullThe method used to generate the code challenge Allowed values:S256 plain

Response

Successfully exchanged code for an API key

字段类型必填说明
keystring-The API key to use for novastack requests
user_idstring or null-User ID associated with the API key

Errors

状态码说明
400Bad Request Error
403Forbidden Error
500Internal Server Error