← Learn

Batch search API for AI agents (1–25 Google, Amazon, Maps or YouTube queries in one paid call, no API key)

When a user asks an agent to run the same lookup over a list (20 keywords, 15 ASINs, 10 cities, a stack of video IDs), send one POST /api/v1/batch or MCP call_batch with 1–25 queries for a single engine, get one 402 quoting the exact total, sign once with x402 USDC on Base, and get indexed results back. Any upstream failure skips settlement. No account, no API key.

Short answer: POST https://marketplaceforaiagents.com/api/v1/batch with {"engine": "google-search", "queries": [...]} (1–25 queries, one single-engine slug). You get one 402 that quotes billed_queries × per_query_price = total, you sign exactly that total once, and you get back results[] in input order. MCP clients call the call_batch tool with the same engine + queries and pay via _meta["x402/payment"].

This is written for Grok Bot, Claude Cowork, Cursor agents and similar runtimes that get asked to "check all of these." Looping 20 single calls means 20 payment handshakes and 20 signatures; a batch is one quote, one signature, one settlement.

When a user's ask is really a batch

User asksenginequeries
Where do we rank for these 20 keywords?google-search20 q strings
Current price for these 15 ASINsamazon-product15 {asin} objects
Plumbers in each of these 10 citiesgoogle-maps10 q strings like 'plumbers in Tacoma WA'
Latest news on each portfolio companygoogle-newsone q per company
Pull captions for these 8 videosyoutube-transcripts8 {video_id} objects
What do Google Play / App Store show for these app namesgoogle-play or apple-app-storeone query per app

One engine per batch. If the user needs two engines, send two batches.

Request shape

queries accepts parameter objects (for example {"q": "..."} or {"asin": "..."}) or plain q strings for q-based engines, and you can mix them in one batch.

bash
curl -si -X POST https://marketplaceforaiagents.com/api/v1/batch \
  -H 'Content-Type: application/json' \
  -d '{"engine":"google-news","queries":[{"q":"Base USDC stablecoin regulation"},{"q":"x402 payments Coinbase"},"agentic commerce Visa"]}'

Allowed engines (single-engine slugs only):

  • youtube-transcripts
  • youtube-video
  • youtube-search
  • google-videos
  • google-search
  • google-news
  • google-images
  • google-lens
  • google-reverse-image
  • google-shopping
  • google-maps
  • google-maps-reviews
  • google-trends
  • google-autocomplete
  • google-scholar
  • google-scholar-author
  • google-patents
  • google-jobs
  • google-finance
  • google-flights
  • google-hotels
  • google-events
  • google-play
  • apple-app-store
  • bing-search
  • bing-news
  • bing-images
  • bing-videos
  • duckduckgo-search
  • yandex-search
  • baidu-search
  • naver-search
  • yahoo-search
  • amazon-search
  • amazon-product
  • amazon-reviews
  • walmart-search
  • ebay-search

Intent chains (serp-stack, news-brief, brand-pulse, trip-skeleton, etc.) are not batchable; call them one at a time via GET /api/public/v1/{intent}.

The 402 quote: read it, sign exactly it

The first POST returns 402 payment_required with accepts[0].amount equal to the total and accepts[0].extra containing billed_queries, engine, per_query_price and total (atomic USDC, 6 decimals; network eip155:8453 Base; asset USDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913; payTo 0x05e82e03753c7bc99fb24d10a876cce53f24b7b7). A trimmed real response from 2026-10-28 for a 3-query google-news batch:

json
{
  "x402Version": 2,
  "error": "payment_required",
  "accepts": [{
    "scheme": "exact",
    "network": "eip155:8453",
    "amount": "9000",
    "extra": { "billed_queries": 3, "engine": "google-news", "per_query_price": "3000", "total": "9000" }
  }]
}

That sample was captured during the October promo; the per-query price follows the site's current pricing, so always sign the live accepts[0].amount and never hard-code it.

Retry the identical JSON body with PAYMENT-SIGNATURE (x402 v2) or X-PAYMENT (v1). The PAYMENT-REQUIRED response header carries the same payload base64-encoded.

MCP: call_batch

Connect to https://marketplaceforaiagents.com/mcp (streamable HTTP, no auth). Tool arguments:

json
{"engine":"google-search","queries":["best CRM for small business","project management software for agencies","email marketing tools comparison"]}

The first call returns the x402 PaymentRequired as an isError result with the exact total; retry the same call with _meta["x402/payment"]. Use call_api for single calls and intents.

Failure and limit rules

  • Paid-only: batches never consume the 3 free calls per agent identity; test single endpoints free first, then batch.
  • All-or-nothing: if any upstream query fails, the batch returns 502 batch_quote_mismatch with settle_skipped: true and billed: 0 — nothing is charged.
  • 0 or more than 25 queries, or a non-batchable engine, returns 400 invalid_batch with a hint (min_queries 1, max_queries 25, allowed_engines, body_shape) and settle_skipped: true.
  • Results come back as results[] with index, params and data, in the same order you sent.
  • Need more than 25? Split into chunks of 25 and budget each chunk from its own 402.

Budgeting a batch run

total = queries × live per-query price.

QueriesAtomic USDC at 3000/queryUSD
515000$0.015
1030000$0.03
2575000$0.075

Table uses the October 2026 rate of 3000 atomic per query; recompute from the live 402 after the promo changes.

Agents should tell the user the quoted total before signing when it is above their per-run cap; see https://marketplaceforaiagents.com/learn/budget-x402-api-calls.

Test it on Base Sepolia first

POST https://marketplaceforaiagents.com/api/sandbox/v1/batch mirrors the same shape with testnet USDC and fixture data; see https://marketplaceforaiagents.com/docs/sandbox and https://marketplaceforaiagents.com/learn/x402-base-sepolia-smoke-test.

Why x402 instead of an API key for bulk work

An unsupervised agent can't sign up for a SERP vendor or paste a card. x402 lets it pay the exact quoted total in USDC on Base per batch, with no account and no leftover prepaid balance.

For background, see https://marketplaceforaiagents.com/learn/x402-protocol-explained and https://marketplaceforaiagents.com/learn/machine-payable-vs-traditional-billing.

Links

  • Marketplace: https://marketplaceforaiagents.com/marketplace
  • Patterns (paid-only batches): https://marketplaceforaiagents.com/docs/patterns
  • Docs: https://marketplaceforaiagents.com/docs
  • MCP server: https://marketplaceforaiagents.com/mcp
  • llms.txt: https://marketplaceforaiagents.com/llms.txt
  • Skill: npx -y skills add Cozy-ctrl/marketplaceforaiagents-skill -y
  • Related: /learn/seo-rank-tracking-api-for-agents, /learn/price-tracking-api-for-agents, /learn/local-business-leads-api-for-agents