Skip to main content
EXPLAINER

What is HTTP 402?

HTTP 402 Payment Required was defined in 1997 and reserved for future digital payments. After decades dormant, it is now being activated for AI agent commerce and machine-payable APIs.

The History of HTTP 402

1997

HTTP 402 defined in RFC 2068, marked as “reserved for future use” for digital payments

1997-2023

Status code sits unused while web payments evolve through separate channels

2024+

AI agents need machine-readable payment signals, HTTP 402 finally activated

Why HTTP 402 Matters Now

The rise of AI agents changes everything. Unlike human users who can navigate payment forms, AI agents need machine-readable payment signals.

Clear Signal

HTTP 402 unambiguously signals “payment required”

Payment Instructions

Structured data: what to pay, how much, where

Proof of Payment

Receipt proving payment occurred

How PEAC Uses HTTP 402

PEAC Protocol builds on HTTP 402 with additional structure for AI access control, payments, and receipts. When a PEAC-enabled endpoint receives a request without valid payment:

Example 402 Response
HTTP/1.1 402 Payment Required
Content-Type: application/json

{
  "type": "payment_required",
  "message": "Access requires payment",
  "payment": {
    "amount": "0.01",
    "currency": "USD",
    "methods": ["x402", "stripe"]
  },
  "policy_url": "https://example.com/.well-known/peac.txt"
}
Response Fields
Payment methods
x402 for crypto, Stripe for fiat
Amount & currency
Clear pricing in machine-readable format
AI policy URL
Link to crawling policy and usage terms

x402: The Payment Extension

x402 is an extension that adds structured payment descriptions to HTTP 402 responses. It works with PEAC to provide:

Payment negotiation - agents can query acceptable payment methods
Receipt return - successful payments return PEAC-Receipts
Verification - receipts can be verified at the domain's verify endpoint

See the x402 integration guide for implementation details.

Testing HTTP 402

You can test a PEAC-enabled 402 endpoint with curl:

Terminal
curl -i https://demo.originary.xyz/api/gated

# Response:
# HTTP/2 402
# content-type: application/json

Try the interactive demo to see 402 flows in action.

Beyond Payments: Access Control

HTTP 402 in PEAC isn't only about money. It can gate access based on:

AI Bot Policy

Require agents to comply with crawling policy

Attribution

Require agreement to attribution terms

Consent

Proof of user consent for training use

Rate Limiting

Premium access for paying agents

Getting Started

1
Define your AI access policy with Originary Declare
2
Add 402 responses to your API endpoints
3
Integrate x402 or Stripe for payment processing
4
Return PEAC-Receipts on successful payment

See Adding 402 in 15 Minutes for a step-by-step guide.