Skip to main content
The discovery API is public, read-only JSON. It needs no API key; requests count against the per-client rate limit. Listings appear here only while their state is published; see Cataloging for how they get there.

List resources

payTo, scheme and network must hold for one and the same payment option: a resource that pays one address on testnet and another on pubnet does not match payTo of the first with network=stellar:pubnet. A filtered resource shows only the payment options that matched, so asking for network=stellar:testnet never returns a pubnet price. Every parameter is validated. A malformed value or an unsupported parameter is refused with HTTP 400 and discovery_invalid_parameter; nothing is silently ignored.
On the hosted service this returns the public demo seller’s HTTP resources (apps/demo-seller). Its POST /translate route also declares the payment-identifier extension, so extensions=payment-identifier returns that resource alone. The responses below show what an item looks like.

One resource on several networks

The catalog keeps one listing per network: a settlement proves a payTo on its own network only, so each network’s listing has its own owner, trust and version history. Discovery shows the listings of one resource as one item. Its accepts holds every network’s payment options, which is how the resource’s own 402 response offers them, and rail402.listings names the listing behind each network. A resource is cataloged on a network once a payment on that network settles through Rail402.

Stable pagination

Resources are returned in catalog order: the order in which each was first published on any network. Every response carries pagination.asOf, the time it was read at; pass it back as asOf with the next offset and the pages of one pagination leave out anything published since, so a new resource never shifts them. A resource withdrawn while you page drops out and moves the later ones up by one. pagination.total is the number of resources that match the filters, read from the same snapshot as the page.

Response size

A response carries at most 3.5 MiB of resources, under the 4 MiB that upstream’s withBazaar client accepts. A page that would grow past that ends early, and its pagination.limit then says how many resources it holds, so offset + limit continues exactly where it ended. Each listing publishes at most BAZAAR_MAX_LISTING_BYTES of content (36 KiB by default) and at most 8 payment options (Cataloging).

Response

The item shape is x402 v2’s discovery item. Rail402-specific facts are kept under rail402, so a stock client sees exactly the specification’s fields. The example is illustrative: its ids, addresses and timestamps do not come from a recorded run.

Get a listing

Returns one listing, on its one network, as an item in the same shape, with an extra state field (pending, published or quarantined). A pending or quarantined listing is still readable here by its id, but is not listed or searched, and its content is withheld: it shows its resource, kind and the payment options that were settled, with "contentWithheld": true, but no description, service metadata or bazaar info and schema. Until an origin confirms it, that metadata is only what a payer echoed under the payTo it paid. An unknown or malformed id returns HTTP 404 with discovery_listing_not_found.

Version history

The listing’s versions, oldest first, a page at a time. Each published entry is a full snapshot of what was published; an entry in another state (pending, quarantined) has its content withheld as above ("contentWithheld": true). pagination.latest is the listing’s current version. pagination.next is present while later versions remain: pass it as after to read on. A page also ends early, with next, before its versions exceed the response byte budget of list pages. Any other parameter returns 400 discovery_invalid_parameter. An illustrative example:
cause is settlement, origin_verification, ownership_transfer, domain_verification or quarantine. transaction is present when a settlement caused the version, except while the listing’s usage is private (Private usage) or on a network that publishes usage counts only (Usage detail per network). A quarantine version carries reason, a code saying why (Origin verification); a quarantined listing whose check fails again for another reason gets a new quarantine version with that reason. Only versions written before reasons were recorded have none. content uses the catalog’s internal field names (kind for the type, method or toolName, bazaar, accepts, and extensions for the keys of the other declared extensions).

Usage

Every settlement that catalogs a resource is recorded against its listing. The usage routes link those settlements to the listings they paid for, so an explorer can show what a payment bought and how often a listing is bought. They follow the visibility rules of the list above:
  • only listings published on the requested network appear, never a pending or quarantined listing, or the listing of another network;
  • a settlement counts toward a listing only when it paid the listing’s current owner. A settlement another payTo made while claiming the resource, or one paid to a previous owner, is not linked;
  • a seller can keep a listing’s usage private: see Private usage;
  • each network publishes either its settlements or counts only: see Usage detail per network.
