Skip to main content

filingrail — Python client for the SEC EDGAR REST API

A thin, async-and-sync Python client for the Filingrail API on RapidAPI. Wraps the 7 v1 endpoints, returns typed dataclasses, no Pydantic dependency.

Install

Live on PyPI (2026-06-04): pypi.org/project/filingrail.

pip install filingrail

Get an API key

Subscribe on RapidAPI: https://rapidapi.com/hudson-enterprises-llc-hudson-enterprises-llc-default/api/filingrail. Free tier = 50 calls/day, no card. Pro $9/mo for 5,000 calls.

Quickstart (sync)

from filingrail import FilingrailClient

with FilingrailClient(api_key="YOUR_X_RAPIDAPI_KEY") as client:
    # Resolve a ticker to its CIK
    [aapl] = client.search_companies("AAPL", limit=1)
    print(aapl.cik, aapl.name)  # 320193 Apple Inc.

    # Latest financials (balance sheet + income statement + cash flow)
    statements = client.get_financials("AAPL", limit=3)
    for s in statements:
        print(s.statement_type, s.period_end, s.line_items.get("total_assets"))

    # Recent insider trades
    trades = client.get_insider_trades("AAPL", limit=5)
    for t in trades:
        print(t.transaction_date, t.insider_name, t.shares, t.price_per_share)

    # Berkshire Hathaway's 13F holdings (CIK 1067983)
    holdings = client.get_13f_holdings(1067983, limit=10)
    for h in holdings:
        print(h.issuer_name, h.value_usd)

Quickstart (async)

import asyncio
from filingrail import AsyncFilingrailClient

async def main():
    async with AsyncFilingrailClient(api_key="YOUR_X_RAPIDAPI_KEY") as client:
        statements = await client.get_financials("MSFT")
        for s in statements:
            print(s.statement_type, s.period_end)

asyncio.run(main())

Environment variable

Set RAPIDAPI_KEY (or X_RAPIDAPI_KEY) and api_key becomes optional:

import os
os.environ["RAPIDAPI_KEY"] = "..."

from filingrail import FilingrailClient
client = FilingrailClient()

All endpoints

Method Endpoint
search_companies(q, limit) /v1/search/companies
get_recent_filings(form_type, cik, limit) /v1/filings/recent
get_financials(ticker_or_cik, limit) /v1/companies/{id}/financials
get_financials_history(ticker_or_cik, period, limit, statement_type, line_item) /v1/companies/{id}/financials/history
get_insider_trades(ticker_or_cik, since, limit) /v1/companies/{id}/insider-trades
get_8k_events(ticker_or_cik, since, limit) /v1/companies/{id}/8k-events
get_13f_holdings(institution_cik, quarter, limit) /v1/institutions/{cik}/13f-holdings
health() /health

Errors

All non-2xx responses raise FilingrailError(message, status, detail). The detail is the parsed body when available, so you can pull out RapidAPI's specific error messages.

from filingrail import FilingrailClient, FilingrailError

try:
    client = FilingrailClient(api_key="wrong")
    client.search_companies("AAPL")
except FilingrailError as e:
    print(f"status={e.status} message={e}")

Why this exists

You could call httpx.get("https://filingrail.p.rapidapi.com/v1/...", headers=...) directly. The SDK saves you:

  • typed responses (autocomplete in your IDE)
  • no boilerplate for the RapidAPI auth headers
  • consistent error handling
  • example queries that match the canonical patterns documented in the RapidAPI listing's Docs tab

Links

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

filingrail-0.1.1.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

filingrail-0.1.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file filingrail-0.1.1.tar.gz.

File metadata

  • Download URL: filingrail-0.1.1.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for filingrail-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9bd4953aa060dc602f64f9e0bde966a516d4eb11b99b756f995d1ad047dee9cd
MD5 738597703b7c42c025317535b25bd531
BLAKE2b-256 1c26cfc8f934ff6ec2fb4c8d7541d9e9e3a3d561f79513861430189e62762196

See more details on using hashes here.

File details

Details for the file filingrail-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: filingrail-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for filingrail-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 96e59d756d14262d8a1a3722e8d4579d18aff944fc1a68758740f9cf2af36478
MD5 770c4ad2b2815fa81855d9d94930a0b6
BLAKE2b-256 6d1eeaf5a04119cc4f7dfdff6ca4c52d27bd172e0ca12ad50ffeb5e9f84743ce

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

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