DEV Community

Your Evenings Data
Your Evenings Data

Posted on

Federal Register API in Python: final rules taking effect in the next 30 days, by CFR title, in a CSV

Article type: How-to guide (one task: list the final federal rules that take effect in the next 30 days, one row per CFR title, in a CSV)

Prerequisites: Python 3.9+ and the requests package. FederalRegister.gov needs no key and no sign-up. You need an Apify account only for the last section.

Tested on: 25 November 2026 (live API).

A final rule doesn't change the Code of Federal Regulations (CFR) on the day it's published but on its effective date, which can be weeks or years later. If you keep a compliance calendar, the useful list is "what takes effect next month, in the CFR titles I follow", and the Federal Register API can build it with a short Python script and no key. This guide does that and saves it as a CSV with one row per CFR title.

Everything below uses a single endpoint:

GET https://www.federalregister.gov/api/v1/documents.json

with conditions[type][]=RULE (final rules) and conditions[effective_date][gte] / [lte] (an effective-date range, YYYY-MM-DD). Each result can include effective_on, the dates paragraph and cfr_references if you ask for those fields.

How do I find federal rules taking effect soon with the Federal Register API?

Save this as effective_dates.py and run python effective_dates.py (next 30 days) or python effective_dates.py 90:

import csv
import re
import sys
import time
from collections import Counter
from datetime import date, timedelta
from urllib.robotparser import RobotFileParser

import requests

DAYS = int(sys.argv[1]) if len(sys.argv) > 1 else 30
API = "https://www.federalregister.gov/api/v1/documents.json"
FIELDS = ["document_number", "title", "action", "agencies", "publication_date", "effective_on",
          "dates", "cfr_references", "significant", "html_url"]
DATE = re.compile(r"(?:January|February|March|April|May|June|July|August|September|October|November|December)"
                  r" \d{1,2}, \d{4}")

session = requests.Session()
UA = "federal-register-effective-dates-tutorial/1.0 (python-requests)"
session.headers["User-Agent"] = UA

robots = RobotFileParser()
robots.parse(session.get("https://www.federalregister.gov/robots.txt", timeout=30).text.splitlines())
if not robots.can_fetch(UA, API):
    sys.exit("robots.txt disallows the API for this script")

# 1. Final rules (type RULE) whose effective date falls between tomorrow and DAYS from today.
#    No publication-date condition: some of these were published years ago.
start, end = date.today() + timedelta(days=1), date.today() + timedelta(days=DAYS)
params = [("conditions[type][]", "RULE"),
          ("conditions[effective_date][gte]", start.isoformat()),
          ("conditions[effective_date][lte]", end.isoformat()),
          ("per_page", "1000"), ("order", "oldest")] + [("fields[]", f) for f in FIELDS]
docs, url = [], API
while url:
    r = session.get(url, params=params if url == API else None, timeout=60)
    r.raise_for_status()
    page = r.json()
    docs += page.get("results", [])
    url = page.get("next_page_url")
    time.sleep(0.5)

# 2. One row per CFR title a rule changes, so you can filter to the titles you follow.
rows = []
for d in docs:
    eff = date.fromisoformat(d["effective_on"])
    # The DATES text can hold exceptions: parts effective earlier, later or "delayed indefinitely".
    text = d.get("dates") or ""
    notes = sorted(set(DATE.findall(text)) - {f"{eff:%B} {eff.day}, {eff.year}"})
    if "indefinitely" in text.lower():
        notes.append("delayed indefinitely")
    for title in sorted({c["title"] for c in d.get("cfr_references") or []}) or [""]:
        rows.append({
            "effective_on": d["effective_on"],
            "cfr_title": title,
            "cfr_parts": "; ".join(sorted({str(c["part"]) for c in d["cfr_references"] if c["title"] == title})) if title else "",
            "title": d["title"],
            "action": d.get("action") or "",
            "agencies": "; ".join(a.get("name") or a.get("raw_name", "") for a in d.get("agencies") or []),
            "published": d["publication_date"],
            "significant": d.get("significant"),
            "dates_note": "; ".join(notes),
            "document_number": d["document_number"],
            "federal_register_url": d["html_url"],
        })
rows.sort(key=lambda r: (r["effective_on"], str(r["cfr_title"])))
out = f"final_rules_effective_{start}_to_{end}.csv"
with open(out, "w", newline="") as f:
    w = csv.DictWriter(f, fieldnames=list(rows[0]))
    w.writeheader()
    w.writerows(rows)

# 3. What's in it.
print(f"{len(docs)} final rules take effect {start} to {end}; wrote {len(rows)} rows to {out}")
print(f"  {sum(d['publication_date'] < str(date.today().year) for d in docs)} were published before {date.today().year}")
print(f"  {sum(d['publication_date'] > date.today().isoformat() for d in docs)} are dated after today (published in advance)")
print(f"  {sum('direct final' in (d.get('action') or '').lower() for d in docs)} are direct final rules (can still be withdrawn)")
print(f"  {sum(bool(r['dates_note']) for r in rows)} rows have another date or 'delayed indefinitely' in the DATES text")
print(f"  {sum(bool(d.get('significant')) for d in docs)} are marked significant (EO 12866)")
print("  CFR titles with the most rules:")
for title, n in Counter(r["cfr_title"] for r in rows).most_common(5):
    print(f"    {title} CFR{n:>6}")
Enter fullscreen mode Exit fullscreen mode

Run on 25 November 2026, about 1 second:

