api-ninjas-com 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.
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.
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-stock-price-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 Stock Price 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: Stock Price
description: 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.
paths:
/v1/stockprice:
get:
tags:
- Stock Price
summary: Get current stock price
description: Returns the current price of a stock or market index. Requires a `ticker` such as AAPL or ^DJI. For past prices and OHLC bars use /stockpricehistorical.
operationId: getCurrentStockPrice
parameters:
- name: ticker
in: query
description: Stock or index ticker symbol (e.g., AAPL or ^DJI). Share classes and preferred shares can be written in any common form, e.g. BRK.B, BRK-B, BRK/B or BRKB, and BAC.PRL or BAC-PL. Non-US stocks take an exchange suffix (SHEL.L, 7203.T) or prefix (LON:SHEL).
required: true
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/StockPriceResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/StockPriceOpenapi_ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/StockPriceOpenapi_ErrorResponse'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/StockPriceOpenapi_ErrorResponse'
security:
- ApiKeyAuth: []
/v1/stockpricehistorical:
get:
tags:
- Stock Price
summary: Get historical stock prices
description: Returns historical price bars for a stock at intervals from 1 minute to 1 day over an optional Unix `start`/`end` range. Requires a `ticker`. For the latest price use /stockprice.
operationId: getHistoricalStockPrice
parameters:
- name: ticker
in: query
description: Stock ticker symbol (e.g., AAPL). Share classes and preferred shares can be written in any common form, e.g. BRK.B, BRK-B, BRK/B or BRKB, and BAC.PRL or BAC-PL. Non-US stocks take an exchange suffix (SHEL.L, 7203.T) or prefix (LON:SHEL).
required: true
schema:
type: string
- name: period
in: query
description: 'Time interval between data points from 1 minute to 1 day. Valid values are: 1m, 5m, 15m, 30m, 1h, 4h, 1d. Default is 1h.'
required: false
schema:
type: string
default: 1h
enum:
- 1m
- 5m
- 15m
- 30m
- 1h
- 4h
- 1d
- name: start
in: query
description: Start 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.
required: false
schema:
type: integer
- name: end
in: query
description: End timestamp in Unix format. If not provided, defaults to current time.
required: false
schema:
type: integer
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: array
items:
type: object
properties:
open:
type: number
low:
type: number
high:
type: number
close:
type: number
volume:
type: integer
time:
type: integer
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/StockPriceOpenapi_ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/StockPriceOpenapi_ErrorResponse'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/StockPriceOpenapi_ErrorResponse'
security:
- ApiKeyAuth: []
/v1/stockpricelist:
get:
tags:
- Stock Price
summary: Get list of all available companies
description: Returns a list of all available companies and their ticker symbols. Supports pagination to retrieve results in batches. Premium only.
operationId: getStockPriceList
parameters:
- name: offset
in: query
description: Number of results to offset for pagination. Default is 0.
required: false
schema:
type: integer
default: 0
- name: limit
in: query
description: Number of results to return. Must be between 1 and 1000. Default is 100.
required: false
schema:
type: integer
default: 100
minimum: 1
maximum: 1000
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/StockListItem'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/StockPriceOpenapi_ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/StockPriceOpenapi_ErrorResponse'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/StockPriceOpenapi_ErrorResponse'
security:
- ApiKeyAuth: []
components:
schemas:
StockListItem:
type: object
properties:
ticker:
type: string
description: The stock ticker symbol.
name:
type: string
description: The full company name.
StockPriceResponse:
type: object
properties:
ticker:
type: string
description: Stock or index ticker symbol.
name:
type:
- string
- 'null'
description: Name of the company or index.
price:
type: number
description: Latest 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:
type:
- string
- 'null'
description: Exchange where the stock is listed.
updated:
type: integer
description: 'Unix timestamp of the moment the price was struck: the provider''s 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 the request was served -- a price that has not moved keeps the same `updated` value.'
currency:
type: string
description: Currency in which the price is denominated.
volume:
type: integer
description: The trading volume (number of shares traded).
previous_close:
type:
- number
- 'null'
description: Closing price of the session immediately before the one `price` belongs to.
change:
type:
- number
- 'null'
description: Price change from `previous_close` to `price`, in the quote currency.
StockPriceOpenapi_ErrorResponse:
type: object
properties:
error:
type: string
description: Error message describing the problem.
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-Api-Key
externalDocs:
description: API Ninjas documentation
url: https://api-ninjas.com/api