PocketDocsPowered by x402

Buying with x402

How your agent pays for things, and why it can buy from anyone rather than a catalogue we curate.

x402 is an open way for a web service to say "this costs money" and be paid for it in the same request. Your agent asks for something, the seller answers with a price instead of the data, your agent pays, and the data comes back.

Pocket handles all of it. You do not need to understand the protocol to use it.

Why it matters to you

You are not locked into a marketplace. Pocket does not run a catalogue and there is nothing to get listed in. Any API priced this way can take your agent's money, whether we have heard of it or not.

It is per call, not per seat. Your agent pays for the work it actually does, rather than a monthly licence sitting idle between jobs.

No account setup with each seller. No signup, no API key to rotate, no invoice to reconcile. The payment is the request.

What a purchase looks like

Trying it from the dashboard

Open Marketplace. It lists paid feeds with live prices and how fresh each one is. Pick which agent pays, press buy, and the response appears inline.

The marketplace with an agent selected, its remaining budget and wallet balance above, and cards for paid feeds each naming its paid endpoint URL.
Marketplace — each card names the URL that answers 402

Every card names its paid endpoint. That address is the thing an agent is eventually pointed at, and a marketplace that hid it would teach you nothing about the protocol underneath. Copy it and hand it to an agent, or paste it into the box for any other paid URL and buy from a seller that is not on the list at all.

A purchase you make here goes through exactly the same limits an agent's does. The only difference recorded is that a person asked.

FeedPriceRefreshesData from
Spot prices0.0160sCoinGecko
Ethereum fee conditions0.0220sA public Ethereum node
Chain TVL leaderboard0.0510mDefiLlama
Stablecoin supply0.0815mDefiLlama
Ethereum market brief0.085mAll three, joined
Full ecosystem deep dive0.755mThe brief, plus the full tables

These are live feeds, not sample responses.

If the paying wallet cannot cover the price, the buy button is disabled and says so. That is arithmetic rather than a policy decision: nothing is signed and nothing is recorded, so an empty wallet does not fill your payments list with refusals. Top it up from the faucets.

Letting your agent do it

Once connected, your agent buys on its own. Give it a job that needs paid data:

Using my agent "Atlas Research", get current token prices from
https://seller.example.com/v1/market/prices and tell me which asset moved
most in the last 24 hours.

Name the agent, and give it the URL. The Capabilities screen has prompts with both already filled in from your own account.

Behind the scenes it calls one tool, pocket_pay_for_resource, and Pocket does the rest.

Buying from your own code

If you are calling Pocket directly rather than through an agent, one request does the whole thing:

POST /v1/payments/x402/purchase
Authorization: Bearer pocket_sk_...

{
  "agentId": "agent_1a2b3c",
  "url": "https://seller.example.com/v1/data",
  "reason": "Prices for the portfolio view"
}

It answers with one of four outcomes, and a refusal is a normal 200 rather than an error:

OutcomeMeansAlso returns
paidBought and deliveredThe data and the receipt
freeThe seller charged nothingThe data
blockedRefused or held. Nothing signedThe reason and what was left
failedReachable but did not completeA message and a code

Amounts are always decimal strings beside their asset, never numbers. A JSON number gets turned back into a float by every client, and a ledger cannot afford that.

{ "amount": "0.08", "asset": "USDC" }

When a seller refuses

A seller answers a rejected payment exactly as it answers an unpaid request: 402, an empty body, and the reason in a header. Pocket reads the header, so what reaches you is the seller's own words rather than an empty object.

The seller refused the payment (402): No matching payment requirements.
This usually means the wallet is empty, the price changed between the
quote and the payment, or the seller does not accept this asset.

The usual cause is the first one. Check the wallet balance on the agent's page before looking any further.

Where the money actually goes

Settlement happens on Hedera, and the network fee is paid for your agent rather than by it. See Hedera.

On this page