Docs

How x402.website works.

A shop is an @handle selling listings to people and programs over HTTP 402. Buyers pay USDC per request, straight to the seller's address. The platform fee is 1% of each settled sale and is accounted on the order. Nothing here needs an account to buy.

What this is

One directory of shops. Each shop is a handle, a display name and a list of listings. A listing is a title, a one-line summary, a price in USDC and what the buyer receives after paying. Service, product and API key are the three kinds; the only difference is what the deliverable looks like, not how payment works.

The buyer and the agent hit the same URLs. A person opens /@handle in a browser; a program calls the same path with an Accept: application/json mindset and reads JSON. There is no separate machine-only tier and no separate price.

Buying

As a person. Open the shop, pick a listing, press buy. You get an order page at /order/<token> that shows the USDC address, the amount and the network. Pay from any wallet, paste the transaction hash back into the page, and the goods release once that transfer is found on Base. Holding another coin instead? The same page offers a hosted invoice in any coin the processor supports, USDC included; the processor calls the server back and the order settles itself. No card, on any rail. That token is the only credential — anyone with the link can read the order, so treat it like a receipt.

As a program. Ask for the listing, get a 402 with the payment terms, pay, then present the proof. Two calls and a signature:

GET  /api/v2/market/listing/lst_...
POST /api/v1/agent/market/purchase     {"listingId": "lst_..."}
  → 402  {"code":"payment_required","accepts":[{ scheme, network, currency,
            maxAmountRequired, payTo, nonce, expiresAt }]}
POST /api/v1/agent/market/purchase     x402-payment: <base64 JSON>
  → 201  {"status":"success","order":{...},"deliverable":"..."}

The x402-payment header is a base64-encoded JSON object with nonce, amountUsd, payer and txHash — the Base transaction that carried the USDC. The nonce ties the second call to the first order; the hash is what gets looked up on chain. A proof with no hash, or an underpaid amount, answers with a fresh 402 rather than the goods.

Buying as an agent needs an agent key with the create scope. Any key can buy from any shop; the key identifies the buyer, it does not restrict the seller. How a program gets that key is written for a program: /auth.md names the credential, the scopes, the limits and the four provisioning steps — one of which is a person's, because signup sits behind Turnstile and an agent cannot solve it.

An agent that speaks OAuth can exchange its key for a short-lived bearer instead. The two standard documents are published: /.well-known/oauth-protected-resource and /.well-known/oauth-authorization-server. The only grant is client_credentials — the client id is the key's id, the secret is its token — so nothing here can widen authority: a token carries a subset of the key's scopes, expires after an hour and dies with the key. There is no authorisation endpoint and no dynamic client registration, which is why both are absent from the metadata rather than described and broken.

curl -X POST https://x402.website/api/oauth/token   -H "content-type: application/x-www-form-urlencoded"   -d "grant_type=client_credentials&client_id=key_...&client_secret=x402_live_..."

  -> 200  {"access_token":"x402_oat_...","token_type":"Bearer","expires_in":3600,"scope":"read create"}
  -> 401  {"error":"invalid_client","error_description":"Client authentication failed."}

curl https://x402.website/api/v1/agent/market/quota -H "Authorization: Bearer x402_oat_..."

Selling

Create an account and a shop key is minted for you. Claim a handle, set the payout address, publish one listing. That is the whole setup — there is no verification queue and no listing review.

A buyer paying by invoice — any coin, USDC included — goes through the processor instead. That money lands in the platform's processor account, not in the shop's wallet, so the shop is owed the net of each such sale and the platform pays it out. Cards are not accepted on any rail. The order records which rail paid it (settlement.provider), so the two kinds of sale are never mixed up in the ledger.

Payouts offers three settings, and a shop runs one of them at a time.Direct sends both kinds of buyer to the shop's own USDC address, and no invoice exists on that rail. Platform-held sends both kinds to the custody address and the shop withdraws the net. Both sends an agent's x402 payment to the shop and a person's invoice into custody, so the balance only holds the people side.

The payment address is where USDC lands. A shop must set a USDC address on Base to accept agent (x402) payments, because an agent cannot pay an invoice: a purchase on that rail is refused with a 409 no_agent_address that names the reason, rather than sending a buyer to an address nobody controls. Set it inPayouts before you publish. Asking for an invoice on a direct order is refused the same way, with 409 no_invoice_rail.

Agents use the shop key: x-agent-key: x402_live_… on every write. Keys carry scopes (read, write, copy, create, delete) and a per-key rate limit, capped by the plan.

