Skip to content

Authentication

Goal: authenticate a request against /v1 with the right key for the job.

  1. Pick your environment — sandbox (https://sandbox.usetessera.io/v1) while building, production (https://api.usetessera.io/v1) once you’re live. See Tenancy & environments.
  2. Pick your key:
    • A secret key (sk_test_… / sk_live_…) for anything running server-side — it can call every endpoint. Never expose it to a browser or mobile client.
    • A publishable key (pk_test_… / pk_live_…) only if you need to read the catalogue or the tier ladder from somewhere untrusted — it can call GET /v1/rewards and GET /v1/tiers, and make a generic earn preview (POST /v1/earn/preview without external_id), and nothing else.
  3. Send it as a bearer token on every request:
Terminal window
curl https://sandbox.usetessera.io/v1/rewards \
-H "Authorization: Bearer $TESSERA_SECRET_KEY"
codeStatusCause
unauthorized401Missing, malformed, unrecognized, or revoked credential.
publishable_key_forbidden403A publishable key called an endpoint that requires a secret key.
insufficient_scope403The credential doesn’t carry the scope the endpoint requires.

The SDK’s PublishableKeyForbiddenError is thrown pre-network when you try a secret-only call with a publishable key — it never even reaches the wire.

See Errors & the envelope for the full code catalogue.