{"id":18232,"library":"coingecko-api-v3","title":"CoinGecko API v3","description":"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.","status":"active","version":"0.0.31","language":"javascript","source_language":"en","source_url":"https://github.com/samuraitruong/coingecko-api-v3","tags":["javascript","coingecko","api","cryptocurrency","typescript"],"install":[{"cmd":"npm install coingecko-api-v3","lang":"bash","label":"npm"},{"cmd":"yarn add coingecko-api-v3","lang":"bash","label":"yarn"},{"cmd":"pnpm add coingecko-api-v3","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only; named export. CommonJS require will not work.","wrong":"const CoinGeckoClient = require('coingecko-api-v3')","symbol":"CoinGeckoClient","correct":"import { CoinGeckoClient } from 'coingecko-api-v3'"},{"note":"TypeScript users should use `import type` for this interface to avoid runtime bundling.","wrong":"import { CoinGeckoClientOptions } from 'coingecko-api-v3'","symbol":"CoinGeckoClientOptions","correct":"import type { CoinGeckoClientOptions } from 'coingecko-api-v3'"},{"note":"ResponseType is a type alias; use `import type` in TypeScript.","wrong":"import { ResponseType } from 'coingecko-api-v3'","symbol":"ResponseType","correct":"import type { ResponseType } from 'coingecko-api-v3'"}],"quickstart":{"code":"import { CoinGeckoClient } from 'coingecko-api-v3';\n\nconst client = new CoinGeckoClient({\n  timeout: 10000,\n  autoRetry: true,\n});\n\nasync function main() {\n  try {\n    const ping = await client.ping();\n    console.log('Ping:', ping);\n    const price = await client.simplePrice({\n      ids: 'bitcoin',\n      vs_currencies: 'usd',\n    });\n    console.log('BTC price:', price.bitcoin.usd);\n    const trending = await client.trending();\n    console.log('Trending:', trending);\n  } catch (err) {\n    console.error('Error:', err);\n  }\n}\nmain();","lang":"typescript","description":"Initializes the client, pings the API, fetches Bitcoin price in USD, and retrieves trending coins."},"warnings":[{"fix":"Use `import { CoinGeckoClient } from 'coingecko-api-v3'` instead of `require('coingecko-api-v3')`.","message":"Library is ESM-only; does not support CommonJS `require()`. Must use `import`.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Implement your own rate-limiting or use a paid CoinGecko plan to increase limits.","message":"Free 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.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Ensure `date` is a string in `dd-mm-yyyy` format when calling history methods.","message":"Some 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.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Monitor CoinGecko API changelog; consider using `client.customRequest()` to manually call new endpoints.","message":"The `/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.","severity":"deprecated","affected_versions":">=0.0.1"},{"fix":"Cache responses yourself or use a memoization pattern in your application.","message":"The library does not include built-in caching; repeated calls to the same endpoint (e.g., coin list) will make new HTTP requests each time.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Replace `import CoinGeckoClient from 'coingecko-api-v3'` with `import { CoinGeckoClient } from 'coingecko-api-v3'`.","cause":"Using default import instead of named import. The package has a named export `CoinGeckoClient`, not a default export.","error":"TypeError: coinGeckoApi_v3_1.default is not a constructor"},{"fix":"Ensure your `tsconfig.json` includes `\"moduleResolution\": \"node\"` and `\"esModuleInterop\": true`.","cause":"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`.","error":"Cannot find module 'coingecko-api-v3' or its corresponding type declarations"},{"fix":"Increase the `timeout` option in the client constructor (default 30s). Also check your network and ensure you are not hitting API limits.","cause":"Network timeout due to slow response from CoinGecko API or no internet connection.","error":"Error: connect ETIMEDOUT"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}