An order is a quote until it is paid, and a quote is good for 30 minutes. If it expires while the buyer is still sorting out a wallet, the shop's key can renew it: POST /api/v1/agent/market/orders/:id/requote with x-agent-key (write scope) keeps the same order and the same buyer, issues a fresh nonce, gives it another 30 minutes and returns orderUrl. The old nonce dies with the renewal, so nothing can be paid twice. An order can be requoted twice; after that the buyer checks out again. A listing that sold out in the meantime refuses the renewal with 409.

Each listing reports what it did. GET /api/v1/agent/market/listings (read scope) returns the calling key's own listings, and every row carries stats: views, quotes, sold, grossUsd, feeUsd and netUsd. A view is a read of GET /api/v2/market/listing/:id, counted on the server, so the UI cannot inflate it. Quotes and sales are counted from the orders themselves rather than a separate tally. A listing nobody has opened or bought reads all zeros.

curl -X POST https://x402.website/api/v1/agent/market/listings \
  -H "x-agent-key: x402_live_..." \
  -H "content-type: application/json" \
  -d '{"kind":"service","title":"Logo cleanup",
       "summary":"Vector redraw of one mark.","priceUsd":25,
       "deliverable":"Work starts within a day."}'

Private shops

A shop can be taken out of the directory. It keeps its URL, its listings and its ability to sell; it simply stops appearing in /shops and on the front page. Use it for a shop you hand a link to, or one that is not ready to be browsed.

PATCH /api/v1/agent/market/handle   {"listed": false}   # link-only
PATCH /api/v1/agent/market/handle   {"listed": true}    # back in /shops

Search is unaffected: /api/v2/market/listings?handle=name and the shop page itself still answer for a private shop. Private means unlisted, not access controlled — anyone with the link can open it.

Fees and limits

The platform fee is 1% of each settled sale. It is recorded on the order — gross, fee and net — never on a listing that does not sell, and it is the same 1% for every shop and every listing kind.

The split is computed in integer micro-USDC. USDC has six decimals, so $1.00 is 1,000,000 micro, and the fee and the net are whole numbers of micro that add back to the gross exactly — no rounding drift, no fraction of a cent anywhere.

GrossFee (1%)Net to the seller
$25.00 (25,000,000 micro)$0.25 (250,000 micro)$24.75 (24,750,000 micro)

You set your own prices. There is no per-transaction minimum, no monthly fee and no chargeback to absorb: the money moves from the buyer's wallet to the payout address, and the fee is accounted as part of the same order.

PlanShopsProductsListingsRequests
Free1101060 / min
Pro3250250600 / min

Pro is not self-serve yet. The upgrade will be paid through the same x402 rail as a listing, and until that lands the free plan is the only tier a new shop can be on.

The ledger

Every settled sale writes its gross, fee and net onto the order, and GET /api/v2/admin/sales reads them back: one row per sale with the order, token, listing, handle, quantity, buyer kind, the micro-unit split, the transaction hash, whether that transfer was verified against Base, and when it settled — plus totals for the whole ledger.

This is the operator's view, not a shop's. It needs the platform owner's session — authorization: Bearer <token> from a signed-in account that is the owner. No session answers 401; any other account answers 403. Add ?format=csv to download the same rows as a CSV file, header first, with micro-units alongside dollars.

A fresh deployment returns an empty ledger and zero totals. There is no sample row and nothing is counted before it settles.

API

Public reads need no key. Writes need x-agent-key. All responses are JSON.

One route is metered: GET /api sells the market index — counts, the price spread by kind, seller concentration, the newest listings and the map of this API — for 0.02 USD. Everything under /api/v2/market stays free, because an agent has to be able to look before it buys. The metered route speaks the x402 v2 wire format, so a client that knows the protocol needs nothing from this page: the 402 carriesPAYMENT-REQUIRED, base64 JSON whose first accepts entry nameseip155:8453, the USDC contract, the amount in micro-units and payTo. There is no facilitator: the entry says assetTransferMethod: onchain-transfer, so the buyer sends the transfer and this server reads the receipt — which is why a signed EIP-3009 authorisation is refused with that reason instead of quietly failing.

GET /api
  → 402  PAYMENT-REQUIRED: eyJ4NDAyVmVyc2lvbiI6Miwi...  (base64 JSON)
         {"x402Version":2,"accepts":[{"scheme":"exact","network":"eip155:8453",
           "asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","amount":"20000",
           "payTo":"0x...","maxTimeoutSeconds":900,
           "extra":{"name":"USD Coin","version":"2",
                    "assetTransferMethod":"onchain-transfer"}}]}

# send 0.02 USDC on Base to payTo, then present the hash
GET /api
  PAYMENT-SIGNATURE: eyJ4NDAyVmVyc2lvbiI6MiwicGF5bG9hZCI6...  {"payload":{"txHash":"0x..."}}
  → 200  {"status":"success","resource":"market-index",...}
         PAYMENT-RESPONSE: eyJzdWNjZXNzIjp0cnVlLCJ0cmFuc2FjdGlvbi...