Each route requires network, stellar:testnet or stellar:pubnet, and refuses any other parameter with 400 discovery_invalid_parameter. A listing in these answers is a ListingRef:

Which listing a settlement paid for

transactions takes 1 to 100 comma-separated transaction hashes, each 64 lowercase hex characters. A hash is the hash of the transaction that settled the payment on chain: for a settlement Rail402 sponsored, the fee bump’s hash, which is the transaction hash /settle returns and block explorers show. The answer lists the settlements linked to a listing, in the order asked; a hash that is unknown, or not linked under the rules above, is simply absent.
observedAt is when the catalog recorded the settlement; asOf is when the answer was read.

A listing’s usage

payments counts the linked settlements and payers the distinct payers among them. recent holds the latest 20, newest first; its amount is what each settlement moved, in base units, so for upto it is the amount charged, not the cap. firstObservedAt and lastObservedAt are null when no settlement is linked. The example is illustrative. A listing that is unknown, not published, or on another network returns 404 discovery_listing_not_found, as the listing route does. A listing whose usage is private, or whose content no origin confirmed, returns 404 with the code discovery_usage_private; the listing itself stays readable.

A seller’s usage

payTo is the seller’s G… or C… address with a valid checksum: the owner of its listings. A muxed M… address is refused with 400 discovery_invalid_parameter; a listing paid to muxed addresses belongs to their base account.
listings holds the seller’s listings published on network, except those with private usage or no origin confirmation, most recently paid first, at most 100; truncated is true when there are more. totals count every such listing, with payers distinct across them. A seller without listings gets 200 with an empty listings.

Private usage

A seller keeps a listing’s usage private by declaring the rail402-private-usage extension, with an empty object, in the resource’s 402 response, next to bazaar:
It is an ordinary x402 extension declaration: clients echo it, and upstream x402 servers pass it through unchanged. The catalog keeps it with the listing’s other declared extensions (extensions.rail402-private-usage in discovery), confirmed by the resource’s own 402 like the rest of the listing. While it is declared, the listing stays listed and searchable, but no usage route links a settlement to it, its version history names no settlement transaction, and its rail402.listings[] entry has no lastSettled. Its settlement count (settlements) stays public, as on every listing. The declaration only ratchets one way from a payment:
  • a settlement whose payload declares rail402-private-usage makes the listing’s usage private at once, as a new version of the listing, and asks the resource’s origin to confirm;
  • nothing a payer sends removes it. Only the resource’s own 402, read by the origin check, can: a seller that stops declaring it gets its usage published again, earlier settlements included, once a settlement and the origin check update the listing.
A listing no origin ever confirmed (trust settled, such as a tool under an mcp:// URL) holds what the payment that created it echoed, not necessarily what its seller declared. Its usage is never published: the listing usage route answers discovery_usage_private, and the other usage routes leave it out.

Usage detail per network

On chain, a payment shows its payer, its payTo and its amount, not which endpoint or tool it bought. The settlements routes add that link. What each network publishes is set by <NET>_BAZAAR_USAGE_DETAIL: With counts, no usage route links a payer, or a transaction, to the listing it paid for. payments, payers, firstObservedAt and lastObservedAt are still published; a seller with few payments on chain can still be matched by their dates.

Errors

Discovery errors use the transport error body:

Interoperability

Rail402 is checked against canonical Bazaar records generated with upstream @x402/extensions from the specification’s examples (GET, POST, MCP tool, dynamic route, service metadata, an upto offer), in tools/interop-fixtures. Each record is settled into the catalog and read back over /discovery/resources and /discovery/search with its resource, payment options, bazaar extension and service metadata unchanged; every filter returns it exactly when it holds; and the upstream withBazaar client parses both responses. What Rail402 publishes differently, on purpose:
  • extensions other than bazaar are republished by key with an empty object;
  • an upto listing shows the seller’s cap, not a settled amount;
  • HTTP resources and http(s) MCP tools are published from their own 402, never from the buyer’s echo;
  • Rail402’s own facts live under rail402;
  • resource is canonicalized, and a dynamic route is published as origin plus routeTemplate;
  • a page that would exceed 3.5 MiB ends early (Response size);
  • pubnet refuses mcp:// tools and plain http resources;
  • a resource sold on several networks is one item with every network’s options.