APIFuseAPIFuse
  • Providers
  • Changelog
  • Playground
  • Dashboard
  • APIFuse Docs
    • Getting started
    • Authentication and Connections
    • Playground
    • OpenAPI and schemas
    • MCP endpoint
    • Developer MCP guide
    • Schema bundles
    • Next.js App Router integration
    • FastAPI integration
    • Error Handling
    • FAQ
    • Resources
APIFuseAPIFuse

Error Handling

Read APIFuse error responses to tell retryable failures apart from requests the upstream service refused.

Error Handling

Every APIFuse error response tells you three things: what happened (code, message), who stopped the request (source), and whether an identical retry can succeed (retryable). Use these fields instead of pattern-matching HTTP status codes.

Error response shape

{
  "error": {
    "code": "UPSTREAM_REJECTED",
    "message": "The requested time slot overlaps an existing reservation.",
    "retryable": false,
    "source": "upstream_rule",
    "fix": "Pick a slot that does not overlap the account's existing reservations.",
    "requestId": "req_1a2b3c"
  }
}
FieldMeaning
codeStable machine-readable code. Operation-specific codes are listed on each operation's reference page.
messageHuman-readable summary.
retryablefalse means an identical retry cannot succeed — change the request instead. true means a retry later can succeed.
sourceWho stopped the request (see below).
fixWhat to change to make the request succeed, when known.
requestIdInclude this when contacting support.

Some error responses may omit source and retryable; when they are absent, fall back to the status classes below.

Platform-level errors — an invalid connection ID, a timeout while reaching the provider's service, a cancelled request — use a flat body carrying the same fields at the top level: {"error", "code", "message", "action", "retryable", "source", "request_id"}. The official SDKs read both shapes.

Who stopped the request

sourceMeaningWhat to do
clientThe request itself needs a change (invalid input, missing or expired Connection).Fix the request or reconnect, then call again.
upstream_ruleThe provider's service understood the request and refused it under its own rules — a sold-out item, a conflicting reservation, an account-state restriction.Show the reason to your user or change the request. Retrying identically returns the same answer.
upstream_failureThe provider's service malfunctioned or did not respond.Retry with backoff.
apifuseAPIFuse could not complete the request.Retry with backoff; contact support with requestId if it persists.

Status classes

StatusClassTypical source
400, 401, 404Request needs a changeclient
409, 410, 422The upstream service refused the request under its own rulesupstream_rule
429Rate limited — honor Retry-Afterupstream_rule
502, 504Upstream malfunction or timeoutupstream_failure
500, 503APIFuse-side faultapifuse

A 409 is not an outage: the upstream service is healthy and gave a definitive answer. Treat it as application data (for example, show "this slot is already booked"), not as an error to retry.

Retrying safely

  • Never auto-retry a response with retryable: false.
  • Retry 429 after the Retry-After interval, and 502/503/504 with exponential backoff.
  • The official TypeScript and Python SDKs follow these rules automatically and expose error.retryable and error.source on thrown errors.
import { ApiFuseClient, ApiFuseError } from "@apifuse/sdk";

const client = new ApiFuseClient({ apiKey: process.env.APIFUSE_API_KEY! });

async function reserve(input: Record<string, unknown>) {
  try {
    return await client.call.invoke("catchtable", "reserve", input);
  } catch (error) {
    if (
      error instanceof ApiFuseError &&
      error.source === "upstream_rule" &&
      error.retryable === false
    ) {
      // Definitive refusal — show it to the user instead of retrying.
      // (A 429 rate limit also carries source "upstream_rule" but stays
      // retryable — the guard above keeps it on the retry path.)
      return { refused: true, reason: error.message, suggestion: error.fix };
    }
    throw error;
  }
}

On this page

Error HandlingError response shapeWho stopped the requestStatus classesRetrying safely
APIFuseAPIFuse
  • Providers
  • Changelog
  • Playground
  • Dashboard
  • APIFuse Docs
    • Getting started
    • Authentication and Connections
    • Playground
    • OpenAPI and schemas
    • MCP endpoint
    • Developer MCP guide
    • Schema bundles
    • Next.js App Router integration
    • FastAPI integration
    • Error Handling
    • FAQ
    • Resources
