An API you can actually break.
This is a real HTTP service implementation, compiled down to JavaScript and running in this tab. No backend, no network calls — but the routing, status codes, idempotency store and rate limiter all behave the way they would in production. Try the same request twice, then open the network tab and notice nothing leaves your browser.
Ctrl / Cmd + Enter sends. The limiter allows 5 requests per second per client.
Three things clients get wrong.
Idempotency
A retried POST must not create a second order. Keys are stored with the response, not just the request.
Rate limiting
429 is a contract, not an accident: it carries Retry-After and the client is expected to honour it.
Pagination
Cursor-based, not offset. The response carries next_cursor so a page never shifts under you.
How the idempotency layer is written
The sandbox mirrors the pattern we use in production — a unique constraint on the key, the completed response stored alongside it, and an in-flight marker so two simultaneous retries don't both execute.
-- the row that makes retries safe CREATE TABLE idempotency_keys ( key text PRIMARY KEY, account_id text NOT NULL, request_hash text NOT NULL, status_code int, response jsonb, locked_until timestamptz, created_at timestamptz NOT NULL DEFAULT now() );
Second request with the same key either replays response, or returns 409 while the first one is still in flight — never a duplicate side effect.