TypeScript authentication
import { FoodAPI } from "@foodapi/sdk"; const client = new FoodAPI({ apiKey: process.env.FOODAPI_API_KEY!, baseUrl: "https://api.foodapi.dev", }); Bearer token…
PythonTypeScript
import { FoodAPI } from "@foodapi/sdk";
const client = new FoodAPI({
apiKey: process.env.FOODAPI_API_KEY!,
baseUrl: "https://api.foodapi.dev",
});
Bearer token is attached on every request by FetchTransport.
External user context
Errors
| Class | HTTP | Notes |
|---|---|---|
AuthenticationError |
401, 403 | Invalid key |
RateLimitError |
429 | retryAfterSeconds |
ValidationError |
400, 422 | Schema validation |
NotFoundError |
404 | |
ServerError |
5xx | |
FoodAPIError |
any | Base class |
See errors reference.