Skip to content
Sign in Create account

Create an API key (v1 / programmatic)

POST /api/v1/api-keys

Creates an API key for the authenticated account. Requires api-keys.create; name is required and budget, expiry, and privacy-mode override are optional validated fields. The plaintext is returned once and is not stored as plaintext.

Authenticate with a portal session token.

Request body

application/json object

  • budget integer
    Range: at least 0
  • expires_at string (date-time)
  • name string required
    Length: at most 100 characters
  • privacy_tier_override PrivacyMode

Example

{
  "budget": 10000,
  "name": "CI key"
}

Responses

201 API key created; plaintext is returned once.

application/json object

  • created_at string (date-time) required
  • is_active boolean required
  • key_id integer required
  • key_prefix string required
  • last_four string required
  • message string required
  • name string required
  • plaintext string required
    Write only

Generated sample

{
  "created_at": "2026-01-01T00:00:00Z",
  "is_active": true,
  "key_id": 0,
  "key_prefix": "string",
  "last_four": "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.

409 The account is paused because scheduled deletion is pending.

application/json object

  • error object required
    • code string required
      Value: "account_deletion_scheduled"
    • message string required
422 Validation or healthtech privacy-floor check failed.

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