Stock Price API
The Stock Price API provides access to real-time and historical stock market prices for companies in every major exchange around the world.
Market index prices are also available. For example, ^DJI returns the price of the Dow Jones Industrial Average.
Available endpoints:
- /v1/stockprice - Get real-time price information for any given ticker symbol
- /v1/stockpricehistorical - Get historical price data in OHLCV format (Premium Only)
- /v1/stockpricelist - Get list of all available companies (Premium Only)
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 380ms | 420ms | 479ms | 811ms | 1098ms |
Didn't find what you were looking for? Suggest an improvement
/v1/stockprice GET
https://api.api-ninjas.com/v1/stockprice
Returns the real-time price information for any given ticker symbol (no delays).
Parameters
tickerrequiredStock or index ticker symbol (e.g.,
AAPLor^DJI).
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Sample Request Live Demo!
https://api.api-ninjas.com/v1/stockprice?ticker=AAPLHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
1
2
3
4
5
6
7
8
9
{
"ticker": "AAPL",
"name": "Apple Inc.",
"price": 192.42,
"exchange": "NASDAQ",
"updated": 1706302801,
"currency": "USD",
"volume": 44594000
}Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/stockprice?ticker=AAPL" \
-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/stockpricehistorical GET Premium Only
https://api.api-ninjas.com/v1/stockpricehistorical
Returns historical price data in OHLCV (Open, High, Low, Close, Volume) format for any given ticker symbol.
To get the 'price' for a particular period, use the close value from the response.
Parameters
tickerrequiredStock ticker symbol (e.g.,
AAPL).periodoptionalTime interval between data points from 1 minute to 1 day. Valid values are:
1m,5m,15m,30m,1h,4h,1d. Default is1h.startoptionalStart timestamp in Unix format. If not provided, defaults to 24 hours ago.
endoptionalEnd timestamp in Unix format. If not provided, defaults to current time.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Historical Price Sample Request Live Demo!
https://api.api-ninjas.com/v1/stockpricehistorical?ticker=AAPL&period=1h&start=1706000000&end=1706302801Headers
X-Api-KeyLog in or sign up to get your API KeyHistorical Price Sample Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[
{
"open": 192.425,
"low": 191.94,
"high": 192.59,
"close": 192.3,
"volume": 8363236,
"time": 1706283000
},
{
"open": 192.48,
"low": 192.34,
"high": 192.975,
"close": 192.425,
"volume": 3467330,
"time": 1706279400
},
"..."
]/v1/stockpricelist GET Premium Only
https://api.api-ninjas.com/v1/stockpricelist
Returns a list of all available companies and their ticker symbols. Supports pagination to retrieve results in batches.
Parameters
offsetoptionalNumber of results to offset for pagination. Default is
0.limitoptionalNumber of results to return. Must be between
1and1000. Default is100.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Stock List Sample Request Live Demo!
https://api.api-ninjas.com/v1/stockpricelist?offset=0&limit=10Headers
X-Api-KeyLog in or sign up to get your API KeyStock List Sample Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[
{
"ticker": "AAPL",
"name": "Apple Inc."
},
{
"ticker": "MSFT",
"name": "Microsoft Corporation"
},
{
"ticker": "GOOGL",
"name": "Alphabet Inc."
},
"..."
]