Skip to main content

API keys

Send your key as a bearer token on every request:
Keys look like rl_live_… (real work, real credits) or rl_test_… (test mode). Each key ends in a short checksum, so a mistyped key is rejected straight away with 401 api_key_invalid. Who can create keys. Anyone signed in to Relettr who has credits can create API keys, on the site under API keys. Keys can’t be created through the API. A key is shown once, when you create it; we store only a hash of it.
Welcome credits are for the website. Live API usage needs purchased credits. Test keys are always free.
Revoking. Revoke a key on the site. Revocation takes effect within 60 seconds; after that the key gets 401 api_key_revoked.
Never put an API key in browser or mobile app code. Live keys sent from a browser (with an Origin header) are refused. Call the API from your server.

Scopes

Each key has a set of scopes. A request without the right scope gets 403 scope_missing. New keys get chapters:write, series:write, webhooks:write and billing:read by default. POST /v1/estimate works with any valid key.

Spend limits

You can give each key an optional monthly credit limit on the site, and set one for the whole account. Limits are checked when a chapter starts, against credits charged plus credits held this calendar month (UTC).
  • At the limit, new starts return 402 spend_limit_reached with scope (key or account), limit and used_this_month.
  • The api_key.spend_limit_reached event fires once.
  • Chapters already running always finish.
Nothing is parked or delayed silently: an over-limit start fails immediately so your code can decide what to do.

Test mode

Test keys (rl_test_…) let you build and test your integration for free.
  • Separate data. Test keys see only test objects and live keys only live objects. Using one with the other’s id returns 404, or 403 test_key_live_object / live_key_test_object when it’s clearly a mix-up. Webhook endpoints, events and ledgers are separate too.
  • Test balance. Each account has 10,000 test credits. Set it with POST /v1/test_helpers/balance, for example to 0 to test a 402.
  • Real validation, fake processing. Uploads, image checks, part cutting and quotes work exactly as in live mode, so integration bugs show up. Processing then runs a fake pipeline (no GPU, no translator) that goes queued → processing → succeeded in about 20 seconds. Results are your own images with a “TEST MODE” band, and regions contain placeholder text such as [test] line 3.
  • Real events. Ledger entries, events and webhook deliveries are real and signed.
  • Test data may be cleared at any time.

Test scenarios

Pass test_scenario when creating a chapter with a test key to exercise failure paths. Live keys reject the field with 400.