JWT Bearer tokens via user credentials or API key — form-encoded token endpoints and claims.
The External API uses JWT Bearer tokens (HS256 symmetric signing). All business routes expect:
Authorization: Bearer <access_token>
There is no API-key-in-header pattern for data routes: you exchange the API key or password for a JWT using the token endpoints, then call /api/* with the Bearer token.
Claim types are the string names of JwtClaims (e.g. UserId, CompanyId, TimeZone). API key logins may also include Vehicles, Actions, and DateFormat for scoped keys.
Do not request a new token on every API call. Each token is valid for ~24 hours. Requesting tokens unnecessarily adds latency and risks hitting future rate limits.
Recommended approach:
On startup, request a token and store it in memory with its expiry time (Date.now() + expires_in * 1000).
Before each API call, check if the token expires within the next 5 minutes.
If yes, re-authenticate and replace the cached token.
Scoped to the primary company associated with the Telemax user account. Multi-company users are pinned to their first company — if you need access to a different company, use an API key issued for that company instead.