BAZAAR MARKETPLACE.

Bazaar is the P402 registry for x402-enabled AI services. Agents use it to discover services, check reputation, and route payments — automatically. Developers use it to publish their services and get found.

What is Bazaar?

Think of Bazaar as the DNS + reputation layer for the agentic web. Just as DNS maps a domain name to an IP address, Bazaar maps a service capability (e.g. "legal document summarization") to a specific agent endpoint, its pricing, and its settlement requirements.

Every listing in Bazaar is an x402-enabled service: it declares what it does, what it costs, and how to pay. An autonomous agent can query Bazaar, find the best service for a task, pay for it via x402, and receive the result — all without human intervention.

Service identity

Each listing has a canonical DID that uniquely identifies the service across the network.

Reputation

Verifiable usage stats and ERC-8004 reputation scores. No fake reviews — usage is on-chain.

Pricing

Input/output token pricing in USD, declared by the service and enforced at settlement.

Listing Schema

A Bazaar listing describes a service in enough detail for an agent to select and pay for it without human involvement.

json — Bazaar listing

{
  "resource_id": "res_8453_0xAbc123...",      // Unique listing ID
  "did": "did:p402:service:legal-summarizer", // Canonical DID for this service
  "title": "Legal Document Summarizer",
  "description": "Summarizes contracts, NDAs, and legal filings into plain English.",
  "endpoint": "https://legalsummarizer.ai/api/a2a",
  "category": "inference",
  "capabilities": ["text-summarization", "legal-nlp"],
  "pricing": {
    "input_per_1k_tokens": 0.50,   // USD per 1k input tokens
    "output_per_1k_tokens": 2.00,  // USD per 1k output tokens
    "currency": "USDC"
  },
  "payment": {
    "scheme": "exact",
    "network": "eip155:8453",      // Base Mainnet
    "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" // USDC
  },
  "reputation": {
    "score": 98,                   // 0–100, derived from ERC-8004 on-chain data
    "total_requests": 14823,
    "success_rate": 0.997,
    "uptime_30d": 0.999
  },
  "agent_card_url": "https://legalsummarizer.ai/.well-known/agent.json",
  "listed_at": "2026-01-15T00:00:00.000Z"
}

Field Reference

Field Description
resource_id Unique ID for this listing. Use this to fetch a specific listing or route directly to it.
did Canonical DID. Stable across updates — use this for long-term references.
category Service category. Used for AP2 mandate category enforcement (inference, search, data, compute, media, storage, agents).
capabilities Specific skills the service advertises. Used for capability-based discovery.
pricing Declared pricing in USD per 1k tokens. Enforced at settlement — the service cannot charge more than declared.
payment Settlement details: scheme (exact/onchain/receipt), network (CAIP-2), and token contract address.
reputation.score Composite score 0–100 derived from ERC-8004 on-chain reputation registry. Higher is better.
agent_card_url URL of the service's A2A AgentCard. Fetch this to get the full A2A endpoint and capabilities.

Discover Services

Query the Bazaar API to find services. Filter by category, capability, or minimum reputation score. Results are sorted by reputation score descending by default.

List all listings

curl "https://p402.io/api/a2a/bazaar" \
  -H "Authorization: Bearer $P402_API_KEY"

Filter by category

curl "https://p402.io/api/a2a/bazaar?category=inference" \
  -H "Authorization: Bearer $P402_API_KEY"

Filter by capability and minimum reputation

curl "https://p402.io/api/a2a/bazaar?capability=legal-nlp&min_reputation=90" \
  -H "Authorization: Bearer $P402_API_KEY"

Get a specific listing

curl "https://p402.io/api/a2a/bazaar/res_8453_0xAbc123" \
  -H "Authorization: Bearer $P402_API_KEY"

Query Parameters

Parameter Type Description
category string Filter by service category: inference, search, data, compute, media, storage, agents
capability string Filter by a specific capability tag declared by the service
min_reputation number (0–100) Only return listings with reputation.score ≥ this value
limit number (default: 20) Maximum number of results to return
offset number (default: 0) Pagination offset
sort reputation listed_at

Register Your Service

To list your AI service in Bazaar, your service must:

  1. Serve a valid A2A AgentCard at /.well-known/agent.json
  2. Declare the x402-payment extension in the AgentCard
  3. Accept payment in USDC on Base (or submit a request for other tokens)
  4. Have a P402 API key (needed for the registration request)

bash — POST /api/a2a/bazaar

curl -X POST https://p402.io/api/a2a/bazaar \
  -H "Authorization: Bearer $P402_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_card_url": "https://myservice.ai/.well-known/agent.json",
    "category": "inference",
    "pricing": {
      "input_per_1k_tokens": 0.30,
      "output_per_1k_tokens": 1.50,
      "currency": "USDC"
    }
  }'

json — response

{
  "resource_id": "res_8453_0xYourService...",
  "did": "did:p402:service:myservice-ai",
  "status": "pending_verification",
  "message": "P402 is verifying your AgentCard. Listing will be active within 60 seconds."
}

Verification process

P402 fetches your AgentCard, verifies the x402 extension is present, and checks that your endpoint responds to A2A discovery requests. This takes up to 60 seconds. Your listing becomes active automatically once verified. If verification fails, the status will be verification_failed with an error message.

End-to-End: Discover and Pay

Here is a complete flow: an agent queries Bazaar, selects the top result, fetches the AgentCard, and calls the service via A2A.

typescript — agent discovers and calls a Bazaar service

// Step 1: Find the best legal summarizer
const listings = await fetch(
  'https://p402.io/api/a2a/bazaar?capability=legal-nlp&min_reputation=90',
  { headers: { Authorization: `Bearer ${process.env.P402_API_KEY}` } }
).then(r => r.json());

const best = listings.items[0];
console.log(`Selected: ${best.title} (reputation: ${best.reputation.score})`);

// Step 2: Fetch its AgentCard to get the A2A endpoint
const agentCard = await fetch(best.agent_card_url).then(r => r.json());
const a2aEndpoint = agentCard.endpoints.a2a.jsonrpc;

// Step 3: Send the A2A task (payment handled by P402 via the session)
const result = await fetch(a2aEndpoint, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.P402_API_KEY}`,
    'Content-Type': 'application/json',
    // Include the session_id so P402 handles payment from your budget
    'X-P402-Session': process.env.P402_SESSION_ID ?? '',
  },
  body: JSON.stringify({
    jsonrpc: '2.0',
    method: 'tasks/send',
    id: 1,
    params: {
      message: {
        role: 'user',
        parts: [{ type: 'text', text: 'Summarize this NDA: [...]' }],
      },
      configuration: { mode: 'quality' },
    },
  }),
}).then(r => r.json());

console.log(result.result.artifacts[0].parts[0].text);

Reputation System

Bazaar reputation scores are derived from verifiable on-chain data through the ERC-8004 Reputation Registry on Base. There are no subjective reviews — reputation reflects actual, settled usage.

Factor Weight Description
Success rate 40% Ratio of tasks completed successfully vs. total tasks attempted
Uptime 30% 30-day rolling uptime. P402 probes endpoints every 5 minutes.
Payment accuracy 20% How accurately the service charges what it declared. Overcharging reduces score.
Volume 10% Total settled volume. New services start lower and build reputation over time.