C
ChowAPI

Error Handling

Every error response follows a consistent format with an AI-friendly .suggestion field.

Error format

{
  "error": {
    "code": "search/query_required",
    "message": "Missing required parameter: q",
    "suggestion": "Add a search query: /v1/search?q=chicken breast",
    "docs": "https://chowapi.dev/docs/search"
  }
}
FieldDescription
codeMachine-readable error code (category/specific)
messageHuman-readable error description
suggestionActionable fix, designed for AI assistants to read and act on
docsLink to relevant documentation page

Why .suggestion?

AI assistants (Claude, ChatGPT, etc.) read error responses to decide what to do next. The .suggestion field tells them exactly how to fix the issue. No guessing, no hallucinating fixes. This makes ChowAPI the most AI-debuggable food API available.

Error codes

Authentication

CodeStatusDescription
auth/missing_key401No Authorization header
auth/invalid_key401Key format invalid or key revoked

Rate Limiting

CodeStatusDescription
rate_limit/burst_exceeded429Per-minute request limit exceeded
rate_limit/monthly_exceeded429Monthly call quota exceeded

Search

CodeStatusDescription
search/query_required400Missing q parameter
search/query_too_short400Query < 2 characters
search/offset_too_large400Offset > 500

Barcode & Foods

CodeStatusDescription
barcode/invalid400Invalid barcode format
barcode/not_found404Barcode not in database
foods/invalid_id400Not a valid UUID
food/not_found404Food ID not found