CLI
The thesma CLI ships with the Python SDK — no separate install. It mirrors every SDK method as a resource-scoped command, reads your API key from the environment, and defaults to human-readable table output with --format json / --format csv escape hatches for scripting.
Install
Section titled “Install”pip install thesmathesma --helpThe thesma command appears on $PATH as soon as the package is installed. Requires Python 3.10+.
Authenticate
Section titled “Authenticate”export THESMA_API_KEY="gd_live_..."The CLI reads THESMA_API_KEY from the environment. There is deliberately no --key flag — keys in shell history are a footgun.
Command shape
Section titled “Command shape”Every command follows thesma <resource> <verb> [target] [flags]:
thesma companies listthesma companies get AAPLthesma financials get AAPL --period annual --limit 5thesma insider-trades list AAPLRun thesma <resource> --help for per-resource usage.
Resources
Section titled “Resources”SEC EDGAR
Section titled “SEC EDGAR”thesma companies list # paginated listthesma companies get AAPL # single companythesma companies get AAPL --include labor,lending # with enrichmentthesma filings list --cik AAPL --form 10-K # filingsthesma financials get AAPL --period annual --limit 5thesma ratios get AAPLthesma events list --cik AAPL --category earningsthesma insider-trades list AAPLthesma holdings list AAPL # institutional holdersthesma compensation get AAPL # executive compensationthesma screener run --revenue-min 1000000000 --roe-min 0.15thesma sections search "electric vehicle supply chain"thesma funds list # 13F filersUS Census
Section titled “US Census”thesma census places get 35620 # MSA by FIPSthesma census metrics list # all 26 metricsthesma census metrics get median_household_income --fips 35620US BLS
Section titled “US BLS”thesma bls industries listthesma bls industries employment 3254 --from 2020-01 --to 2025-12thesma bls states unemployment 06 # California LAUSthesma bls occupations wages 15-1252 # Software developersUS SBA
Section titled “US SBA”thesma sba counties lending 06037 # Los Angeles Countythesma sba states lending 06thesma sba industries lending 236220thesma sba lenders list --limit 20Bulk export
Section titled “Bulk export”thesma export financials --since 2024-01-01 --format csv > financials.csvthesma export insider-trades --since 2024-01-01 --format jsonl > trades.jsonlthesma export companies --format csv > companies.csvExports stream — they start writing output immediately, so the file grows as the data arrives. Safe for tens of thousands of records.
Output formats
Section titled “Output formats”Default is a human-readable table; --format json or --format csv for scripting.
# Human-readable (default)thesma financials get AAPL --period annual --limit 3
# JSONthesma financials get AAPL --period annual --limit 3 --format json
# CSV (pipe to a file or downstream tool)thesma financials get AAPL --period annual --limit 3 --format csv > apple.csv
# JSONL (one record per line, pipe-friendly)thesma companies list --format jsonl | jq -r '.ticker' | sort -u | headCross-dataset enrichment
Section titled “Cross-dataset enrichment”The --include flag mirrors the HTTP ?include= parameter. Pass a comma-separated list:
thesma companies get AAPL --include labor,lendingThe enriched labor_context and lending_context fields render inline in table output; in JSON output they’re nested objects.
Pagination
Section titled “Pagination”List commands auto-paginate when you pipe output — iteration is transparent. Limit with --limit:
# First 500 companiesthesma companies list --limit 500 --format jsonl | wc -l
# All companies (auto-paginates)thesma companies list --format jsonl | wc -l # ~6005Rate-limit awareness
Section titled “Rate-limit awareness”The CLI respects Retry-After headers on 429s, prints a progress line when waiting, and retries on 5xx with exponential backoff. Nothing to configure — it matches the SDK’s default behavior.
If you want to abort early instead of retrying, set THESMA_NO_RETRY=1.
Useful recipes
Section titled “Useful recipes”Get all 13F holdings of Berkshire Hathaway:
thesma funds get 0001067983 --include holdings --format jsonl \ | jq -r '.holding_ticker, .shares, .market_value'Screen for profitable pharma companies:
thesma screener run \ --sic 2834 \ --roe-min 0.15 \ --revenue-min 100000000 \ --format csv > screen.csvPull monthly employment for semiconductors (NAICS 3344) over 10 years:
thesma bls industries employment 3344 \ --from 2015-01 --to 2025-12 \ --format csv > semi.csvExit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 | Success |
1 | Generic error |
2 | Validation error (bad flag, missing argument) |
3 | Auth error (missing / invalid key) |
4 | Rate limited (after retries exhausted) |
5 | Network error (after retries exhausted) |
Safe to use in shell pipelines with set -e.
See also
Section titled “See also”- Python SDK — the CLI is a thin wrapper over the SDK
- Authentication —
gd_live_key format - Quickstart — zero-to-first-call in five minutes