Registry / http-networking / coingecko-api

coingecko-api

JSON →
library1.2jsnpmunverified

This package, `coingecko-api`, is a Node.js wrapper for the CoinGecko API, notable for its explicit lack of external dependencies. The current stable version, 1.0.10, was published over six years ago and appears to be largely unmaintained. While the CoinGecko API itself is actively developed with frequent updates and breaking changes, this particular wrapper does not reflect those ongoing developments, including new endpoints, security updates, or changes in data structures. As such, it differentiates itself by being dependency-free but offers an outdated interface to the CoinGecko API. Newer community-driven wrappers, often with TypeScript support, have emerged to keep pace with the official API's evolution.

npm install coingecko-api
INSTALL
IMPORT
SIG · COINGECKO-API
C
coingecko-api
http-networkingjavascriptv1.2
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.

CoinGecko
const CoinGecko = require('coingecko-api');
import CoinGecko from 'coingecko-api';
This package is CommonJS-only, last updated over six years ago. ESM imports will result in a runtime error unless using a CJS interop loader.
CoinGecko.ORDER
const CoinGecko = require('coingecko-api'); const order = CoinGecko.ORDER.MARKET_CAP_DESC;
import { ORDER } from 'coingecko-api';
Constants like ORDER are exposed as properties of the main CoinGecko export, not as named exports. Requires CommonJS `require` syntax.
CoinGecko.STATUS_UPDATE_CATEGORY
const CoinGecko = require('coingecko-api'); const category = CoinGecko.STATUS_UPDATE_CATEGORY.GENERAL;
import { STATUS_UPDATE_CATEGORY } from 'coingecko-api';
Similar to ORDER, constants are properties of the main CoinGecko export. Direct named import will fail.

Demonstrates initializing the CoinGecko API client, making a simple ping request, fetching Bitcoin's price, and listing top coins by market cap using an internal constant.

const CoinGecko = require('coingecko-api'); const CoinGeckoClient = new CoinGecko(); const fetchPingAndBitcoinPrice = async () => { try { // Ping the API to check connectivity let pingData = await CoinGeckoClient.ping(); console.log('API Ping Status:', pingData.data.gecko_says); // Get current price of Bitcoin in USD let bitcoinPrice = await CoinGeckoClient.simple.price({ ids: 'bitcoin', vs_currencies: 'usd' }); console.log('Bitcoin Price (USD):', bitcoinPrice.data.bitcoin.usd); // Example using a constant for ordering results let markets = await CoinGeckoClient.coins.markets({ vs_currency: 'usd', order: CoinGecko.ORDER.MARKET_CAP_DESC, per_page: 5 }); console.log('Top 5 Coins by Market Cap:', markets.data.map(coin => coin.name)); } catch (error) { console.error('Error fetching data from CoinGecko:', error.message); } }; fetchPingAndBitcoinPrice();
Debug
Known issues
breakingThis package (v1.0.10) has not been updated in over six years and does not reflect recent breaking changes in the official CoinGecko API. Endpoints, parameters, or data structures may have diverged significantly, leading to unexpected behavior or incorrect data.
fix
Consider migrating to a more actively maintained CoinGecko API client, such as `coingecko-api-v3` or `@crypto-coffee/coingecko-api`, which are regularly updated and support modern JavaScript/TypeScript features.
affects: 1.0.10
breakingThe official CoinGecko API made significant breaking changes regarding how `market_cap_rank` is handled for rehypothecated tokens and deprecated the `trust_score` field in early 2026. This wrapper will likely return `null` or outdated values for these fields as it has not been updated to reflect these changes.
fix
Verify the expected data structure and field availability against the current official CoinGecko API documentation. Use an updated client or implement custom handling for potentially `null` or missing data.
affects: 1.0.10
gotchaThis package is CommonJS-only. Attempting to use `import CoinGecko from 'coingecko-api';` directly in an ES Module context will result in a runtime error unless a compatible CJS interop mechanism is used.
fix
Always use `const CoinGecko = require('coingecko-api');` when importing this package. If you require ESM, use a transpilation step or a different, modern API client.
affects: 1.0.10
gotchaThe public CoinGecko API has rate limits (e.g., 50 calls/minute for the free tier). This wrapper does not include built-in rate limiting or retry mechanisms. Exceeding limits will result in HTTP 429 Too Many Requests errors.
fix
Implement custom rate limiting and retry logic in your application. For higher call volumes, consider obtaining a CoinGecko Pro API key and ensure your client supports API key authentication, which this wrapper may not fully facilitate.
affects: >=1.0.0
Errors
Common errors & fixes
ReferenceError: require is not defined
Attempting to use `require()` in an ES Module (ESM) environment without proper configuration, or trying to use `import` with a CommonJS-only package.
fix
Ensure your project is configured for CommonJS (`"type": "commonjs"` in `package.json` or by using `.cjs` file extensions) or use a modern CoinGecko client that supports ESM imports.
TypeError: CoinGeckoClient.someNewMethod is not a function
The package is abandoned and does not support new endpoints or methods introduced in the CoinGecko API since its last update over six years ago.
fix
Check the official CoinGecko API documentation for the method you are trying to call. If it's a new endpoint, this wrapper will not support it. Migrate to a more recent, actively maintained CoinGecko API client or use direct HTTP requests.
Error fetching data from CoinGecko: 429 Too Many Requests
Exceeded the rate limits for the CoinGecko API (e.g., 50 requests/minute for the public API).
fix
Introduce a delay between API calls, implement a robust rate-limiting strategy, or subscribe to a CoinGecko Pro API plan for higher rate limits. Note that this wrapper does not handle rate limiting internally.
property 'market_cap_rank' of undefined / null
Accessing `market_cap_rank` or similar fields that have been deprecated or modified in the CoinGecko API since this wrapper's last update.
fix
The official CoinGecko API has introduced `market_cap_rank_with_rehypothecated` and deprecated `trust_score`. This wrapper is unaware of these changes. Either update to a current API client or add defensive coding to handle potentially `null` or missing data for these specific fields.
Upgrade
Version history
1.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
48 hits · last 30 days
node
42
Perplexity
1
OpenAI (training)
1
Resources
coingecko-api — npm install coingecko-api · libregistry