Reserved in the original spec and now used in practice for quota, billing and insufficient-funds conditions.
Defined in RFC 9110 §15.5.3 — 402 Payment Required · MDN reference
Rare in public APIs and increasingly common in SaaS ones: an exhausted quota, an unpaid invoice, a feature behind a plan the caller is not on.
Rare enough that most clients have never seen one, which is exactly why it is worth provoking before a payment provider sends you one in production.
Never retry. A 402 is resolved by a human doing something commercial, not by the client trying again. Surface the message and the upgrade path; a retry loop here just burns quota that is already exhausted.
6 endpoints in this playground answer with 402. Every one is free, needs no signup, and can be called from the browser or with curl.
POST https://funapi.dev/api/bank/v1/transfers — Insufficient funds (Bank API) Open & run this endpointGET https://funapi.dev/api/bank/v1/premium/statements — Always. Payment Required on demand, like the pizza oven’s 500. (Bank API) Open & run this endpointGET https://funapi.dev/api/fiba/v1/players/{id}/advanced — Payment Required (FIBA World Cup API) Open & run this endpointPOST https://funapi.dev/api/gta/v1/vehicles/{id}/respray — Not enough cash (GTA API) Open & run this endpointPOST https://funapi.dev/api/gta/v1/weapons/{id}/buy — Not enough cash (GTA API) Open & run this endpointDELETE https://funapi.dev/api/gta/v1/wanted — Not enough cash (GTA API) Open & run this endpointAll HTTP status codes · All 39 mock REST APIs · Getting started guide
Last updated