Authentication
All API requests use a personal token and can access only the account that owns it.
Generate a token
In the Treering app, open Account management → Personal API and export, then select Generate token. The token can read and modify your account's data; there are no permissions to select. The secret is shown once. Store it securely.
Use the token
Save the token in the TREERING_API_TOKEN environment variable. Send it in the Authorization header with each request:
For example, read recent time entries:
Scripts, shortcuts and AI tools use the same header. Keep tokens out of URLs, source code, logs and AI conversation text. Supply them through environment variables or the tool's credential settings.
Lifetime and revocation
By default, tokens remain valid until manually revoked. Revoke a token on the same page used to generate it; subsequent requests with that token are rejected. Existing restricted or finite-expiry tokens retain their original rules.
Entitlement requirements
Ordinary API requests require an active official sync entitlement. After expiry, only these three export endpoints remain available:
- POST /exports: create a full export.
- GET /exports/{id}: check export status.
- GET /exports/{id}/download: download the export file.
Export access remains indefinitely and allows repeated exports. Files themselves last 7 days and can be regenerated. The token must still be valid and the account active; token revocation, account suspension and deletion still apply. Sign-in and token generation/revocation remain available in the app.
Authentication errors
401 means the token is missing, invalid, expired or revoked. Check the Authorization header and token status.
403 means the entitlement or token permissions are insufficient. Check the official sync entitlement; after expiry, use the export endpoints listed above.