Bitcoin API
The Bitcoin API provides access to the latest Bitcoin price and market data.
Available endpoints:
- /v1/bitcoin - Get the latest Bitcoin price and market data
- /v1/bitcoinhistorical - Get historical Bitcoin price data
Premium members have access to live prices, while free users only have access to 15-minute delayed data.
From 9,829 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 247ms | 265ms | 287ms | 683ms | 1173ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
/v1/bitcoin GET
https://api.api-ninjas.com/v1/bitcoin
Returns the latest Bitcoin price in USD and 24-hour market data. Premium members have access to live prices, while free users only have access to 15-minute delayed data. For historical price data, see /v1/bitcoinhistorical.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON object with the following fields or an error if the request is unsuccessful.
priceThe price of Bitcoin in USD.
timestampThe timestamp of the price in Unix format (in seconds).
24h_price_changeThe price change of Bitcoin in USD over the last 24 hours.
24h_price_change_percentThe price change percentage of Bitcoin over the last 24 hours.
24h_highThe highest price of Bitcoin in USD over the last 24 hours.
24h_lowThe lowest price of Bitcoin in USD over the last 24 hours.
24h_volumeThe volume of Bitcoin traded over the last 24 hours.
Sample Request Live Demo!
Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/bitcoinHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/bitcoin" \
-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/bitcoinhistorical GET Premium Only
https://api.api-ninjas.com/v1/bitcoinhistorical
Returns historical price data for Bitcoin in USD.
Parameters
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
A JSON object with the following fields or an error if the request is unsuccessful.
priceThe price of Bitcoin in USD.
timestampThe timestamp of the price in Unix format (in seconds).
Sample Request
https://api.api-ninjas.com/v1/bitcoinhistorical?interval=1h&start=1637809196&end=1637895596&limit=10Sample Response
Frequently Asked Questions
Can I use the Bitcoin API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Bitcoin API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the Bitcoin API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the Bitcoin API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.What endpoints does the Bitcoin API provide?
The API has two endpoints:/v1/bitcoinreturns the latest Bitcoin price and 24-hour market data, and/v1/bitcoinhistoricalreturns historical price data. The historical endpoint is Premium only, and to get prices for other coins you can use the Crypto Price API.What fields are included in the live /v1/bitcoin response?
Each response is a JSON object containingprice(USD),timestamp(Unix seconds),24h_price_change,24h_price_change_percent,24h_high,24h_low, and24h_volume, or an error if the request is unsuccessful. For equity or commodity pricing, see the Stock Price API and Commodity Price API.How do I query a specific historical time range?
On the/v1/bitcoinhistoricalendpoint, passstartandendas Unix timestamps (seconds), set theinterval(one of1m,5m,15m,30m,1h,4h, or1d, defaulting to5m), and uselimitto cap results (default 100, maximum 1000). This endpoint requires a Premium plan.How fresh is the Bitcoin price data?
Premium members get live prices, while free users receive 15-minute delayed data, and the exact time of each quote is given in thetimestampfield. Browse other available data in the full API catalog.