Skip to content
Sign in Create account

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_generated boolean
  • key_id integer
  • key_prefix string
  • message string
  • name string
  • plaintext string

    Present 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

  • error any

    One of

    • string
    • object

      Any keys are accepted.

  • error_code string
  • code string
  • message string
  • detail string
  • status any

    One of

    • string
    • integer
  • errors object

    Any keys are accepted.

429 The request was rate limited. API-generated responses are JSON;

Response headers

  • Retry-After string header

    Seconds to wait before retrying, when provided.

  • X-RateLimit-Scope string header

    Identifies the scope of the request limit, when provided.

application/json GenericError

  • error any

    One of

    • string
    • object

      Any keys are accepted.

  • error_code string
  • code string
  • message string
  • detail string
  • status any

    One of

    • string
    • integer
  • errors object

    Any keys are accepted.

text/html string