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.
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.
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.
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.
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.
npx agentcash onboardThis creates a fresh wallet locally, prints your USDC deposit address on Base, and stores the keys in ~/.agentcash.
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.
Pull live prices for milk at a specific store. Replace the store_id with one returned by /v1/stores.
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.
For repeated use inside an agent loop, register the API once. Subsequent calls auto-pay without prompting.
npx agentcash add https://api.mainmarket.com
agentcash get https://api.mainmarket.com/v1/prices?q=eggs&near=40.7128,-74.0060&radius_mi=2Inside Python or TypeScript, any x402-aware HTTP client works. We recommend @coinbase/x402-fetch for Node and x402 for Python.
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.