Authentication
Every request sends one credential in the Authorization header:
Authorization: Bearer hl_live_...There are two kinds:
| API key | OAuth access token | |
|---|---|---|
| For | Your own account: scripts, servers, back ends | Apps that act for other HalationLab.ai users |
| Created | In the app, at Account → Developers | By the OAuth flow, after the user approves your app |
| Permissions | Every scope | The scopes the user granted |
| Spending | The spending limit you set for the key | The spending limit the user set when connecting your app |
| Where it may live | Your server only | A server, or a browser app (public client with PKCE) |
GET /v1/models and GET /v1/models/{model} need no credential.
API keys
Section titled “API keys”A key acts for its owner’s account, within the projects chosen for it (all projects by default) and its spending limit (on by default, resets monthly; it can be switched off, and the key can then spend up to the account balance).
- A key starts with
hl_live_and is shown once, when you create it. HalationLab.ai stores only a hash, so a lost key cannot be shown again: create a new one. - A key holds every scope.
- A key that is not used for 30 days expires. Create a new one, or use keys at least monthly.
- You can revoke a key at any time in Account → Developers. A revoked or mistyped key gets
401 api_key_invalid. - Creating keys and changing their projects or spending limits is possible only in the app, never through the API.
OAuth access tokens
Section titled “OAuth access tokens”Apps that act for other people use OAuth 2.0 authorisation code with PKCE, and send the access token as Authorization: Bearer …. The user chooses what your app may do and sets its spending limit on the consent screen. See For app builders.
Scopes
Section titled “Scopes”| Scope | Allows |
|---|---|
read |
Read models, projects, assets, generations, the account and events. |
projects:write |
Create and change projects. |
assets:write |
Upload and import files, and make transformed copies. |
generate |
Start and cancel paid generations within the spending limit the account owner set. |
webhooks |
Register and remove webhook endpoints. |
offline_access |
Receive a refresh token (OAuth only). |
API keys hold all of these. GET /v1/account needs no scope. A request without the scope it needs gets 403 insufficient_scope, with the missing scopes in details.required_scopes. The scopes page lists the scope each endpoint needs.
Uploading needs consent
Section titled “Uploading needs consent”Uploading or importing files needs the account owner’s acceptance of the upload rights and processing terms for that credential. It is given when the key is created, or on the OAuth consent page. Without it, uploads and imports get 403 consent_required with a manage_url where the owner can accept.
Check a credential
Section titled “Check a credential”GET /v1/account shows who the credential acts for, its scopes and projects, the balance and what is left of its spending limit:
# Shows who the API key acts for, its balance and what is left of its spending limit.set -euo pipefailAPI="${HL_API_BASE:-https://api.halationlab.ai/v1}"
curl -sS --fail-with-body "$API/account" \ -H "Authorization: Bearer $HALATIONLAB_API_KEY"Errors
Section titled “Errors”| Status | Code | Meaning |
|---|---|---|
| 401 | authentication_required |
No credential was sent. |
| 401 | api_key_invalid |
The API key is revoked, expired or mistyped. |
| 401 | access_token_invalid |
The access token is invalid or expired, or the connection has ended. |
| 403 | insufficient_scope |
The credential lacks a scope this request needs. |