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.
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| code | string | 是 | The authorization code received from the OAuth redirect |
| code_verifier | string | 否 | The code verifier if code_challenge was used in the authorization request |
| code_challenge_method | enum or null | 否 | The method used to generate the code challenge Allowed values:S256 plain |
Response
Successfully exchanged code for an API key
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| key | string | - | The API key to use for novastack requests |
| user_id | string or null | - | User ID associated with the API key |
Errors
| 状态码 | 说明 |
|---|---|
| 400 | Bad Request Error |
| 403 | Forbidden Error |
| 500 | Internal Server Error |