API Keys
Retrieve API key status, rotate your key, and create scoped keys limited to running intents or to reading.
Both endpoints on this page require the owner role — there is no admin exception, since the raw key grants full production API access.
GET /dashboard/api-key
Returns API key metadata. The full key is never returned — only the masked preview.
GET https://api.liyaengine.ai/dashboard/api-key
Authorization: Bearer <jwt>Response:
{
"success": true,
"data": {
"hasKey": true,
"maskedKey": "liya_F9y-...o4k",
"createdAt": "2026-01-15T08:00:00Z",
"lastUsedAt": "2026-03-14T22:41:07Z",
"revokedAt": null
}
}| Field | Description |
|---|---|
hasKey | true if a valid, non-revoked key exists |
maskedKey | Preview for UI display — e.g. liya_F9y-...o4k |
lastUsedAt | Timestamp of the last successful API call |
revokedAt | Non-null if the key was revoked |
POST /dashboard/api-key/rotate
Generates a new API key and immediately invalidates the old one. The full key is returned once — save it.
POST https://api.liyaengine.ai/dashboard/api-key/rotate
Authorization: Bearer <jwt>Response:
{
"success": true,
"data": {
"apiKey": "liya_prod_a1b2c3d4e5f6...",
"maskedKey": "liya_a1b-...f6g"
},
"message": "Save this key now — it will not be shown again."
}After rotation:
- The old key returns
401 INVALID_API_KEYimmediately - All active integrations using the old key will fail until updated
lastUsedAtresets tonullfor the new key
Scoped keys
An environment's own key has full access. You can add keys limited to a scope: runtime (execute only), read (GET only) or run_read (both, and nothing that changes configuration). Key creation, rotation, and revocation are recorded in the audit log.
Project owners can manage all scoped keys. Group members can view metadata for their group's keys. A group manager must also be a project admin: admins who manage a group can create or revoke scoped keys assigned to it, and only owners can create a key outside a group. A key made by an admin must list at least one capability (allowedCapabilities), so a group never issues a key that can run everything. Only project admins can create groups, and only an admin or owner can be added to a group as a manager. A group member does not automatically receive the key secret: the full secret is returned only once when a key is created, so provision it to the relevant service through your secrets manager. Membership changes do not revoke secrets already copied into external services; revoke or rotate those credentials separately when access must end.
GET /dashboard/environments/:id/api-keys # list the environment's scoped keys
POST /dashboard/environments/:id/api-keys # create a scoped key
DELETE /dashboard/api-keys/:keyId # revoke a scoped key
GET /dashboard/api-key-groups # list groups visible to the current user
POST /dashboard/api-key-groups # create a group (project admin)
POST /dashboard/api-key-groups/:groupId/members
DELETE /dashboard/api-key-groups/:groupId/members/:userIdCreate a key:
POST https://api.liyaengine.ai/dashboard/environments/env_123/api-keys
Authorization: Bearer <jwt>
Content-Type: application/json
{ "scope": "runtime", "label": "billing-service", "groupId": "group_123", "allowedCapabilities": ["intent:support/answer"] }{
"success": true,
"data": {
"id": "key_abc",
"apiKey": "liya_...",
"apiKeyPreview": "liya_F9y-...o4k",
"scope": "runtime",
"label": "billing-service",
"policyEnforced": true,
"allowedCapabilities": ["intent:support/answer"],
"groupId": "group_123",
"createdAt": "2026-11-30T09:00:00Z",
"lastUsedAt": null,
"revokedAt": null
},
"message": "Save this key now — it will not be shown again."
}| Field | Description |
|---|---|
scope | Required. runtime, read or run_read. A second full-access key cannot be created: rotate the environment's key to replace it. |
label | Optional, up to 60 characters. What the key is for. |
groupId | Required unless you are a project owner. Assigns this service credential to a group in the same project. Only a project owner, or an admin who manages that group, may create its keys. |
allowedCapabilities | Optional. When supplied, enables a fail-closed capability allowlist in addition to scope. Currently supported identifiers include intent:<domain>/<intent>, agent:<agent_key>, workflow:<workflow_key>, action:<id>, collections:query, files:parse, and guardrails:check. An empty list grants no capabilities, and is refused for anyone who is not a project owner. A streaming call (/stream) uses the same capability as the call it streams. |
If allowedCapabilities is omitted, the key retains its scope-only behavior. This preserves existing keys and integrations. If enabled, an unlisted or unclassified route is denied. Capability policy enforcement is separate from authenticating an individual end user: API-key requests still represent the service credential, not a human caller.
The full key is returned once. An environment can have at most 20 active scoped keys.
DELETE /dashboard/api-keys/:keyId revokes a scoped key at once. Calls with it then fail with API_KEY_REVOKED. The environment's full-access key is replaced by rotating it, so deleting it here returns USE_ROTATE.
Rotating the environment's key (POST /dashboard/environments/:id/api-key/rotate) replaces only the full-access key. Scoped keys keep working until you revoke them.
Environment boundary
Environment-specific keys identify the environment associated with the credential. They do not yet isolate project configuration, knowledge, conversations, runtime data, logs, or evaluation records; those remain project-scoped. Do not treat development/staging/production keys as separate data sandboxes until full environment data isolation is available.