HTTP Errors

What Is a 402 Payment Required Error?

What Is a 402 Payment Required Error? — conceptual illustration
On this page

HTTP 402 Payment Required indicates the server is refusing the request until payment, billing, or quota issues are resolved. It was reserved in the original HTTP spec for future digital-payment use cases. In modern web scraping you mostly see it from APIs (Stripe, OpenAI, scraping APIs themselves) when an API key is expired, a free quota is exhausted, or a paid plan has lapsed — and occasionally from content sites enforcing paywalls.

Quick facts

Status family4xx — client error
Most common causeAPI key out of credits, plan expired, or paywall
Retry safe?No — server explicitly refused; retrying without fixing billing wastes requests
Where you see itAPI responses, paywalled article endpoints, metered crawl services
FixTop up credits, rotate to a working key, or upgrade plan

What 402 actually means in scraping

The 402 code was originally reserved for "digital cash" payments that never materialized. Today it is a generic billing signal — most often "you ran out of credits." If your scraping pipeline calls a third-party API (Bright Data, Scrappey, an LLM, a CAPTCHA solver) and gets a 402, the upstream provider has decided your account can no longer pay for the work. The request body usually contains a human-readable message naming the quota or plan that lapsed.

How to detect and recover

Treat 402 as a hard fail, not a transient error. Backoff and retry will not help — the server is not overloaded; it is refusing on policy grounds. In production: alert immediately, pause the job, and route remaining work to a fallback provider if you have one. Log the response body so the on-call engineer can see exactly which quota tripped. Some providers degrade gracefully (rate-limit instead of 402) when you approach the limit; configure those warnings rather than waiting for the cliff.

When the target site returns 402

A small number of paywalled publishers return 402 instead of 401/403 to signal a metered article. Scrapers should respect this — bypassing a metered paywall to extract paid content is a clear terms-of-service breach. If you have legitimate access (institutional licence, paid subscription), authenticate via the proper login flow and reuse the session cookie rather than attempting to bypass the 402 directly.

Code example

python
import requests, sys

resp = requests.post('https://publisher.scrappey.com/api/v1', json={
    'cmd': 'request.get',
    'url': 'https://example.com'
}, headers={'Authorization': 'YOUR_API_KEY'})

if resp.status_code == 402:
    print('402 Payment Required:', resp.text)
    sys.exit(2)  # Do not retry — alert on-call

Related terms

Concept map

How 402 Error connects

The terms most directly tied to this one. Hover a node to see its neighbours, click to preview, drag to rearrange.

0 terms · 0 connections
You are here · HTTP Errors
Building map…

Frequently asked questions

Is 402 the same as 401?

No. 401 Unauthorized means your credentials are missing or invalid. 402 means your credentials are valid but the account cannot pay for the work — quota exhausted, plan expired, card declined.

Should I retry a 402?

Not automatically. The server is refusing on policy. Retrying without fixing the underlying billing issue just burns through your own API budget reaching the upstream.

Why is 402 so rare compared to 401 and 403?

It was reserved in the HTTP spec without a concrete implementation, so most servers picked 403 for billing failures instead. It is now mostly used by modern APIs and some paywall systems.

Last updated: 2026-05-26