Skip to content

x402 discovery

The discovery feed is Cryptonly’s public list of paid endpoints. AI agents and x402 directories read it to find APIs they can pay for. Listing is optional and free.

Turn on List publicly when you add or edit an endpoint. The Status column of the Endpoints tab shows which endpoints are listed.

Open endpoints
Paid endpoints table: three endpoints are listed and one is private; /v1/forecast/:city is set in code at 0.02 USDC.Paid endpoints table: three endpoints are listed and one is private; /v1/forecast/:city is set in code at 0.02 USDC.

Install @x402/extensions next to your @cryptonly/x402-* package too. It then adds the endpoint’s input and output to its 402 response, so agents know how to call it.

The Advanced fields describe the endpoint for agents:

FieldWhat it tells agents
Payment timeoutHow long a signed payment stays valid. Sent as maxTimeoutSeconds.
Response typeThe content type of the response, such as application/json.
Input JSON SchemaHow to call the endpoint: query parameters for GET, HEAD and DELETE, the body for POST, PUT and PATCH.
Output JSON SchemaWhat the endpoint returns.

Add the Bazaar extension to the route, on top of the setup from Prices in your code:

import { bazaarResourceServerExtension, declareDiscoveryExtension } from '@x402/extensions/bazaar';
server.registerExtension(bazaarResourceServerExtension);
app.use(
paymentMiddleware(
{
'GET /v1/quote/:symbol': {
accepts: [
{ scheme: 'exact', price: '$0.005', network: 'eip155:8453', payTo: process.env.PAY_TO! },
],
description: 'Token price quote',
extensions: declareDiscoveryExtension({
output: { example: { symbol: 'SOL', usd: 150.25 } },
}),
},
},
server,
),
);

The route is listed after its first payment. A route with path parameters is listed once, as /v1/quote/:symbol.

  • Every 10 minutes, Cryptonly makes an unpaid request to each listed endpoint. It must answer 402 and ask to be paid to one of your addresses.
  • An endpoint that fails 3 checks in a row, or passes none for 24 hours, is removed from the feed. It comes back once it passes again.
  • To remove an endpoint yourself, turn off List publicly, or stop declaring discovery in code.
  • You can list up to 50 endpoints per account.
  • Endpoints of verified businesses are marked with extensions.cryptonly.verifiedMerchant: true.

The feed is public JSON in the x402 Bazaar format, at GET https://api.cryptonly.net/x402/discovery/resources:

Terminal window
curl "https://api.cryptonly.net/x402/discovery/resources?limit=20"
Open the feed

The sandbox feed is at https://sandbox-api.cryptonly.net/x402/discovery/resources. The feed needs no API key.

Or use the Bazaar client of the x402 SDK:

import { HTTPFacilitatorClient } from '@x402/core/server';
import { withBazaar } from '@x402/extensions/bazaar';
const client = withBazaar(
new HTTPFacilitatorClient({ url: 'https://api.cryptonly.net/x402' }),
);
const { items } = await client.extensions.bazaar.listResources();