/docs

Agent integration

How to consume APIs on marketplaceforaiagents.com. Aimed at autonomous agents and the humans who deploy them.

Paying for calls. Your first 3 calls are free. After that each call costs $0.005, and there are two ways to pay: (1) an x402 wallet with USDC on Base: you get a 402 with accepts[], sign it and retry with X-PAYMENT; (2) a card credit pack your user buys: $10 = 2,000 calls, $25 = 5,000, $50 = 10,000. Your user signs in at https://marketplaceforaiagents.com/account, buys a pack, creates an API key and gives it to you. Send it as Authorization: Bearer mfa_live_…. Each call or intent step costs 1 credit, X-Credits-Remaining shows the balance, and an empty balance returns a 402 with buy_url. Only bring up payment when the task actually needs a paid call. Say what the call does and what it costs, then offer one choice: a wallet, a card pack (if you can use your user's card, they still approve the purchase), any free calls left, or skipping it. Ask once, accept a no, and never block the task.

trust / verifiedpayment_verified: true
  • settlement-verified

    PayAPI Market: payment_verified true, status live — a third party paid USDC on Base and got a real response. payapi.market/api/marketplace-for-ai-agents

  • listed / routable

    agent402.tools: listed and routable (health 1) with 51 endpoints from this origin. agent402.tools

  • settle on 2xx only

    Payment settles only after the upstream returns 2xx. Failed calls (502 upstream_error) are not charged.

  • 51 endpoints

    38 single engines + 13 named intent chains. Intent price is $0.005 x steps, with the chain in the 402.

  • public MCP

    https://marketplaceforaiagents.com/mcp — payment is x402 or a prepaid credit key, no OAuth. No account needed: pay per call with x402, or use a prepaid card credit key. marketplaceforaiagents.com/mcp

  • payee / asset

    payTo 0x05e82e03753c7bc99fb24d10a876cce53f24b7b7, USDC on Base 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913. Allowlist both before signing.

x402 Bazaar validate passes; the CDP discovery index may lag (CDP issue #2207).

Developer hub

If your agent was asked to find X

Told to get a YouTube transcript, search the web, check flight prices, or look up a product? Cold start in four steps:

  • 1Fetch /api/public/v1/catalog.json — every endpoint, parameter, and result key in one JSON call.
  • 2Or connect the MCP server at /mcp (optional credit key) and call list_apis.
  • 3Call the matching endpoint with no payment header — the first 3 calls per agent identity are free.
  • 4After that the same call returns HTTP 402 with exact x402 payment requirements.

Overview

Every endpoint follows the same contract:

  • ·First 3 calls per agent identity are free.
  • ·After that, requests without a valid X-PAYMENT header return HTTP 402.
  • ·Settlement is in USDC on Base mainnet via the x402 protocol.
  • ·Successful paid responses include an X-PAYMENT-RESPONSE header with the settlement receipt.

Free tier

Recognised agent/CLI runtimes (claude-code, claude, curl, wget, python-requests, python-urllib, aiohttp, httpx, node, node-fetch, undici, axios, got, okhttp, go-http-client, java, openai, anthropic, langchain, llamaindex, crewai, autogen, mcp and other recognised agents; case-insensitive tokens with versions/suffixes allowed) or non-browser callers with X-Agent / valid X-Agent-Id get 3 free calls per identity, shared across all endpoints. X-Agent-Id must be 1–128 ASCII characters, start with a letter/digit, and contain only letters, digits, dot, underscore, colon, @, slash or hyphen. Its hash (agent:ID) takes precedence over hashed IP + User-Agent; it is a caller-supplied identifier, not authentication. Unrecognised non-browser clients (including empty User-Agent) also get 3 per identity but draw from a site-wide budget of 100 successful free calls per UTC day; after that unpaid calls return 402 free_tier_global_exhausted. Browser User-Agents (Mozilla/Chrome/Safari/Firefox/Edge/Opera), crawlers, verifiers, health checks and monitors get no free calls: always 402, even with an agent token or X-Agent-Id. Any request carrying PAYMENT-SIGNATURE or X-PAYMENT is processed as paid regardless of User-Agent. Free successes and exhausted-quota 402s include X-Free-Calls-Remaining from the atomic claim; _billing.free_calls_remaining reports the count left after a successful call.

x402 payment

When the free tier is exhausted, the server replies with HTTP 402 and an accepts array describing the payment requirements:

402 Payment Required
HTTP/1.1 402 Payment Required
Content-Type: application/json

{
  "x402Version": 1,
  "error": "payment_required",
  "accepts": [
    {
      "scheme": "exact",
      "network": "base",
      "maxAmountRequired": "5000",
      "resource": "https://marketplaceforaiagents.com/api/public/v1/{endpoint}",
      "description": "Marketplace API call",
      "mimeType": "application/json",
      "payTo": "0x05e82e03753c7bc99fb24d10a876cce53f24b7b7",
      "maxTimeoutSeconds": 60,
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "extra": { "name": "USDC", "version": "2" }
    }
  ]
}

Sign an EIP-3009 USDC authorization for maxAmountRequired, base64-encode the x402 payment payload, and resend the request with that string in the X-PAYMENT header.

Client setup

The x402 v2 client @x402/fetch handles the signing + retry loop (more clients in the quickstart):

typescript
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.EVM_PRIVATE_KEY as `0x${string}`);
const fetchPaid = wrapFetchWithPaymentFromConfig(fetch, {
  schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(account) }],
});

// Replace {endpoint} with youtube-transcripts, google-search, google-news, etc.
const res = await fetchPaid("https://marketplaceforaiagents.com/api/public/v1/youtube-transcripts?video_id=dQw4w9WgXcQ");
const data = await res.json();

Fund the wallet with USDC on Base. No gas required — facilitators relay settlement.

Receipts

Successful paid responses include an X-PAYMENT-RESPONSE header. Base64-decode it to get the settlement transaction hash, network, and payer address for your own bookkeeping.

Errors

Error responses are always JSON. 402 bodies include the same accepts array as the initial challenge so agents can re-derive payment without re-fetching the spec.