← 返回
开发者工具 中文

CoinMarketCap x402 APIs

Access CoinMarketCap data via x402 pay-per-request protocol with USDC payments on Base. Use when users mention x402, want CMC data without API keys, ask abou...
通过 x402 按请求付费协议访问 CoinMarketCap 数据,使用 Base 链上的 USDC 支付。适用于用户提及 x402、希望无 API key 获取 CMC 数据或询问相关问题时。
bryan-cmc bryan-cmc 来源
开发者工具 clawhub v1.0.1 1 版本 100000 Key: 无需
★ 0
Stars
📥 808
下载
💾 10
安装
1
版本
#latest

概述

CoinMarketCap x402

Pay-per-request crypto market data powered by the x402 protocol. Access CoinMarketCap endpoints instantly with on-chain USDC payment. No API key or subscription required.

What is x402?

x402 is an open payment protocol developed by Coinbase that enables automatic stablecoin payments over HTTP. Instead of managing API keys, you pay $0.01 USDC per request on Base. The x402 client library handles payment signing automatically.

Learn more: https://docs.x402.org

Prerequisites

Before using x402 endpoints, ensure you have:

  1. Node.js 18+ and npm installed
  2. Base network wallet with a private key you control
  3. USDC on Base to pay for requests ($0.01 per request)
  4. Small amount of ETH on Base for gas fees

Use Cases

Get current prices for specific coins:

Use /x402/v3/cryptocurrency/quotes/latest with symbol or id parameter.

Example: Get BTC and ETH prices for a portfolio tracker.

List top cryptocurrencies:

Use /x402/v3/cryptocurrency/listing/latest with limit parameter.

Example: Display top 100 coins ranked by market cap.

Search for DEX tokens:

Use /x402/v1/dex/search with keyword parameter.

Example: Find a memecoin by name when you don't know the contract address.

Get DEX pair trading data:

Use /x402/v4/dex/pairs/quotes/latest with pair address.

Example: Monitor liquidity and volume for a specific Uniswap pool.

AI agent data access:

Use the MCP endpoint at https://mcp.coinmarketcap.com/x402/mcp.

Example: Let Claude or other LLMs fetch live crypto data with automatic payment.

Quick Start

Install the x402 TypeScript SDK:

npm install @x402/axios @x402/evm viem

Fetch data with automatic payment:

import { createX402AxiosClient } from "@x402/axios";
import { ExactEvmScheme, toClientEvmSigner } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";
import { createPublicClient, http } from "viem";
import { base } from "viem/chains";

// SECURITY: Never hardcode private keys in source code.
// Use environment variables: process.env.PRIVATE_KEY
// For production, use a dedicated hot wallet with limited funds.
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
const publicClient = createPublicClient({ chain: base, transport: http() });
const signer = toClientEvmSigner(account, publicClient);

const client = createX402AxiosClient({
  schemes: [new ExactEvmScheme(signer)],
});

const response = await client.get(
  "https://pro.coinmarketcap.com/x402/v3/cryptocurrency/quotes/latest",
  { params: { symbol: "BTC,ETH" } }
);

console.log(response.data);

Endpoints

Base URL: https://pro.coinmarketcap.com

EndpointPathUse For
-------------------------
Quotes/x402/v3/cryptocurrency/quotes/latestCurrent prices for specific coins
Listings/x402/v3/cryptocurrency/listing/latestTop coins by market cap
DEX Search/x402/v1/dex/searchFind DEX tokens by keyword
DEX Pairs/x402/v4/dex/pairs/quotes/latestDEX pair trading data

All parameters from the standard CMC Pro API work with x402 endpoints. See endpoints.md for full parameter reference.

MCP for AI Agents

The x402 MCP endpoint lets AI agents access CMC data with automatic payment.

Connection URL:

https://mcp.coinmarketcap.com/x402/mcp

Transport: Streamable HTTP (POST)

Connect using any MCP client with an x402-aware HTTP transport. The server exposes the same tools as the REST endpoints and supports automatic tool discovery.

Pricing

$0.01 USDC per request on Base (Chain ID: 8453).

Payment only occurs on successful data delivery. If the request fails, no payment is deducted.

References

Resources

  • x402 Protocol: https://x402.org
  • x402 Documentation: https://docs.x402.org
  • x402 GitHub: https://github.com/coinbase/x402
  • CMC API Documentation: https://coinmarketcap.com/api/documentation

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-03-29 21:39 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 204 📥 65,995
professional

Crypto Research using CoinMarketCap MCP

bryan-cmc
使用 CoinMarketCap MCP 数据对加密货币进行全面尽职调查。当用户询问特定币种的更多信息(不仅仅是价格)时使用。
★ 0 📥 703
data-analysis

AdMapix

fly0pants
广告情报与应用数据分析助手,支持搜索广告素材、分析应用排名、下载量、收入及市场洞察,用于广告素材和竞品分析。
★ 295 📥 136,886