Python authentication
FoodAPI uses API key authentication on every request. Constructor from foodapi import FoodAPI client = FoodAPI(api_key="foodapi_your_key") The key is sent as…
PythonTypeScript
FoodAPI uses API key authentication on every request.
Constructor
The key is sent as Authorization: Bearer <api_key>.
Environment variable
Multi-tenant external users
Pass external_user_id to scope pantry and reasoning to an end-user in your product:
Per-request override on reasoning:
Errors
| Exception | HTTP | When |
|---|---|---|
AuthenticationError |
401, 403 | Missing/invalid key or insufficient scope |
RateLimitError |
429 | Quota exceeded; check retry_after_seconds |
ValidationError |
400, 422 | Invalid request body or query |
NotFoundError |
404 | Unknown resource id |
ServerError |
5xx | API or gateway failure |
Full hierarchy: errors reference.