Skip to main content
Whenever a fetchbean API call fails, the response body contains a unified error envelope with a matching HTTP status code. Every error — whether it originates from a bad request, an auth failure, or an upstream provider — uses the same structure, so you can write one error-handling path that works across all providers and endpoints.

Error envelope

Every non-2xx response from fetchbean looks like this:
Each field serves a distinct purpose:

Error types

Codes worth handling

A few code values inside those types come up often enough to branch on directly:

Handling errors

Branch on type for the main decision logic, and use code when you need to handle a specific failure scenario. Use the retryable flag to determine whether a retry is appropriate:
You are never charged for provider or timeout errors — the provider never delivered, so billable is false. normalization is the exception: the provider call succeeded and cost real money, and only fetchbean’s mapping to a stable shape failed, so it is billable. Fall back to POST /v1/run to get that provider’s raw response.
Read billable rather than inferring from the status code — it is authoritative for every error. Your spend can never exceed your balance regardless, because insufficient-credit calls are rejected before any provider request is made.