API authentication
Huudis takes four kinds of credential. Which one a route accepts depends on its route group; every route's section in the API reference says which, under Authentication.
| Credential | Sent as | Who is calling | Accepted on |
|---|---|---|---|
| Session | Cookie: huudis_session=… |
A person signed in at huudis.com (the dashboard) | Every route a person may call |
| Bearer token | Authorization: Bearer <access token> |
A person, through an OIDC or device-flow token (the CLI, a product acting for its signed-in user) | Every route a person may call |
| Access key | Authorization: Huudis-HMAC-SHA256 Credential=…, Signature=… and X-Huudis-Date |
A program, acting as the user the key belongs to (or as a service account, on /authz only) |
/account/*, /iam/*, /oidc/clients, /ops/end-users/* and /authz/whoami — except the person-only routes below — within the user's IAM policies; /authz/check and /authz/assume-role for any key |
| Client credentials | Authorization: Basic base64(client_id:client_secret), or X-Client-Id + X-Client-Secret |
Your OIDC app itself | /app/* only |
A request that carries a person's session or bearer token is that person's; an access key sent alongside it changes nothing.
Bearer tokens
A bearer token is a person's short-lived access token (an ES256 JWT, 15 minutes). Get one by signing in:
The CLI runs the OIDC device flow and keeps the tokens for you:
npm install -g @forjio/huudis-cli huudis auth login # visit the URL it prints, enter the code huudis api iam users # every API route is a command; calls carry your tokenThe tokens live in
~/.huudis/session.json(mode 0600).A product signing its users in receives the token from
POST /api/v1/oidc/token(authorization code, refresh token or device grant). Huudis accepts it on its own API when its audience ishuudisor a registered OIDC client.
Send it as Authorization: Bearer <token>. It carries the person's identity, the workspace it was issued for (accountId) and whether the sign-in passed MFA (mfaVerified). To act in another of the person's workspaces, add X-Huudis-Workspace-Id: <acc_…>; Huudis checks the membership.
Access keys
An access key lets a program — a script, CI, an AI agent — call the management API without a person signing in. It is the AKIA… id plus a secret, created on Dashboard → Access keys (or POST /api/v1/iam/access-keys) and shown once.
A key belongs to one principal:
- Your own user. The key acts as you, on the
/account/*,/iam/*,/oidc/clients(your workspace's apps),/ops/end-users/*(the people who signed in to them) and/authz/whoamiroutes, and never as more than you: every request must pass both- what you may do yourself (the route's own checks — owner or admin role, workspace membership), and
- what your IAM policies allow — the policies attached to your user and to your groups, evaluated like
/authz/check. Each route has an action, such ashuudis:ListUsersorhuudis:CreateGroup, on a resourceforjio:huudis::<workspace>:<type>/<id>; the reference lists every route's action. No policy, no access: a new key can do nothing until a policy allows it. A policy statement that requires MFA never matches a key, and a statement can name one key with the condition{ "StringEquals": { "forjio:AccessKeyId": "AKIA…" } }.
- A service account in your workspace. Its key calls
/authz/checkand/authz/assume-roleonly.
A signed-in person creates and revokes keys — for themselves and for the workspace's service accounts only, never for another person, since the key would act as them. A key can list keys but never create or revoke one.
Routes a key may never call
Whatever its policies say, a key is refused (403 PERSON_ONLY) on routes that create or revoke access keys, change how a person signs in (MFA included), manage their sessions, delete an account or workspace, act as another person, or decide what keys may do:
| Route | Why |
|---|---|
POST /account/password-change, POST /account/email-change, GET /account/linked-accounts, DELETE /account/linked-accounts/:provider |
The person's sign-in methods |
GET /account/sessions, POST /account/sessions/:id/revoke, POST /account/sessions/revoke-all |
The person's sign-in sessions |
DELETE /account, POST /account/schedule-deletion, POST /account/cancel-deletion |
Deleting the person's account |
POST /account/workspaces/:id/schedule-deletion, POST /account/workspaces/:id/cancel-deletion |
Deleting a workspace (every Forjio product's data for it) |
POST /account/workspaces/:id/switch |
Switches a sign-in session's workspace (a key names one per request with X-Huudis-Workspace-Id) |
POST /account/connected-apps/:clientId/revoke, DELETE /account/connected-apps/:id |
The person's own sign-in grants to apps |
POST /iam/key-actions/:id/undo, POST /iam/key-requests/:id/challenge, /approve, /deny |
A workspace owner's check on what keys do (below) |
POST /iam/access-keys, POST /iam/access-keys/:id/revoke, DELETE /iam/access-keys/:id |
A person decides which keys exist |
Every /mfa/* route |
The person's second sign-in factor |
POST /ops/end-users/:id/impersonate, POST /ops/end-users/stop-impersonation |
Acting as another person |
POST /ops/end-users/:id/verify-email |
Vouches for another person's email address without proof |
POST /ops/end-users/:id/disable, POST /ops/end-users/:id/enable |
Forjio operator actions |
A key also cannot change its own user's permissions (403 SELF_ESCALATION): it cannot attach or detach a policy on its own user, on a group its user is in or on a role its user can assume, add its user to or remove it from a group, delete a group its user is in, or edit or delete a policy that applies to its user. A signed-in person can.
People and sign-in setup
A key may manage the workspace's members and its SSO identity providers, and reset another member's password, under a workspace owner's eye:
The action must be named in a policy.
huudis:AddMember,huudis:InviteMember,huudis:UpdateMember,huudis:RemoveMember,huudis:ResetMemberPassword,huudis:CreateIdentityProvider,huudis:UpdateIdentityProviderandhuudis:DeleteIdentityProviderare granted only by an Allow statement that lists the action itself. A wildcard (*,huudis:*,huudis:*Member) or aNotActionstatement does not grant them; an explicit Deny, wildcard or not, still refuses.Member changes happen at once, and every owner is emailed. Adding (
POST /iam/users), inviting (POST /iam/invites), changing a role (PATCH /iam/users/:id) and removing (DELETE /iam/users/:id) run right away. Every owner of the workspace gets an email with a link to undo the change, and can revoke the key in the same step (POST /iam/key-actions/:id/undowith{"revokeKey": true}). Undo works while the member is still as the key left them: if someone changed it since, undo answers409 CHANGED_SINCErather than overwrite them. A key never chooses or sees a member's password: leavepasswordout ofPOST /iam/users(sending it is400 KEY_CANNOT_SET_PASSWORD) and Huudis emails the new member a temporary one. A key cannot mark an email verified (PATCH /iam/users/:idwithemailVerifiedis403 PERSON_ONLY).An owner approves, with a second-factor code, anything that could take the workspace over: SSO identity providers, resetting another member's password, and granting, changing or removing the owner role. The key's first request is answered
202and nothing changes:{ "data": { "approvalRequired": true, "code": "APPROVAL_REQUIRED", "message": "A workspace owner must approve this first …", "request": { "id": "kar_…", "status": "pending", "title": "reset the password of ana@acme.co", "expiresAt": "…" } } }Every owner is emailed a link to the request (Dashboard → IAM → Key requests). An owner approves it there with a code from their second factor (
POST /iam/key-requests/:id/challenge, then/approvewith the code) or denies it (/deny); an owner without a second factor turns one on first (403 MFA_REQUIRED). The key then sends exactly the same request again (same key, workspace, method, path and body), and it runs, once — so any SDK or CLI call works as it is. Until an owner approves, the same request answers202 APPROVAL_PENDINGwith the request already open (not a new one); a key may have at most 10 requests waiting, and a request expires 24 hours after it was made. To name the approval, send the headerX-Huudis-Approval-Id: kar_…: then a request that was denied answers403 APPROVAL_DENIED, expired410 APPROVAL_EXPIRED, already used409 APPROVAL_USED, and one for a different request or key409 APPROVAL_MISMATCH. Huudis keeps only a fingerprint of the request and a summary with secret-looking fields hidden, never the body; a reset password is emailed to the member and never returned to the key.
The key's user must still be allowed to do it themselves: an owner or admin of the workspace, and an owner to grant the owner role. A key may read what keys did and asked for (GET /iam/key-actions, GET /iam/key-requests, huudis:ListKeyActions, huudis:ListKeyRequests, huudis:GetKeyRequest); undoing, approving and denying is a signed-in owner's.
Signing a request
Each request is signed with the secret; the secret itself is never sent.
StringToSign = METHOD + "\n" + PATH-WITH-QUERY + "\n" + X-Huudis-Date + "\n" + hex(sha256(BODY))
Signature = hex(HMAC-SHA256(secret, StringToSign))
Authorization: Huudis-HMAC-SHA256 Credential=<AKIA… id>, Signature=<Signature>
X-Huudis-Date: <the same ISO-8601 timestamp, e.g. 2026-09-30T12:00:00.000Z>
PATH-WITH-QUERYis exactly what the request line carries:/api/v1/account/audit?limit=5.BODYis the exact bytes sent (empty for a request without one); send JSON asContent-Type: application/json.X-Huudis-Datemust be within 5 minutes of Huudis's clock.
The SDKs and the CLI sign for you:
export HUUDIS_ACCESS_KEY_ID=AKIA…
export HUUDIS_SECRET_ACCESS_KEY=…
huudis api iam users # the CLI signs every call with the key
import { HuudisClient } from '@forjio/huudis-node';
const huudis = new HuudisClient({
issuer: 'https://huudis.com',
accessKey: { accessKeyId: process.env.HUUDIS_ACCESS_KEY_ID, secretAccessKey: process.env.HUUDIS_SECRET_ACCESS_KEY },
});
const users = await huudis.api.iamUsers();
from huudis import HuudisClient
huudis = HuudisClient(issuer="https://huudis.com", access_key_id="AKIA…", secret_access_key="…")
users = huudis.api.iam_users()
c, err := huudis.NewClient(huudis.ClientOptions{Issuer: "https://huudis.com", AccessKeyID: "AKIA…", SecretAccessKey: "…"})
users, err := c.API.IamUsers(ctx)
All three also read HUUDIS_ACCESS_KEY_ID / HUUDIS_SECRET_ACCESS_KEY from the environment, and HUUDIS_WORKSPACE_ID (or workspaceId / workspace_id / WorkspaceID) for the workspace to act in; without one, a key acts in its user's first workspace.
Errors
| Status | error.code |
Meaning |
|---|---|---|
401 |
INVALID_ACCESS_KEY |
The signature did not verify, X-Huudis-Date is more than 5 minutes off, the key is revoked or expired, or its user is disabled. |
403 |
ACCESS_DENIED |
The user's policies do not allow the route's action (the message names it). The denial is in the user's audit log as iam.access_key.denied. |
403 |
PERSON_ONLY |
The route takes a signed-in person only. |
403 |
SELF_ESCALATION |
The change would raise the key's own user's permissions. |
403 |
USER_ACCESS_KEY_REQUIRED |
A service account's key on a management route. |
403 |
NOT_A_MEMBER / NO_WORKSPACE |
The key's user is not a member of the named workspace, or of any. |
202 |
APPROVAL_REQUIRED / APPROVAL_PENDING |
A workspace owner must approve this request first; send the same request again once they have (people and sign-in setup). |
403 |
APPROVAL_DENIED |
An owner denied the request (with X-Huudis-Approval-Id). |
409 |
APPROVAL_USED / APPROVAL_MISMATCH |
The approval was already used, or is for a different request or key. |
410 |
APPROVAL_EXPIRED |
The request is more than 24 hours old; send it again without the header to ask again. |
429 |
TOO_MANY_OPEN_REQUESTS |
The key already has 10 requests waiting for an owner. |
400 |
KEY_CANNOT_SET_PASSWORD |
POST /iam/users with password from a key: leave it out and the member is emailed a temporary one. |
A signed-in person revokes a key with POST /api/v1/iam/access-keys/:id/revoke (or on the dashboard); it stops working at once. See Access keys.
Client credentials
The /app/* routes are your OIDC app calling as itself — for example, to list the users who have signed in to it. Authenticate with the app's client_id and client_secret (a confidential client; public clients are refused):
curl https://huudis.com/api/v1/app/users -u "$HUUDIS_CLIENT_ID:$HUUDIS_CLIENT_SECRET"
or send X-Client-Id and X-Client-Secret. The app sees its own users only. The SDKs use clientId + clientSecret (HUUDIS_CLIENT_ID + HUUDIS_CLIENT_SECRET) on /app/* routes automatically, and the CLI does for huudis api app ….
Verifying a token in your product
Huudis access tokens are ES256 JWTs you verify locally against the published JWKS (/api/v1/oidc/.well-known/jwks.json, also in the discovery document) — the SDKs' verifyAccessToken does it and caches the keys. Always check the audience is your own client id.
Next
- API reference — every route, with the credential it takes.
- Access keys — creating, listing and revoking keys.
- Policies — what a key's user may do.