Authentication and access
Authentication identifies the caller. Authorization determines what that caller may do. A valid credential can still be refused because of its scope, workspace membership, role, or entitlement.
Choose a credential
| Credential | Use it for | Boundary |
|---|---|---|
| Interactive access token | Requests on behalf of a signed-in person | The person's current account, workspace, role, and plan access |
| Developer token | Scoped scripts and CI jobs | Only routes that explicitly accept the token and its scopes |
| Enterprise API key | Supported workspace integrations | The key's permitted workspace and API-key scopes |
| OAuth access token | An existing delegated integration | The consented grant and the routes that accept it |
These credentials are not interchangeable. In particular, a developer token does not become an interactive session token by being exchanged or used through the CLI.
Interactive sessions
Sign in through a supported frontend or the CLI browser login. Direct password login is described in authentication, including the required verification for that flow.
A login returns short-lived access credentials and a refresh capability. Use the expiry returned by the API instead of hardcoding a lifetime. A refresh response replaces the previous token values; store the new values together.
Send an authenticated request
GET /api/v1/ai/sessions HTTP/1.1
Host: api.chainabit.com
Authorization: Bearer YOUR_ACCESS_TOKENThis session-list request needs an interactive token and the applicable AI access. A missing, expired, or invalid credential returns 401. A valid credential can receive 403 if the caller lacks permission.
For Business workspaces, account and workspace selection are additional context, not additional authority. Selecting a workspace you cannot access does not grant membership.
Developer tokens for automation
Use a developer token directly as a Bearer token on a supported route. Select only the scopes needed by the job. The CLI accepts the token through CHAINABIT_TOKEN or its documented credential-input options.
CHAINABIT_TOKEN=YOUR_DEVELOPER_TOKEN chainabit workspace listThe CLI can use a legacy compatibility exchange when talking to an older server. That does not widen the token's authority. Interactive session routes remain interactive even when the request comes from a script.
See developer access for the current scopes, expiry, and revocation rules. Creating or managing a developer token requires the appropriate human session and can require recent identity verification.
Verification-sensitive actions
Sign-in, account recovery, and other sensitive flows may require a captcha, a second factor, or recent identity verification. Complete the challenge specified by the supported flow. A saved access token alone does not satisfy a new verification requirement.
A 403 STEP_UP_REQUIRED response means a protected action needs recent verification. Complete that action's challenge and retry the original request as instructed; do not silently weaken the action or substitute another credential.
Refresh a session
Use the refresh capability belonging to the interactive session. Refresh is not a way to upgrade a developer token or an OAuth grant into an interactive user session. The authentication reference documents the request and response.
Enterprise API keys
Enterprise API keys have their own supported scopes and workspace access. Scope names in the API key reference are not automatically available to developer tokens.
OAuth and passwordless sign-in
OAuth grants and mailbox sign-in use their configured consent and verification flows. Follow OAuth token guidance for an existing OAuth integration, or the authentication walkthrough for mailbox sign-in.
Account and workspace roles
Enterprise accounts use a two-level role model: each member has an account role, and a workspace role in each workspace they can access. A route that requires a role refuses a caller without it with 403.
Both levels use the same six role names: owner, admin, member, analyst, billing and viewer. The owner role cannot be assigned through the account member or invitation endpoints.
A member's role in a workspace is decided in this order:
- A workspace membership sets the member's role in that workspace, even when it is lower than their account role.
- Without a workspace membership, the account owner can open every workspace in the account.
- Without a workspace membership, an account admin can open only workspaces shared with invited members. A workspace kept private to the owner stays closed to admins.
- Any other member needs a workspace membership.
Diagnose access failures
| Response | First check |
|---|---|
401 | Credential validity, expiry, and the accepted authentication mechanism |
403 | Scope, account/workspace selection, membership, role, and entitlement |
403 STEP_UP_REQUIRED | The recent identity verification required for this action |
429 | The retry delay and the endpoint's request or usage limit |
If access to one selected account was revoked, clear or change that selection rather than assuming the user's entire login has failed. Use error codes to distinguish the causes.
Protect credentials
Keep credentials in a private environment or secret store, never in a public frontend bundle, request URL, screenshot, or committed example. Revoke an exposed credential and issue a replacement with the minimum required scope.