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 is the status code a server sends to say: "I won't do this until a payment, billing, or quota problem is fixed." It was set aside in the original HTTP spec for future digital-payment ideas that never fully arrived. In modern web scraping you mostly meet it from APIs (Stripe, OpenAI, scraping APIs themselves) when an API key has expired, a free quota is used up, 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 caught on. Today it is a general billing signal — usually meaning "you ran out of credits." If your scraping pipeline calls a paid third-party API (Bright Data, Scrappey, an LLM, a CAPTCHA solver) and gets a 402, that provider has decided your account can no longer pay for the work. The response body usually includes a plain-English message naming the quota or plan that ran out.

How to detect and recover

Treat 402 as a permanent failure, not a temporary glitch. Automatic backoff and retry (waiting, then trying again) will not help — the server isn't overloaded; it is refusing on purpose because of an account policy. In production: alert immediately, pause the job, and send the remaining work to a backup provider if you have one. Log the response body so the on-call engineer can see exactly which quota was hit. Some providers warn you nicely (slowing you down instead of returning 402) as you near the limit — switch those warnings on rather than waiting to hit the wall.

When the target site returns 402

A small number of paywalled publishers return 402 instead of 401 or 403 to signal a metered article (one you only get a limited number of for free). Scrapers should respect this — getting around a metered paywall to grab paid content is a clear terms-of-service breach. If you have legitimate access (an institutional licence or paid subscription), log in through the proper flow and reuse the session cookie — the token the site gives you after login to prove you're signed in — rather than trying to bypass the 402 directly.

Code example

python
import requests, sys

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

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 — the server doesn't know who you are. 402 means your credentials are fine, but the account can't pay for the work: quota exhausted, plan expired, or card declined.

Should I retry a 402?

Not automatically. The server is refusing on policy, so retrying changes nothing until you fix the billing issue. Worse, each retry still costs you — it burns through your own API budget contacting the upstream provider.

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-31