Authentication
Most Haltless API endpoints authenticate with a bearer JWT access token. Telemetry ingestion authenticates with an API key instead. See Sensor Data and the API Keys guide.
Send the access token on every authenticated request:
Authorization: Bearer <jwt>
Access tokens last 30 minutes. A refresh token, valid for 7 days, is returned as a secure, httpOnly cookie by /api/v1/auth/login and is used by /api/v1/auth/refresh to mint a new access token. Each refresh replaces the cookie, and the old one stops working.
Endpoints
| Method | Path | Description |
|---|---|---|
POST | /api/v1/auth/login | Exchange email and password for an access token |
POST | /api/v1/auth/refresh | Get a fresh access token from the refresh cookie |
GET | /api/v1/auth/me | Return the authenticated user's profile |
POST | /api/v1/auth/logout | Revoke the current session |
POST | /api/v1/auth/mfa/verify | Complete an MFA challenge for a full token |
POST | /api/v1/auth/mfa/setup | Start setting up two-factor authentication |
POST | /api/v1/auth/mfa/verify-setup | Confirm the first code, turn it on, and get recovery codes |
POST | /api/v1/auth/mfa/disable | Turn two-factor authentication off |
GET | /api/v1/auth/mfa/backup-codes/count | How many recovery codes you have left |
POST | /api/v1/auth/mfa/backup-codes/regenerate | Replace your recovery codes |
POST | /api/v1/auth/forgot-password | Email a password-reset link |
POST | /api/v1/auth/reset-password | Set a new password from a reset token |
GET | /api/v1/auth/invitation/{token} | Who an invitation is for |
POST | /api/v1/auth/accept-invitation | Accept an invitation and set a password |
GET | /api/v1/auth/sso/check | Check whether an email domain uses SSO |
POST | /api/v1/auth/sso/exchange | Exchange an SSO code for tokens |
GET | /api/v1/auth/sso/callback | Where an OpenID Connect provider returns the browser |
GET | /api/v1/auth/sso/saml/{tenant_id}/metadata | Haltless's SAML metadata for a company |
POST | /api/v1/auth/sso/saml/{tenant_id}/acs | Where a SAML provider posts its answer |
Single sign-on is configured with the admin endpoints under Configuring single sign-on.
Log in
POST /api/v1/auth/login
Request body
{
"email": "user@example.com",
"password": "<password>",
"tenant_id": null
}
tenant_id is optional. Send it only when a previous response asked you to choose an organization (see below).
Response: 200 OK
{
"access_token": "<jwt>",
"token_type": "bearer",
"mfa_required": false,
"tenant_choice_required": false,
"tenants": [],
"password_expired": false
}
| Field | Description |
|---|---|
mfa_required | true when the account has multi-factor authentication enabled. access_token is then a pending token, valid for 5 minutes and only for completing the challenge |
tenant_choice_required | true when the email and password match accounts in more than one organization. access_token is then empty and tenants lists the organizations (tenant_id, name); repeat the request with the chosen tenant_id |
password_expired | true when the password is over 90 days old. Until it is changed, requests other than changing it return 403 |
Errors
| Status | Meaning |
|---|---|
401 | Wrong email or password, or the account is deactivated |
403 | The email address has not been verified yet. Also, for a request that comes from the Haltless portal's own sign-in page, the Cloudflare Turnstile check did not pass: the body's error_code is TURNSTILE_FAILED. API clients that do not send the portal's origin are not asked for it |
423 | The company's account is suspended |
429 | Too many failed attempts: 10 failures within 10 minutes lock the account, or the address they came from, for 15 minutes |
Refresh an access token
POST /api/v1/auth/refresh
Sends the httpOnly refresh cookie set at login; no request body is required.
Response: 200 OK
{
"access_token": "<jwt>",
"token_type": "bearer"
}
Each refresh replaces the cookie: a refresh token works once. One presented a second time means someone else holds a copy, so it ends the whole session it came from, for both holders, and the next refresh with either cookie is a 401; sign in again. Send refreshes one at a time (one per browser, not one per tab).
Errors
| Status | Meaning |
|---|---|
401 | No refresh cookie, or it is invalid, expired, already used (which ends the whole session) or revoked, or the password was changed since it was issued, or the account is deactivated |
403 | The company's account is suspended |
503 | Your session could not be renewed right now. Try again after the number of seconds in the Retry-After header (5) |
Complete an MFA challenge
POST /api/v1/auth/mfa/verify
Request body
{
"mfa_token": "<pending-token>",
"code": "123456"
}
The code accepts a six-digit time-based one-time code or a single-use recovery code. The pending token works once.
A wrong or already used code, or an expired or invalid mfa_token, returns 401. After 10 wrong codes in 10 minutes the call is locked for 15 minutes (429).
Response: 200 OK
{
"access_token": "<jwt>",
"token_type": "bearer"
}
Get the current user
GET /api/v1/auth/me
Requires a bearer JWT. Returns the authenticated user's profile.
Response: 200 OK
{
"id": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"email": "user@example.com",
"full_name": "Jordan Rivera",
"role": "operator",
"mfa_enabled": true,
"timezone": "UTC",
"locale": "en",
"last_login_at": "2026-08-07T09:12:00Z"
}
Set up two-factor authentication
Each person sets up their own, signed in. Setting up, confirming, turning off and regenerating cannot be called while impersonating someone. Codes are six-digit time-based codes from an authenticator app.
POST /api/v1/auth/mfa/setupreturnsotpauth_uri(to show as a QR code) andsecret(to type in by hand). Nothing is on yet. While it is on, this returns409: turn it off first.POST /api/v1/auth/mfa/verify-setupwith the first code the app shows,{"code": "123456"}, turns it on and returns ten single-use recovery codes, once:
{ "backup_codes": ["ABCDE-FGHJK", "LMNPQ-RSTUV", "..."] }
POST /api/v1/auth/mfa/disable with a current code (not a recovery code) turns it off and deletes the recovery codes (204). GET /api/v1/auth/mfa/backup-codes/count returns {"remaining": 7}; POST /api/v1/auth/mfa/backup-codes/regenerate with a current code replaces them all and returns the new set as verify-setup does.
A code already used is refused (400), and so is a wrong one. After 10 wrong codes in 10 minutes the call is locked for 15 minutes (429). Each change is emailed to the person and recorded in the audit log.
Log out
POST /api/v1/auth/logout
Requires a bearer JWT. Revokes the current access and refresh tokens and clears the refresh cookie. Returns 204 No Content.
Password reset
These two, and accepting an invitation, are completed in the Haltless portal from the link in the email. On the hosted service each needs a Cloudflare Turnstile token (turnstile_token in the body) that the portal's form issues, so they cannot be called from a script; a self-hosted install without Turnstile configured takes them as shown.
POST /api/v1/auth/forgot-password emails a time-limited reset link to the address if it matches a user. It always returns 204 No Content, so it never reveals whether an email is registered.
{
"email": "user@example.com"
}
POST /api/v1/auth/reset-password consumes the emailed token and sets a new password:
{
"token": "<reset-token>",
"new_password": "<new-password>"
}
Returns 204 No Content on success. A reset link lasts 30 minutes and works once. new_password follows the rules under Accept an invitation (422 otherwise) and must differ from your last 12 passwords. An unknown, used or expired link, or a password you used recently, returns 400. Too many attempts from one address return 429.
Accept an invitation
An invited person sets their password from the emailed link. GET /api/v1/auth/invitation/{token} says who the invitation is for, {"email": "...", "full_name": "..."}, or 404 when the link is unknown, used or expired. It needs no sign-in and spends nothing.
POST /api/v1/auth/accept-invitation spends the token and activates the account (204); the person then signs in as usual:
{
"token": "<invitation-token>",
"new_password": "<new-password>"
}
The password needs 12 to 128 characters, with a digit, an upper-case and a lower-case letter, and a symbol (422 otherwise). A link lasts 72 hours and works once (400 after); an administrator can send a new one (Settings). Wrong tokens from one address are locked out for 15 minutes after 10 in 10 minutes (429). On the hosted service it needs the portal's Turnstile token, as above.
Single sign-on
A company can sign its people in with its own identity provider, over SAML 2.0 or OpenID Connect (see the guide). A sign-in is started from the email, and can be finished only in the browser that started it.
First keep a random secret in the browser, and send its SHA-256 (lower-case hex) with the email:
GET /api/v1/auth/sso/check?email=user@example.com&binding=<sha256-of-secret>
Response: 200 OK
{
"has_sso": true,
"provider_name": "Microsoft Entra ID",
"redirect_url": "https://login.microsoftonline.com/.../saml2?SAMLRequest=...&RelayState=..."
}
has_sso is false when the domain has no provider, or its company has not yet verified it; show a password field then. This endpoint is rate limited per address.
Send the browser to redirect_url. After the provider signs the person in, Haltless sends the browser back to the portal's login page with a short-lived sso_code, or with an sso_error saying why it did not work (no_account, invalid_callback, oauth_failed, email_unverified, access_denied or generic). Exchange the code, with the secret, for tokens:
POST /api/v1/auth/sso/exchange
{
"code": "<sso-code>",
"binding_secret": "<the secret>"
}
Response: 200 OK, and the refresh cookie, as for a password sign-in
{
"access_token": "<jwt>",
"token_type": "bearer"
}
A code is spent on its first exchange and lasts two minutes. A code exchanged with any other secret signs no one in.
Single sign-on signs in only people who already have an account, added by an administrator or by the company's identity provider over SCIM.
Addresses the identity provider uses
The browser and the provider call these, not your code; they are what you register with the provider. GET /api/v1/auth/sso/config/saml-service-provider returns the SAML ones for your company.
| Path | Who calls it |
|---|---|
GET /api/v1/auth/sso/callback | An OpenID Connect provider sends the browser back here (its redirect URI). |
GET /api/v1/auth/sso/saml/{tenant_id}/metadata | Haltless's SAML metadata for your company (application/samlmetadata+xml), for a provider that imports it. It needs no sign-in, and it can be imported before SAML is saved. |
POST /api/v1/auth/sso/saml/{tenant_id}/acs | A SAML provider posts its answer here (HTTP-POST). Only an answer to a sign-in started at Haltless signs anyone in; one started from the provider's app tile starts that sign-in instead. |
Each ends by sending the browser to the portal's login page, with the sso_code or sso_error above.
Configuring single sign-on
These endpoints need an account administrator with the SSO settings tab.
| Method | Path | Description |
|---|---|---|
GET | /api/v1/auth/sso/config | The company's identity provider |
POST | /api/v1/auth/sso/config | Save it (create, or replace) |
PATCH | /api/v1/auth/sso/config | Change some of it, switch protocol, or switch it on or off (is_active) |
DELETE | /api/v1/auth/sso/config | Remove it |
POST | /api/v1/auth/sso/config/verify-domain | Look for the domain's verification TXT record |
GET | /api/v1/auth/sso/config/saml-service-provider | The entity ID and addresses to give a SAML provider |
POST | /api/v1/auth/sso/config/saml-metadata | Read a SAML provider's metadata into config fields (saves nothing) |
GET | /api/v1/auth/sso/provisioning | SCIM provisioning: whether it is on, its base URL, token hint and default role |
POST | /api/v1/auth/sso/provisioning/token | Turn provisioning on, or replace its token |
PATCH | /api/v1/auth/sso/provisioning | The role new people start with |
DELETE | /api/v1/auth/sso/provisioning | Turn provisioning off |
The identity provider
| Field | Protocol | Description |
|---|---|---|
protocol | saml or oidc (default oidc) | |
domain | The email domain whose sign-ins go to this provider | |
provider_name | Shown on the sign-in button | |
saml_entity_id | SAML | The provider's entity ID: the issuer its assertions name |
saml_sso_url | SAML | Where the browser is sent to sign in (HTTP-Redirect binding), HTTPS |
saml_certificates | SAML | The provider's signing certificate, PEM; up to 3 during a rollover. An expired one is refused. |
issuer_url | OIDC | The issuer, HTTPS; its endpoints are discovered from it |
client_id, client_secret | OIDC | The app's credentials. The secret is never returned. |
is_active | Whether sign-ins go to the provider (default true) |
Each protocol's fields are required when it is chosen, and the other protocol's are cleared. A PATCH that switches protocol must carry the new protocol's fields.
{
"protocol": "saml",
"domain": "acme.com",
"provider_name": "Microsoft Entra ID",
"saml_entity_id": "https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/",
"saml_sso_url": "https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/saml2",
"saml_certificates": "-----BEGIN CERTIFICATE-----\nMIIC8D...\n-----END CERTIFICATE-----"
}
The response carries, besides the fields (never client_secret):
saml_certificates: each certificate'ssubject,not_afterandfingerprint_sha256;saml_service_provider: theentity_id,acs_urlandmetadata_urlto configure the SAML provider with;domain_verified, and the TXT record that proves the domain (verification_record_name,verification_record_value). Sign-ins for the domain go to the provider only once it is verified. A domain another company has verified returns409.
POST /api/v1/auth/sso/config/saml-metadata takes {"metadata_url": "..."} or {"metadata_xml": "..."} and returns saml_entity_id, saml_sso_url and saml_certificates ready to save, with the certificates summarised. Metadata that lacks one of them, or holds only expired certificates, returns 422; an address that cannot be reached returns 502.
Provisioning
POST /api/v1/auth/sso/provisioning/token takes an optional {"default_role": "technician"} (any role but an administrator one; operator when first turned on) and returns the provisioning settings with the new token. It is in that answer and nowhere else; a token it replaces stops working at once.
{
"enabled": true,
"base_url": "https://api.haltless.io/api/v1/scim/v2",
"default_role": "technician",
"token_hint": "Q7xk",
"token_created_at": "2026-11-14T09:00:00Z",
"last_used_at": null,
"managed_users": 0,
"token": "hlt_scim_..."
}
See SCIM Provisioning for what the identity provider can then do.
See the Authentication getting-started guide for a full walkthrough.