98 final rules take effect 2026-11-26 to 2026-12-25; wrote 100 rows to final_rules_effective_2026-11-26_to_2026-12-25.csv
  3 were published before 2026
  0 are dated after today (published in advance)
  3 are direct final rules (can still be withdrawn)
  14 rows have another date or 'delayed indefinitely' in the DATES text
  11 are marked significant (EO 12866)
  CFR titles with the most rules:
    14 CFR    37
    40 CFR    11
    12 CFR     7
    30 CFR     5
    42 CFR     4
Enter fullscreen mode Exit fullscreen mode

A few rows of final_rules_effective_2026-11-26_to_2026-12-25.csv (titles cut, six columns shown):

effective_on,cfr_title,published,title,document_number,dates_note
2026-12-01,12,2024-09-30,"Simplification of Share Insurance Rules",2024-21888,"October 30, 2024"
2026-12-14,21,2026-10-13,"Use of Salt Substitutes To Reduce the Sodium ",2026-20848,"November 12, 2026"
2026-12-14,5,2026-10-15,"Family and Medical Leave Act",2026-21104,"November 16, 2026"
2026-12-17,47,2026-11-17,"Modernizing the Commission's National Environ",2026-23385,"delayed indefinitely"
Enter fullscreen mode Exit fullscreen mode

Of the 37 rules in Title 14 (Aeronautics and Space), 21 are FAA airworthiness directives, each about particular aircraft or engine models, and most of the rest are changes to airspace. If that's not your world, filter out cfr_title 14 and the list drops to 63 rows.

Design choices:

  • Effective date only, no publication date. The window is on effective_date alone. Adding "published in the last 30 days" would lose 34 of the 98 rules (gotcha 1).
  • One row per CFR title. Most people follow a few titles (12 for banking, 21 for food and drugs, 40 for the environment), so the CSV repeats a rule once for each title it changes. 98 rules gave 100 rows: one rule changes titles 26, 29 and 45.
  • A dates_note column. The script pulls any other date, or the words "delayed indefinitely", out of the dates paragraph, because effective_on holds one date and some rules have more (gotcha 2).
  • Fields named, 1,000 a page. The default result leaves out effective_on (it carries 10 fields), and the default page holds 20 results.

What can go wrong with an effective-date list?

  1. Effective soon doesn't mean published recently. Of the 98 rules, 16 were published in the last 7 days, 64 in the last 30 and 3 more than a year ago (the oldest in December 2023). The median gap from publication to effective date was 35 days; 16 rules had exactly 30 and 7 exactly 60.
  2. effective_on is one date; the rule may have several. Three dates paragraphs said "except". The share insurance rule above takes effect on 1 December 2026, except three amendments that took effect on 30 October 2024. The FCC's rule modernizing its National Environmental Policy Act rules takes effect on 17 December 2026, except 52 instructions "delayed indefinitely", and a 2023 rule effective 15 December 2026 has the same wording for some sections. Read the dates_note rows before you put a date in a calendar.
  3. Direct final rules can still be pulled. Three are in the list. The Family and Medical Leave Act rule takes effect on 14 December "unless significant adverse comments are received by November 16, 2026", an EPA rule on Nevada's underground storage tank program had a 23 November deadline with the same condition, and a Nuclear Regulatory Commission rule on materials licensing exemptions had a 4 November one. If comments come in, the agency publishes a withdrawal instead.
  4. An effective-date search can't see rules already in force. Of the 248 final rules published from 25 October to 25 November, 73 took effect on the day they were published, 21 before it (7 of them temporary closures and quota transfers, and 4 confirmations of a direct final rule's effective date), and 20 had no effective_on at all (notices of enforcement, published licences and similar). For "what changed this week", run a second search on publication_date.
  5. Dates must be ISO. conditions[effective_date][gte]=26/11/2026 returned HTTP 400 "Effective Date is not a valid date".

To change the task, add ("conditions[cfr][title]", "21") to params for one title, or ("conditions[agencies][]", "food-and-drug-administration") for one agency.

The hosted version (Disclosure: we built this)

Our Apify Actor, Federal Register API Scraper & Regulation Monitor, wraps this API. You can filter by document type, effective-date range (effectiveFrom, effectiveTo), CFR title and part, agency, words, docket, RIN and publication date, and rows include effectiveOn, the dates text, the CFR references and a link to the govInfo PDF (the official edition). Schedule it with monitorMode on and later runs give you only documents that are new to it.

Where it falls short for this task: it takes fixed effective dates, not "the next N days", so a scheduled search needs its dates updated; it doesn't split rows by CFR title or flag exceptions in the dates text; and its publication window defaults to the last 7 days, so set publishedWithinDays to 0 with an effective-date range. In a free local run with the default left on, the range below returned 16 of the 98 rules. It's pay per event; prices on the Actor's Pricing tab. For example (not run on the Apify platform for this post; a free local run of the Actor's code with this input on 25 November returned all 98):

{
  "mode": "documents",
  "documentTypes": ["RULE"],
  "publishedWithinDays": 0,
  "effectiveFrom": "2026-11-26",
  "effectiveTo": "2026-12-25",
  "maxResults": 0
}
Enter fullscreen mode Exit fullscreen mode

Federal Register API on Apify

Data: FederalRegister.gov API, read 25 November 2026. Federal Register documents are US government works. This post and the Actor are not affiliated with or endorsed by the Office of the Federal Register, the National Archives or any agency named.

Your Evenings

Top comments (0)