Authentication
API key authentication for the LiyaEngine REST API, dashboard JWT flow, and key management.
API Key Authentication
All /v1/* endpoints require an API key passed as a Bearer token in the Authorization header.
curl -X POST https://api.liyaengine.ai/v1/run \
-H "Authorization: Bearer liya_F9y2kQ8mZ1..." \
-H "Content-Type: application/json" \
-d '{ "domain": "...", "intent": "...", "input": { ... } }'API keys are scoped to your tenant and carry all domain and intent permissions associated with your account.
Key format
Keys are prefixed with liya_ followed by a random 32-byte token. The full key is only shown once — at creation or rotation. The dashboard shows a masked preview (e.g. liya_F9y-...o4k) for identification.
Getting your key
- Sign up at liyaengine.ai/signup
- Verify your email address
- Your API key is generated automatically on account creation — copy it from the API Keys page before leaving
Rotating your key
Keys are issued per environment. Rotate the key for a specific environment:
POST https://api.liyaengine.ai/dashboard/environments/:id/api-key/rotate
Authorization: Bearer <dashboard_jwt>Rotating generates a new key and immediately invalidates the old one. The full key is returned once in the response — save it.
{
"success": true,
"data": {
"apiKey": "liya_F9y2kQ8mZ1...",
"apiKeyPreview": "liya_F9y2kQ8...m1w"
},
"message": "Save this key now — it will not be shown again."
}A legacy tenant-wide POST /dashboard/api-key/rotate (no environment id) still works too, for tenants created before environments existed.
Key scopes
Every environment has one full-access key, the one described above. You can add more keys to an environment and limit each to what its caller needs, so a key that ships in a production service cannot also change your configuration.
| Scope | What the key can do |
|---|---|
full | Everything. The scope of the environment's own key and of every key created before scopes existed. |
runtime | Execute only: POST /v1/run and its streaming form, the POST /v1/{domain}/{intent} path form, running agents and workflows, the standalone guardrails check, knowledge query, file parsing, and reporting a wrong answer. It cannot change configuration, list resources or read traces. |
read | GET and HEAD only, on any /v1 resource, including traces. It cannot run intents, so it cannot spend model tokens, and it cannot change anything. |
run_read | Both of the above and nothing more: everything runtime may run, plus GET and HEAD on any /v1 resource. It cannot change configuration. A capability allowlist on such a key limits what it may run; reading is not listed. |
A request a scope does not allow returns 403 with the error code API_KEY_SCOPE_DENIED. Scopes are deny-by-default: a route not listed for runtime is refused to a runtime key.
A scope on its own limits what a key can do, not which resources it can reach: a runtime key can run every intent your tenant has enabled. To narrow it, give the key an allowlist of capabilities such as intent:support/answer, agent:helper or workflow:kyc-review. A key with an allowlist can use only what is listed, and anything else is refused with API_KEY_CAPABILITY_DENIED. A key made by an admin, rather than an owner, must have one.
Create, list and revoke scoped keys with the Dashboard API (owners, or admins who manage the key's group). Rotating the environment's key replaces only the full-access key; scoped keys keep working until you revoke them.
Rate limits
Runtime requests are rate-limited per tenant over a sliding 60-second window. The limit is a per-tenant setting, not a fixed platform cap: new workspaces start at 60 requests per minute, and higher throughput is configured for your account on request. Enterprise plans carry committed capacity. Your current limit is returned as rateLimits.requestsPerMinute by GET /dashboard/account.
Some endpoint classes apply an additional, lower ceiling because each call generates significant model spend. Chat endpoints and the Evaluation API are examples, so a raised tenant limit does not remove those.
Every response carries X-RateLimit-Limit and X-RateLimit-Remaining, so clients should read the limit from the headers rather than hard-coding a number. When the limit is exceeded the API returns 429 with error code RATE_LIMIT_EXCEEDED, plus Retry-After and X-RateLimit-Reset headers. The official SDKs retry 429 and 5xx responses automatically. Monthly request and token quotas are separate and are listed per plan on the pricing page.
Dashboard Authentication (JWT)
The dashboard web app (app.liyaengine.ai/dashboard) uses email/password login and issues a short-lived JWT for dashboard API calls.
Signup
POST https://api.liyaengine.ai/auth/signup
Content-Type: application/json
{
"companyName": "Acme Corp",
"email": "[email protected]",
"password": "...",
"fullName": "Jane Smith" // optional
}Response
{
"success": true,
"data": {
"token": "<jwt>",
"user": { "id": "...", "email": "[email protected]", "role": "owner" },
"tenant": { "tenantId": "acme-corp", "tenantName": "Acme Corp", "plan": "starter" },
"apiKey": "liya_F9y2kQ8mZ1..."
}
}The apiKey is only returned at signup. Store it securely. A verification email is sent automatically — the dashboard enforces email verification before full access.
Login
POST https://api.liyaengine.ai/auth/login
Content-Type: application/json
{
"email": "[email protected]",
"password": "..."
}JWT usage
Pass the JWT as a Bearer token for all /dashboard/* endpoints:
Authorization: Bearer <jwt>JWTs expire after 7 days by default. Call POST /auth/refresh (with your current, still-valid JWT) to get a new one. GET /auth/me returns the current user/tenant but does not reissue a token.
Error codes
| Code | HTTP | Meaning |
|---|---|---|
MISSING_API_KEY | 401 | No Authorization header sent |
INVALID_API_KEY | 401 | Key not recognised |
INVALID_API_KEY_FORMAT | 401 | Key is malformed (doesn't start with liya_, wrong length) |
API_KEY_REVOKED | 401 | Key was rotated or manually revoked |
API_KEY_SCOPE_DENIED | 403 | The key's scope does not allow this request |
DOMAIN_NOT_ENABLED | 403 | Domain not in your tenant's enabled_domains |
INTENT_NOT_PERMITTED | 403 | Intent disabled for your tenant |
INVALID_CREDENTIALS | 401 | Wrong email or password |
ACCOUNT_INACTIVE | 403 | Account deactivated — contact support |
EMAIL_TAKEN | 409 | Account already exists for this email |