An Overview of Federal Register Public API

The Federal Register Public API is a set of RESTful web services that provide access to data and tools from the Federal Register. The API currently has two end-points: Documents and Search. Each end-point provides various functionalities.

In this blog, we will take a deep dive into the Federal Register Public API and provide examples of how to consume the API using JavaScript.

JavaScript Examples for Federal Register Public API

Documents Endpoint

The Documents end-point provides access to search and retrieve information about individual documents. Here is an example of how to retrieve the document in JavaScript:

fetch('https://www.federalregister.gov/api/v1/documents/2019-24499')
  .then((response) => response.json())
  .then((data) => console.log(data))

This code will log the JSON data for the document with document number "2019-24499".

Search Endpoint

The Search end-point provides access to search and retrieve information about multiple documents based on specific criteria. Here is an example of how to search for documents related to "Environmental Protection Agency" in JavaScript:

const params = new URLSearchParams({
  conditions: '[{"field":"agency","value":"environmental-protection-agency"}]',
  order: 'oldest',
  per_page: 10
})

fetch(`https://www.federalregister.gov/api/v1/documents.json?${params}`)
  .then((response) => response.json())
  .then((data) => console.log(data))

This code will log JSON data for the 10 oldest documents related to "Environmental Protection Agency".

Conclusion

In this blog post, we have provided an overview of the Federal Register Public API and examples of how to consume the API using JavaScript. As you can see, the API is straightforward to use, and it provides a great deal of information that can be used for research and analysis. We encourage you to explore the Federal Register Public API and see what interesting information you can uncover.

Related APIs