Providers
  • API Reference
    • Amazon Japan
    • Baemin Provider
    • Buyee
    • CatchTable Restaurant Search and Reservations
    • Charan Commerce
    • Daangn public listings
    • Daiso Product and Store Data
    • Danawa price comparison
    • Demaecan
    • Ekitan
    • Goodchoice Domestic Lodging
    • Google Flights
    • Han River Water Level
    • Hot Pepper Gourmet provider
    • Hyundai Card
    • Jalan
    • Japan National Diet Minutes
    • Japan Disaster Alerts
    • Japan EDINET Filings
    • Japan e-Gov Law
    • Japan e-Stat
    • Japan GSI Geocoding
    • Japan e-Gov Open Data
    • Japan Post ZIP
    • Japan Public Holidays
    • JMA Weather
    • KakaoMap Place Search and Directions
    • Kakao T Taxi Dispatch
    • Korea Address Search
    • AirKorea Real-time Air Pollution
    • Korea Apartment Rent Prices
    • Korea Apartment Sale Prices
    • Korea Bid Notices
    • Korea Building Register
    • Korea Business Verify
    • Korea Camping
    • Korea DART Corporate Finance
    • DART Corporate Info
    • Korea Culture Events
    • Korea Disaster Alert
    • Korea Emergency Hospital
    • Korea ETF
    • Korea EV Charger
    • Korea Fuel Price
    • Korea Holiday
    • Korea Hospital Info
    • Korea Land Price
    • Korea MFDS Drug Safety
    • Korea MFDS Food Safety
    • Korea Household Waste Disposal Guide
    • Korea National Law Search and Lookup
    • Korea NEIS School Meals
    • Carrier List and Delivery Tracking
    • Korea Pharmacy
    • Korea Population
    • Korea Stock Index
    • Korea Stock Price
    • Korea Train Schedule
    • Korea Weather Forecast Data
    • Korea Weather Forecast
    • Korea Welfare Service
    • K-Startup
    • LH Housing Notices
    • Market Kurly product data
    • Mercari
    • Modu Parking
    • Naver Blog Search
    • Naver Flight API
    • Naver Map
    • Naver News Search
    • NOL Stays
    • Ohouse Store and Contents
    • Rakuten Ichiba
    • Rakuten Travel
    • SEC EDGAR Filings
    • Seoul Bike
    • Seoul Live Crowd Density
    • Seoul Subway Arrivals
    • Shinhan Bank
    • Shinhan Card
    • Skiplagged
    • SUUMO
    • Swing Taxi
    • Tabelog
    • TableCheck
    • Weverse Provider
    • Yahoo! Shopping (Japan)
    • Yogiyo
    • ZOZOTOWN
APIFuseAPIFuse

Error Handling

Read APIFuse error responses to tell retryable failures apart from requests the upstream service refused.

Error Handling

Every APIFuse error response tells you three things: what happened (code, message), who stopped the request (source), and whether an identical retry can succeed (retryable). Use these fields instead of pattern-matching HTTP status codes.

Error response shape

{
  "error": {
    "code": "UPSTREAM_REJECTED",
    "message": "The requested time slot overlaps an existing reservation.",
    "retryable": false,
    "source": "upstream_rule",
    "fix": "Pick a slot that does not overlap the account's existing reservations.",
    "requestId": "req_1a2b3c"
  }
}
FieldMeaning
codeStable machine-readable code. Operation-specific codes are listed on each operation's reference page.
messageHuman-readable summary.
retryablefalse means an identical retry cannot succeed — change the request instead. true means a retry later can succeed.
sourceWho stopped the request (see below).
fixWhat to change to make the request succeed, when known.
requestIdInclude this when contacting support.

Some error responses may omit source and retryable; when they are absent, fall back to the status classes below.

Platform-level errors — an invalid connection ID, a timeout while reaching the provider's service, a cancelled request — use a flat body carrying the same fields at the top level: {"error", "code", "message", "action", "retryable", "source", "request_id"}. The official SDKs read both shapes.

Who stopped the request

sourceMeaningWhat to do
clientThe request itself needs a change (invalid input, missing or expired Connection).Fix the request or reconnect, then call again.
upstream_ruleThe provider's service understood the request and refused it under its own rules — a sold-out item, a conflicting reservation, an account-state restriction.Show the reason to your user or change the request. Retrying identically returns the same answer.
upstream_failureThe provider's service malfunctioned or did not respond.Retry with backoff.
apifuseAPIFuse could not complete the request.Retry with backoff; contact support with requestId if it persists.

Status classes

StatusClassTypical source
400, 401, 404Request needs a changeclient
409, 410, 422The upstream service refused the request under its own rulesupstream_rule
429Rate limited — honor Retry-Afterupstream_rule
502, 504Upstream malfunction or timeoutupstream_failure
500, 503APIFuse-side faultapifuse

A 409 is not an outage: the upstream service is healthy and gave a definitive answer. Treat it as application data (for example, show "this slot is already booked"), not as an error to retry.

Retrying safely

  • Never auto-retry a response with retryable: false.
  • Retry 429 after the Retry-After interval, and 502/503/504 with exponential backoff.
  • The official TypeScript and Python SDKs follow these rules automatically and expose error.retryable and error.source on thrown errors.
import { ApiFuseClient, ApiFuseError } from "@apifuse/sdk";

const client = new ApiFuseClient({ apiKey: process.env.APIFUSE_API_KEY! });

async function reserve(input: Record<string, unknown>) {
  try {
    return await client.call.invoke("catchtable", "reserve", input);
  } catch (error) {
    if (
      error instanceof ApiFuseError &&
      error.source === "upstream_rule" &&
      error.retryable === false
    ) {
      // Definitive refusal — show it to the user instead of retrying.
      // (A 429 rate limit also carries source "upstream_rule" but stays
      // retryable — the guard above keeps it on the retry path.)
      return { refused: true, reason: error.message, suggestion: error.fix };
    }
    throw error;
  }
}

On this page

Error HandlingError response shapeWho stopped the requestStatus classesRetrying safely