Published: August 15, 2023
Today, we are thrilled to announce the release of our highly anticipated Search Service as part of the GovInfo API. The Search Service enables searching of GovInfo content and metadata using the same search terms as on the website, allowing for complex queries to target specific documents. This opens up a new world of possibilities for developers using the GovInfo API.
To issue a request to the service, issue a POST request to http://api.govinfo.gov/search with a request body that looks like:
{ "query":"federal API", "pageSize":"2", "offsetMark":"*", "sorts":[ { "field":"score", "sortOrder":"DESC" } ] }
Using our interactive documentation, simply copy the above into the request body field and click the execute button. If you need an API key, sign up for one here. To try the API before creating a key, use DEMO_KEY by clicking on the Authorize button at the top of the documentation page, adding it, and clicking Authorize.
This request is functionally equivalent to this search.
Here is an explanation of the request parameters.
The following parameters are optional:
Here are some quick tips that may be of use with the Search Service.
Additional examples of Search Service requests are available on our API repository on GitHub.
After a successful request, the Search Service will return a set of results formatted in json, with a set of fields intended to provide a good baseline of metadata and links for further exploration, including direct links to content and metadata.
For the sample request above, here is an example response.
{ "results": [ { "title": "Adjustments to the API.", "packageId": "CFR-2022-title47-vol3", "granuleId": "CFR-2022-title47-vol3-sec61-46", "lastModified": "2023-07-27T16:18:39Z", "governmentAuthor": [ "National Archives and Records Administration", "Office of the Federal Register" ], "dateIssued": "2022-10-01", "collectionCode": "CFR", "resultLink": "http://api.govinfo.gov/packages/CFR-2022-title47-vol3/granules/CFR-2022-title47-vol3-sec61-46/summary", "dateIngested": "2023-07-27", "download": { "premisLink": "http://api.govinfo.gov/packages/CFR-2022-title47-vol3/premis", "xmlLink": "http://api.govinfo.gov/packages/CFR-2022-title47-vol3/granules/CFR-2022-title47-vol3-sec61-46/xml", "zipLink": "http://api.govinfo.gov/packages/CFR-2022-title47-vol3/zip", "modsLink": "http://api.govinfo.gov/packages/CFR-2022-title47-vol3/granules/CFR-2022-title47-vol3-sec61-46/mods", "pdfLink": "http://api.govinfo.gov/packages/CFR-2022-title47-vol3/granules/CFR-2022-title47-vol3-sec61-46/pdf" } }, { "title": "Exceptions to the definition of an API.", "packageId": "CFR-2022-title26-vol13", "granuleId": "CFR-2022-title26-vol13-sec1-1061-3", "lastModified": "2023-03-07T23:32:43Z", "governmentAuthor": [ "National Archives and Records Administration", "Office of the Federal Register" ], "dateIssued": "2022-04-01", "collectionCode": "CFR", "resultLink": "http://api.govinfo.gov/packages/CFR-2022-title26-vol13/granules/CFR-2022-title26-vol13-sec1-1061-3/summary", "dateIngested": "2023-03-07", "download": { "premisLink": "http://api.govinfo.gov/packages/CFR-2022-title26-vol13/premis", "xmlLink": "http://api.govinfo.gov/packages/CFR-2022-title26-vol13/granules/CFR-2022-title26-vol13-sec1-1061-3/xml", "zipLink": "http://api.govinfo.gov/packages/CFR-2022-title26-vol13/zip", "modsLink": "http://api.govinfo.gov/packages/CFR-2022-title26-vol13/granules/CFR-2022-title26-vol13-sec1-1061-3/mods", "pdfLink": "http://api.govinfo.gov/packages/CFR-2022-title26-vol13/granules/CFR-2022-title26-vol13-sec1-1061-3/pdf" } } ], "offsetMark": "AoIIQtxvuD8aQ0ZSLTIwMjItdGl0bGUyNi12b2wxMy1DRlItMjAyMi10aXRsZTI2LXZvbDEzLXNlYzEtMTA2MS0z", "count": 15668 }
We are excited to hear your thoughts on the new Search Service!
To provide feedback, please create a new issue on the GovInfo API GitHub repository.
We will review user feedback and incorporate changes and enhancements to the Search Service in the future. Changes will be announced ahead of time via issues with an upcoming label and an assigned milestone . Once we have a sense that the main functionality is satisfactory to the majority of users, we will remove the Public Preview label and announce the Search Service as production-ready, meaning that further changes will be enhancements only and non-breaking.