A transfer that is not final yet keeps the 402 — the buyer's money is not spent until the chain agrees — and a hash already spent is refused, so one transfer buys one call. The marketplace's own checkout answers 402 with the same header, bound to that order's amount and the seller's address.

RouteWhat it does
GET /apiMarket index, 402 with PAYMENT-REQUIRED until paid
GET /api/v1308 to /api
GET /api/v2/market/shopsDirectory of listed shops
GET /api/v2/market/shop/:handleOne shop and its active listings
GET /api/v2/market/listing/:idOne listing plus its review summary
GET /api/v2/market/listingsFeed: ?limit, ?handle, ?kind, ?q
GET /api/v2/market/handles/checkHandle availability, never 400
POST /api/v2/market/checkoutCreate a human order (201)
GET /api/v2/market/order/:tokenOrder status by token
POST /api/v2/market/order/:token/confirmVerify the transfer on Base, then release (order token)
POST /api/v2/market/reviewsReview a delivered order
POST /api/v2/market/reportsReport a vendor or a product to the platform operator
POST /api/v1/agent/market/purchaseAgent buy: 402, then proof (create scope)
POST /api/v1/agent/market/orders/:id/requoteRenew an open quote: fresh nonce, 30 minutes (write)
POST /api/v1/agent/market/handlesClaim a handle (create scope)
GET /api/v1/agent/market/handleThe calling key’s own handle (read)
PATCH /api/v1/agent/market/handleList or unlist the shop (write)
GET|POST /api/v1/agent/market/listingsList or publish; each row carries its stats (read / create)
PATCH|DELETE /api/v1/agent/market/listings/:idEdit or remove (write / delete)
GET /api/v1/agent/market/quotaPlan limits and current usage (read)
GET /api/v2/admin/salesSettled sales ledger, ?format=csv (platform owner session)
GET /api/v2/admin/reportsVendor and product reports, ?status=open|closed (platform owner session)
PATCH /api/v2/admin/reports/:idClose or reopen one report (platform owner session)

Orders

An order has a status: awaiting_payment, paid, delivered, cancelled or refunded. The deliverable is withheld until settlement — a token that reads an unpaid order sees the item and the amount, not the goods.

Settlement is verified, not assumed. POST /api/v2/market/order/:token/confirm takes { "txRef" } and checks the transfer on Base before any goods move. The receipt must exist and have succeeded, it must carry a USDC (0x833589fcd6edb6e08f4c7c32d4f71b54bda02913) Transfer to the shop's payout address for at least the order amount, and it must be at least 3 blocks deep so a reorg cannot take it back. An empty or too-short reference (under 16 characters) is refused as a typo, and an order never settles twice.

StatusCodeWhat it means
402payment_requiredThe payment is missing, too short, underpaid or could not be verified. Nothing is delivered; the order stays awaiting_payment
202not_finalThe transfer is on chain but still confirming. Retry when it is buried; nothing is released yet
409conflictThat transaction already paid another order. One transfer buys one thing

On a local development run there is no node configured, so a settlement there skips the chain check and records the order as unverified: the order carries verified: false, and the ledger marks those rows the same way. Nothing in production settles without a chain to check against.

Status codes

StatusCodeMeaning
202not_finalTransfer on chain but not yet 3 blocks deep; retry, nothing released
400invalidInput failed validation (price, email, handle, listed)
401not_foundMissing or inactive x-agent-key, or a bad session
402payment_requiredPayment terms in accepts[], or a transfer that failed the chain check
403unpaid / plan_limit / forbiddenGoods withheld, the plan cap is reached, or not your order and not the owner
404not_foundNo such shop, listing, order or handle
409sold_out / conflict / takenStock, nonce or transaction reuse, or a handle collision

Rate-limited responses carry x-ratelimit-limit and x-ratelimit-remaining. Agent limits are per key, per minute.

For agents and crawlers

Every public route in this reference answers JSON with no key, and settlement is USDC on Base over HTTP 402; the platform fee is 1% of each settled sale. The same catalogue is published as plain text and XML, so an agent can read the shops and their prices before it pays.

  • /llms.txt — the marketplace as plain text, for models
  • /sitemap.xml — every listed shop and listing URL
  • /feed.xml — the guides as RSS, newest first
  • /guides — HTTP 402, facilitators, pricing and where agents buy
  • /docs#api — the full public route table
  • /api/v2/market/shops — directory JSON, listed shops only
  • /api/v2/market/listings — listing feed JSON, with prices
  • /api/v2/market/listing/:id — one listing, its price and its payment terms

Something missing?

Questions about an order go to the shop that sold it — the platform does not run a support desk and does not read order threads. If a shop or a listing misbehaved, Report a shop reaches the operator.