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/verify endpoint after wallet signature verification. They expire after a short window and are suitable for immediate use in client-side flows or testing.
API keys
API keys are the recommended method for production applications. They do not expire and can be scoped with budget caps and domain allowlists.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. |
allowlist | array (optional) | Allowed Origin or Referer hostnames. Empty = unrestricted. |
List API keys
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:Allowlists
Theallowlist field restricts which origins can use the key. This is useful for browser-facing API keys that should not be usable from other domains.
Origin or Referer not in the list are rejected with 403 Forbidden.
An empty or null allowlist allows all origins — appropriate for server-side keys.
Error codes
| Code | Meaning |
|---|---|
401 | Missing or invalid token |
402 | Insufficient credits |
403 | Origin not in allowlist, or permission denied |