Authentication

Cassia accepts two credential types, each for a different context.

Bearer API keys (csk_live_*)

What merchants integrate with.

  • Format: csk_live_ + 32 hex chars.
  • Passed as Authorization: Bearer csk_live_....
  • Scope: one key per project; it reaches the payment API only.
  • Storage: only a SHA-256 hash is persisted. Plaintext is shown once on creation and never again.
  • Rotation: POST /auth/api-key/rotate issues a new key; old key stays valid for 24 hours. Use the window to redeploy, then the old key expires automatically. A project holds at most two live keys: rotating again inside the 24-hour window revokes the older key(s) immediately, keeping only the newest previous key.
  • Revocation: POST /auth/api-key/revoke stops every live key of the project immediately, including one still in its rotation window.
  • 2FA required to manage keys. Creating, rotating and revoking a key require 2FA to be enabled on the account and a current code in X-Cassia-TOTP; without 2FA these calls return 403 TOTP_REQUIRED. Existing keys keep working for the payment API whether or not 2FA is enabled.

Session cookies

Used by the Cassia dashboard itself. Never hit the API with a cookie from your code — it’s bound to the merchant’s browser and rejected cross-origin: a cookie-authenticated write whose Origin is not the dashboard origin gets 403 Forbidden. Dashboard mutations require TOTP (2FA) regardless of the cookie. API-key requests don’t require TOTP — the key is the factor.

Endpoints

  • POST/api/auth/logout
    Authenticated. Clears the session cookie server-side. Returns { ok: true }. Allowed even when an account is in soft-suspended (read-only) mode so a suspended merchant can sign out cleanly.
  • POST/api/auth/api-key
    Create the project’s first key. 2FA required (X-Cassia-TOTP). Returns 409 API_KEY_EXISTS when the project already has a live key — rotate or revoke it instead.
  • POST/api/auth/api-key/rotate
    Issue a fresh csk_live_*. 2FA required. Old key keeps working for 24h; if the project already has two or more live keys, every older key except the most recent one is revoked immediately and listed in revoked_key_ids.
  • POST/api/auth/api-key/revoke
    2FA required. Every live key of the project stops working immediately. Returns { ok: true, revoked_key_ids: [...] }; 404 when there is no live key.

These POST calls take an empty JSON body ({}) or no Content-Type header at all. A body-less request that still sends Content-Type: application/json is rejected with 400.

Updated . For integration help, email [email protected]

From signup to payment setup in 7 minutes

Start accepting
payments today
on 5 blockchains.

Create accountRead documentation