Quickstart
Make your first Stocks API request and build a small company research snapshot.
Stocks accepts x402 exact payments or a project API key backed by prepaid credits.
For repeated calls, create a project in the Naven workspace,
add project credits, and keep its API key on your server. Set it in your shell for the examples below:
export NAVEN_API_KEY='naven_api_...'Without a key, the same URL returns HTTP 402 with a PAYMENT-REQUIRED challenge.
Use an x402 client to sign and retry that request; see the
buyer guide.
To find a verified Robinhood Chain stock token's address and logo URL, fetch the
catalog and look up its items by symbol:
curl --fail-with-body -H "Authorization: Bearer $NAVEN_API_KEY" \
https://api.naven.network/v1/stocks/catalogThe catalog describes token listings. Confirm that your execution venue supports the address before trading; the company quote below is not a token execution quote.
Get a quote
Request Apple's latest quote:
curl --fail-with-body \
--header 'Accept: application/json' \
--header "Authorization: Bearer $NAVEN_API_KEY" \
https://api.naven.network/v1/stocks/quote/AAPLA successful response has HTTP status 200 and places the quote in data:
{
"code": 0,
"message": "ok",
"data": {
"source": "naven",
"symbol": "AAPL",
"name": "Apple Inc.",
"price": 230.1,
"change": 1.72,
"changePercent": 0.75,
"volume": 41234567,
"dayLow": 227.5,
"dayHigh": 231.2,
"yearLow": 180.4,
"yearHigh": 250.8,
"marketCap": 3400000000000,
"averagePrice50Day": 225.4,
"averagePrice200Day": 210.9,
"exchange": "NASDAQ",
"open": 228.2,
"previousClose": 228.38,
"asOf": "2026-09-15T14:31:00.000Z"
}
}The numbers above illustrate the response shape; use the values and asOf timestamp from
your response.
Build a company snapshot in TypeScript
This complete example requests the profile, quote, latest quarterly financials, recent
earnings, and news concurrently. It runs in Bun or any modern Node.js runtime with fetch.
const api = "https://api.naven.network/v1/stocks";
const symbol = "AAPL";
const apiKey = process.env.NAVEN_API_KEY;
if (!apiKey) throw new Error("NAVEN_API_KEY is required");
async function get(path: string) {
const response = await fetch(`${api}${path}`, {
headers: { Accept: "application/json", Authorization: `Bearer ${apiKey}` },
signal: AbortSignal.timeout(10_000),
});
const body = await response.json();
if (!response.ok || body.code !== 0) {
throw new Error(`HTTP ${response.status}: ${body.message ?? "Request failed"}`);
}
return body.data;
}
async function main() {
const encoded = encodeURIComponent(symbol);
const [quote, profile, financials, earnings, news] = await Promise.all([
get(`/quote/${encoded}`),
get(`/profile/${encoded}`),
get(`/financials/${encoded}?period=quarter&limit=4`),
get(`/earnings/${encoded}?limit=4`),
get(`/news/${encoded}?limit=5`),
]);
console.log(JSON.stringify({ quote, profile, financials, earnings, news }, null, 2));
}
main().catch((error) => {
console.error(error instanceof Error ? error.message : "Request failed");
process.exitCode = 1;
});Save it as stocks.ts, then run:
bun run stocks.tsAdd a daily price range
Dates use YYYY-MM-DD. This request returns daily rows from August 1 through September 1:
curl --fail-with-body \
-H "Authorization: Bearer $NAVEN_API_KEY" \
'https://api.naven.network/v1/stocks/history/AAPL?from=2026-08-01&to=2026-09-01'If both dates are omitted, the API uses today in UTC as to and the preceding 30 calendar
days as from. The range can contain weekends and market holidays; only available trading
days appear in items.
Production use
- Set a request timeout and retry HTTP 502 or 503 with exponential backoff and jitter.
- Do not retry invalid requests (400) or unknown quote/profile symbols (404) unchanged.
- Honor the private
Cache-Controlresponse; quotes update more often than profiles or financial statements. - Treat nullable fields as missing data, not zero.
- Store source URLs with news-derived claims so a person or agent can inspect the article.
See Data behavior before using the API in automated decisions.