Skip to main content

openfilings

PyPI License: MIT Python

Official Python client for the OpenFilings API - primary-source regulatory filings, canonical cross-GAAP KPIs, and signed push webhooks across 16 markets (US, EU/ESEF, UK, Japan, Hong Kong, South Korea, China, Taiwan, India, Singapore, Australia, Canada, Brazil, Israel, UAE, Saudi Arabia).

pip install openfilings

Quickstart

from openfilings import Client

client = Client(api_key="of_...")  # or set OPENFILINGS_API_KEY

entity = client.entities.search(ticker="AAPL").entity
print(entity.canonical_key, [l.market_id for l in entity.listings])

filings = client.filings.list("AAPL", market_id="us", limit=5)
for f in filings.filings:
    print(f.form_type, f.filing_date, f.id)

financials = client.companies.financials(
    ticker="AAPL",
    market_id="us",
    fiscal_year_from=2020,
    fiscal_year_to=2024,
    line_items=["revenue", "ebitda", "gross_profit"],
)
for period in financials.periods:
    print(period.fiscal_year, period.values)

Get an API key from your dashboard: My Page -> API Keys on openfilings.org. Every response is a thin wrapper: documented fields are plain attributes (entity.canonical_key), and .raw / .to_dict() always has the full JSON - so a new field the API starts returning tomorrow is reachable today without an SDK upgrade.

Async

AsyncClient mirrors Client one-to-one:

import asyncio
from openfilings import AsyncClient

async def main() -> None:
    async with AsyncClient(api_key="of_...") as client:
        markets = await client.markets.list()
        print(markets.allowed_market_ids)

asyncio.run(main())

Resources

Resource Purpose
client.markets.list() Markets enabled on your plan - call first
client.entities.search(...) / .lookup(...) Resolve a company by name, ticker, LEI, or ISIN. When ambiguous, read entities
client.filings.discover(...) Cross-market filing discovery, one call
client.filings.list(ticker, ...) Filing history for one ticker/market
client.filings.resolve(...) Resolve one specific filing
client.filings.search(q, ...) Full-text search over filing section bodies
client.filings.kpis(filing_id) Canonical, cross-GAAP KPIs for one filing
client.filings.sections(filing_id) / .section(filing_id, key) Narrative sections (Item 1A, MD&A, ...)
client.companies.financials(...) Multi-year period series, no per-filing loop
client.companies.earnings(market, ticker) Street upcoming/recent earnings
client.companies.supply_chain(market, ticker) Named + anonymous supply-chain edges (price_correlations / price_correlation_n when computed)
client.companies.kpi_taxonomy() Valid line_items codes
client.companies.snapshot(market, ticker, ...) Live quote, market cap, and close history
client.notifications.list(...) Your alert inbox
client.watchlist.list() / .add(...) / .update(...) / .remove(...) Followed tickers
client.press.list_for_ticker(...) / .insider_transactions(...) Wire headlines + Form 4 (Pro+)
client.webhooks.list() / .create(...) / .update(...) / .delete(...) / .test(...) Manage push endpoints (Business)
client.people.search(...) / .get(slug) / .companies(slug) Officer/director/major-shareholder directory
client.people.insider_transactions(slug) Form 4 rows for one party (Pro+)
client.institutional.holders(market, ticker, ...) Form 13F managers holding an issuer
client.institutional.manager(manager_cik, ...) One 13F manager's full book
client.market.fx_rates() / .macro_rates(...) FX cross rates and CMT/gov/policy rate snapshots
client.market.weo(area, ...) / .weo_areas() IMF World Economic Outlook vintages (MCP get_macro)
client.events.for_ticker(ticker, ...) / .list(...) Lifecycle / Exits tape (M&A, delistings)
client.documents.list(...) / .get(id) / .download(id) Raw document archive (Business plan)

Webhooks

Business plan accounts can register a URL that receives a signed POST within seconds of a new filing, press release, or insider transaction matching your watchlist:

client.webhooks.create(
    "https://yourapp.example.com/openfilings-webhook",
    event_types=["filing.discovered"],
    secret="whsec_...",  # returned once - store it, later reads redact it
)

