Generate the first CloakAPI key during onboarding
POST /api/onboarding/generate-api-key
Creates a default API key only when the account has none. A newly created plaintext token is returned once; if a default key already exists, the response contains only its ID and masked prefix. Both branches return HTTP 200.
Authenticate with a portal session token.
Responses
200 Default key created, or an existing default key was reported without its plaintext.
application/json object
already_generatedbooleankey_idintegerkey_prefixstringmessagestringnamestringplaintextstringPresent only when a new key is created; shown once.
Write only
Generated sample
{
"already_generated": true,
"key_id": 0,
"key_prefix": "string",
"message": "string",
"name": "string",
"plaintext": "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 Error response.
application/json GenericError
erroranyOne of
- string
- object
Any keys are accepted.
error_codestringcodestringmessagestringdetailstringstatusanyOne of
- string
- integer
errorsobjectAny keys are accepted.
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