Crypto Price API
The Crypto Price API provides access to live market prices for several hundred different cryptocurrencies.
Checking API status...
/v1/cryptoprice GET
https://api.api-ninjas.com/v1/cryptoprice
Returns the current price and current time (in UNIX timestamp in seconds) for any cryptocurrency symbol. For historical price data, see /v1/cryptopricehistorical.
Parameters
symbolrequiredCryptocurrency symbol (e.g.
LTCBTC). To get the full list of available symbols, use the Crypto Symbols API.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
symbolThe cryptocurrency trading pair symbol (e.g. LTCBTC).
priceThe current price of the cryptocurrency pair.
timestampThe timestamp of the price in Unix format (in seconds).
Sample Request Live Demo!
https://api.api-ninjas.com/v1/cryptoprice?symbol=LTCBTCHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
1
2
3
4
5
{
"symbol": "LTCBTC",
"price": "0.00381400",
"timestamp": 1637809196
}Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/cryptoprice?symbol=BTCUSD" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
/v1/cryptopricehistorical GET Premium Only
https://api.api-ninjas.com/v1/cryptopricehistorical
Returns historical price data for any cryptocurrency pair in OHLCV (Open, High, Low, Close, Volume) format. The data is returned in descending order (most recent first).
Parameters
symbolrequiredCryptocurrency symbol (e.g.
LTCBTC). Use the same values as the symbol parameter in /v1/cryptoprice.intervaloptionalTime interval between data points. Valid values are:
1m,5m,15m,30m,1h,4h,1d. Default is5m.startoptionalStart timestamp in Unix format (in seconds). If not provided, defaults to 24 hours ago.
endoptionalEnd timestamp in Unix format (in seconds). If not provided, defaults to current time.
limitoptionalMaximum number of data points to return. Default is 100, maximum is 1000.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
openThe opening price of the cryptocurrency.
highThe highest price of the cryptocurrency.
lowThe lowest price of the cryptocurrency.
closeThe closing price of the cryptocurrency.
volumeThe volume of the cryptocurrency traded in the time period.
close_timeThe timestamp of the closing price in Unix format (in milliseconds).
timestampThe timestamp of the price in Unix format (in seconds).
priceThe current price of the cryptocurrency pair. This is the same value as the
closefield.
Historical Price Sample Request
https://api.api-ninjas.com/v1/cryptopricehistorical?symbol=LTCBTC&interval=1h&start=1637809196&end=1637895596&limit=10Historical Price Sample Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
[
{
"open": "0.00381100",
"high": "0.00381100",
"low": "0.00380100",
"close": "0.00380900",
"volume": "6.41000000",
"close_time": 1637812799999,
"timestamp": 1637812799,
"price": "0.00380900"
},
{
"open": "0.00379800",
"high": "0.00382900",
"low": "0.00377100",
"close": "0.00381400",
"volume": "338.95000000",
"close_time": 1637816399999,
"timestamp": 1637816399,
"price": "0.00381400"
},
{
"open": "0.00381400",
"high": "0.00381400",
"low": "0.00378100",
"close": "0.00378100",
"volume": "97.99000000",
"close_time": 1637819999999,
"timestamp": 1637819999,
"price": "0.00378100"
},
{
"open": "0.00379800",
"high": "0.00380600",
"low": "0.00375500",
"close": "0.00377400",
"volume": "143.66000000",
"close_time": 1637823599999,
"timestamp": 1637823599,
"price": "0.00377400"
},
{
"open": "0.00377400",
"high": "0.00378100",
"low": "0.00376700",
"close": "0.00376700",
"volume": "39.30000000",
"close_time": 1637827199999,
"timestamp": 1637827199,
"price": "0.00376700"
},
"..."
]