Regulations.gov API Python Client
Python client library for the Regulations.gov API v4, providing access to federal regulatory documents, comments, and dockets from the U.S. government's public rulemaking portal. Wraps the REST API with typed Python methods for searching and retrieving regulatory data.
Warnings
- breaking An API key from api.data.gov is required for all requests. Without it, every call returns a 403 error.
- gotcha The Regulations.gov API enforces strict rate limits (typically 1,000 requests per hour). Exceeding the limit returns HTTP 429 with no built-in retry in the client.
- gotcha The package name uses hyphens (regulations-gov-api) but the import uses underscores (regulations_gov_api). Mixing them up causes ImportError.
- gotcha API responses return nested JSON structures following the JSON:API specification. Document fields are under data[].attributes, not at the top level.
- gotcha The page_size parameter has a maximum of 250. Requesting more silently caps at 250 or returns an error depending on the endpoint.
Install
-
pip install requests
Imports
- RegulationsAPI
from regulations_gov_api import RegulationsAPI
Quickstart
import os
import requests
api_key = os.environ.get("REGULATIONS_GOV_API_KEY", "DEMO_KEY")
resp = requests.get(
"https://api.regulations.gov/v4/documents",
params={"api_key": api_key, "filter[searchTerm]": "climate", "page[size]": 5},
headers={"Accept": "application/json"}
)
resp.raise_for_status()
data = resp.json()
for doc in data.get("data", []):
print(doc["attributes"]["title"])