Skip to main content

Authenticating requests

Headers​

HeaderRequiredPurpose
X-Client-Idyes (runtime calls)Resolves the project + app client.
X-EnvironmentoptionalSelects the environment; default live.
Authorization: Bearer <token>yes (secured calls)User token, service/API key, admin token, master key, or SCIM token — depends on the namespace.
X-CSRF-Tokencookie-mode state changesCSRF token from GET /v1/csrf.
X-Device-Name / X-Device-Fingerprintoptional (sign-in)Persisted with the new session; fingerprint aids refresh-theft detection.
Idempotency-KeyoptionalSafe retry of create POSTs.

Security schemes​

All credentials are HTTP bearer tokens; the kind determines the surface:

SchemePrincipalUsed on
bearerAuthend-user access token (default)/v1/* runtime
serviceTokenservice account/v1/* machine-to-machine
adminTokenproject admin/v1/projects/{id}/admin/*
masterKeyoperator/mgmt/v1/*
scimTokenSCIM connection/v1/scim/v2/{connection_id}/*
clientSecretBasic / oauth2OAuth client/oauth2/*

Two request modes​

Bearer mode (default; APIs, mobile, SPAs)​

Send the access token in the Authorization header. Immune to CSRF because the credential is not ambiently attached.

curl https://auth.example.com/v1/auth/session \
-H "X-Client-Id: prj_7Fk2" \
-H "X-Environment: live" \
-H "Authorization: Bearer eyJ..."

The session can instead live in the iam_session cookie (iam_refresh scoped to the refresh endpoint). The server promotes the cookie into a bearer credential internally. Every state-changing cookie request must carry a valid X-CSRF-Token (bound to the same X-Client-Id) or it is rejected 403 invalid_csrf. Safe methods, bearer requests, and non-cookie requests are exempt.

# 1. get a CSRF token
curl https://auth.example.com/v1/csrf -H "X-Client-Id: app_web"
# -> { "csrf_token": "csrf_..." }

# 2. state-changing cookie request
curl -X POST https://auth.example.com/v1/auth/sign-out \
-H "X-Client-Id: app_web" \
-H "X-CSRF-Token: csrf_..." \
--cookie "iam_session=..."

Environment binding​

An authenticated credential is bound to the environment it was minted in. A live token presented with X-Environment: test is rejected — tokens cannot cross environments.