Skip to content

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

FieldTypeDescription
400Bad RequestMalformed body or missing field — e.g. an org-wide key without projectId.
401UnauthorizedMissing, malformed, or revoked API key.
403ForbiddenValid key, but missing a required scope or restricted to a different project.
404Not FoundResource doesn't exist or belongs to another organization.
413Payload Too LargeUploaded file exceeds your plan's size limit.
429Too Many RequestsRate limit exceeded — back off and retry after the Retry-After header.
5xxServer ErrorSomething 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 projectId in 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 /usage or 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.