402 Payment Required

Reserved for future use. In practice, APIs use it to signal a billing problem such as an exhausted quota or an unpaid invoice.

Status

HTTP/1.1 402 Payment Required

Details

402 has been reserved since the original HTTP/1.1 spec, with no standard semantics ever defined. There is no interoperable meaning to rely on, and no standard way to express what payment is expected.

That has not stopped anyone. Several large APIs return 402 when a subscription lapses, a credit balance runs out, or a plan limit is exceeded, with the details in the body. Treat it as a vendor-specific billing signal and read the documentation for the API you are calling.

Common causes

How to fix it

As the client

As the server

Examples

POST /api/v2/order HTTP/1.1
Host: api.example.com
Authorization: Bearer sk_live_example

HTTP/1.1 402 Payment Required
Content-Type: application/json; charset=utf-8

{"error":"balance_exhausted","balance":0,"billing_url":"/dashboard/billing"}

Specifications

RFC 9110 §15.5.3

See also