Verify deliveries with zero extra dependencies - openfilings.webhooks only needs the standard library, so it works in a Lambda handler without the rest of the SDK installed.

Recommended - FastAPI (pip install openfilings[fastapi]):

import os
from fastapi import Depends, FastAPI
from openfilings import Client
from openfilings.integrations.fastapi import openfilings_webhook_dependency
from openfilings.webhooks import WebhookEvent

app = FastAPI()
client = Client()  # OPENFILINGS_API_KEY
verify = openfilings_webhook_dependency(os.environ["OPENFILINGS_WEBHOOK_SECRET"])

@app.post("/openfilings-webhook")
async def on_filing(event: WebhookEvent = Depends(verify)) -> dict:
    if event.event == "filing.discovered":
        kpis = client.filings.kpis(event.data["filing_id"])
        # ... run your signal ...
    return {"ok": True}

Also Flask (pip install openfilings[flask]):

from openfilings.integrations.flask import verify_flask_webhook
event = verify_flask_webhook(request, SECRET)

Or call verify_webhook(raw_body, headers, secret) directly with the stdlib helper.

See examples/fastapi_webhook.py and examples/flask_webhook.py for complete handlers, and openfilings.org/docs/webhooks for the full event catalog, payload envelope, and retry policy.

Signature scheme

  • X-Webhook-Signature: sha256=<hex>
  • X-Webhook-Timestamp: <ISO 8601 UTC> - same value embedded in the JSON body's timestamp
  • Signature = HMAC-SHA256(secret, f"{timestamp}." + raw_body_bytes)
  • Envelope: {"event": "...", "version": "1", "timestamp": "...", "data": {...}}

Always verify against the raw request body bytes - re-serializing the parsed JSON before verifying will break the signature if key order or whitespace differs.

Error handling

from openfilings import Client, QuotaExceededError, UpgradeRequiredError, NotFoundError

client = Client(api_key="of_...")
try:
    client.press.list_for_ticker("AAPL")
except UpgradeRequiredError as exc:
    print(f"needs {exc.min_plan} plan - feature: {exc.feature}")
except QuotaExceededError as exc:
    print(f"quota exceeded ({exc.dimension}); retry after {exc.retry_after}s")
except NotFoundError:
    print("not found")

All exceptions inherit from openfilings.OpenFilingsError. HTTP 429 with a short Retry-After (<= 5s) is retried automatically (2 attempts by default, tune with max_retries=); longer waits - e.g. a daily quota reset - surface as QuotaExceededError instead of blocking your process.

Configuration

Environment variable Purpose Default
OPENFILINGS_API_KEY X-API-Key sent on every request -
OPENFILINGS_BASE_URL API base URL https://api.openfilings.org

Both can be overridden per-client: Client(api_key=..., base_url=...).

License

MIT - see LICENSE.

Metadata

Release files for openfilings 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openfilings 0.2.0
File Size Uploaded Provenance Actions
openfilings-0.2.0.tar.gz 72.6 kB Without provenance Details for openfilings-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openfilings 0.2.0
File Interpreter ABI Platform Actions
openfilings-0.2.0-py3-none-any.whl Python 3 none any Details for openfilings-0.2.0-py3-none-any.whl

Total release size: 109.7 kB

Release files / openfilings-0.2.0.tar.gz

Download URL openfilings-0.2.0.tar.gz
Size 72.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3ec2c825f0ffdee1932a69ac4b76eb258ea6bb7abf113e8e51985fe0ceb4bb39
BLAKE2b-256 checksum
How to use checksums
3d029b25cb1c3399688462cc2796d3ef48f4730c9ccc894f8a034d32744e7e12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / openfilings-0.2.0-py3-none-any.whl

Download URL openfilings-0.2.0-py3-none-any.whl
Size 37.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82c517510c26db143dd71d3ba627bd911b21ee5d323a5f1dcea81c22a032df35
BLAKE2b-256 checksum
How to use checksums
4f84cf8037685c9b427523ad7a01fb43b99cc8b1f3238803649cfa5d41e913cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for openfilings 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page