AnswerLine Sign in Start free

Engineering · Tutorials

Handle API errors like a pipeline, not a script

Most API integration bugs are retry bugs. An answer API has an extra wrinkle: some calls cost money, so retrying the wrong thing can bill twice. Here’s the policy that gets it right — and what the SDKs already do for you.

The error taxonomy

What the SDKs implement

// The TypeScript client's policy, for reference:
// - 429: always retry with capped full-jitter backoff
// - 5xx/timeout/conn-error: retry GET/DELETE and keyed task creation only
// - sync monitor calls: retry only on unsent (refused/DNS)
// - per-attempt 30s; sync monitor calls allow 330s
# The Python client mirrors it — Client and AsyncClient share the policy.

If you hand-roll HTTP instead, encode exactly this. Details in the auth and errors guide and rate limits; the idempotency mechanics are in the keys post.

The last line of defense

Webhooks mean a lost response isn’t lost data: even if your sync call dies mid-flight, a queued task’s result still arrives at your endpoint. For anything you can’t afford to lose, create it async with a key — then retries are bookkeeping, not gambling.

Try it on your own prompts

500 free credits a month, no card. One POST returns the answer, sources and citations as JSON.

Keep reading