Skip to main content

Error Format

All errors return a consistent JSON shape:
{
  "error": {
    "code": "invalid_api_key",
    "message": "Invalid or missing API key. Include your key as: Authorization: Bearer sk-stw_...",
    "docs": "https://docs.stewrd.dev/quickstart"
  }
}
FieldTypeDescription
codestringMachine-readable error code
messagestringHuman-readable error description
docsstringLink to relevant documentation

Error Codes

CodeHTTPDescriptionFix
invalid_api_key401Key is missing, malformed, or revokedCheck your Authorization header and key
invalid_body400Request body is not valid JSONEnsure Content-Type is application/json
missing_message400The message field is missing or emptyInclude a non-empty message in the body
invalid_capabilities400Capabilities array contains invalid valuesUse valid capability names: chat, research, documents, code, data, files
capability_not_enabled403Requested capability is not enabled on the projectEnable the capability in your project settings
plan_restricted403Capability requires a paid planUpgrade your plan to access this capability
quota_exceeded429Monthly request quota exceededUpgrade your plan or wait for the next billing cycle
rate_limited429Too many requests (60/min limit)Back off and retry after a short delay
compute_error502The compute service returned an errorRetry the request; if persistent, contact support
compute_unavailable502Failed to reach the compute serviceRetry the request; check status.stewrd.dev
service_unavailable503Compute service is not configuredCheck status.stewrd.dev for outages

Handling Errors

const response = await fetch('https://api.stewrd.dev/v1/agent', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${STEWRD_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ message: 'Hello' }),
})

if (!response.ok) {
  const { error } = await response.json()
  console.error(`[${error.code}] ${error.message}`)

  if (error.code === 'rate_limited') {
    // Wait and retry
    await new Promise(r => setTimeout(r, 2000))
  }
}
All error responses include a docs field with a direct link to the relevant documentation page. Use it to quickly find the fix.