Skip to main content
The official Node.js client library for the CoinPaprika API provides convenient access to cryptocurrency market data.

Installation

Install the CoinPaprika JavaScript SDK using npm:

Quick Start

The following example shows how to create a client instance and fetch global market data and a list of all tickers.

Using Promises

Using Async/Await

Authenticating with a paid plan

If you have a paid plan (Starter, Pro, Business, Ultimate), pass your API key when constructing the client. The SDK switches to https://api-pro.coinpaprika.com automatically when pro: true is set.
Use /key/info from your monitoring stack to self-throttle. It returns your plan, status, requests made this month, and requests remaining. Hit it once a day and alert at 80%.
Requires @coinpaprika/api-nodejs-client@3.0.0 or newer. Earlier versions do not support the apiKey option.

Common Use Cases

Getting Coin Information

Fetch a list of all available coins and find a specific one by its ID.

Getting Ticker Data

Fetch ticker information for all coins or for a specific coin.

Historical OHLCV Data

Fetch historical Open-High-Low-Close-Volume (OHLCV) data for a specific coin.

Historical Ticker Data

Fetch historical ticker data for a specific coin within a date range and at a given interval.

Error Handling

The client returns a Promise, so you can handle errors by chaining a .catch() block or by using a try...catch block with async/await. The error object from the underlying node-fetch library will contain details about the failure.

Available Methods

getGlobal()

getCoins()

getCoin(coinId)

getAllTickers(options)

getAllTickers({ historical })

  • Description: Get historical ticker data.
  • historical (Object):
    • start (String): Required. Start date (e.g., '2023-01-01').
    • end (String): Optional. End date.
    • limit (Number): Optional. Data points limit.
    • quote (String): Optional. Quote currency (e.g., 'usd').
    • interval (String): Optional. Time interval (e.g., '1h').

getCoinsOHLCVHistorical(options)

  • Description: Get historical OHLCV data for a coin.
  • options `(Object)**:
    • coinId (String): Required. ID of a specific coin.
    • quote (String): Optional. Quote currency (defaults to 'usd').
    • start (String): Required. Start date.
    • end (String): Optional. End date.

Requirements

  • Node.js 12.0 or higher

Dependencies

  • node-fetch: For making HTTP requests.
  • qs: For query string handling.

License

This library is available under the MIT license. See the LICENSE file for more info.

FAQs

Create the client with your key when needed or configure HTTP headers before calls; free endpoints work without a key.
Use the Coverage Checker to look up canonical IDs such as btc-bitcoin.
Use getCoinsOHLCVHistorical({ coinId, start, end, quote }) with an API key.