---
title: 'HTTP 402 Payment Required: Meaning, History, and x402 | RunAPI'
description: What the HTTP 402 Payment Required status code means, why it sat unused for decades, when APIs return it today, and how x402 turns it into a payment flow.
url: https://runapi.ai/http-402.md
canonical: https://runapi.ai/http-402
locale: en
updated: '2026-09-24'
date: '2026-09-24'
site: RunAPI
image: https://runapi.ai/assets/opengraph-bfaaa0f0.png
alternates:
  en: https://runapi.ai/http-402
  zh-CN: https://runapi.ai/zh-CN/http-402
  es: https://runapi.ai/es/http-402
  ja: https://runapi.ai/ja/http-402
  de: https://runapi.ai/de/http-402
  fr: https://runapi.ai/fr/http-402
  pt-BR: https://runapi.ai/pt-BR/http-402
  ko: https://runapi.ai/ko/http-402
  it: https://runapi.ai/it/http-402
  nl: https://runapi.ai/nl/http-402
  pl: https://runapi.ai/pl/http-402
  tr: https://runapi.ai/tr/http-402
  zh-TW: https://runapi.ai/zh-TW/http-402
  zh-HK: https://runapi.ai/zh-HK/http-402
  ar: https://runapi.ai/ar/http-402
  x-default: https://runapi.ai/http-402
---

> HTML version: https://runapi.ai/http-402
> Site index for agents: https://runapi.ai/llms.txt

# HTTP 402 Payment Required: what it means and how x402 uses it

402 is the HTTP status code for a request that needs payment before the server will fulfil it. For most of its history it had no standard format. x402 gives it one.

_Updated September 24, 2026 · 5 min read_


## Key takeaways

- 402 Payment Required is a client error: the request is valid, but the server wants payment first.
- HTTP/1.1 reserved 402 for future use and never defined how payment should work, so each API used it differently.
- x402 defines the missing pieces: a PAYMENT-REQUIRED header with machine-readable terms and a signed payment on retry.

## What 402 Payment Required means

A 402 response tells the client that the request itself is fine but will not be served until payment is made. It belongs to the 4xx family because the client, not the server, has to act next.

402 is different from 401 Unauthorized and 403 Forbidden. 401 asks for credentials, 403 refuses the request outright, and 402 asks for payment.


## Why 402 went unused for so long

The code was reserved when HTTP/1.1 was written, with the expectation that some form of digital cash would arrive later. The specification never said what a 402 body should contain or how a client should pay, so browsers never acted on it.

Without a shared format, APIs that did return 402 used it as a plain error: an account ran out of credits, a card was declined, or a plan limit was reached.


## When APIs return 402 today

You will see 402 in two broad situations.

- Account billing errors: the key is valid but the balance, quota, or subscription does not cover the request. The fix is to top up or upgrade.
- Pay-per-request quotes: the server returns payment terms, and the client can pay and retry the same request. This is how x402 works.

## How x402 turns 402 into a payment flow

x402 puts machine-readable terms in a PAYMENT-REQUIRED header: amount, asset, network, and recipient. A client signs a stablecoin authorization for those terms, sends it back in a PAYMENT-SIGNATURE header, and receives the response with a PAYMENT-RESPONSE receipt.

Because the whole exchange is plain HTTP, an AI agent with a wallet can pay for an API call without signing up or storing an API key.


## Handling a 402 in your client

Check for a PAYMENT-REQUIRED header first. If it is there, the response is an x402 quote and an x402 client can pay it. If it is not, read the error body: it usually means the account needs more credits or a different plan.



## HTTP 402 FAQ

### Is 402 Payment Required an error?

It is a client error in the 4xx range, but it does not mean the request was malformed. It means payment is needed before the server will continue.

### What is the difference between 402 and 401?

401 means the server needs valid credentials. 402 means the server needs payment. An API can return 401 for a bad key and 402 for a valid key with no balance.

### Do browsers handle 402 automatically?

No. Browsers show a 402 like any other error page. Automatic payment needs a client that understands a protocol such as x402.

