Test data — probe for free, then spend a dime well

How to integrate against bazaar.tools — the schema probe is free, and the first paid call costs a dime.

Every paid call that returns rows settles at least $0.10 (the minCharge floor — see The upto scheme). So the integration recipe is: probe for free with the unpaid 402, then make your first paid call count.

Mode 1 — Free probe: the unpaid 402

The cheapest possible probe is genuinely free: send the request with no payment header. The 402 Payment Required body carries the full pricing metadata (extra.pricePerUnit, extra.maxUnits, extra.minCharge), and the Bazaar discovery listing carries the input schema, output schema, and a realistic example response — all at zero cost, no signature, no on-chain transaction.

Useful for:

  • Validating your client wiring (HTTP, header handling, 402 parsing).
  • Snapshotting the response shape for tests — the Bazaar listing’s output.example is the canonical body shape.
  • Reading prices programmatically before committing to a paid call.

Mode 2 — First paid call: request the ceiling’s worth

Because of the $0.10 floor, a 1-row call costs exactly the same as a full-ceiling call on most endpoints. Don’t probe with maxResults=1 — authorise the per-call ceiling and request the ceiling’s worth of rows:

# Pseudo-curl — you still need an EVM signer to produce PAYMENT-SIGNATURE.
curl -sS -X GET 'https://api.bazaar.tools/v1/stocks/quote?symbols=AAPL,MSFT,NVDA,GOOGL,AMZN&maxResults=50' \
  -H "PAYMENT-SIGNATURE: $(./sign-upto.sh --amount 100000)"

You get real rows back, deterministic enough for integration tests, and you’ve paid the same $0.10 you’d have paid for one.

Mode 3 — Scaled call

Once your integration is green, authorise the per-call ceiling ($0.10 for most endpoints) and request as many rows as you need. The facilitator settles max(rows × pricePerUnit, $0.10) — see The upto scheme for the math.

Local dev

If you want to drive the API end-to-end without touching mainnet, hit https://api-staging.bazaar.tools instead. It serves the same routes against Base Sepolia. Top up your test wallet from the Circle Sepolia USDC faucet.