Congress.gov API

repository·main·Indexed 21 days ago

https://github.com/libraryofcongress/api.congress.gov

Machine-readable access to Congress.gov data, including bills and amendments, available in XML and JSON formats. The repository provides sample clients for Java (OpenJDK 18.0+) and Python (3.8+), along with a command-line interface (cdg_cli). It includes documentation on authentication via API keys, rate limits (5,000 requests per hour), pagination, and the structure of version 3 (v3) API responses.

Tokens
25K
Snippets
49
Records
108
Agent score
76%

What's inside api.congress.gov

  1. CRS Reports API Overview and Specification

    main

    The Congressional Research Service (CRS) Reports endpoint provides access to CRS product data.

  2. Access Committee Meeting data via the API

    main

    The Committee Meeting endpoint provides access to committee meeting data. For details on the scope of available data, refer to the Coverage Dates for Congress.gov Collections.

    To understand the specific data structures, supported endpoints, and available query parameters, consult the official OpenAPI Specification.

    https://api.congress.gov/#/committee-meeting/committee_meeting_list
  3. Understand House requirement API coverage and specification

    main

    House requirement data coverage and details regarding communications to the House can be found in the official Congress.gov help documentation. For a complete technical definition of all supported endpoints and parameters, refer to the OpenAPI Specification at the API root.

  4. Access Committee data via the Committee endpoints

    main

    The Committee endpoints allow users to interact with data regarding congressional committees, including committee lists, reports, bills, nominations, and House communications.

    For detailed information on the available endpoints, supported parameters, and the full schema, refer to the OpenAPI Specification at https://api.congress.gov/#/committee/committee_list.

  5. Understand Committee and Subcommittee systemCodes

    main

    The systemCode is a unique identifier for a committee or subcommittee. You can distinguish between full committees and subcommittees by inspecting the trailing numerals:

    • Full Committees: The systemCode ends in a double zero (e.g., hspw00).
    • Subcommittees: The systemCode contains numerals other than a double zero (e.g., hspw14).

    The first letter of the systemCode indicates the chamber: h for House, s for Senate, or j for Joint.

  6. Understand partitioned presidential nominations

    main

    A presidential nomination (PN) containing multiple nominees may be partitioned by the Senate if the nominees follow different confirmation paths. These partitions are identified by a suffix appended to the nomination number (e.g., PN230-1 and PN230-2).

    When querying the API:

    • To retrieve all partitions of a nomination, search using the base nomination number (e.g., PN230).
    • To retrieve a specific partition, use the nomination number with its suffix (e.g., PN230-1).

    The nomination number format follows the regular expression: [0-9]+(-[0-9]+)?.

    [0-9]+(-[0-9]+)?
  7. Understand the Congress List Level data structure

    main

    When querying the list level endpoint (https://api.congress.gov/v3/congress?api_key=<YOUR_API_KEY>), note that items at this level cannot be filtered.

    In XML format, the response includes an <api-root> element. The primary container is <congresses>, which contains repeatable <item> elements. Each <item> represents a Congress and includes:

    • <name>: The name (e.g., 116th Congress).
    • <startYear>: The start year of the two-year period.
    • <endYear>: The generalized end year.
    • <sessions>: A container for <item> elements representing specific sessions.
      • <chamber>: Either House of Representatives or Senate.
      • <type>: R for Regular or S for Special.
      • <startDate>: Session start date.
      • <endDate>: Session end date.
      • <number>: The session number (suppressed for special sessions).
    • <url>: A referrer URL to the specific congress item.
  8. Understand the Congress.gov API response structure

    main

    The Congress.gov API returns data in either XML or JSON formats. Every response is composed of three primary elements:

    1. Request: Contains metadata about the API request, such as the format and the contentType (similar to HTTP request headers).
    2. Pagination: Provides metadata for navigating result sets, including the total count of data items, a URL for the next page, and (if the offset is greater than 1) a URL for the previous page.
    3. Data: A container for the actual results. The name of this element varies by endpoint (e.g., <bills> for the bills endpoint, <amendments> for the amendments endpoint).
  9. Understand bill summary data coverage and date filtering

    main

    By default, the Summaries endpoint only returns bill summaries published within the last day. To access a broader range of data, you must use the fromDateTime and/or toDateTime parameters in your API request.

    For a complete list of all bill summaries available on Congress.gov (including those not covered by the default daily view), use the bill endpoint.

  10. Understand the Congress Item Level data structure

    main

    When accessing a specific congress via its unique URL, the response provides detailed metadata for that specific congress.

    In XML format, the response includes an <api-root> element. The parent container is <congress>, which includes:

    • <sessions>: A container for <item> elements representing sessions for that specific congress.
      • <chamber>: House of Representatives or Senate.
      • <type>: R (Regular) or S (Special).
      • <startDate>: Session start date.
      • <endDate>: Session end date.
      • <number>: The assigned session number (suppressed for special sessions).
    • <name>: The name of the congress.
    • <startYear>: The start year.
    • <endYear>: The end year.
    • <updateDate>: The timestamp of the last update in Congress.gov.
    • <number>: The congress number (e.g., 116).
    • <url>: A referrer URL to the congress item.