### Which APIs use 402 with x402?

Any server that implements the x402 protocol. RunAPI returns x402 quotes on its per-call AI model endpoints, so an agent can pay for image, video, music, and audio generation in USDC.



## Related pages

- [x402 API for AI models](https://runapi.ai/x402.md) - Pay per request in USDC on Base with no API key.
- [Model catalog](https://runapi.ai/models.md) - Every model and endpoint available on RunAPI.
- [Developer docs](https://runapi.ai/docs/guides) - Request formats, task polling, and error codes.
- [Pricing](https://runapi.ai/pricing.md) - Credits, per-call prices, and billing details.


Claude visitors: new accounts receive $1.00 in bonus API credit within 30 days. One per person; usage credits only.


## Try a 402 you can actually pay

Send a request to a RunAPI per-call endpoint without a key and inspect the x402 quote it returns.

- [Browse models](https://runapi.ai/models.md)
- [Read the docs](https://runapi.ai/docs/guides)



---

## More from RunAPI

- [Home](https://runapi.ai/.md)
### Product
- [Model Catalog](https://runapi.ai/models.md)
- [Pricing](https://runapi.ai/pricing.md)
- [Providers](https://runapi.ai/models#all-models)
### Developers
- [Documentation](https://runapi.ai/docs/guides)
- [SDKs](https://runapi.ai/sdk.md)
- [CLI](https://runapi.ai/cli.md)
- [MCP Server](https://runapi.ai/mcp.md)
### Guides
- [Claude Code vs Cursor](https://runapi.ai/claude-code-vs-cursor.md)
- [Cursor API Setup](https://runapi.ai/cursor-api-setup.md)
- [RunAPI vs OpenRouter](https://runapi.ai/openrouter-alternative.md)
- [x402 API](https://runapi.ai/x402.md)
### Company
- [Enterprise](https://runapi.ai/contact.md)
- [Contact](https://runapi.ai/contact.md)
### Legal
- [Terms](https://runapi.ai/terms.md)
- [Privacy](https://runapi.ai/privacy.md)
- [Site index for agents](https://runapi.ai/llms.txt)

Contact: contact@runapi.ai

## Structured data

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "en",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "en",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/icon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "en",
    "@type": "Article",
    "headline": "HTTP 402 Payment Required: Meaning, History, and x402",
    "description": "What the HTTP 402 Payment Required status code means, why it sat unused for decades, when APIs return it today, and how x402 turns it into a payment flow.",
    "datePublished": "2026-09-24",
    "dateModified": "2026-09-24",
    "author": {
      "@type": "Organization",
      "name": "RunAPI"
    },
    "publisher": {
      "@type": "Organization",
      "name": "RunAPI",
      "url": "https://runapi.ai/"
    },
    "mainEntityOfPage": "https://runapi.ai/http-402"
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "en",
    "@type": "FAQPage",
    "mainEntity": [
      {
        "@type": "Question",
        "name": "Is 402 Payment Required an error?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "It is a client error in the 4xx range, but it does not mean the request was malformed. It means payment is needed before the server will continue."
        }
      },
      {
        "@type": "Question",
        "name": "What is the difference between 402 and 401?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "401 means the server needs valid credentials. 402 means the server needs payment. An API can return 401 for a bad key and 402 for a valid key with no balance."
        }
      },
      {
        "@type": "Question",
        "name": "Do browsers handle 402 automatically?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "No. Browsers show a 402 like any other error page. Automatic payment needs a client that understands a protocol such as x402."
        }
      },
      {
        "@type": "Question",
        "name": "Which APIs use 402 with x402?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "Any server that implements the x402 protocol. RunAPI returns x402 quotes on its per-call AI model endpoints, so an agent can pay for image, video, music, and audio generation in USDC."
        }
      }
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "en",
    "@type": "BreadcrumbList",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "name": "Home",
        "item": "https://runapi.ai/"
      },
      {
        "@type": "ListItem",
        "position": 2,
        "name": "HTTP 402",
        "item": "https://runapi.ai/http-402"
      }
    ]
  }
]
```
