MainMarketDocumentation
Get Access
Get started
  • Welcome
  • Getting started
  • Authentication
  • Pricing
Concepts
  • Stores, chains, products
  • Pricing tiers + freshness
  • Indices + methodology
  • Coupons
Use cases
  • Cheapest near me
  • Track price trends
  • Resolve a shopping list
  • Compare across chains
  • Coupons & deals nearby
  • Plan an in-store route
  • Monthly inflation snapshot
Reference
  • API Reference →
  • Methodology
  • OpenAPI spec
  • Agent skill spec
Get started
  • Welcome
  • Getting started
  • Authentication
  • Pricing
Concepts
  • Stores, chains, products
  • Pricing tiers + freshness
  • Indices + methodology
  • Coupons
Use cases
  • Cheapest near me
  • Track price trends
  • Resolve a shopping list
  • Compare across chains
  • Coupons & deals nearby
  • Plan an in-store route
  • Monthly inflation snapshot
Reference
  • API Reference →
  • Methodology
  • OpenAPI spec
  • Agent skill spec

Getting started

There are two ways to get access to the MainMarket API. Most teams take the first; the second is a self-serve option for AI agents that want to call us without a sales conversation.

1. Email us — the default path

Send a short note to hello@mainmarket.com describing what you're building, which chains and regions matter to you, and your expected call volume. We typically reply within one business day, scope the right tier with you, and issue an enterprise API key.

Once you have a key, every endpoint works with a standard Authorization: Bearer header.

Authenticated requestbash
curl https://api.mainmarket.com/v1/prices?q=milk \
  -H "Authorization: Bearer mm_live_..."

Enterprise keys cover full discovery, pricing, indices, and coupons across the catalog, with rate limits and SLAs sized to your use case. See Pricing for the full tier breakdown.

2. Self-serve via AgentCash + x402 — for agents

If you're an AI agent (or building one) and want to start calling immediately without emailing anyone, MainMarket also accepts x402 micropayments at $0.01 per call. No signup, no key — just a USDC wallet that auto-pays the 402 Payment Required challenge.

The fastest path is the AgentCash CLI, which provisions a wallet, funds it with a few cents of USDC on Base, and pays the per-call fee transparently. End-to-end is under 60 seconds.

ℹ
When to use which path
Use the email path for production workloads, dashboards, internal tools, or anything where you want predictable billing, an account manager, and an SLA. Use the x402 path for agent loops, exploratory scripts, or when a human emailing sales isn't in the loop.

2a. Install AgentCash

AgentCash is an open-source CLI that holds a USDC wallet on Base and auto-pays x402 challenges. No installation needed — invoke it through npx.

Onboardbash
npx agentcash onboard

This creates a fresh wallet locally, prints your USDC deposit address on Base, and stores the keys in ~/.agentcash.

2b. Fund with $0.10 USDC on Base

Send $0.10 USDC on the Base network to the address AgentCash prints. That's enough for ten paid calls. Bridges and on-ramps that support Base USDC: Coinbase, Coinbase Wallet, Phantom, MetaMask + Bridge, or any centralized exchange with Base withdrawals.

⚠
Check the network
USDC on Base is a different token from USDC on Ethereum mainnet, Polygon, or any other chain. Sending the wrong-network USDC will not credit AgentCash.

2c. Make your first paid call

Pull live prices for milk at a specific store. Replace the store_id with one returned by /v1/stores.

Try itbash
npx agentcash try 'https://api.mainmarket.com/v1/prices?q=milk&store_id=4f2a...'

AgentCash detects the 402 Payment Required response, signs and submits a $0.01 USDC payment on Base, then retries the request with the payment proof attached. You get a normal JSON response back — and a settlement receipt in the response headers.

2d. Wire it into your agent

For repeated use inside an agent loop, register the API once. Subsequent calls auto-pay without prompting.

Registerbash
npx agentcash add https://api.mainmarket.com
agentcash get https://api.mainmarket.com/v1/prices?q=eggs&near=40.7128,-74.0060&radius_mi=2

Inside Python or TypeScript, any x402-aware HTTP client works. We recommend @coinbase/x402-fetch for Node and x402 for Python.

Free routes — no setup at all

Discovery endpoints (/v1/stores, /v1/chains, /health, /openapi.json) are free and require no authentication on either path. Hit them from any terminal to start exploring — see Pricing for the full free list.

Where next?

  • Authentication — full details on enterprise keys, x402, and internal tokens.
  • Concepts — understand pricing tiers, freshness, and chain-vs-store-level pricing before you act on the data.
  • API Reference — every endpoint and parameter.