{"slug": "use-the-signal8-api-in-python-sec-filings-insider-trades-and-quotes-with", "title": "Use the Signal8 API in Python: SEC filings, insider trades and quotes with requests", "summary": "A developer published a Python walkthrough for the Signal8 API, showing how to pull SEC filings, Form 4 insider trades and stock quotes using the requests library. The guide includes a reusable client that handles 429 rate limits via the Retry-After header and a cursor-based polling loop that fetches each new filing once from the real-time stream. Signal8 Pro, priced at $29.50 per month, provides 120 requests per minute and 10,000 per day.", "body_md": "To call the Signal8 API from Python, send a GET request with `requests` to `https://api.signal8.ai/api/v1/public` and your API key in the `X-Api-Key` header. Below: a first request, a small client that waits out 429 rate limits, Form 4 insider trades, and a loop that picks up each new SEC filing once using a cursor.\n\n`sk_live_` (or `sk_test_` for a test key). Signal8 Pro ($29.50/mo or $294/yr, no free trial) includes the REST API, the MCP server and the streams, at 120 requests a minute and 10,000 a day, with up to 3 API keys.`pip install requests`.` SIGNAL8_API_KEY` instead of writing it into the script.\nEvery response is JSON. Successful ones put the result under `data`; errors put `code` and `message` under `error`.\n\n**Python: get a quote**\n\n``` python\n# pip install requests\nimport os\nimport requests\n\nr = requests.get(\n    \"https://api.signal8.ai/api/v1/public/companies/AAPL/quote\",\n    headers={\"X-Api-Key\": os.environ[\"SIGNAL8_API_KEY\"]},\n    timeout=30,\n)\nr.raise_for_status()\nquote = r.json()[\"data\"]\nprint(quote[\"ticker\"], quote[\"currentPrice\"], quote[\"changePercent\"])\n```\n\nPro allows 120 requests a minute and 10,000 a day. Past the per-minute limit the API answers 429 `RATE_LIMIT_EXCEEDED` with a `Retry-After` header in seconds; past the daily limit it answers 429 `DAILY_LIMIT_EXCEEDED`, which resets at midnight UTC. The client below sleeps on the first and stops on the second.\n\n**Python: signal8_client.py**\n\n``` python\n# signal8_client.py: a small client with rate-limit handling.\nimport os\nimport time\nimport requests\n\nBASE = \"https://api.signal8.ai/api/v1/public\"\nsession = requests.Session()\nsession.headers[\"X-Api-Key\"] = os.environ[\"SIGNAL8_API_KEY\"]\n\nclass Signal8Error(Exception):\n    pass\n\ndef get(path, **params):\n    \"\"\"GET a Signal8 endpoint and return the decoded JSON body.\"\"\"\n    for _ in range(5):\n        r = session.get(BASE + path, params=params, timeout=30)\n        if r.status_code == 429:\n            error = r.json().get(\"error\", {})\n            if error.get(\"code\") == \"DAILY_LIMIT_EXCEEDED\":\n                raise Signal8Error(error.get(\"message\"))  # resets at midnight UTC\n            time.sleep(int(r.headers.get(\"Retry-After\", \"5\")))\n            continue\n        if not r.ok:\n            error = r.json().get(\"error\", {})\n            raise Signal8Error(f\"{r.status_code} {error.get('code')}: {error.get('message')}\")\n        return r.json()\n    raise Signal8Error(\"still rate limited after 5 tries\")\n```\n\nEvery response also carries `X-RateLimit-Remaining` and `X-DailyLimit-Remaining`, so a batch job can slow down before it hits either limit.\n\n`/intelligence/{ticker}/insider-transactions` returns each Form 4 transaction with the insider, title, date, shares, price and value. `transactionCode=P` keeps open-market purchases; `S` is a sale, `A` an award, `M` an option exercise.\n\n**Python: recent insider purchases**\n\n``` python\nfrom signal8_client import get\n\npage = get(\"/intelligence/AAPL/insider-transactions\", transactionCode=\"P\", limit=20)\nfor t in page[\"data\"][\"transactions\"]:\n    print(t[\"transactionDate\"][:10], t[\"insiderName\"], t[\"insiderTitle\"],\n          t[\"shares\"], \"@\", t[\"pricePerShare\"])\n```\n\n`/stream/events` returns the events of the real-time stream as pages. Keep the `next_cursor` and send it as `since` on the next call to get only what arrived after it. When `has_more` is true, call again straight away. Events are kept for 24 hours.\n\n**Python: a polling loop**\n\n``` python\nimport time\nfrom pathlib import Path\n\nfrom signal8_client import get\n\nCURSOR_FILE = Path(\"signal8-cursor.txt\")\n\ndef poll_once():\n    params = {\"channels\": \"filings\", \"forms\": \"8-K,S-1,424B*\", \"limit\": 200}\n    if CURSOR_FILE.exists():\n        params[\"since\"] = CURSOR_FILE.read_text().strip()\n    page = get(\"/stream/events\", **params)[\"data\"]\n    for event in page[\"events\"]:\n        f = event[\"data\"]\n        print(f[\"accepted_at\"], f[\"form\"], f[\"company\"], f[\"tickers\"], f[\"filing_url\"])\n    if page[\"next_cursor\"]:\n        CURSOR_FILE.write_text(page[\"next_cursor\"])  # save after handling the events\n    return page[\"has_more\"]\n\nwhile True:\n    if not poll_once():\n        time.sleep(60)\n```\n\nFilters match the stream: `tickers`, `ciks`, `forms` (a trailing `*` matches a family), `items` for 8-K items, `market_cap_min` and `market_cap_max` in US dollars, and `channels` (for example `filings`, `filings.ai`, `press_releases` and `press_releases.ai`). A filter on a figure we do not have never matches: an unknown market cap fails a market cap filter.\n\nFor filings the moment we see them, without polling, open the WebSocket at `wss://api.signal8.ai/api/v1/stream` with the same key. One key can hold 2 connections at once. The [Python streaming tutorial](https://signal8.ai/developer/streams/stream-sec-filings-python) builds a full alert bot with reconnects and cursor resume, and the [protocol reference](https://signal8.ai/developer/streams/protocol) lists every message.\n\n| Status and code | What it means | \n|---|---|\n| 401 `API_KEY_REQUIRED` | No key was sent, or the header value is not a Signal8 key. Send `X-Api-Key: sk_live_...` . | \n| 401 `INVALID_API_KEY` | The key is wrong, revoked, rotated or expired. | \n| 403 `PRO_REQUIRED` | The key's account is on the Free plan. The API is part of Signal8 Pro. | \n| 429 `RATE_LIMIT_EXCEEDED` | Over 120 requests in a minute. Wait for `Retry-After` seconds. | \n| 429 `DAILY_LIMIT_EXCEEDED` | Over 10,000 requests today. Resets at midnight UTC. | \n| 400 `BAD_FILTER` /`BAD_CURSOR` | A stream filter failed validation, or `since` is not a cursor we issued. | \n\nEach one is covered in [Troubleshooting](https://signal8.ai/developer/troubleshooting).\n\n**Is there a Signal8 Python SDK?**\n\nYes. `pip install signal8` installs a thin client (Python 3.9 or newer, its only dependency is requests) whose methods return the API JSON unchanged. You do not need it: the API is plain HTTPS and JSON, and the requests examples in this article are a complete client.\n\n**How do I authenticate to the Signal8 API in Python?**\n\nSend your key in the X-Api-Key header, for example requests.get(url, headers={\"X-Api-Key\": key}). An Authorization: Bearer header with the key also works.\n\n**How many requests can my Python script make?**\n\nSignal8 Pro allows 120 requests a minute and 10,000 a day, with up to 3 API keys. Responses that served nothing (400, 404 or a 5xx) give their daily count back, up to a cap.\n\nThe original guide, kept up to date, is on Signal8: [signal8.ai/integrations/python](https://signal8.ai/integrations/python).", "url": "https://wpnews.pro/news/use-the-signal8-api-in-python-sec-filings-insider-trades-and-quotes-with", "canonical_source": "https://dev.to/signal8/use-the-signal8-api-in-python-sec-filings-insider-trades-and-quotes-with-requests-5ec0", "published_at": "2026-12-05 07:39:12+00:00", "updated_at": "2026-12-05 07:52:46.402982+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools"], "entities": ["Signal8", "SEC", "Python", "requests"], "also_reported_by": [], "takeaway": "Signal8's API returns 429 with a Retry-After header for per-minute limits and a DAILY_LIMIT_EXCEEDED code for daily caps, so a client should sleep on the former and stop on the latter while persisting next_cursor to avoid reprocessing stream events.", "recommendation": {"advice": "Persist the stream's next_cursor and pass it as since on each poll, and back off using the Retry-After header on 429s while stopping on DAILY_LIMIT_EXCEEDED.", "playbook": "production-ops", "playbook_url": "https://wpnews.pro/playbooks/production-ops"}, "alternates": {"html": "https://wpnews.pro/news/use-the-signal8-api-in-python-sec-filings-insider-trades-and-quotes-with", "markdown": "https://wpnews.pro/news/use-the-signal8-api-in-python-sec-filings-insider-trades-and-quotes-with.md", "text": "https://wpnews.pro/news/use-the-signal8-api-in-python-sec-filings-insider-trades-and-quotes-with.txt", "jsonld": "https://wpnews.pro/news/use-the-signal8-api-in-python-sec-filings-insider-trades-and-quotes-with.jsonld"}}