NewConnect Claude, Gemini, ChatGPT, and other AI agents to API Ninjas via our MCP server

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:

Premium members have access to live prices. Free users receive the closing price of the most recent completed trading session.

(4.3)

From 3,661 users

3,000+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
343ms356ms390ms594ms1103ms

Didn't find what you were looking for? Suggest an improvement

3 endpoints

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

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response Fields

A JSON object with the following fields or an error if the request is unsuccessful.

  • ticker

    Stock or index ticker symbol (e.g., AAPL or ^DJI).

  • name

    The full company name associated with the ticker symbol.

  • price

    The 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.

  • exchange

    The stock exchange where the stock is traded (e.g., NASDAQ, NYSE).

  • updated

    Unix 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 updated value. Use it to tell a fresh price from a repeated one.

  • currency

    The currency code for the price (e.g., USD, EUR).

  • volume

    The trading volume (number of shares traded).

  • previous_close

    The closing price of the session immediately before the one price belongs to. null when only one session is on record.

  • change

    The price move from previous_close to price, 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. null when previous_close is unavailable.

Sample Request Live Demo!

ticker

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=AAPL

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON
{
    ticker:"AAPL",
    name:"Apple Inc.",
    price:192.42,
    exchange:"NASDAQ",
    updated:1706302801,
    currency:"USD",
    volume:44594000,
    previous_close:191.73,
    change:0.69
}

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

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON array of objects, each containing the following fields, or an error if the request is unsuccessful.

  • open

    The opening price for this time period.

  • low

    The lowest price during this time period.

  • high

    The highest price during this time period.

  • close

    The closing price for this time period.

  • volume

    The trading volume (number of shares traded) during this time period.

  • time

    The Unix timestamp for this data point.

  • provisional  daily bars only, present only when true

    Present and set to true on 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 provisional field 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!

ticker
period
start
end

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=1706302801

Headers

X-Api-KeyLog in or sign up to get your API Key

Historical Price Sample Response

JSON
[
    {
      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
    },
    "..."
]

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

  • offset  optional

    Number of results to offset for pagination. Default is 0.

  • limit  optional

    Number of results to return. Must be between 1 and 1000. Default is 100.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON array of objects, each containing the following fields, or an error if the request is unsuccessful.

  • ticker

    The stock ticker symbol.

  • name

    The full company name.

Stock List Sample Request Live Demo!

offset
limit

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=10

Headers

X-Api-KeyLog in or sign up to get your API Key

Stock List Sample Response

JSON
[
    {
      ticker:"AAPL",
      name:"Apple Inc."
    },
    {
      ticker:"MSFT",
      name:"Microsoft Corporation"
    },
    {
      ticker:"GOOGL",
      name:"Alphabet Inc."
    },
    "..."
]

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

  • 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.
  • Sign up for a free account to instantly get your API key, then pass it in the X-Api-Key header on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.
  • 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.
  • 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.
  • Send a GET request to the /v1/stockprice endpoint with the ticker parameter set to a stock symbol such as AAPL or an index symbol such as ^DJI for the Dow Jones Industrial Average. The response returns price, updated timestamp, volume, previous_close, change, name, exchange and currency — every field is available on every plan, including the free tier. For richer company metadata see the Ticker API.
  • Premium members receive live, real-time prices. Free users receive the closing price of the most recent completed trading session. The updated field 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 same updated value, and change gives the move from previous_close without you having to compare two calls. You can upgrade for live pricing on the pricing page.
  • Yes. The premium /v1/stockpricehistorical endpoint returns OHLCV data as a JSON array of objects with open, high, low, close, volume and time fields, and you can control the interval with the period parameter (values from 1m up to 1d) along with optional start and end Unix 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.
  • Use the premium /v1/stockpricelist endpoint, which returns a paginated JSON array of objects with ticker and name fields; control paging with the offset and limit parameters (limit must be between 1 and 1000). For fund pricing instead, see the related ETF API and Mutual Fund API.