### govinfo API - Collections Endpoint Example
Source: https://github.com/usgpo/api/wiki/Transition-Guide
An example of a base request to the govinfo collections endpoint to see available collections. It includes a demo key for ease of use.
```JSON
{
"collections": [
{
"name": "BILLS",
"url": "/collections/BILLS"
},
{
"name": "BILLSTATUS",
"url": "/collections/BILLSTATUS"
}
]
}
```
--------------------------------
### GovInfo Packages Service - FR Example
Source: https://github.com/usgpo/api/blob/main/README.md
Example URL to retrieve the summary of a Federal Register package from the GovInfo Packages Service. Requires a package ID and optionally an API key.
```APIDOC
GET /packages/{packageId}/summary
Retrieve summary information for a specific package.
Parameters:
- packageId: The unique identifier for the package (e.g., FR-2018-04-12).
- api_key: Your API key (optional, for demo purposes).
Example:
https://api.govinfo.gov/packages/FR-2018-04-12/summary?api_key=DEMO_KEY
```
--------------------------------
### GovInfo Packages Service - BILLS Example
Source: https://github.com/usgpo/api/blob/main/README.md
Example URL to retrieve the summary of a Congressional Bill package from the GovInfo Packages Service. Requires a package ID and optionally an API key.
```APIDOC
GET /packages/{packageId}/summary
Retrieve summary information for a specific package.
Parameters:
- packageId: The unique identifier for the package (e.g., BILLS-115hr1625enr).
- api_key: Your API key (optional, for demo purposes).
Example:
https://api.govinfo.gov/packages/BILLS-115hr1625enr/summary?api_key=DEMO_KEY
```
--------------------------------
### GovInfo Packages Service - CREC Example
Source: https://github.com/usgpo/api/blob/main/README.md
Example URL to retrieve the summary of a Congressional Record package from the GovInfo Packages Service. Requires a package ID and optionally an API key.
```APIDOC
GET /packages/{packageId}/summary
Retrieve summary information for a specific package.
Parameters:
- packageId: The unique identifier for the package (e.g., CREC-2018-01-03).
- api_key: Your API key (optional, for demo purposes).
Example:
https://api.govinfo.gov/packages/CREC-2018-01-03/summary?api_key=DEMO_KEY
```
--------------------------------
### BILLSTATUS Sitemap Entry Example
Source: https://github.com/usgpo/api/wiki/Transition-Guide
This snippet demonstrates a sample entry within the BILLSTATUS sitemap, pointing to the XML file for a specific bill and its last modified date.
```xml
https://www.govinfo.gov/bulkdata/BILLSTATUS/113/s/BILLSTATUS-113s1422.xml
2017-02-19T21:59:00.100Z
monthly
1.0
```
--------------------------------
### GovInfo Packages Service - Download Links
Source: https://github.com/usgpo/api/blob/main/README.md
Example JSON structure showing download links for various content and metadata formats for a given package ID. It includes links for HTML, XML, PDF, MODS, PREMIS, and ZIP files, as well as related package information.
```json
"download": { \
"txtLink": "https://api.govinfo.gov/packages/BILLS-115hr1625enr/htm", \
"xmlLink": "https://api.govinfo.gov/packages/BILLS-115hr1625enr/xml", \
"pdfLink": "https://api.govinfo.gov/packages/BILLS-115hr1625enr/pdf", \
"modsLink": "https://api.govinfo.gov/packages/BILLS-115hr1625enr/mods", \
"premisLink": "https://api.govinfo.gov.govinfo/packages/BILLS-115hr1625enr/premis", \
"zipLink": "https://api.govinfo.gov/packages/BILLS-115hr1625enr/zip" \
}, \
"related": { \
"billStatusLink": "https://www.govinfo.gov/bulkdata/BILLSTATUS/115/hr/BILLSTATUS-115hr1625.xml" \
}
```
--------------------------------
### GovInfo Granules Service - CHRG Example
Source: https://github.com/usgpo/api/blob/main/README.md
Example URL to retrieve a list of granules for a specific Congressional Hearings package. Requires a package ID, offsetMark, and pageSize. An API key is optional.
```APIDOC
GET /packages/{packageId}/granules
Retrieve a list of granules for a specific package.
Parameters:
- packageId: The unique identifier for the package (e.g., CHRG-107shrg82483).
- offsetMark: Marker for pagination, typically '*'.
- pageSize: The number of results per page.
- api_key: Your API key (optional, for demo purposes).
Example:
https://api.govinfo.gov/packages/CHRG-107shrg82483/granules?offsetMark=*&pageSize=10&api_key=DEMO_KEY
```
--------------------------------
### GovInfo Granules Service - CREC Example
Source: https://github.com/usgpo/api/blob/main/README.md
Example URL to retrieve a list of granules for a specific Congressional Record package. Requires a package ID, offsetMark, and pageSize. An API key is optional.
```APIDOC
GET /packages/{packageId}/granules
Retrieve a list of granules for a specific package.
Parameters:
- packageId: The unique identifier for the package (e.g., CREC-2018-01-03).
- offsetMark: Marker for pagination, typically '*'.
- pageSize: The number of results per page.
- api_key: Your API key (optional, for demo purposes).
Example:
https://api.govinfo.gov/packages/CREC-2018-01-03/granules?offsetMark=*&pageSize=100&api_key=DEMO_KEY
```
--------------------------------
### BILLS Sitemap Entry Example
Source: https://github.com/usgpo/api/wiki/Transition-Guide
This snippet shows a sample entry within the BILLS sitemap, indicating the location and last modification date of a bill.
```xml
https://www.govinfo.gov/app/details/BILLS-115s3021enr
2018-10-31T10:43:38.699Z
monthly
1.0
```
--------------------------------
### GovInfo ZIP Generation Message
Source: https://github.com/usgpo/api/blob/main/README.md
Example JSON response when a ZIP file is generated upon request for a package. It indicates that the ZIP is being created and provides a recommended retry interval.
```json
{"message":"Generating ZIP file. Please retry your request again after 30 seconds"}
```
--------------------------------
### Construct Package Content Download Links
Source: https://github.com/usgpo/api/wiki/Transition-Guide
You can directly construct URLs to download specific content formats (like XML, PDF, or ZIP) for a given bill package using its `packageId`. Append the desired content type to the base package URL. An API key can be included in the URL path or via a header.
```APIDOC
Base URL Structure:
https://api.govinfo.gov/packages/{{packageId}}/{{contentType}}
Examples:
- XML: https://api.govinfo.gov/packages/BILLS-115s3021enr/xml?api_key=DEMO_KEY
- PDF: https://api.govinfo.gov/packages/BILLS-115s3021enr/pdf?api_key=DEMO_KEY
- ZIP: https://api.govinfo.gov/packages/BILLS-115s3021enr/zip?api_key=DEMO_KEY
Replace {{packageId}} with the actual package identifier and {{contentType}} with the desired format (e.g., 'xml', 'pdf', 'zip', 'htm').
```
--------------------------------
### GovInfo Search Service Sorting Parameters
Source: https://github.com/usgpo/api/blob/main/README.md
Documentation for recommended parameters for the 'sorts.field' in the Search Service. Lists supported fields, their sort order options, UI equivalents, and notes on usage.
```APIDOC
Search Service Sorting Parameters:
Supported fields for sorting:
- score: DESC (Relevance)
- publishdate: ASC, DESC (Date Old to New/New to Old)
- lastModified: ASC, DESC (sorts based on most recent add/update in GovInfo)
- title: ASC, DESC (Alphabetical(Z-A)/Alphabetical(A-Z))
```
--------------------------------
### govinfo API - Collections Endpoint
Source: https://github.com/usgpo/api/wiki/Transition-Guide
This API endpoint retrieves a list of available collections from the govinfo service. It requires an API key, which can be passed in the URL or as an 'X-Api-key' header.
```APIDOC
GET https://api.govinfo.gov/collections?api_key=DEMO_KEY
Description:
Retrieves a list of available collections from the govinfo service.
Parameters:
- api_key (string): Your API key for authentication. Recommended to pass via 'X-Api-Key' header.
Returns:
- JSON object containing a list of collections.
```
--------------------------------
### API Error Handling and Rate Limiting
Source: https://github.com/usgpo/api/blob/main/README.md
Explains common API error responses and rate limiting mechanisms, including status codes, headers, and recommended actions.
```APIDOC
503 Service Unavailable (for MODS or ZIP requests)
Description: Indicates that the requested granule MODS or ZIP file is being regenerated. The response includes a 'Retry-After' header with a value of 30 seconds, suggesting a retry interval.
429 Too Many Requests
Description: Indicates that the client has exceeded the API rate limit. The response includes 'X-RateLimit-Limit' and 'X-RateLimit-Remaining' headers to show the current rate limit status.
401 Unauthorized - API_KEY_MISSING
Description: Indicates that the request did not include a valid API key. Users should obtain a key or use the DEMO_KEY for testing.
```
--------------------------------
### GovInfo Search Service cURL Request
Source: https://github.com/usgpo/api/blob/main/README.md
A sample cURL request to the GovInfo Search Service. This demonstrates how to query the search engine with specific parameters like collection, nature of suit, court type, page size, offset mark, and sorting preferences.
```curl
curl --location 'https://api.govinfo.gov/search' \
--data '{ \
"query":"collection:(USCOURTS) and naturesuit:(Securities, Commodities, Exchange) courttype:appellate", \
"pageSize":"100", \
"offsetMark":"*", \
"sorts":[ \
{ \
"field":"score", \
"sortOrder":"DESC" \
} \
] \
}'
```
--------------------------------
### Collections Service Response Structure
Source: https://github.com/usgpo/api/wiki/Transition-Guide
The collections service returns a JSON object containing the total count of matching bills, a message (if any), links to the next and previous pages of results, and a list of 'packages'. Each package includes its ID, last modified date, a link to its summary, its document class, and its title.
```JSON
{
"count": 969,
"message": null,
"nextPage": "https://api.govinfo.gov/collections/BILLS/2018-10-30T10:37:40Z/2018-10-31T10:37:46Z?offset=100&pageSize=100",
"previousPage": null,
"packages": [
{
"packageId": "BILLS-115hr2464enr",
"lastModified": "2018-10-31T10:37:46Z",
"packageLink": "https://api.govinfo.gov/packages/BILLS-115hr2464enr/summary",
"docClass": "hr",
"title": "An Act To designate the facility of the United States Postal Service located at 25 New Chardon Street Lobby in Boston, Massachusetts, as the John Fitzgerald Kennedy Post Office."
},
{
"packageId": "BILLS-115hr1208enr",
"lastModified": "2018-10-31T10:37:46Z",
"packageLink": "https://api.govinfo.gov/packages/BILLS-115hr1208enr/summary",
"docClass": "hr",
"title": "An Act To designate the facility of the United States Postal Service located at 9155 Schaefer Road, Converse, Texas, as the Converse Veterans Post Office Building."
},
...
{
"packageId": "BILLS-115s3021enr",
"lastModified": "2018-10-31T10:37:45Z",
"packageLink": "https://api.govinfo.gov/packages/BILLS-115s3021enr/summary",
"docClass": "s",
"title": "America’s Water Infrastructure Act of 2018"
},
...
]
}
```
--------------------------------
### Retrieve Package Summary Metadata
Source: https://github.com/usgpo/api/wiki/Transition-Guide
You can retrieve detailed metadata for a specific bill package using its `packageId`. The `packageLink` from the collections service response points to this endpoint. The summary includes title, short titles, collection information, issue date, details link, package ID, download links for various formats (txt, xml, pdf, mods, premis, zip), and related bill status links.
```APIDOC
GET https://api.govinfo.gov/packages/{packageId}/summary?api_key={api_key}
Example:
GET https://api.govinfo.gov/packages/BILLS-115s3021enr/summary?api_key=DEMO_KEY
Response Structure (abbreviated):
{
"title": "An Act To provide for improvements to the rivers and harbors of the United States, to provide for the conservation and development of water and related resources, to provide for water pollution control activities, and for other purposes.",
"shortTitle": [
{
"type": "measure",
"title": "America’s Water Infrastructure Act of 2018"
},
{
"type": "level",
"level": "title",
"title": "Water Resources Development Act of 2018"
}
],
"collectionCode": "BILLS",
"collectionName": "Congressional Bills",
"category": "Bills and Statutes",
"dateIssued": "2018-10-24",
"detailsLink": "https://www.govinfo.gov/app/details/BILLS-115s3021enr",
"packageId": "BILLS-115s3021enr",
"download": {
"txtLink": "https://api.govinfo.gov/packages/BILLS-115s3021enr/htm",
"xmlLink": "https://api.govinfo.gov/packages/BILLS-115s3021enr/xml",
"pdfLink": "https://api.govinfo.gov/packages/BILLS-115s3021enr/pdf",
"modsLink": "https://api.govinfo.gov/packages/BILLS-115s3021enr/mods",
"premisLink": "https://api.govinfo.gov/packages/BILLS-115s3021enr/premis",
"zipLink": "https://api.govinfo.gov/packages/BILLS-115s3021enr/zip"
},
"related": {
"billStatusLink": "https://www.govinfo.gov/bulkdata/BILLSTATUS/115/s/BILLSTATUS-115s3021.xml"
}
}
```
--------------------------------
### Granule Summary API
Source: https://github.com/usgpo/api/blob/main/README.md
Fetches a JSON summary for a specific granule, providing basic metadata and links to all available content and metadata formats.
```APIDOC
GET https://api.govinfo.gov/packages/CREC-2018-07-10/granules/CREC-2018-07-10-pt1-PgD782/summary?api_key=DEMO_KEY
Parameters:
- api_key: Your API key for authentication.
Returns:
A JSON object with granule metadata and links to content.
```
```APIDOC
GET https://api.govinfo.gov/packages/FR-2018-04-12/granules/2018-07777/summary?api_key=DEMO_KEY
Parameters:
- api_key: Your API key for authentication.
Returns:
A JSON object with granule metadata and links to content.
```
```APIDOC
GET https://api.govinfo.gov/packages/CDIR-2018-10-29/granules/CDIR-2018-10-29-DE-S-2/summary?api_key=DEMO_KEY
Parameters:
- api_key: Your API key for authentication.
Returns:
A JSON object with granule metadata and collection-specific information.
```
--------------------------------
### Federal Register Granules API
Source: https://github.com/usgpo/api/blob/main/README.md
Retrieves a list of titles, granuleIds, and links to granule summaries for Federal Register packages. Supports pagination via offsetMark and pageSize.
```APIDOC
GET https://api.govinfo.gov/packages/FR-2018-04-12/granules?offsetMark=0&pageSize=100&api_key=DEMO_KEY
Parameters:
- offsetMark: The starting point for pagination.
- pageSize: The number of results to return per page.
- api_key: Your API key for authentication (DEMO_KEY for testing).
Returns:
A JSON object containing a list of granules, each with title, granuleId, and links to summary and content.
```
--------------------------------
### BILLSTATUS Bulkdata JSON Congress Directories
Source: https://github.com/usgpo/api/wiki/Transition-Guide
This JSON snippet illustrates the structure of the BILLSTATUS bulk data, listing directories for different Congresses and other resources.
```json
{
"files": [{
"formattedLastModifiedTime": "18-Feb-2016 03:40",
"name": "113",
"folder": true,
"displayLabel": "113th Congress (2013-2014)",
"link": "http://www.govinfo.gov/bulkdata/json/BILLSTATUS/113",
"justFileName": "113"
}, {
"formattedLastModifiedTime": "17-Feb-2016 04:58",
"name": "114",
"folder": true,
"displayLabel": "114th Congress (2015-2016)",
"link": "http://www.govinfo.gov/bulkdata/json/BILLSTATUS/114",
"justFileName": "114"
}, {
"formattedLastModifiedTime": "04-Jan-2017 08:19",
"name": "115",
"folder": true,
"displayLabel": "115th Congress (2017-2018)",
"link": "http://www.govinfo.gov/bulkdata/json/BILLSTATUS/115",
"justFileName": "115"
}, {
"formattedLastModifiedTime": "26-Jan-2017 02:35",
"name": "resources",
"folder": true,
"displayLabel": "resources",
"link": "http://www.govinfo.gov/bulkdata/json/BILLSTATUS/resources",
"justFileName": "resources"
}
]
}
```
--------------------------------
### BILLSTATUS Bulkdata JSON Root Directory
Source: https://github.com/usgpo/api/wiki/Transition-Guide
This JSON structure represents the root directory of the BILLSTATUS bulk data, showing metadata for the collection and its subfolders.
```json
{
"formattedLastModifiedTime": "26-Jan-2017 02:35",
"name": "BILLSTATUS",
"folder": true,
"displayLabel": "Bill Status",
"link": "http://www.govinfo.gov/bulkdata/json/BILLSTATUS",
"justFileName": "BILLSTATUS"
}
```
--------------------------------
### Find BILLS using Collections Service
Source: https://github.com/usgpo/api/wiki/Transition-Guide
This API endpoint allows you to find congressional bills within a specified date range. You can filter by `docClass` (e.g., 'h', 's') and paginate results using `pageSize` and `offset`. The `api_key` is required for access.
```APIDOC
GET https://api.govinfo.gov/collections/BILLS/{startTime}/{endTime}?pageSize={pageSize}&offset={offset}&api_key={api_key}&docClass={docClass}
Parameters:
- startTime: The start of the date range (ISO 8601 format).
- endTime: The end of the date range (ISO 8601 format, optional).
- pageSize: The number of results per page (e.g., 100).
- offset: The starting point for results.
- api_key: Your unique API key.
- docClass: Optional filter for bill type (e.g., 'h', 'hr', 's', 'sres').
```
--------------------------------
### GovInfo API - Collections Service
Source: https://github.com/usgpo/api/blob/main/README.md
Provides access to collections within the GovInfo system. Supports retrieving a list of all available collections or filtering by collection code and modification dates. Includes details on pagination and date parameter usage.
```APIDOC
OpenAPI/Swagger Specification:
https://api.govinfo.gov/docs
Base Collections Request:
GET https://api.govinfo.gov/collections?api_key=DEMO_KEY
- Retrieves a JSON list of available collections.
- Response includes: `collectionCode`, `collectionName`, `packageCount`, `granuleCount`.
- Responses are minified by default.
Collection Update Request:
GET https://api.govinfo.gov/collections/{collectionCode}/{lastModifiedStartDate}/?offsetMark=*&pageSize=100&api_key=DEMO_KEY
- Retrieves package IDs added or modified within a specified time frame for a given collection.
- Parameters:
- `collectionCode` (required): The code of the collection.
- `lastModifiedStartDate` (required): The start date for modification search (ISO 8601 format).
- `lastModifiedEndDate` (optional): The end date for modification search (ISO 8601 format).
- `offsetMark` (required for pagination): Use '*' for the initial request; the API provides the next offsetMark.
- `pageSize` (required): Maximum results per page (limited to 1000).
- `lastModified` parameter usage:
- Searches against the `lastModified` value of packages, reflecting additions or updates.
- Not equivalent to Date Published, Date Issued, or Date Ingested in MODS.
Example for Congressional Bills (BILLS) with lastModifiedStartDate:
GET https://api.govinfo.gov/collections/BILLS/2023-01-01T00:00:00Z/?offsetMark=*&pageSize=100&api_key=DEMO_KEY
- Retrieves BILLS packages modified since 2023-01-01T00:00:00Z.
```
--------------------------------
### GovInfo Published Service API
Source: https://github.com/usgpo/api/blob/main/README.md
The Published Service API allows retrieval of government packages based on their publication date (dateIssued). It supports filtering by date ranges, collections, and modification dates.
```APIDOC
Published Service API:
Format: https://api.govinfo.gov/published/{dateIssuedStartDate}/{dateIssuedEndDate}?offsetMark={startingRecord}&pageSize={number of records in call}&collection={comma-separated list of values}&api_key={your api.data.gov api key}
Required Parameters:
- dateIssuedStartDate: The earliest package you are requesting by dateIssued (YYYY-MM-DD).
- offsetMark: Starting record. Initial request should be '*'. The API provides the next offsetMark in the 'nextPage' key. This allows traversal past the first 10,000 records.
- pageSize: Number of records to return per request (e.g., 10).
- collection: Comma-separated list of collections (e.g., BILLS,CFR,FR). See [/collections](https://api.govinfo.gov/collections?api_key=DEMO_KEY) for a list.
Optional Parameters:
- dateIssuedEndDate: The latest package you are requesting by dateIssued (YYYY-MM-DD).
- docClass: Filter by collection-specific categories (e.g., 's', 'hr' for BILLS; 'HOUSE', 'SENATE' for CREC).
- congress: Congress number (e.g., '116').
- modifiedSince: Request packages modified since a given date/time (ISO 8601 format, e.g., 2020-02-28T00:00:00Z).
Examples:
- BILLS issued between January and July 2019:
https://api.govinfo.gov/published/2019-01-01/2019-07-31?offsetMark=*&pageSize=100&collection=BILLS&api_key=DEMO_KEY
- Federal Register and CFR packages in 2019, modified since 2020-01-01:
https://api.govinfo.gov/published/2019-01-01/2019-12-31?offsetMark=*&pageSize=100&collection=CFR,FR&modifiedSince=2020-01-01T00:00:00&api_key=DEMO_KEY
```
--------------------------------
### GovInfo Collections API Endpoints
Source: https://github.com/usgpo/api/blob/main/README.md
Endpoints for retrieving collections of government information, such as Congressional Bills, Congressional Record, and US Court Opinions. These endpoints allow filtering by date ranges and pagination.
```APIDOC
Collections API:
1. Congressional Bills (BILLS):
- Endpoint: https://api.govinfo.gov/collections/BILLS/{dateIssuedStartDate}/{dateIssuedEndDate}?offsetMark=*&pageSize={number}&api_key={your_api_key}
- Description: Retrieves Congressional Bills within a specified date range.
- Parameters:
- dateIssuedStartDate: The earliest package issue date (YYYY-MM-DD).
- dateIssuedEndDate: The latest package issue date (YYYY-MM-DD).
- offsetMark: Starting record marker (use '*' for initial request).
- pageSize: Number of records per request.
- api_key: Your API key.
- Example: https://api.govinfo.gov/collections/BILLS/2022-07-03T00:00:00Z/2018-07-10T23:59:59Z?offsetMark=*&pageSize=150&api_key=DEMO_KEY
2. Congressional Record (CREC):
- Endpoint: https://api.govinfo.gov/collections/CREC/{dateIssuedStartDate}?offsetMark=*&pageSize={number}&api_key={your_api_key}
- Description: Retrieves Congressional Record entries for a specific date.
- Parameters:
- dateIssuedStartDate: The date for which to retrieve records (YYYY-MM-DD).
- offsetMark: Starting record marker.
- pageSize: Number of records per request.
- api_key: Your API key.
- Example: https://api.govinfo.gov/collections/CREC/2023-01-01T00:00:00Z?offsetMark=*&pageSize=10&api_key=DEMO_KEY
3. United States Court Opinions (USCOURTS):
- Endpoint: https://api.govinfo.gov/collections/USCOURTS/{dateIssuedStartDate}?offsetMark=*&pageSize={number}&api_key={your_api_key}
- Description: Retrieves US Court Opinions for a specific date.
- Parameters:
- dateIssuedStartDate: The date for which to retrieve opinions (YYYY-MM-DD).
- offsetMark: Starting record marker.
- pageSize: Number of records per request.
- api_key: Your API key.
- Example: https://api.govinfo.gov/collections/USCOURTS/2023-04-03T00:00:00Z?offsetMark=*&pageSize=25&api_key=DEMO_KEY
```
--------------------------------
### GovInfo Related Service API
Source: https://github.com/usgpo/api/blob/main/README.md
The Related Service API allows users to find and retrieve content and metadata about related items within GovInfo based on an access ID. It supports various relationship types for different document collections.
```APIDOC
Related Service API:
Pattern: https://api.govinfo.gov/related/{accessId}?api_key={your_api_key}
Description: Retrieves a list of relationships for a given access ID.
Example: https://api.govinfo.gov/related/BILLS-116hr748enr?api_key=DEMO_KEY
Following Relationships:
- To retrieve specific documents based on a relationship, append the relationship type to the URL:
Example: https://api.govinfo.gov/related/BILLS-116hr748enr/BILLS?api_key=DEMO_KEY
Available Relationships:
- From BILLS, BILLSTATUS, or PLAW packageIds:
- Related Bill Versions (BILLS)
- Bill History (HOB)
- Presidential Signing Statements and Remarks (CPD)
- Public and Private Laws (PLAW)
- Congressional Committee Prints
- Congressional Reports
- U.S. Code References
- Statutes at Large References
- From FR documents:
- Related FR documents by Regulation Identifier Number (RIN)
- Code of Federal Regulations Citations
- From CHRG:
- Related Hearings - often parts or errata
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.