SDKs & tools

Python SDK

The official Python SDK wraps the CoinMarketCap Pro API with typed request/response models, automatic retries, and a namespace API grouped by endpoint category.

Get started

  1. Install the package

    TerminalCode
    pip install coinmarketcap-sdk

    Or with uv / Poetry:

    TerminalCode
    uv add coinmarketcap-sdk poetry add coinmarketcap-sdk
  2. Create a client

    Set your API key from the Developer Portal. For keyless endpoints, use environment="public".

    Code
    import os from coinmarketcap import CoinMarketCap cmc = CoinMarketCap(api_key=os.environ["CMC_PRO_API_KEY"])
  3. Call an endpoint

    Endpoints are grouped by category on the client instance:

    Code
    quotes = cmc.cryptocurrency.quotes_latest(id="1,1027") listings = cmc.cryptocurrency.listings_latest(limit=10)

    Async variants use the async_ prefix:

    Code
    quotes = await cmc.cryptocurrency.async_quotes_latest(id="1,1027")
  4. Handle errors

    The SDK raises typed exceptions for common HTTP failures:

    Code
    from coinmarketcap import CMCError, RateLimitError, AuthenticationError try: quotes = cmc.cryptocurrency.quotes_latest(id="1") except RateLimitError: # 429 — backoff or reduce request rate ... except AuthenticationError: # 401 — check your API key ... except CMCError as e: print(e.status_code, e)

Public (keyless) mode

Code
from coinmarketcap import CoinMarketCap cmc = CoinMarketCap(environment="public") cmc.cryptocurrency.listings_latest(limit=10)

See the Keyless Public API for available endpoints without a key.

Next steps