Stock Price API
The Stock Price API provides access to 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.
For price and fund information for ETFs and Mutual Funds, use the ETF API and Mutual Fund API respectively, and for company earnings information, use the Earnings API.
Available endpoints:
- /v1/stockprice - Get price information for any given ticker symbol
- /v1/stockpricehistorical - Get historical price data in OHLCV format
- /v1/stockpricelist - Get list of all available companies
Premium members have access to live prices. Free users receive the closing price of the most recent completed trading session.
From 3,661 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 343ms | 356ms | 390ms | 594ms | 1103ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
https://api.api-ninjas.com/v1/stockprice
Returns price information for any given ticker symbol. Premium members have access to live prices. Free users receive the closing price of the most recent completed trading session.
Parameters
tickerrequiredStock or index ticker symbol (e.g.,
AAPLor^DJI).Show popular tickers
For the full list of supported tickers, use the /v1/stockpricelist endpoint.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response Fields
A JSON object with the following fields or an error if the request is unsuccessful.
tickerStock or index ticker symbol (e.g.,
AAPLor^DJI).nameThe full company name associated with the ticker symbol.
priceThe current stock price. On paid plans this is the live price during market hours; on the free plan it is the closing price of the most recent completed trading session.
exchangeThe stock exchange where the stock is traded (e.g.,
NASDAQ,NYSE).updatedUnix timestamp of the moment the price was struck — the last quote update on paid plans, or the 16:00 ET close of the session the price belongs to on the free plan. This is not the time your request was served, so a price that has not moved keeps the same
updatedvalue. Use it to tell a fresh price from a repeated one.currencyThe currency code for the price (e.g.,
USD,EUR).volumeThe trading volume (number of shares traded).
previous_closeThe closing price of the session immediately before the one
pricebelongs to.nullwhen only one session is on record.changeThe price move from
previous_closetoprice, in the quote currency. Prefer this over comparing prices across two calls of your own — a price that has not been restruck yet will repeat, and differencing repeats yields the previous session's move rather than the current one.nullwhenprevious_closeis unavailable.
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/stockprice?ticker=AAPLHeaders
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/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.
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.
The most recent 5 years of data are available on all paid tiers. Access to the full archive (older than 5 years, back to IPO) requires a Business, Professional, Enterprise, or annual subscription. See pricing.
Parameters
tickerrequiredStock ticker symbol (e.g.,
AAPL).Show popular tickers
For the full list of supported tickers, use the /v1/stockpricelist endpoint.
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 approximately the most recent 900 data points for the chosen period. Requests reaching further back than 5 years require a Business, Professional, Enterprise, or annual subscription.
endoptionalEnd timestamp in Unix format. If not provided, defaults to current time.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON array of objects, each containing the following fields, or an error if the request is unsuccessful.
openThe opening price for this time period.
lowThe lowest price during this time period.
highThe highest price during this time period.
closeThe closing price for this time period.
volumeThe trading volume (number of shares traded) during this time period.
timeThe Unix timestamp for this data point.
provisionaldaily bars only, present only when truePresent and set to
trueon a daily (period=1d) bar whose session has not finished settling. Open, high, low and close are final; volume is still being revised upward by the exchange as late trades are reported, so it may understate the final figure. The field is omitted entirely once the bar settles — see the publication schedule below.
Daily bar publication schedule
Daily (period=1d) bars for US equities are published on the following schedule. A bar is never returned while its session is still open, so an in-progress session is never served as if it were a completed one.
During the session
The current day is not returned. The most recent completed session is the newest bar available.
From 17:00 ET (1 hour after the close)
The session's bar becomes available, marked
provisional: true. OHLC is final; volume is not yet.By 14:00 ET the following day
The bar is re-read from source with settled volume and the
provisionalfield is dropped. If you need final volume, wait for the field to disappear or re-pull the session the next day.
Non-US listings follow the same schedule on the US clock. Because every major exchange closes at or before 16:00 ET, their bars are settled well before publication.
Historical Price 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/stockpricehistorical?ticker=AAPL&period=1h&start=1706000000&end=1706302801Headers
X-Api-KeyLog in or sign up to get your API KeyHistorical Price Sample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/stockpricehistorical?ticker=AAPL&period=1d&start=1706000000&end=1706302801" \
-H "X-Api-Key: YOUR_API_KEY"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.
Response
A JSON array of objects, each containing the following fields, or an error if the request is unsuccessful.
tickerThe stock ticker symbol.
nameThe full company name.
Stock List 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/stockpricelist?offset=0&limit=10Headers
X-Api-KeyLog in or sign up to get your API KeyStock List Sample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/stockpricelist?offset=0&limit=10" \
-H "X-Api-Key: YOUR_API_KEY"Frequently Asked Questions
Can I use the Stock Price API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Stock Price 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 Stock Price 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 Stock Price 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.How do I look up the current price of a stock or market index?
Send a GET request to the/v1/stockpriceendpoint with thetickerparameter set to a stock symbol such asAAPLor an index symbol such as^DJIfor the Dow Jones Industrial Average. The response returnsprice,updatedtimestamp,volume,previous_close,change,name,exchangeandcurrency— every field is available on every plan, including the free tier. For richer company metadata see the Ticker API.How fresh are the stock prices, and how do I get live (non-delayed) data?
Premium members receive live, real-time prices. Free users receive the closing price of the most recent completed trading session. Theupdatedfield gives the Unix timestamp of the moment the price was struck — not the time of your request — so a price that has not moved keeps the sameupdatedvalue, andchangegives the move fromprevious_closewithout you having to compare two calls. You can upgrade for live pricing on the pricing page.Does the Stock Price API provide historical price data?
Yes. The premium/v1/stockpricehistoricalendpoint returns OHLCV data as a JSON array of objects withopen,high,low,close,volumeandtimefields, and you can control the interval with theperiodparameter (values from1mup to1d) along with optionalstartandendUnix timestamps. The most recent 5 years are available on any paid plan; the full archive (older than 5 years, back to IPO) requires a Business, Professional, Enterprise, or annual subscription. See pricing.How can I get the full list of supported companies and tickers?
Use the premium/v1/stockpricelistendpoint, which returns a paginated JSON array of objects withtickerandnamefields; control paging with theoffsetandlimitparameters (limit must be between1and1000). For fund pricing instead, see the related ETF API and Mutual Fund API.