Skip to main content
Build a script that rides out a busy minute and fails clearly on a real mistake. Every error has a stable code, a suggestion and a retryable flag. See Errors for the full format.
1

Decide on code and retryable

A good client does four things:
  1. Branches on code, never on the wording of title or detail.
  2. Retries only when retryable is true. It waits for Retry-After when the response has it, and backs off when it doesn’t. It hands back an error whose wait is longer than it can block, such as the remaining wait after a recently failed fetch.
  3. Stops on everything else and shows suggestion, because the same request will fail the same way.
  4. Logs request_id, from the body or the Request-Id header.
2

Wrap your calls

This helper retries what can be retried and stops on the rest. The call below sends a misspelled parameter on purpose, so you can see the answer:
Response
unknown_parameter is not retryable, so the helper returns at once. Its suggestion names the parameter you probably meant.

The errors you’ll meet most

Errors never cost API credits, so a retry that fails again costs nothing. A retry that succeeds is charged like any call. Errors lists every code.
Alura fetches products, shops and keywords it has never seen when you ask for them. If it pauses fetching a kind of item, a single product, shop or Etsy link it has never collected answers 404 not_collected, with retryable: false and no Retry-After. The item may well exist on Etsy: search for items Alura already has. Bulk and keyword lookups keep these misses in unfetched with code fetch_unavailable.

Next steps

Errors

Every error, with what it means.

Rate and fetch limits

What each 429 means.

Usage and limits

Check what you have left.