Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.1.0
info:
title: Oxford Ledge API
description: Oxford Ledge — REST API for equities, BDCs, fundamentals, macro, filings, and learning
content. See the narrative [Developer Guide](/docs/guide) for authentication, rate limits, and SDK
usage.
version: 1.0.0
paths:
/healthcheck:
get:
summary: Healthcheck Liveness
description: Liveness probe — returns immediately, no I/O. Used by Render.
operationId: healthcheck_liveness_healthcheck_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
head:
summary: Healthcheck Liveness
description: Liveness probe — returns immediately, no I/O. Used by Render.
operationId: healthcheck_liveness_healthcheck_head
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
/api/health/deep:
get:
summary: Api Health Deep Public
description: 'Deep health probe, MONITOR-facing body: {status, checks: {name:
ok|degraded|error}, release}. Runs the full probe (so every check and
every escalation log line still happens) and returns only the projection.
The per-check detail is admin-only.
Do NOT point Render''s healthcheck at this -- it bypasses the 60s cache
and can hammer PG (that is what /api/health is for).'
operationId: api_health_deep_public_api_health_deep_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/HealthDeepPublicResponse'
/api/health:
get:
summary: Api Health
description: 'Cached public health probe. ALWAYS cheap — never blocks on outbound.
That claim is now structural rather than aspirational: a stale provider
cache triggers a background refresh that this request does not await, so
the response time is independent of third-party latency. Before
2026-08-19 the refresh WAS awaited, and its ~8s worst case exceeded
Render''s 5s health-check budget.
Returns 503 until lifespan startup completes (CIK map loaded, billing
initialized, seed financials ready). Render health-check uses this
endpoint; pre-lifespan 200s caused routing to partially-initialized
workers for 5-15s post-deploy (S49 Performance P1).'
operationId: api_health_api_health_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/HealthResponse'
/api/data-status:
get:
summary: Api Data Status
description: 'Public data freshness: row counts + latest timestamps per pipeline.
Backs the /data-status page. Cached 60s per dyno. Safe to expose — no
PII, no secrets, only aggregate metadata.'
operationId: api_data_status_api_data_status_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/DataStatusResponse'
/api/health/providers:
get:
summary: Api Health Providers
description: "Public provider quota status — drives the degraded-UX banner.\n\nResponse shape (stable;\
\ frontend reads this verbatim):\n {\n providers: {\n fmp: {status, calls_today, daily_limit,\
\ pct_used},\n finnhub: {status, calls_today?, daily_limit?},\n },\n any_degraded:\
\ bool,\n any_exhausted: bool,\n }\n\nStatus thresholds (per provider):\n - exhausted: calls_today\
\ >= daily_limit (hard 429s expected)\n - degraded: calls_today >= 0.85 * daily_limit (banner\
\ trigger)\n - ok: below 0.85"
operationId: api_health_providers_api_health_providers_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ProviderQuotaResponse'
/api/health/running-job:
get:
summary: Api Health Running Job
description: 'Is a declared long-running shell job alive on this instance?
LIVENESS, added 2026-09-22. /persistent survives the container that wrote
the declaration, so a pid alone proves nothing: after the deploy that
killed the v49 fleet reparse, this endpoint still served `running: true`
for pid 4115 on a pod where that pid does not exist, and the pre-push hook
refused the RECOVERY push until an operator removed the file by hand.
services/running_job.py compares the declaration''s recorded writer
(release, host, pid start) against THIS instance; a provably dead writer
reads dead=True / running=False / stale=True, so even a pre-2026-09-22
hook that only knows `running` and `stale` degrades to its warn path.
An UNPROVABLE liveness is never treated as dead — it falls back to the
TTL, and says which it did in `liveness`.'
operationId: api_health_running_job_api_health_running_job_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/RunningJobResponse'
/api/data:
get:
tags:
- Market Data
summary: Consolidated ticker snapshot (price, metrics, debt, capital allocation, sparkline)
description: Full ticker data snapshot. The main data endpoint.
operationId: get_ticker_data_api_data_get
parameters:
- name: ticker
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Ticker
- name: symbol
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Symbol
- name: nocache
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Nocache
- name: fields
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Fields
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/TickerDataResponse'
'400':
description: Missing or invalid ticker parameter
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Ticker not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'422':
description: Invalid ticker format
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'429':
description: Rate limit exceeded
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Upstream data provider error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'503':
description: Data temporarily unavailable; retry after Retry-After seconds
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'504':
description: Upstream data provider timed out; retry after Retry-After seconds
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/api/tickers:
get:
summary: Get Tickers
description: List all loaded tickers.
operationId: get_tickers_api_tickers_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
items:
type: string
type: array
title: Response Get Tickers Api Tickers Get
/api/data-coverage:
get:
summary: Data Coverage
description: Show data source coverage for a ticker.
operationId: data_coverage_api_data_coverage_get
parameters:
- name: ticker
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Ticker
- name: symbol
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Symbol
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/DataCoverageResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/ticker/{ticker}/coverage:
get:
summary: Api Ticker Coverage
description: 'Return coverage manifest for a single ticker: price history depth,
fundamentals freshness, and a 4-tier classification (full / partial /
minimal / none). Cached 1-hour by the browser since coverage is a
daily-refresh artifact, not a live metric.'
operationId: api_ticker_coverage_api_ticker__ticker__coverage_get
parameters:
- name: ticker
in: path
required: true
schema:
type: string
title: Ticker
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/TickerCoverageResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/cache-stats:
get:
summary: Cache Stats
description: Cache statistics across all layers.
operationId: cache_stats_api_cache_stats_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/CacheStatsResponse'
/api/insider-summary:
get:
tags:
- Analysis
summary: Insider Summary
description: 'Insider transaction summary — PG-first (SEC Form 4), Finnhub fallback.
2026-05-16 P1 incident fix: this endpoint (the primary
`#insider-activity` panel''s source via peer-view) was Finnhub-ONLY.
When `FINNHUB_API_KEY` is unset/quota-limited/degraded it returned
empty or name-less rows → the panel rendered blank ("unknown" to the
user) while 384,118 rich, 100%-named, role-tagged Form 4 rows sat
UNUSED in `form4_transactions`. The `e8ac1dc4` repoint fixed
`/api/insiders`/SSR/digest but NOT this Finnhub path. Per
`feedback_local_data_fallback` (PG canonical when the API is
incomplete) we now read PG first via the (form4-backed)
`pg_get_insider_activity` and only fall back to Finnhub when PG has
nothing for the ticker. Emits `position` (OWNER directive — name is
signal-irrelevant; never blank) alongside the peer-view wire shape
(`{name,type,date,shares,value}` + `netAmount`); `type` is "Buy"/"Sell" for
P/S only (peer-view tests `tx.type.includes(''buy'')`); every other code
carries its Form 4 word and never moves `netAmount` (CHAOS 2026-10-11 MF-1).'
operationId: insider_summary_api_insider_summary_get
parameters:
- name: ticker
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Ticker
- name: symbol
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Symbol
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/InsiderSummaryResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/fund-search:
get:
summary: Fund Search
description: "Search for institutional fund 13F filers — LOCAL-FIRST.\n\n13F CYCLE 2026-06-11 Batch-1\
\ fix 1 (CHAOS F-1+F-3, GTM option A).\nThe original implementation phrase-quoted the input into\
\ LIVE SEC\nEDGAR full-text search over 13F-HR filings and returned hits[0] by\nFTS relevance\
\ — \"ARK\" (a dictionary word) resolved to a dormant\nfiler whose filings mention \"ark\", with\
\ the CORRECT ARK Investment\nManagement (CIK 0001697748) sitting unconsulted in our own curated\n\
universe. Fourth branded-common-word contamination incident\n(feedback_cusip_ticker_fuzzy_cross_issuer\
\ class).\n\nResolution order:\n 1. pg_search_filers_by_name — our curated CIK-bound universe\n\
\ (fund_holdings_snapshot ∪ featured_filers), prefix-ranked.\n 2. EDGAR FTS only on ZERO\
\ local hits — re-ranked by file_date\n desc with a ~2-quarter recency floor so dormant filers\
\ never\n rank above active ones."
operationId: fund_search_api_fund_search_get
parameters:
- name: q
in: query
required: false
schema:
type: string
default: ''
title: Q
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/FundSearchResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/fund-holdings:
get:
summary: Fund Holdings
description: 13F holdings for a given fund CIK. `max_holdings` caps the rows returned (1-500, default
50). Rows carry `ticker` (resolved symbol, else null) and `issuer_name`; no `cusip` is served.
operationId: fund_holdings_api_fund_holdings_get
parameters:
- name: cik
in: query
required: false
schema:
type: string
default: ''
title: Cik
- name: max_holdings
in: query
required: false
schema:
type: integer
maximum: 500
minimum: 1
default: 50
title: Max Holdings
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/FundHoldingsResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/cross-validate:
get:
summary: Cross Validate
description: Cross-validate data across Finnhub, FMP, and cache.
operationId: cross_validate_api_cross_validate_get
parameters:
- name: ticker
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Ticker
- name: symbol
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Symbol
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/CrossValidateResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/metrics:
post:
summary: Ingest Metrics
description: 'Receive telemetry beacons from the client (web vitals, fetch metrics, nav timing).
P3-31: CSRF protection intentionally omitted. This endpoint is called via
navigator.sendBeacon() which does not support custom request headers (including
X-CSRF-Token). The endpoint is telemetry-only (no state mutations, no PII writes),
and cross-origin requests are blocked by origin allowlist check below.'
operationId: ingest_metrics_api_metrics_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
/api/v1/schema:
get:
summary: Api Schema
description: Machine-readable endpoint catalog.
operationId: api_schema_api_v1_schema_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ApiSchemaResponse'
/api/schema:
get:
summary: Api Schema
description: Machine-readable endpoint catalog.
operationId: api_schema_api_schema_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ApiSchemaResponse'
/api/:
get:
summary: Api Schema
description: Machine-readable endpoint catalog.
operationId: api_schema_api__get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ApiSchemaResponse'
/api:
get:
summary: Api Schema
description: Machine-readable endpoint catalog.
operationId: api_schema_api_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ApiSchemaResponse'
/api/auth/challenge:
get:
tags:
- auth
- billing
summary: Auth Challenge
description: 'Issue a proof-of-work challenge for registration.
Returns a 32-char hex challenge valid for 5 minutes.
Client must find a nonce such that SHA256(challenge + nonce) starts with ''000''.
Also issues an anonymous CSRF token (stored in `ol_csrf` cookie + returned
in body) so the subsequent /api/auth/register POST can be protected by the
same `validate_csrf` dependency used everywhere else. Prior to this, register
relied on PoW + rate limit only, leaving it inconsistent with the rest of
the state-changing endpoints.'
operationId: auth_challenge_api_auth_challenge_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AuthActionResponse'
/api/auth/me:
get:
tags:
- auth
- billing
summary: Auth Me
description: 'Return current authenticated user info, tier, and CSRF token.
Mirrors the existing _handle_auth_me logic exactly:
- Checks trial status via billing module
- Returns tier (free / plus_trial / plus / pro / etc.)
- Extracts CSRF token from cookie for JS to use in X-CSRF-Token header
Also issues an anon CSRF token to unauthenticated callers — SSR
pages (e.g. /learn/<course>/<module>/) need this so the quiz-submit
flow can satisfy `validate_csrf` before sign-in. Symmetric to
`/api/auth/challenge`.'
operationId: auth_me_api_auth_me_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AuthMeResponse'
/api/auth/accept-terms:
post:
tags:
- auth
- billing
summary: Accept Terms
description: 'User-initiated re-acceptance of the current TERMS_VERSION.
ROADMAP P2 (2026-04-24). Called by the frontend
terms_reacceptance modal after the user clicks "I accept the
updated terms." Updates `users.terms_version` + `terms_accepted_at`
and writes an audit-log row so legal can prove the user
consented to a specific version.
The CSRF dependency + require_auth dependency together ensure
only the authenticated user can re-accept (not an XSRF or
impersonation attack). No request body — the version is read
server-side from `OL_TERMS_VERSION` so the client can''t lie
about which version they''re accepting.'
operationId: accept_terms_api_auth_accept_terms_post
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AuthActionResponse'
/api/auth/complete-age-verification:
post:
tags:
- auth
- billing
summary: Complete Age Verification
description: 'COPPA age-gate completion for OAuth-created users (v34).
OAuth signup skips the DOB collection that /api/auth/register enforces,
so new OAuth users land with oauth_age_pending=TRUE + date_of_birth=NULL.
This endpoint collects DOB (+ parental consent email for minors) and
flips the flag, matching the /register path''s compliance posture.'
operationId: complete_age_verification_api_auth_complete_age_verification_post
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AuthActionResponse'
/api/auth/oauth-config:
get:
tags:
- auth
- billing
summary: Oauth Config
description: Return OAuth provider configuration (client IDs only, no secrets).
operationId: oauth_config_api_auth_oauth_config_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AuthActionResponse'
/api/auth/oauth-state:
get:
tags:
- auth
- billing
summary: Oauth State
description: 'Generate a CSRF state token for the OAuth flow.
The client includes this state in the OAuth authorize URL;
the server validates it on callback to prevent CSRF.'
operationId: oauth_state_api_auth_oauth_state_get
parameters:
- name: provider
in: query
required: false
schema:
type: string
default: github
title: Provider
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AuthActionResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/auth/google/callback:
get:
tags:
- auth
- billing
summary: Google Oauth Callback
description: 'Google OAuth authorization code callback.
Google redirects here after user authorizes. We exchange the code
server-side, create/find the user, set session cookies, and redirect
to the dashboard.'
operationId: google_oauth_callback_auth_google_callback_get
parameters:
- name: code
in: query
required: false
schema:
type: string
default: ''
title: Code
- name: state
in: query
required: false
schema:
type: string
default: ''
title: State
- name: error
in: query
required: false
schema:
type: string
default: ''
title: Error
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/auth/github/callback:
get:
tags:
- auth
- billing
summary: Github Oauth Callback
description: GitHub OAuth authorization code callback.
operationId: github_oauth_callback_auth_github_callback_get
parameters:
- name: code
in: query
required: false
schema:
type: string
default: ''
title: Code
- name: state
in: query
required: false
schema:
type: string
default: ''
title: State
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/billing/trial-status:
get:
tags:
- auth
- billing
summary: Billing Trial Status
description: 'Return feature trial usage from the feature_trials table.
Returns {used, remaining, max} for the given feature.
Unauthenticated users get full trial allowance (encouraging signup).'
operationId: billing_trial_status_api_billing_trial_status_get
parameters:
- name: feature
in: query
required: false
schema:
type: string
default: ''
title: Feature
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/BillingActionResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/auth/refresh-tier:
get:
tags:
- auth
- billing
summary: Auth Refresh Tier
description: 'Re-read the user''s tier from PG and refresh the session cookie.
CR-H5 (2026-04-30): After Stripe Checkout the webhook can take 2–5s to
update the user''s tier. The frontend polls this endpoint (up to 10×, 1s
apart) until `tier` changes from the pre-checkout value, then dispatches
`ol-tier-refreshed` so TierGate re-evaluates gates without a page reload.
This is a read-only GET — no CSRF required (idempotent, no state change
on the server beyond reading PG). The session cookie is refreshed in-place
when the tier changes so subsequent /api/auth/me calls reflect the new tier
without the client needing a full logout/login cycle.
GET is exempt from validate_csrf per the auth-route convention: read-only
endpoints that carry no state mutation are guarded by require_auth (401)
rather than CSRF (403). See `auth_me` + `billing_trial_status` siblings
for prior art.'
operationId: auth_refresh_tier_api_auth_refresh_tier_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/TierRefreshResponse'
/api/auth/register:
post:
tags:
- auth
- billing
summary: Auth Register
description: 'User registration with proof-of-work verification.
Expects JSON body with: email, password, challenge, solution,
plus optional: displayName, dateOfBirth, parentalConsentEmail,
experience, useCase, referralSource, timezone.
The PoW challenge must have been obtained via GET /api/auth/challenge,
and SHA256(challenge + solution) must start with ''000''.'
operationId: auth_register_api_auth_register_post
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AuthActionResponse'
/api/auth/verify-email:
get:
tags:
- auth
- billing
summary: Auth Verify Email
description: 'The emailed verification link. A GET that CHANGES NOTHING.
2026-11-15 (external security review HIGH, account pre-hijacking): this
GET used to mark the address verified, clear the token and sign the
visitor in. Mail scanners and link prefetchers fetch links on their own,
so an address could be verified with nobody choosing to -- including an
address someone else had registered with a password of their choosing,
which a later OAuth sign-in by the real owner then linked onto.
It now only checks the token (read-only: purpose prefix, lookup, the
account/address binding) and redirects to the /verify-email confirm page,
where the person presses a button that POSTs the token
(routes/routes_auth_verify_fastapi.py). That POST is the only thing that
verifies, and it signs the person in. A bad or expired token redirects to
the same verify_error reasons as before.'
operationId: auth_verify_email_api_auth_verify_email_get
parameters:
- name: token
in: query
required: false
schema:
type: string
default: ''
title: Token
- name: next
in: query
required: false
schema:
type: string
default: ''
title: Next
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AuthActionResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
post:
tags:
- auth
- billing
summary: Auth Verify Email Confirm
description: 'Verify an address by redeeming its one-time token. JSON body
{token, next?}. On success: the address is verified, a session is
started (best-effort, as the old GET did -- EXT-AUDIT 4.1) and the body
carries the `redirect` the page should follow.'
operationId: auth_verify_email_confirm_api_auth_verify_email_post
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/VerifyEmailConfirmResponse'
/verify-email:
get:
tags:
- auth
- billing
summary: Serve Verify Email
operationId: serve_verify_email_verify_email_get
responses:
'200':
description: Successful Response
content:
text/html:
schema:
type: string
/api/auth/verify-email/preview:
post:
tags:
- auth
- billing
summary: Auth Verify Email Preview
description: 'The address a verify token confirms. READ-ONLY.
OWNER ruling T2 (2026-11-16; CISO+CHAOS P2 login CSRF). Someone can mail
a victim the verify link of an account THEY own; pressing the button
would sign the victim in to it. The confirm page calls this first and
shows the address, and its button stays disabled until it has. The same
# --- truncated at 32 KB (1099 KB total) ---
# Full source: https://artifacts.apis.io/oxfordledge-com/openapi/_original/oxfordledge-com-api-openapi.yml