Protocols

What is HTTP 402 Payment Required?

HTTP 402 Payment Required is the status code a server returns when a request needs payment before it can be served. HTTP reserved it for future use for decades without defining how payment works; MDN still lists it as nonstandard. x402 and similar conventions now use it to carry machine-readable payment terms.

RFC 7231 and its successor RFC 9110 keep the same wording for 402: the code is reserved for future use. MDN describes it as a nonstandard status with no standard use convention, so different systems use it differently. An individual Internet-Draft published in August 2026, draft-nottingham-httpbis-402, discusses how the code should be used and what clients must guard against.

The draft's security section makes two points that matter for automated clients. Clients should not act on payment information in a response that was not received over an authenticated connection, because an attacker who can insert or modify responses can substitute their own payment information. And clients that pay without direct human involvement need constraints on how much, how often and to whom they pay.

In practice a 402 response now often carries a JSON body describing what to pay, where and how long the offer holds. At PROXIES.SX an unpaid request to api.proxies.sx/v1/x402/pool returns 402 with an x402 version 1 body listing a Base and a Solana entry, each with the USDC amount in six-decimal units, the recipient and maxTimeoutSeconds 900. The same JSON is base64-encoded in the payment-required response header.

Where you meet it

You meet a 402 when a script or agent calls an API that charges per use and has not paid yet. The useful reaction is to read the body rather than treat it as an error: it usually says exactly what payment would unlock the resource, and a client can decide whether that is within its limits.

Common questions

Is a 402 the same as a 401 or 403?

No. A 401 asks for authentication and a 403 refuses access. A 402 says the resource can be served once payment is made, and a body that follows a convention such as x402 says how to pay.

Should a client pay every 402 it receives automatically?

No. Check the recipient, asset and amount against what you expected and against a limit you set, and only act on a 402 received over an authenticated connection such as HTTPS.

Where can I see a real 402 response?

Request https://api.proxies.sx/v1/x402/pool?tier=peer&traffic=1 without payment. The response is a 402 with the quote in the body and in the payment-required header; nothing is charged.

Related terms

x402
x402 is a convention for paying for an HTTP resource with a stablecoin. The server answers an unpaid request with status 402 Payment Required and machine-readable payment terms; the client pays and repeats the request with proof of payment. It lets software, including AI agents, buy access without an account or a card.
AI Agent
An AI agent is a program that lets a language model choose its own next action toward a goal, calling tools such as a browser, an HTTP client or a shell between reasoning steps and feeding each result back into its context. A fixed script sets the order in advance; an agent derives it from what the last step returned.
HTTP Proxy
An HTTP proxy is a server that forwards HTTP requests on a client's behalf, parsing the protocol rather than blindly relaying bytes. The client sends the full target URL in the request line, or issues a CONNECT to tunnel an HTTPS session. Proxies conventionally listen on ports such as 8080 or 3128; port 80 belongs to the origin web server.
HTTPS Proxy
An HTTPS proxy carries encrypted TLS traffic between a client and a destination site, usually by opening a tunnel with the HTTP CONNECT method to port 443. The proxy relays raw bytes without reading the request path, headers or body. The term also describes a proxy whose own listening port accepts a TLS-encrypted client connection.
SOCKS5
SOCKS5 is a session-layer proxy protocol, defined in RFC 1928, that relays TCP connections and can relay UDP datagrams for any application rather than only web traffic. It negotiates an authentication method first, then takes a target given as an IPv4 address, an IPv6 address or a domain name and forwards bytes without interpreting them.
SOCKS4
SOCKS4 is the earlier version of the SOCKS proxy protocol. It relays TCP connections only and addresses targets by raw IPv4 address, with no authentication beyond a user ID string the proxy may ignore. The SOCKS4a extension adds hostname support. SOCKS5 superseded it, and current clients keep SOCKS4 only for legacy endpoints.
SSL/TLS
SSL and TLS are the protocols that encrypt and authenticate traffic between a client and a server. SSL is the deprecated original; TLS is what runs today, with TLS 1.2 and TLS 1.3 the only versions current software should negotiate. The handshake proves the server's identity with a certificate, then agrees the keys used for the session.
HTTP/2
HTTP/2 is a binary version of HTTP that carries many concurrent requests as multiplexed streams over a single TCP connection and compresses headers with HPACK. It keeps HTTP's methods, status codes and header semantics unchanged, so only the wire format differs. Browsers negotiate it during the TLS handshake through ALPN, advertising the identifier h2.

Real 4G/5G mobile and residential IPs

PROXIES.SX runs carrier IPs in many countries with HTTP and SOCKS5 on every endpoint. $4/GB down to $2.40/GB at volume, free endpoints and rotation, and your GB never expire.