Errors

The C0R Food API uses standard HTTP status codes. Error responses always return JSON with a detail field.

Error Response Shape

{
  "detail": "Human-readable error message."
}

Validation errors return an array in detail:

{
  "detail": [
    {
      "type": "string_too_short",
      "loc": ["query", "q"],
      "msg": "String should have at least 2 characters",
      "input": "a"
    }
  ]
}

HTTP Status Codes

StatusMeaningCommon Cause
200OKRequest succeeded
401UnauthorizedMissing, invalid, or revoked API key
422Unprocessable EntityInvalid query parameters (e.g., query too short, invalid enum value)
429Too Many RequestsDaily quota exceeded or per-second burst limit hit
500Internal Server ErrorUnexpected server error — contact support if persistent

401 — Authentication Errors

No API key provided:

curl "https://api.c0r.ai/v1/search?q=apple"
# → 401
{
  "detail": "API key required. Pass Authorization: Bearer {key} or X-API-Key header."
}

Invalid API key:

curl "https://api.c0r.ai/v1/search?q=apple" -H "X-API-Key: fdb_bad"
# → 401
{
  "detail": "Invalid API key."
}

422 — Validation Errors

Query parameter too short:

curl "https://api.c0r.ai/v1/search?q=a" -H "X-API-Key: fdb_your_key"
# → 422
{
  "detail": [
    {
      "type": "string_too_short",
      "loc": ["query", "q"],
      "msg": "String should have at least 2 characters",
      "input": "a"
    }
  ]
}

429 — Rate Limit Exceeded

# After exceeding 1,000 requests/day on Developer plan
# → 429
{
  "detail": "Daily rate limit exceeded."
}

See the Rate Limits page for retry strategies and quota reset timing.