api-ninjas-com Bitcoin API
The Bitcoin API provides access to the latest Bitcoin price and market data.
The Bitcoin API provides access to the latest Bitcoin price and market data.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/api-ninjas-com:api-ninjas-com-bitcoin-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Ninjas Bitcoin API
description: 'Combined OpenAPI specification for every API Ninjas endpoint. Requests go to https://api.api-ninjas.com with an `X-Api-Key` header; get a free key at https://api-ninjas.com/register. Human-readable docs: https://api-ninjas.com/api. Index for LLMs: https://api-ninjas.com/llms.txt.'
version: 1.0.0
contact:
name: API Ninjas
url: https://api-ninjas.com
license:
name: Proprietary
servers:
- url: https://api.api-ninjas.com
description: API Ninjas Production
security:
- ApiKeyAuth: []
tags:
- name: Bitcoin
description: The Bitcoin API provides access to the latest Bitcoin price and market data.
paths:
/v1/bitcoin:
get:
summary: Get the latest Bitcoin price and market data
description: Returns the latest Bitcoin price and market data. Takes no parameters. For a price series over a past time range use /bitcoinhistorical.
operationId: getBitcoinData
security:
- ApiKeyAuth: []
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/BitcoinResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/BitcoinOpenapi_Error'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/BitcoinOpenapi_Error'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/BitcoinOpenapi_Error'
tags:
- Bitcoin
/v1/bitcoinhistorical:
get:
summary: Get historical Bitcoin price data
description: Returns historical Bitcoin price data over a chosen interval and Unix timestamp range. For the latest price instead use /bitcoin.
operationId: getBitcoinHistoricalData
parameters:
- name: interval
in: query
description: Time interval between data points.
required: false
schema:
type: string
enum:
- 1m
- 5m
- 15m
- 30m
- 1h
- 4h
- 1d
default: 5m
- name: start
in: query
description: Start timestamp in Unix format (in seconds).
required: false
schema:
type: integer
- name: end
in: query
description: End timestamp in Unix format (in seconds).
required: false
schema:
type: integer
- name: limit
in: query
description: Maximum number of data points to return.
required: false
schema:
type: integer
default: 100
maximum: 1000
security:
- ApiKeyAuth: []
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: array
items:
type: object
properties:
timestamp:
type: integer
description: The timestamp of the price in Unix format (in seconds).
price:
type: string
description: The price of Bitcoin in USD.
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/BitcoinOpenapi_Error'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/BitcoinOpenapi_Error'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/BitcoinOpenapi_Error'
tags:
- Bitcoin
/v1/bitcointreasury:
get:
operationId: getBitcoinTreasury
summary: Get SEC-reported bitcoin holdings of companies and ETFs
description: Bitcoin positions reported to the SEC in quarterly XBRL filings, covering operating companies and spot bitcoin exchange-traded products. Each position is as of the filer's reported period end. For holdings in other crypto assets use /v1/cryptotreasury.
tags:
- Bitcoin
parameters:
- name: ticker
in: query
required: false
description: Stock ticker of the filer, e.g. MSTR. Private filers have no ticker; use cik.
schema:
type: string
- name: cik
in: query
required: false
description: SEC Central Index Key of the filer, with or without leading zeros.
schema:
type: string
- name: name
in: query
required: false
description: Case-insensitive substring match on the filer name. Requires a Business or Professional subscription.
schema:
type: string
- name: entity_type
in: query
required: false
description: OPERATING is a company holding crypto on its balance sheet. ETP is an exchange-traded product whose holdings are the fund itself. PRIVATE is a filer with no listed ticker.
schema:
type: string
enum:
- OPERATING
- ETP
- PRIVATE
- name: period
in: query
required: false
description: Reporting period end as YYYY-MM-DD, or 'latest'. Defaults to the most recent period. History depth is limited by subscription tier.
schema:
type: string
- name: include_unverified
in: query
required: false
description: Include positions whose unit count does not reconcile with the filer's own reported fair value. Excluded by default; when included they are reproduced exactly as filed and carry a warning.
schema:
type: boolean
default: false
- name: limit
in: query
required: false
description: 'Maximum results to return. Capped by tier: 5 on Free, 50 on Developer, 250 on Business and Professional.'
schema:
type: integer
minimum: 1
maximum: 250
- name: offset
in: query
required: false
description: Number of results to skip, for pagination.
schema:
type: integer
minimum: 0
maximum: 10000
default: 0
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/CryptoTreasuryResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/CryptoTreasuryOpenapi_Error'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/CryptoTreasuryOpenapi_Error'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/CryptoTreasuryOpenapi_Error'
components:
schemas:
CryptoTreasuryOpenapi_Error:
type: object
properties:
error:
type: string
CryptoTreasuryAttribution:
type: object
description: How each figure was derived, so callers can audit rather than trust.
properties:
asset_source:
type: string
description: dimensional_member when the filing tagged the asset explicitly; unit_string when the XBRL unit named it; valuation_inference when identified by matching implied unit price to the period-end market close; unknown when undetermined.
units_basis:
type: string
description: 'How overlapping unit facts were collapsed: single_fact, stated_total, undimensioned_total, summed_components, labelled_total or max_of_ambiguous.'
units_facts_reconciled:
type: integer
description: How many raw XBRL facts were reconciled into this figure.
recovered_from_instance_document:
type: boolean
description: True when recovered by parsing the filing's XBRL instance because SEC's JSON APIs do not expose it.
quality:
type: string
description: consistent, unverified, scale_suspect or inconsistent.
implied_unit_price_usd:
type:
- number
- 'null'
description: Reported fair value divided by reported units.
market_price_at_period_end_usd:
type:
- number
- 'null'
description: Market close for the asset on the period end date.
warning:
type: string
description: Present when quality is scale_suspect or inconsistent.
CryptoTreasuryDisclosure:
type: object
properties:
source:
type: string
license:
type: string
description: Grants storage, redistribution and commercial display.
not_advice:
type: string
CryptoTreasuryResponse:
type: object
properties:
results:
type: array
items:
$ref: '#/components/schemas/CryptoTreasuryPosition'
count:
type: integer
description: Number of results returned.
data_last_refreshed:
type: integer
description: Unix timestamp of the last successful ingestion run.
note:
type: string
description: Present when unverified filings were excluded.
disclosure:
$ref: '#/components/schemas/CryptoTreasuryDisclosure'
upgrade_hint:
type: string
description: Present on the Free tier.
BitcoinResponse:
type: object
properties:
price:
type: string
description: The price of Bitcoin in USD. Live on paid plans; on the free plan it is the close of the last completed hour.
timestamp:
type: integer
description: 'Unix timestamp (seconds) of the moment the data was measured. On paid plans this is the moment the price was read. On the free plan it is the top of the current hour: the free tier updates once per hour, so every request within the same hour returns the same values and the same timestamp.'
24h_price_change:
type: string
description: The price change of Bitcoin in USD over the last 24 hours. On the free plan this is measured over the 24 completed hours ending at `timestamp`, rather than a live rolling window.
24h_price_change_percent:
type: string
description: The price change percentage of Bitcoin over the last 24 hours. On the free plan this is measured over the 24 completed hours ending at `timestamp`, rather than a live rolling window.
24h_high:
type: string
description: The highest price of Bitcoin in USD over the last 24 hours. On the free plan this is measured over the 24 completed hours ending at `timestamp`, rather than a live rolling window.
24h_low:
type: string
description: The lowest price of Bitcoin in USD over the last 24 hours. On the free plan this is measured over the 24 completed hours ending at `timestamp`, rather than a live rolling window.
24h_volume:
type: string
description: The volume of Bitcoin traded over the last 24 hours. On the free plan this is measured over the 24 completed hours ending at `timestamp`, rather than a live rolling window.
CryptoTreasuryPosition:
type: object
properties:
entity_name:
type: string
description: Filer name as it appears in EDGAR.
ticker:
type:
- string
- 'null'
description: Stock ticker.
cik:
type: string
description: SEC Central Index Key, zero-padded to 10 digits.
entity_type:
type: string
description: OPERATING, ETP or PRIVATE.
asset:
type: string
description: Canonical asset name, e.g. BITCOIN.
units:
type: number
description: Number of coins held at the period end.
fair_value_usd:
type:
- number
- 'null'
description: Value of THIS asset position.
cost_usd:
type:
- number
- 'null'
description: Cost basis as reported.
entity_total_crypto_fair_value_usd:
type:
- number
- 'null'
description: The filer's total crypto fair value across all assets.
entity_holds_multiple_assets:
type: boolean
description: True when the filer reported more than one crypto asset for this period.
period_end:
type: string
description: Reporting period end, YYYY-MM-DD. Positions are quarterly and may be materially stale.
calendar_year:
type:
- integer
- 'null'
description: Calendar year of the reporting period. Not the filer's fiscal year.
calendar_quarter:
type:
- string
- 'null'
description: Calendar quarter, Q1 to Q4. Not the filer's fiscal quarter.
accession:
type:
- string
- 'null'
description: SEC accession number of the source filing.
sec_filing_url:
type:
- string
- 'null'
description: Link to the source filing on EDGAR.
attribution:
$ref: '#/components/schemas/CryptoTreasuryAttribution'
BitcoinOpenapi_Error:
type: object
properties:
message:
type: string
description: Error message detailing what went wrong.
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-Api-Key
externalDocs:
description: API Ninjas documentation
url: https://api-ninjas.com/api