API keys and scopes
API keys let your server call the platform without a person signed in.
- A key looks like
ngk_followed by 43 characters (32 random bytes). - Only its SHA-256 hash is stored. The full key is returned once, when created.
- A key belongs to one workspace, has scopes, and can expire (1–3650 days).
- Revoking a key (
DELETE /v1/api-keys/{id}) stops it immediately. last_used_atshows whether a key is still in use.
Scopes
| Scope | Allows |
|---|---|
runs | Run agents; read, stream, resume and cancel runs |
agents:read | Read agent definitions |
agents:write | Create, change and delete agents (includes agents:read) |
knowledge:read | Search knowledge and read indexing jobs |
knowledge:write | Add and delete documents and files (includes knowledge:read) |
Keys can never manage the workspace, members, invites, other keys or the audit trail; those need a person with the admin role.
Good practice
- One key per app or integration, with only the scopes it needs. A website
chat needs only
runs. - Keep keys in a secret manager on your server. Never put a key in a browser, a mobile app, a prompt or a chat message.
- Set an expiry and rotate keys: create the new key, deploy it, then revoke the old one.