Authentication
JWT for user sessions, API keys for integrations
4 min read
FreeMaint accepts two auth mechanisms: JWTs (issued by /auth/login, used by our web and mobile apps) and API keys (created in /company-settings/api, used by your own integrations).
JWT (user sessions)
- POST /auth/login โ Body: {email, password}. Returns {access_token, refresh_token}.
- Send Authorization header โ On every request: Authorization: Bearer <access_token>.
- Refresh when expired โ POST /auth/refresh with the refresh_token to get a new access_token. Access tokens last 2 hours.
API key (server integrations)
- Open /company-settings/api โ Visible to admins from Business tier upward.
- Click 'New key' โ Optionally set an expiration. The raw key is shown ONCE โ copy it immediately.
- Use it โ Send Authorization: Bearer fmk_<rawKey> on every request. Format: starts with fmk_ followed by 32 hex characters.
Security notes
- API keys are stored as SHA-256 hashes โ once you close the reveal dialog, the raw value is unrecoverable
- Revoking a key disables it immediately; the row is kept for audit
- Each key is scoped to a single company; cross-tenant requests always 401
- Keys can have an optional expiresAt for short-lived integrations
Tip
Compromise a key? Revoke it from /company-settings/api โ takes effect within seconds.
Related articles
Was this page helpful?