How to Pull SEC Company Financials in Codex
Codex CLI is fast and terminal-native, but it has no built-in way to fetch financial data. When you need real revenue numbers, earnings per share, or balance sheet data for a public company, Codex is stuck guessing from training data. AgentPatch’s SEC Company Financials tool gives it direct access to SEC EDGAR XBRL filings.
Why This Matters
If you’re writing code that deals with financial data — whether it’s a reporting tool, a data pipeline, or even a quick analysis script — you need actual numbers to work with. Not approximations, not whatever the model remembers from its training set.
SEC EDGAR is the official source for US public company financials. Every 10-K and 10-Q filing is there in machine-readable XBRL format. But EDGAR’s API isn’t exactly developer-friendly, and parsing XBRL yourself is a project in its own right.
The SEC Company Financials tool handles all of that. Pass in a CIK number and you get back structured data: revenues, net income, assets, liabilities, stockholders’ equity, EPS, operating income, and cash position. Each entry includes the value, unit, reporting period, filing date, and form type (10-K or 10-Q). It costs 75 credits ($0.0075) per call.
Setup
Add AgentPatch to ~/.codex/config.toml:
[mcp_servers.agentpatch]
url = "https://agentpatch.ai/mcp"
bearer_token_env_var = "AGENTPATCH_API_KEY"
Then set your API key:
export AGENTPATCH_API_KEY=your_api_key
Replace your_api_key with your actual key from the AgentPatch dashboard. Codex discovers all AgentPatch tools automatically on next start.
Example
You’re building a financial data ingestion service and want to validate your schema against real SEC data. You tell Codex:
“Look up Tesla’s CIK number on SEC, then pull their financials for the last 3 years. Show me what the raw data shape looks like.”
Codex runs both tools:
Searching SEC for "Tesla"...
Found: Tesla Inc, CIK 0001318605
Pulling financials for CIK 0001318605 (years: 3)...
Response shape:
{
"company": { "cik": "0001318605", "name": "Tesla Inc" },
"facts": {
"Revenues": [
{ "value": 97690000000, "unit": "USD", "period": "2024-01-01 to 2024-12-31",
"filed": "2025-01-29", "form": "10-K" },
{ "value": 96773000000, "unit": "USD", "period": "2023-01-01 to 2023-12-31",
"filed": "2024-01-29", "form": "10-K" },
...
],
"NetIncomeLoss": [...],
"Assets": [...],
"Liabilities": [...],
"StockholdersEquity": [...],
"EarningsPerShareBasic": [...],
"OperatingIncomeLoss": [...],
"CashAndCashEquivalentsAtCarryingValue": [...]
}
}
Each fact array contains entries from both 10-K (annual) and 10-Q (quarterly) filings.
I can filter to annual-only if you want a cleaner view for your schema.
Codex fetched real SEC data and showed you the exact response shape. Now you can design your database schema or TypeScript types around actual data, not assumptions.
Wrapping Up
AgentPatch gives Codex access to official SEC financial data without you managing API keys or parsing XBRL. Use sec-company-search to find CIK numbers, then pull financials in a single call. The same AgentPatch connection also unlocks search, email, maps, and every other tool on the marketplace. See the full list at agentpatch.ai.