x402 Protocol Compatibility

IndieGent works with x402-enabled APIs automatically. No extra setup needed.

What is x402?

x402 is a payment protocol developed by Coinbase that uses the HTTP 402 Payment Required status code to enable pay-per-request APIs. When an API needs payment, it returns a 402 response with structured payment requirements in the body. The agent pays, then retries with proof of payment in an X-PAYMENT header.

It's one of several emerging standards for machine-to-machine payments, alongside MPP and IndieGent's own Agent Pay format.


How IndieGent Handles x402

If your agent — using the IndieGent SDK — encounters an API that uses x402, payment is handled automatically. The SDK detects the x402 format in the 402 response body, pays from your agent's wallet, builds the correct proof header, and retries.

import { IndieGent } from "@indiegent/sdk";

const agent = new IndieGent({
  apiKey: process.env.INDIEGENT_API_KEY,
});

// This API happens to use x402 — your agent doesn't care
const res = await agent.fetch("https://some-x402-api.com/resource");
const data = await res.json();
// SDK detected x402, paid from wallet, retried with X-PAYMENT header

How x402 Works (Technical)

For those who want to understand the protocol under the hood:

1. Agent makes a request

GET /resource HTTP/1.1
Host: api.example.com

2. Server returns 402 with payment requirements

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

{
  "x402Version": 1,
  "accepts": [{
    "scheme": "exact",
    "network": "base",
    "maxAmountRequired": "10000",
    "resource": "https://api.example.com/resource",
    "description": "Pay to access this resource",
    "payTo": "0xServiceWallet...",
    "maxTimeoutSeconds": 300,
    "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
  }]
}

3. Agent pays and retries with proof

GET /resource HTTP/1.1
Host: api.example.com
X-PAYMENT: <base64-encoded payment proof>

4. Server verifies and responds

HTTP/1.1 200 OK

{ "data": "..." }

x402 vs IndieGent Marketplace

x402 is a payment protocol — it defines how agents prove they've paid for API access. IndieGent is a full platform — wallets, funding, spending controls, dashboard, marketplace, and support for multiple payment protocols including x402.

x402 (Protocol)IndieGent (Platform)
What it isPayment proof standard for HTTPFull wallet + marketplace platform
Developed byCoinbaseIndieGent
Wallet managementNot included — bring your ownCreate, fund, manage, monitor wallets
FundingNot includedCredit card via Coinbase, or direct USDC
Spending controlsNot includedPer-agent caps, auto-topup, dashboard
Service discoveryNot includedMarketplace with flights, email, search, etc.
x402 supportNativeFull compatibility via SDK

Think of it like this: x402 is a payment rail (like a card network). IndieGent is the full banking experience (like the bank that issues your card). IndieGent uses x402 as one of several supported payment rails.


When Does This Matter?

If you use the IndieGent marketplace, you don't need to think about x402 at all — the marketplace handles billing internally.

x402 compatibility matters when your agent calls APIs outside the marketplace that use x402 for payments. As Coinbase and others roll out x402 support to more APIs, your IndieGent wallet will work with all of them automatically.


Three Protocols, One Wallet

The IndieGent SDK automatically detects and handles three payment protocols:

  • Agent Pay — IndieGent's own format. Simple JSON with plain-English instructions. Used by the IndieGent marketplace.
  • MPP — Machine Payments Protocol. IETF standards-track. Uses HTTP WWW-Authenticate headers.
  • x402 — Coinbase's protocol. Uses structured JSON in the 402 response body with X-PAYMENT proof header.

Your agent doesn't need to know which protocol an API uses. The SDK figures it out and pays the right way. One wallet, every protocol.


Learn More

IndieGent— Independent wallets for independent agents

npm install -g @indiegent/cli