> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Crypto market data from CoinMarketCap - ranked market listings, price and volume quotes, ID resolution, asset metadata, global market metrics, price conversion, exchange details, and API key usage.

Use **CoinMarketCap** through Corsair: one client, typed API calls.

Create a key at [https://pro.coinmarketcap.com/login](https://pro.coinmarketcap.com/login) and copy it from the dashboard. Every call sends it in the `X-CMC_PRO_API_KEY` header.

Things that shape the results:

* **IDs are stable, tickers are not.** Several assets can share a ticker, so a lookup by `symbol` can return more than one. `cryptocurrency.map` resolves a ticker to the CMC IDs the other operations take.
* **`quote` changes shape by route.** The `/v3` routes return an array with one entry per requested currency, and each entry names its currency with `id` and `symbol`. The `/v1` and `/v2` routes return an object keyed by currency symbol. This plugin passes each through unchanged.
* **`data` changes shape too.** `cryptocurrency.info` and `exchange.info` are keyed by the identifier passed, and a `symbol` or `address` lookup wraps each key's value in an array. Both operations flatten that into one list and keep the provider's key as `lookup_key`.
* **Credits.** A listing costs one credit per 250 assets returned and one more per extra `convert` currency. `key.info` reports the plan limits and what is left this minute, today and this month.
* **Rate limits.** CoinMarketCap answers 429 with an `error_code` that says which limit was hit. 1008 (per minute) and 1011 (per IP) are retried up to twice, using `Retry-After` when present and the documented 60 second window otherwise. 1009 (daily limit), 1010 (monthly limit) and 1022 (anonymous allowance) are not retried, because waiting out one window cannot clear them.
* **Plans.** `exchange.info` needs a paid plan: a Basic key gets 403 `error_code` 1005 for it. Every other operation here works on Basic.
* **Empty results.** A filter that matches nothing is a success: the route answers `data: []` with `error_code` `"0"`, and this plugin returns an empty list. A body with a success status and no `data` field at all is malformed, and the call throws instead of reporting an empty page.
* **`key.info` costs no credits.** On a paid plan it reports `rate_limit_minute` and `credit_limit_monthly`, plus what is left this minute and this month. The daily object carries `credits_used` only, with no `credits_left`, so this plugin types that field as optional.

The keyless public API at `/public-api` is not used here: every operation goes through the keyed Pro API, so a key is always required.

**What you get:**

* 8 typed API operations

## Setup

**1. Install**

```bash npm theme={null}
npm install corsair @corsair-dev/coinmarketcap better-sqlite3
npm install --save-dev @types/better-sqlite3
```

```bash yarn theme={null}
yarn add corsair @corsair-dev/coinmarketcap better-sqlite3
yarn add --dev @types/better-sqlite3
```

```bash pnpm theme={null}
pnpm install corsair @corsair-dev/coinmarketcap better-sqlite3
pnpm install --save-dev @types/better-sqlite3
```

```bash bun theme={null}
bun add corsair @corsair-dev/coinmarketcap better-sqlite3
bun add --dev @types/better-sqlite3
```

**2. Add the plugin**

```ts corsair.ts theme={null}
import Database from 'better-sqlite3';
import { createCorsair } from 'corsair';
import { coinmarketcap } from '@corsair-dev/coinmarketcap';

export const corsair = createCorsair({
	plugins: [
		coinmarketcap(),
	],
	database: new Database('corsair.db'),
	kek: process.env.CORSAIR_KEK!,
	multiTenancy: true,
	hub: {
		projectApiKey: process.env.CORSAIR_API_KEY!,
		signingSecret: process.env.CORSAIR_SIGNING_SECRET!,
	},
});
```

With `multiTenancy: true`, scope calls with `corsair.withTenant(id)`. See [Quick start](https://docs.corsair.dev/quick-start.md) for KEK + Hub keys, and [Multi-tenancy](https://docs.corsair.dev/concepts/multi-tenancy.md) for account isolation.

**3. Choose authentication**

> [tab] API Key (Recommended)
>
> No setup required yet. When you make your first request as a tenant, Corsair prompts for the API key.
>
> ```ts theme={null}
> coinmarketcap()
> ```
>
> More: [API Key](https://docs.corsair.dev/concepts/api-key)

**4. Connect a tenant**

Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see [Connect / OAuth](https://docs.corsair.dev/management/connect).

```ts theme={null}
const { connectUrl } = await corsair.manage.connect.createLink({
	plugin: 'coinmarketcap',
	tenantId: 'acme',
});
// redirect the user's browser to connectUrl
```

## Example API calls

**Top coins by market cap**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.coinmarketcap.api.cryptocurrency.listings({ limit: 10 });
```

**Convert one BTC to USD by its CMC ID**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.coinmarketcap.api.tools.priceConversion({
	amount: 1,
	id: 1,
	convert: ['USD'],
});
```

See the full list on the [API](https://docs.corsair.dev/plugins/coinmarketcap/api.md) page.

## What's next

> [card] [API reference](https://docs.corsair.dev/plugins/coinmarketcap/api.md)
>
> Every `coinmarketcap.api.*` operation with input and output types.

> [card] [Connect / OAuth](https://docs.corsair.dev/management/connect)
>
> createLink, Hub delivery, and tenant connect flows.

> [card] [Use with agents](https://docs.corsair.dev/mcp-adapters/mcp-adapters)
>
> Expose this plugin's operations as MCP tools.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.