Skip to main content
One call in, a bearer token out.

Get a token

$BASE is your tenant’s API root, https://<tenant>-api.mathfi.ai. It is issued with your account and differs per customer, so take it as configuration rather than hard-coding it.
The field is username, and it holds your email address. This trips up nearly everyone on the first call.
Wrong credentials give 401 with no body worth parsing.

Use it

Every /api/v1/** endpoint needs it. /api/login does not. Never send it to a signed upload URL. Those URLs carry their own signature, and an extra Authorization header invalidates it. You get 403 SignatureDoesNotMatch and it is not obvious why.

Lifetime

The window slides: each authenticated request pushes expiry forward, so an active client stays signed in. An idle one lapses after an hour. Either way the session ends 24 hours after login and you log in again. This matters for long jobs. A Feature Refinery run can outlive an idle token, so a client that starts a run and then sleeps for an hour will wake up to 401. Either keep polling, which slides the window, or re-authenticate on 401.

No API keys

There are none today. Service-to-service callers use the same email and password flow, with a dedicated account. Store credentials outside your code. Environment variables, a secret manager, a keychain, whichever your environment provides. A CLI or agent built from these docs should take credentials as parameters and never write them to disk in plain text.

Handling expiry

The pattern any client should implement:
Retry a 401 once. If the second attempt also fails, the credentials are wrong, not the token.

Recipes

Full flows built on this helper.