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
| Status | Meaning | Common Cause |
|---|---|---|
200 | OK | Request succeeded |
401 | Unauthorized | Missing, invalid, or revoked API key |
422 | Unprocessable Entity | Invalid query parameters (e.g., query too short, invalid enum value) |
429 | Too Many Requests | Daily quota exceeded or per-second burst limit hit |
500 | Internal Server Error | Unexpected 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.