Authentication
The Faces API accepts two authentication methods: JWT tokens (for server-to-server use right after login) and API keys (for long-lived application access). Both are passed as aBearer token in the Authorization header.
JWT tokens
JWTs are issued by the/auth/login endpoint after email/password authentication. They expire after a short window and are suitable for immediate use in client-side flows or testing.
Register
Login
Refresh
API keys
API keys are the recommended method for production applications. They support optional budget caps, expiration, and restrictions on which faces and models can be used.Create an API key
| Field | Type | Description |
|---|---|---|
name | string | Human-readable label |
budget_usd | float (optional) | Hard spend cap in USD. Requests fail with 402 once exhausted. Null = unlimited. |
expires_in_days | int (optional) | Number of days until the key expires. Null = never expires. |
scopes | array (optional) | Permission scopes. Default: ["v1:*"] (full access). |
allowed_face_ids | array (optional) | Restrict the key to specific face aliases. Null = all owned faces. |
allowed_llm_models | array (optional) | Restrict the key to specific LLM models. Null = all models. |
List API keys
Update an API key
Revoke an API key
Budget caps
When a budget cap is set on an API key, every chat request checks the remaining budget before proceeding. If the balance is zero or the key is frozen, the API returns:Face and model restrictions
Theallowed_face_ids field restricts which faces can be used with a key. Pass face aliases (not UUIDs):
allowed_llm_models field restricts which LLM models can be used:
403 Forbidden.
Null or omitted fields allow all faces/models — appropriate for unrestricted keys.
Error codes
| Code | Meaning |
|---|---|
401 | Missing or invalid token |
402 | Insufficient credits |
403 | Face/model not allowed, or permission denied |