Documentation
Authentication
Every request needs two headers:
Code
Creating a token
- In the Zenith app, go to Settings → API tokens.
- Create a token. The plaintext value (
zth_live_…) is shown exactly once — copy it now. Only a SHA-256 hash is stored; nobody, including Zenith staff, can recover it later. - Copy the company key shown alongside it — that's your
X-Company-Keyvalue.
One token is permanently bound to one company. If you work with multiple
companies, create one token per company. The explicit X-Company-Key header
exists as a guard: if the header and the token's bound company ever disagree,
the request fails with 400 invalid_company_key instead of silently reading
the wrong books.
Token lifecycle
- Tokens are read-only — even a leaked token cannot modify or delete anything.
- Optional expiry date at creation; expired tokens fail with
401 token_expired. - Any member of the company can revoke any of its tokens from
Settings → API tokens (
401 token_revokedafterwards). GET /meshows the token'slast_used_at— useful to confirm an integration is alive before revoking old tokens.
Keep it secret
The token is a bearer credential — treat it like a password:
- Store it in environment variables or a secret manager, never in source control.
- Server-to-server only. The API sends no CORS headers, so browsers block cross-origin calls by design — never embed the token in frontend code.
- Rotate by creating a new token first, switching your integration, then revoking the old one.
Last modified on