/v1/* route must carry a Bearer credential. ReconLayer accepts two kinds of credential on the same Authorization header, and resolves your organization from whichever one you present.
/health, /openapi.json, /openapi.yaml, the /docs API explorer, and everything under /webhooks/* are public and do not require a credential. Every other route β including all /v1/* routes β runs through the authentication hook below before it is handled.Two credential types
ReconLayer inspects the bearer token and routes it to one of two verification paths:- API key (headless clients)
- Clerk session token (dashboard users)
Use an API key for servers, scripts, and backend integrations. API keys are created via The organization, scopes, and key status are all resolved server-side from the key itself β you do not need to send
POST /v1/api-keys and are the recommended credential for any code that calls ReconLayer outside the dashboard.x-organization-id alongside a valid API key.How ReconLayer tells the two apart
The API key check is a cheap prefix match before any database lookup: any bearer token that starts withrl_live_ is treated as an API key and verified against the hashed key store. Anything else is treated as a Clerk session token and verified with Clerk.
POST /v1/api-keys β copy it immediately, because it cannot be retrieved again. The response also includes a non-secret prefix (the keyβs first 16 characters, e.g. rl_live_AbCd1234) that is safe to display in the dashboard for identification.
API keys: scopes, status, and expiry
Each API key carries:| Field | Description |
|---|---|
prefix | Non-secret display prefix (e.g. rl_live_AbCd1234), safe to show in UI. |
scopes | An array of free-form scope strings assigned at creation, used by your own authorization logic. |
status | One of active, expired, or revoked, derived from revokedAt / expiresAt. |
expiresAt | Optional ISO 8601 expiry. After this time the key is rejected. |
revokedAt | Set when a key is revoked; revoked keys are rejected immediately. |
lastUsedAt | Updated on every successful verification. |
status is not active (revoked, or past expiresAt) is rejected with:
401 Invalid, revoked, or expired API key
POST /v1/api-keys, GET /v1/api-keys, PATCH /v1/api-keys/{keyId}, and DELETE (revoke) /v1/api-keys/{keyId}.
Organization resolution
ReconLayer is multi-tenant: every record belongs to an organization, and every authenticated request resolves to exactly oneorganizationId.
- API key requests β the organization is whatever the key was issued for. You do not need to send
x-organization-id. - Clerk session requests β the organization comes from the active organization on the Clerk session. If the session does not carry one, send
x-organization-idand ReconLayer will use it as a fallback.
Missing or invalid credentials
| Situation | Status | Body |
|---|---|---|
No Authorization header, or it doesnβt start with Bearer | 401 | { "error": "unauthorized", "message": "Missing bearer credential. Provide an API key or session token." } |
Token looks like an API key (rl_live_...) but is unknown, revoked, or expired | 401 | { "error": "unauthorized", "message": "Invalid, revoked, or expired API key." } |
| Token is not a valid Clerk session, or resolves to no organization | 401 | { "error": "unauthorized", "message": "Invalid session token or no active organization." } |
Signed-in-user-only routes
A small set of routes require a real dashboard user β for example, creating, updating, or revoking API keys, and other account-administration actions. If you call one of these with an API key, ReconLayer responds:403 Signed-in session required
error: "forbidden") is also returned when a signed-in user lacks the workspace permission required for an action β for example, a user without the cases_action permission calling a write endpoint.
Local development bypass
When running the API locally withAUTH_DEV_BYPASS=1 (and NODE_ENV is not production), requests may omit the Authorization header entirely and instead identify their organization with x-organization-id alone:
NODE_ENV=production, so it cannot accidentally ship enabled. In any real deployment, always present a Bearer credential as described above.
Next steps
- API design principles β idempotency, business-level uniqueness, and how writes are deduplicated.
- Idempotency β the
Idempotency-Keyheader in depth. - Errors β the error envelope and status codes youβll see across the API.
- Quickstart β get an API key and make your first authenticated call.
