Registry / http-networking / coingecko-api-v3

coingecko-api-v3

JSON →
library0.0.31jsnpmunverified

A TypeScript-based Node.js client for the CoinGecko API v3, version 0.0.31. It provides full coverage of the CoinGecko API endpoints including simple price, coin data, market charts, exchange info, trending, and more. Zero runtime dependencies, ships with TypeScript definitions, and supports auto-retry on rate-limiting (HTTP 429). The library is actively maintained on GitHub with CI and code coverage. Key differentiator: a typed, fully promise-based client with minimal config compared to alternatives.

npm install coingecko-api-v3
INSTALL
IMPORT
SIG · COINGECKO-API-V3
C
coingecko-api-v3
http-networkingjavascriptv0.0.31
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CoinGeckoClient
import { CoinGeckoClient } from 'coingecko-api-v3'
const CoinGeckoClient = require('coingecko-api-v3')
ESM-only; named export. CommonJS require will not work.
CoinGeckoClientOptions
import type { CoinGeckoClientOptions } from 'coingecko-api-v3'
import { CoinGeckoClientOptions } from 'coingecko-api-v3'
TypeScript users should use `import type` for this interface to avoid runtime bundling.
ResponseType
import type { ResponseType } from 'coingecko-api-v3'
import { ResponseType } from 'coingecko-api-v3'
ResponseType is a type alias; use `import type` in TypeScript.

Initializes the client, pings the API, fetches Bitcoin price in USD, and retrieves trending coins.

import { CoinGeckoClient } from 'coingecko-api-v3'; const client = new CoinGeckoClient({ timeout: 10000, autoRetry: true, }); async function main() { try { const ping = await client.ping(); console.log('Ping:', ping); const price = await client.simplePrice({ ids: 'bitcoin', vs_currencies: 'usd', }); console.log('BTC price:', price.bitcoin.usd); const trending = await client.trending(); console.log('Trending:', trending); } catch (err) { console.error('Error:', err); } } main();
Debug
Known issues
gotchaLibrary is ESM-only; does not support CommonJS `require()`. Must use `import`.
fix
Use `import { CoinGeckoClient } from 'coingecko-api-v3'` instead of `require('coingecko-api-v3')`.
affects: >=0.0.1
gotchaFree CoinGecko API has rate limits (~10-30 calls/min). The library's `autoRetry` only retries on 429, but does not handle other rate-limit responses or backoff beyond simple retry.
fix
Implement your own rate-limiting or use a paid CoinGecko plan to increase limits.
affects: >=0.0.1
gotchaSome endpoints (e.g., `/coins/{id}/history`, `marketChart`) require a `date` parameter in format `dd-mm-yyyy`; passing an incorrect format or falsy value may result in 400 errors.
fix
Ensure `date` is a string in `dd-mm-yyyy` format when calling history methods.
affects: >=0.0.1
deprecatedThe `/simple/price` endpoint has been deprecated by CoinGecko in favor of `/simple/price?include_...`, but the library still uses the old path, which may break in future API updates.
fix
Monitor CoinGecko API changelog; consider using `client.customRequest()` to manually call new endpoints.
affects: >=0.0.1
gotchaThe library does not include built-in caching; repeated calls to the same endpoint (e.g., coin list) will make new HTTP requests each time.
fix
Cache responses yourself or use a memoization pattern in your application.
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: coinGeckoApi_v3_1.default is not a constructor
Using default import instead of named import. The package has a named export `CoinGeckoClient`, not a default export.
fix
Replace `import CoinGeckoClient from 'coingecko-api-v3'` with `import { CoinGeckoClient } from 'coingecko-api-v3'`.
Cannot find module 'coingecko-api-v3' or its corresponding type declarations
TypeScript may not find the types if `tsconfig.json` does not include ESM resolution. The package exports types but requires `moduleResolution: "node"` (or `nodenext/16`) and `esModuleInterop: true`.
fix
Ensure your `tsconfig.json` includes `"moduleResolution": "node"` and `"esModuleInterop": true`.
Error: connect ETIMEDOUT
Network timeout due to slow response from CoinGecko API or no internet connection.
fix
Increase the `timeout` option in the client constructor (default 30s). Also check your network and ensure you are not hitting API limits.
Upgrade
Version history
0.0.31latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
coingecko-api-v3 — npm install coingecko-api-v3 · libregistry