Skip to content

Error Response Format

All API errors return a JSON object with an error field:

json
{
  "error": "Human-readable error message"
}

Some endpoints include additional fields:

json
{
  "error": "Quota exceeded",
  "resource": "aiTokens",
  "current": 1050000,
  "limit": 1000000,
  "source": "plan"
}

HTTP Status Codes

Success Codes

CodeMeaningWhen
200OKSuccessful GET, PATCH, DELETE
201CreatedSuccessful POST that creates a resource
202AcceptedV2 ingest — event accepted for processing
204No ContentCORS preflight, successful delete with no body
304Not ModifiedBrain document unchanged (ETag match)

Client Error Codes

CodeMeaningCommon Causes
400Bad RequestInvalid JSON, missing required fields, validation error
401UnauthorizedMissing or invalid API key, expired session
403ForbiddenInsufficient permissions (RBAC), quota exceeded, HMAC validation failed
404Not FoundResource doesn't exist or you don't have access
409ConflictDuplicate resource (idempotence check), version conflict
422Unprocessable EntityValid JSON but semantically invalid (e.g., invalid schemaKey format)
429Too Many RequestsRate limit exceeded (200 req/min). Check Retry-After header

Server Error Codes

CodeMeaningWhat to Do
500Internal Server ErrorRetry after a moment. If persistent, contact support
502Bad GatewayTemporary infrastructure issue. Retry
503Service UnavailableMaintenance or overload. Check status page

Rate Limiting Headers

When rate limited (429), the response includes:

Retry-After: 60
X-RateLimit-Limit: 200
X-RateLimit-Remaining: 0

Common Error Scenarios

Authentication Errors

json
// Missing API key
{ "error": "Unauthorized" }

// Invalid API key
{ "error": "Invalid API key" }

// HMAC validation failed
{ "error": "Invalid HMAC signature" }

// Timestamp too old (anti-replay)
{ "error": "Timestamp too far from server time" }

Quota Errors

json
// Plan limit reached
{
  "error": "Quota exceeded for resource: aiTokens",
  "resource": "aiTokens",
  "current": 1050000,
  "limit": 1000000,
  "source": "plan"
}

// No credits available
{
  "error": "Quota exceeded and no prepaid credits available",
  "resource": "aiTokens"
}

Validation Errors

json
// Missing required field
{ "error": "name is required" }

// Invalid field value
{ "error": "visibility must be 'public' or 'private'" }

// Content too large
{ "error": "content exceeds maximum length of 50000 characters" }

Permission Errors

json
// Insufficient role
{ "error": "Forbidden: requires admin role" }

// Not a project member
{ "error": "Not a member of this project" }