API
Errors
The API uses conventional HTTP status codes and returns a consistent JSON error body you can branch on.
Error format
json
{
"statusCode": 403,
"error": "Forbidden",
"message": "API key is missing required scope(s): knowledge:write",
"path": "/api/v1/knowledge/documents",
"timestamp": "2026-07-12T10:30:00.000Z"
}message is human-readable and safe to log. Validation failures return an array of messages, one per invalid field.
Status codes
| Field | Type | Description |
|---|---|---|
400 | Bad Request | Malformed body or missing field — e.g. an org-wide key without projectId. |
401 | Unauthorized | Missing, malformed, or revoked API key. |
403 | Forbidden | Valid key, but missing a required scope or restricted to a different project. |
404 | Not Found | Resource doesn't exist or belongs to another organization. |
413 | Payload Too Large | Uploaded file exceeds your plan's size limit. |
429 | Too Many Requests | Rate limit exceeded — back off and retry after the Retry-After header. |
5xx | Server Error | Something failed on our side. Retry with exponential backoff; if persistent, contact support. |
Troubleshooting
- 401 with a fresh key — check you're sending
Authorization: Bearer sk_...(the word Bearer, one space, then the key, no quotes). - 400 "This API key is org-wide" — pass
projectIdin the body (POST) or query string (GET), or create a project-scoped key instead. - 403 scope errors— the message names the missing scope; edit the key's scopes in Developer → API keys or mint a new key.
- Quota errors on /chat— your plan's monthly message allowance is exhausted; check
GET /usageor the billing page. - Streaming stops early— ensure your HTTP client doesn't buffer or time out idle connections; SSE responses stay open for the duration of the answer.
