Save BYOK provider API key
POST /api/providers/{provider}/key
Validates a submitted key with a read-only provider request when an endpoint is supported, then stores it encrypted. A rejected key returns provider_key_rejected without replacing the saved row. Network failure or an unsupported endpoint stores the key as not verified. The response never echoes the submitted key.
Authenticate with a portal session token.
Parameters
providerstring path required
Request body
application/json object
api_keystring (password) required
Generated sample
{
"api_key": "string"
}Responses
200 Provider key saved; verification status reflects the provider response.
application/json object
activeboolean requiredValue:truemessagestring requiredproviderstring requiredverification_statusstring requiredOne of:"verified","not_verified"verification_reasonstring requiredOne of:"accepted","unavailable","unsupported"verification_messagestring required
Generated sample
{
"active": true,
"message": "string",
"provider": "string",
"verification_status": "verified",
"verification_reason": "accepted",
"verification_message": "string"
}401 Missing or invalid bearer token.
application/json object
Any keys are accepted.
403 Authenticated caller lacks the required permission, ability, or role.
application/json object
Any keys are accepted.
422 Malformed input, unknown provider, or provider rejected the key (provider_key_rejected).
application/json any
One of
- GenericError
- object
errorobject requiredtypestring requiredValue:"provider_key_error"codestring requiredValue:"provider_key_rejected"messagestring required
429 The request was rate limited. API-generated responses are JSON;
Response headers
Retry-Afterstring headerSeconds to wait before retrying, when provided.
X-RateLimit-Scopestring headerIdentifies the scope of the request limit, when provided.
application/json GenericError
erroranyOne of
- string
- object
Any keys are accepted.
error_codestringcodestringmessagestringdetailstringstatusanyOne of
- string
- integer
errorsobjectAny keys are accepted.
text/html string