Overview
API keys provide programmatic access to the Nadoo AI platform without requiring interactive user authentication. Each key is scoped to a specific workspace and user, ensuring that access is isolated and auditable.Workspace-Scoped
Every API key belongs to a workspace. It can only access resources within that workspace.
Granular Scopes
Keys can be limited to specific permission scopes such as
read, write, or admin.Rate Limited
Each key has a configurable rate limit (default: 100 requests/minute) to prevent abuse.
API Key Lifecycle
Create a Key
Generate a new API key via the dashboard or the API. The full key value is returned only once at creation time.Response:
Monitor Usage
Track usage statistics for any key:The response includes total requests, success/failure ratio, average response time, and the most-used endpoints.
API Endpoints Reference
The complete set of API key management endpoints:| Method | Endpoint | Description | Permission Required |
|---|---|---|---|
POST | /api/v1/api-keys | Create a new API key | WORKSPACE:CREATE |
GET | /api/v1/api-keys?workspace_id={id} | List all keys in a workspace | WORKSPACE:READ |
GET | /api/v1/api-keys/{id} | Get details for a specific key | Owner of the key |
PATCH | /api/v1/api-keys/{id} | Update key name, description, or scopes | Owner of the key |
DELETE | /api/v1/api-keys/{id} | Revoke (deactivate) a key | Owner of the key |
GET | /api/v1/api-keys/{id}/stats?days=7 | Usage statistics (1-90 days) | Owner of the key |
POST | /api/v1/api-keys/{id}/rotate | Revoke old key and generate new one | Owner of the key |
The
workspace_id query parameter is required when listing API keys. This ensures keys are always accessed within the context of a specific workspace.Key Properties
Each API key has the following attributes:| Property | Type | Description |
|---|---|---|
id | UUID | Unique identifier for the key record |
key | String (64 chars) | The secret key value (only returned at creation) |
name | String | Human-readable name for identification |
description | String | Optional description of the key’s purpose |
workspace_id | UUID | The workspace this key is scoped to |
user_id | UUID | The user who created the key |
scopes | JSON array | Permission scopes (e.g., ["read", "write", "admin"]) |
rate_limit | Integer | Maximum requests per minute (default: 100) |
expires_at | DateTime | Expiration timestamp (null = no expiration) |
is_active | Boolean | Whether the key is currently active |
usage_count | Integer | Total number of requests made with this key |
last_used_at | DateTime | Timestamp of the most recent request |
Scopes
API key scopes control what operations the key can perform. If no scopes are specified, the key has full access within its workspace.| Scope | Description |
|---|---|
read | Read-only access to all workspace resources |
write | Create and update resources |
admin | Full access including member management |
* | Wildcard — equivalent to all scopes |
Usage Logging
Every request made with an API key is logged in theapi_key_logs table, capturing:
- Endpoint and HTTP method called
- Status code of the response
- Client IP address and User-Agent
- Response time in milliseconds
- Error messages (if any)
Best Practices
Store keys in a secrets manager
Store keys in a secrets manager
Use AWS Secrets Manager, HashiCorp Vault, Google Secret Manager, or similar tools. Never store API keys in environment files committed to version control.
Set expiration dates
Set expiration dates
Use the
expires_in_days parameter when creating keys. Short-lived keys (30-90 days) reduce the window of exposure if a key is leaked.Rotate keys regularly
Rotate keys regularly
Use the
/rotate endpoint for zero-downtime key rotation. The old key is revoked immediately and a new key is returned in the same response.Use minimal scopes
Use minimal scopes
Restrict each key to only the scopes it needs. A backend service that only reads data should use a
read-only key.Monitor usage patterns
Monitor usage patterns
Review the
/stats endpoint periodically. Unexpected spikes in usage or requests from unfamiliar IP addresses may indicate a compromised key.Never expose keys in client-side code
Never expose keys in client-side code
API keys should only be used in server-side environments. For frontend applications, use JWT-based authentication with short-lived access tokens.