Getting started overview
The Federal Register API provides direct, programmatic access to the Federal Register's database of official U.S. government documents. This includes rules, proposed rules, notices, and presidential documents from federal agencies, departments, and organizations. The API is designed for public access, meaning developers can retrieve a wide range of government data without the need for an API key or a formal registration process for basic usage. This facilitates immediate integration for monitoring federal regulations, researching public policy, and integrating government data into applications.
The API is implemented as a RESTful web service, sending and receiving data primarily in JSON format. It supports standard HTTP methods such as GET for data retrieval. Developers can query documents, filter by various parameters like agency, date, or topic, and access structured information about agencies and public inspection documents. The official Federal Register developer resources serve as the primary source for detailed API documentation and examples.
To begin, developers will typically first explore the API's available endpoints and understand the structure of the data returned. The next step involves constructing requests, often starting with a simple query to retrieve a list of documents or agency information, and then processing the JSON responses programmatically. The API's accessibility without an authentication layer simplifies the initial setup, allowing a focus on data integration and application logic.
Create an account and get keys
The Federal Register API does not require an account or API keys for accessing public data. This means developers can begin making requests immediately after reviewing the API documentation. The design choice to remove an authentication layer for public data aims to maximize accessibility and ease of use for researchers, developers, and the public needing to query government information.
Unlike many commercial APIs, there is no signup process, no dashboard to generate keys, and no rate limit specific to individual API keys, because none are issued. Instead, rate limits are typically applied based on IP address or overall server load to ensure fair access for all users. Developers should consult the Federal Register API terms of service for any usage policies or potential limitations that may apply based on request volume.
This model simplifies the getting started process significantly, as it removes the typical overhead associated with API key management, rotation, and secure storage. Developers can focus directly on constructing API calls and integrating the returned data into their applications. While no key is required, it is good practice to include a descriptive User-Agent header with your requests, identifying your application, which can be helpful for troubleshooting and API usage monitoring by the Federal Register team.
Your first request
To make your first request to the Federal Register API, you will use a simple HTTP GET request. This example will retrieve a list of recent documents. The base URL for the API is https://www.federalregister.gov/api/v1/.
curl "https://www.federalregister.gov/api/v1/documents.json?per_page=5"
This curl command fetches the 5 most recent documents in JSON format. The documents.json endpoint is a common starting point for exploring the API. The per_page parameter limits the number of results returned, which is useful for testing and pagination.
Here's a breakdown of the request:
- Base URL:
https://www.federalregister.gov/api/v1/ - Endpoint:
documents.json(for retrieving a list of documents) - Query Parameters:
per_page=5: Limits the response to 5 documents.
A successful response will return a JSON object containing an array of document entries. Each entry will include metadata such as the document's title, publication date, agency, and a URL to its full text. An example (truncated for brevity) might look like this:
{
"count": 5,
"results": [
{
"document_number": "2026-12345",
"title": "Example Rulemaking Action",
"publication_date": "2026-05-28",
"type": "RULE",
"agencies": [
{
"name": "Environmental Protection Agency",
"slug": "environmental-protection-agency"
}
],
"html_url": "https://www.federalregister.gov/documents/2026/05/28/2026-12345/example-rulemaking-action"
}
// ... more documents
]
}
To use this in a programming language, consider the following Python example using the requests library:
import requests
url = "https://www.federalregister.gov/api/v1/documents.json"
params = {
"per_page": 5
}
try:
response = requests.get(url, params=params)
response.raise_for_status() # Raise an exception for HTTP errors
data = response.json()
print(f"Retrieved {data['count']} documents.")
for doc in data['results']:
print(f"- Title: {doc['title']}")
print(f" Agency: {', '.join([a['name'] for a in doc['agencies']])}")
print(f" Published: {doc['publication_date']}")
print(f" Link: {doc['html_url']}\n")
except requests.exceptions.HTTPError as http_err:
print(f"HTTP error occurred: {http_err}")
except requests.exceptions.ConnectionError as conn_err:
print(f"Connection error occurred: {conn_err}")
except requests.exceptions.Timeout as timeout_err:
print(f"Timeout error occurred: {timeout_err}")
except requests.exceptions.RequestException as req_err:
print(f"An unexpected error occurred: {req_err}")
Quick Reference Table
| Step | What to do | Where |
|---|---|---|
| 1. Review Documentation | Understand API endpoints and data models. | Federal Register Developer Resources |
| 2. No Key Needed | Proceed directly to making requests. | N/A (no account or key required) |
| 3. Construct Request | Formulate your first GET request to an endpoint like /documents.json. |
Your preferred HTTP client (e.g., curl, Python requests) |
| 4. Parse Response | Extract and process the JSON data returned. | Your application's code |
Common next steps
After successfully making your first request, several common next steps can enhance your integration with the Federal Register API:
- Explore Other Endpoints: The API offers various endpoints beyond
/documents.json, such as/agencies.jsonfor information about federal agencies, or more specific document searches. Refer to the API reference documentation to discover all available resources and their respective query parameters. - Implement Filtering and Pagination: For more targeted data retrieval, utilize the API's extensive filtering options. You can filter documents by publication date, agency, type (e.g., rule, notice), and more. Implement pagination (using
pageandper_pageparameters) to efficiently retrieve large datasets without hitting rate limits or overwhelming your application. - Error Handling: Implement robust error handling in your application. While the Federal Register API does not use API keys with specific error codes, it will return HTTP status codes (e.g.,
400 Bad Request,404 Not Found,500 Internal Server Error) that indicate issues with your request or the server. Gracefully handling these responses prevents application crashes and improves user experience. Understanding HTTP status codes is a fundamental aspect of API integration. - SDK Utilization: If you are working with Python, consider using the community-maintained Python SDK, if one is officially linked or commonly used. While the Federal Register documentation states Python SDKs are available, using a wrapper can simplify API interactions by abstracting HTTP requests and JSON parsing.
- Rate Limit Management: Be mindful of potential rate limits. Although specific limits are not tied to API keys, excessive requests from a single IP address can lead to temporary blocks. Implement sensible delays between requests, especially when performing bulk data retrieval, to avoid being rate-limited. Batching requests or using conditional GET requests (if supported with
ETagheaders) can also help. - Data Storage and Caching: For frequently accessed data, consider implementing a caching strategy. Storing retrieved data locally can reduce the number of API calls, improve application performance, and minimize the load on the Federal Register servers.
- Monitoring and Logging: Set up monitoring for your integration to track API call success rates, response times, and identify any errors. Comprehensive logging of API requests and responses can greatly assist in debugging and understanding application behavior.
Troubleshooting the first call
When your initial API request to the Federal Register encounters issues, here are common troubleshooting steps:
- Verify the URL and Endpoint: Double-check the base URL (
https://www.federalregister.gov/api/v1/) and the specific endpoint (e.g.,documents.json). A common mistake is typos in the URL path or using an incorrect file extension. Ensure.jsonis appended to endpoints where specified for JSON responses. - Check Query Parameters: Review your query parameters (e.g.,
per_page,qfor search). Ensure they are correctly formatted (param=value) and properly URL-encoded if they contain special characters. Incorrect parameter names or values can lead to400 Bad Requesterrors. - Inspect Network Connection: Confirm that your machine has an active internet connection and can reach
federalregister.gov. Network issues, firewalls, or proxy settings can prevent successful HTTP requests. - Examine HTTP Status Codes: The API will return standard HTTP status codes. For example:
200 OK: The request was successful.400 Bad Request: The server cannot process the request due to client error (e.g., malformed syntax, invalid request message framing, deceptive request routing).404 Not Found: The requested resource could not be found. This often means an incorrect endpoint or resource ID.5xx Server Error: An error occurred on the Federal Register's server. This usually indicates an issue beyond your control; try again later.
- Review Response Body for Error Messages: Even with a non-200 status code, the API often includes a JSON error message in the response body that provides specific details about what went wrong. Parse this message for guidance.
- Consult Official Documentation: Refer to the Federal Register developer documentation for endpoint-specific requirements, valid parameters, and common error scenarios. The documentation is the most authoritative source for API behavior.
- Test with cURL: If you are using a programming language, try replicating the request using
curlfrom your terminal first. This isolates whether the issue is with your code or the API call itself. A successfulcurlcommand confirms the API is reachable and the request format is correct. - Check Rate Limits: Although not tied to keys, aggressive querying can lead to temporary IP-based rate limiting. If you receive persistent
503 Service Unavailableor similar errors, try waiting for a few minutes before retrying.