CartirraAPI
Get API keys

Getting started

Authentication

Secret and public keys, test and live mode, rotating keys without downtime, and keeping them safe.

Every request carries a secret key in the Authorization header:

Authorization: Bearer sk_test_51Hc8f…

Your keys

Each business has one key pair per mode:

KeyPrefixWhere it goesWhat it can do
Secret keysk_test_, sk_live_Your server onlyEverything in this API reference
Public keypk_test_, pk_live_Your web page, with the checkout widgetNothing on its own: the widget also needs a session's client secret

The key decides two things, so you never send them separately:

  • The business. A key only ever sees its own business's data. Another business's id returns 404.
  • The mode. sk_test_ keys see test data only; sk_live_ keys see live data only. The two never mix.

A public key on a server route, or a dashboard sign-in token on a key-only route, is refused with 401 CREDENTIAL_NOT_ACCEPTED.

Permissions

Secret keys can call every endpoint in this reference. Each endpoint lists the permission it needs (for example orders:read), so you can see at a glance what an integration touches. Keys can't call dashboard-only routes such as team management or bank account changes.

Keep secret keys secret

  • Store them in environment variables or a secrets manager, never in source control.
  • Never put a secret key in a browser, mobile app or anything a customer can download.
  • Never log them. Cartirra shows a secret key in full only once, when it's created or regenerated; after that the dashboard shows its last four characters.
  • Developers → API keys shows when each key was last used (to the minute), so you can spot a key that's in use somewhere you didn't expect.

Rotate keys without downtime

Regenerate a pair from Developers → API keys (it asks for a confirmation code). Choose an overlap of 0–72 hours:

  1. The new pair works immediately.
  2. The old pair keeps working until the overlap ends, and the dashboard lists it as expiring with the exact time.
  3. Deploy the new key everywhere, check the old key's last used time stops moving, then let the overlap run out.

An overlap of 0 cuts the old keys off at once. Use it when a key has leaked.

Errors you may see

StatusCodeMeaning
401unauthenticatedNo key, a malformed key, or a revoked or expired key
401credential_not_acceptedA public key or sign-in token where a secret key is required
403permission_deniedThe key can't call this route
403live_mode_not_enabledA live key before your business can go live
403merchant_suspendedThe business is suspended; contact support