Skip to main content

Error Handling

Authenticated API errors use a consistent JSON shape. Use the HTTP status code to decide what to do, and the error body for details. Unauthenticated x402 and MPP payment challenges carry their details in response headers; see the x402 and MPP guides.

Error response shape

Authenticated API errors return this structure:
The code field is a stable, machine-readable string. The message field is human-readable and may change between versions — don’t match against it programmatically.

Error code reference

Handling errors in code

The SDK throws typed error classes, so you can catch specific error types and handle them differently. For raw HTTP, check the status code of the response.

Rate limit headers

Every response includes rate limit headers so you can track your budget before hitting 429. See Rate Limits & Tiers for the full header reference and trust tier table.

Implementation advice

For production integrations, handle 429 and retryable 503 responses with exponential backoff. A simple strategy: wait 2^attempt seconds, capped at 60 seconds, with jitter. If Retry-After is present, use it as the first delay. Treat 429 as your API key’s account-level rate limit. Treat 503 service_unavailable from live data endpoints as a temporary upstream/platform issue, not as your quota being exhausted. Some upstream platforms return soft-block payloads inside otherwise successful responses; Influship normalizes those into retryable 503 responses with Retry-After when possible — including the raw Instagram post and transcript lookups. Treat 402 as a billing issue that needs human intervention — don’t retry it automatically. Surface it to your ops team or billing dashboard instead.