POST to https://api.stockcontext.com/v1/tools/{name} with a JSON body and your key in the X-API-Key header.
This quickstart uses schema 2, the default wire. Add
{ "schema": 1 } only if you intentionally need the frozen legacy shape.1
Create an API key
Open the dashboard keys page athttps://stockcontext.com/dashboard/keys, create a key, and copy it before you close the dialog — the secret is shown once. Send it in the X-API-Key header on every request.2
Set your environment
3
Resolve a symbol
Start withstock_search to resolve a ticker, name, or CIK to a security and confirm it is covered.stock_search (trimmed)
coverage.financials: true means fundamentals are ingested and served. An unrecognized ticker or an uncovered security returns a typed refusal or a coverage reason; do not guess a value.4
Fetch verified financials
Ask for one annual period of Apple’s financials.detail: "full" adds the full provenance (sources, hashes) to each cell; the default concise omits it.stock_financials (trimmed)
5
Read values and refusals
Financial statements are columnar.data.periods is the header, and each data.fields.<name> array aligns to that header. A cell is either an exact decimal string, a JSON number for a computed ratio, or a typed refusal object.A value that is present:- Exact money, share-count, and per-share magnitudes are decimal strings. Parse them with a decimal type, not a float.
- Computed ratios such as
effective_tax_rate.values[0]can be plain JSON numbers. - Money units come from
data.reporting.reporting_currencyand field metadata. Do not assume money is USD.
v; d is display-only.A value that could not be proven from the filing:unavailable first. When it is present, there is no value — do not substitute 0 or null. The token tells you why and recovery.action tells an agent what to do next. The catalog of every refusal and recovery action is served by stock_reference with { "catalog": "refusal_tokens" }.Call it from code
Both clients branch on schema-2 refusal objects before using a cell.- Python
- TypeScript
financials.py
Next steps
Core concepts
The trust model behind every value.
Choose a tool
Map a question to the smallest set of calls.
Errors and refusals
Handle auth, rate limits, and refused values.