curl -sS "https://api.stockcontext.com/v1/tools/stock_prices" \
-H "X-API-Key: $STOCKCONTEXT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"symbol":"AAPL","schema":2,"view":"history","range":"1mo","interval":"1d","indicators":["sma_50"]}'import requests
url = "https://api.stockcontext.com/v1/tools/stock_prices"
payload = {
"symbol": "AAPL",
"schema": 2,
"view": "history",
"range": "1mo",
"interval": "1d",
"indicators": ["sma_50"]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
symbol: 'AAPL',
schema: 2,
view: 'history',
range: '1mo',
interval: '1d',
indicators: ['sma_50']
})
};
fetch('https://api.stockcontext.com/v1/tools/stock_prices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stockcontext.com/v1/tools/stock_prices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'symbol' => 'AAPL',
'schema' => 2,
'view' => 'history',
'range' => '1mo',
'interval' => '1d',
'indicators' => [
'sma_50'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.stockcontext.com/v1/tools/stock_prices"
payload := strings.NewReader("{\n \"symbol\": \"AAPL\",\n \"schema\": 2,\n \"view\": \"history\",\n \"range\": \"1mo\",\n \"interval\": \"1d\",\n \"indicators\": [\n \"sma_50\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.stockcontext.com/v1/tools/stock_prices")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"symbol\": \"AAPL\",\n \"schema\": 2,\n \"view\": \"history\",\n \"range\": \"1mo\",\n \"interval\": \"1d\",\n \"indicators\": [\n \"sma_50\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.stockcontext.com/v1/tools/stock_prices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"symbol\": \"AAPL\",\n \"schema\": 2,\n \"view\": \"history\",\n \"range\": \"1mo\",\n \"interval\": \"1d\",\n \"indicators\": [\n \"sma_50\"\n ]\n}"
response = http.request(request)
puts response.read_bodyStock prices
Current/EOD bars, OHLC history, return and range context, dividends, and splits.
curl -sS "https://api.stockcontext.com/v1/tools/stock_prices" \
-H "X-API-Key: $STOCKCONTEXT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"symbol":"AAPL","schema":2,"view":"history","range":"1mo","interval":"1d","indicators":["sma_50"]}'import requests
url = "https://api.stockcontext.com/v1/tools/stock_prices"
payload = {
"symbol": "AAPL",
"schema": 2,
"view": "history",
"range": "1mo",
"interval": "1d",
"indicators": ["sma_50"]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
symbol: 'AAPL',
schema: 2,
view: 'history',
range: '1mo',
interval: '1d',
indicators: ['sma_50']
})
};
fetch('https://api.stockcontext.com/v1/tools/stock_prices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.stockcontext.com/v1/tools/stock_prices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'symbol' => 'AAPL',
'schema' => 2,
'view' => 'history',
'range' => '1mo',
'interval' => '1d',
'indicators' => [
'sma_50'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.stockcontext.com/v1/tools/stock_prices"
payload := strings.NewReader("{\n \"symbol\": \"AAPL\",\n \"schema\": 2,\n \"view\": \"history\",\n \"range\": \"1mo\",\n \"interval\": \"1d\",\n \"indicators\": [\n \"sma_50\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.stockcontext.com/v1/tools/stock_prices")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"symbol\": \"AAPL\",\n \"schema\": 2,\n \"view\": \"history\",\n \"range\": \"1mo\",\n \"interval\": \"1d\",\n \"indicators\": [\n \"sma_50\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.stockcontext.com/v1/tools/stock_prices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"symbol\": \"AAPL\",\n \"schema\": 2,\n \"view\": \"history\",\n \"range\": \"1mo\",\n \"interval\": \"1d\",\n \"indicators\": [\n \"sma_50\"\n ]\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Body
Request body for stock_prices.
Ticker or resolvable symbol.
1 - 24Response schema selector. Omit (or send 2) for the schema-2 envelope, the default; 1 selects the frozen legacy wire. Boolean values are rejected by the API boundary.
1, 2 Schema 1 defaults to history; schema 2 defaults to the price-only snapshot. Corporate_actions serves per-payment dividends + splits. Quote/action remain deprecated snapshot aliases; technicals returns a 200 recovery redirect to stock_technicals.
snapshot, history, corporate_actions, quote, action, technicals Range token. Schema 1 accepts 1M/3M/6M/1Y/5Y/max. Schema 2 canonicalizes duration aliases and accepts 1w/1mo/3mo/6mo/ytd/1y/5y/max; applies to view history (default 1y) and corporate_actions (default 5y), never snapshot.
1M, 3M, 6M, 1Y, 5Y, 1w, 1mo, 3mo, 6mo, ytd, 1y, 5y, max Schema-2 history resampling interval.
1d, 1w, 1mo Schema-2 only when false. Schema 1 always returns bars.
Schema-2 history indicator columns. On the snapshot view this parameter returns a 200 recovery redirect to stock_technicals.
sma_50, sma_200, ema_12, ema_26, rsi_14, macd_12_26_9, bollinger_20_2, atr_14_pct Schema-2 response detail tier.
core, full, audit Response
Get licensed price data. Envelope-level schema; captured examples remain authoritative for full nested payload detail.
Schema-2 envelope. The OpenAPI schema is structural; captured examples are authoritative for full nested payload detail.