Reference layout demo. Full live docs are published at docs.lunedata.io.
Getting started

Authentication

Every request to the Lune API must include a bearer token. Keys are scoped per environment and you can have many active at once. Lost a key? Rotate it without downtime.

Bearer tokens

Send your key in the Authorization header on every request:

Authorization: Bearer lune_sk_live_a1b2c3d4...

Keys are never logged in plaintext, even by you, after creation — store them in a secrets manager (AWS Secrets Manager, HashiCorp Vault, GCP Secret Manager, or Cloudflare Worker secret bindings).

Key types

PrefixEnvironmentUse for
lune_sk_test_SandboxLocal dev, CI, integration tests. Free, rate-limited.
lune_sk_live_ProductionReal customer traffic. Counts against your contract.
lune_pk_EitherPublishable key for browser-side Engage SDK widgets.

Scopes

Each key carries one or more scopes that restrict what it can do. Set scopes at key creation; you can't widen them later — create a new key instead.

Key rotation

Rotation is two-phase, so you never have downtime:

  1. Create a new key with the same scopes.
  2. Roll it out to production (both keys are valid).
  3. Verify traffic on the new key in the dashboard.
  4. Revoke the old key.

The dashboard shows last-used timestamps per key so you can confirm the cutover before revoking.

Authentication errors

StatusBodyMeaning
401missing_authorizationNo Authorization header.
401invalid_keyKey doesn't exist or was revoked.
403missing_scopeKey is valid but lacks the scope required for this endpoint.
403wrong_environmentYou hit a production endpoint with a sandbox key, or vice versa.