openapi: "3.0.1"
info:
  title: Congress.gov API
  description: |-
    The Congress.gov API provides programmatic access to legislative data
    from the United States Congress. This API enables developers to search,
    retrieve, and analyze legislative data including bills, resolutions,
    amendments, and congressional records.

    This is NOT the official congress.gov YAML and contains modifications.

    Currently only supports 8/100 API operations.
    
    Bill API: 0/16
    
    Amendments API: 0/8
    
    Summaries API: 0/3
    
    Congress API: 0/3
    
    Member API: 8/8 ✅
    
    Committee API: 0/10
    
    Committee Report API: 0/5
    
    Committee Print API: 0/5
    
    Committee Meeting API: 0/4
    
    Hearing API: 0/4
    
    Congressional Record API: 0/1
    
    Daily Congressional Record API: 0/4
    
    Bound Congressional Record API: 0/4
    
    House Communication API: 0/4
    
    House Requirement API: 0/3
    
    Senate Communication API: 0/4
    
    Nomination API: 0/7
    
    Treaty API: 0/7
  contact:
    email: "liudotjson@gmail.com"
  license:
    name: "Apache 2.0"
    url: "http://www.apache.org/licenses/LICENSE-2.0.html"
  version: "0.1.8"
externalDocs:
  description: "Official documentation"
  url: "https://api.congress.gov/"
servers:
  - url: "https://api.congress.gov/v3"
paths:
  /member:
    get:
      tags:
        - "Congress"
      summary: "Returns a list of congressional members."
      description: |
        Get congress member list.
        Supports query parameters for pagination and filtering.
      operationId: "getMembers"
      parameters:
        - $ref: "#/components/parameters/Offset"
        - $ref: "#/components/parameters/LimitMax250"
        - $ref: "#/components/parameters/FromDateTimeUpdateDate"
        - $ref: "#/components/parameters/ToDateTimeUpdateDate"
        - $ref: "#/components/parameters/CurrentMember"
      responses:
        "200":
          $ref: "#/components/responses/CongressMemberListResponse"
        "400":
          $ref: "#/components/responses/CongressMemberListErrorResponse"
        "403":
          $ref: "#/components/responses/ForbiddenError"
        "429":
          $ref: "#/components/responses/RateLimitErrorResponse"
  /member/{bioguideId}:
    get:
      tags:
        - "Congress"
      summary: "Returns details of a single congressional member."
      description: |
        Get a member's details from their bioguideId.
      operationId: "getMemberDetails"
      parameters:
        - $ref: "#/components/parameters/BioguideId"
      responses:
        "200":
          $ref: "#/components/responses/CongressMemberDetailsResponse"
        "403":
          $ref: "#/components/responses/ForbiddenError"
        "404":
          $ref: "#/components/responses/ResourceNotFoundErrorResponse"
        "429":
          $ref: "#/components/responses/RateLimitErrorResponse"
  /member/{bioguideId}/sponsored-legislation:
    get:
      tags:
        - "Congress"
      summary: "Returns a list of legislation sponsored by a congressional member."
      description: |
        Get a list of legislation sponsored by a member.
        Supports query parameters for pagination.
      operationId: "getMemberSponsoredLegislation"
      parameters:
        - $ref: "#/components/parameters/BioguideId"
        - $ref: "#/components/parameters/Offset"
        - $ref: "#/components/parameters/LimitMax250"
      responses:
        "200":
          $ref: "#/components/responses/MemberSponsoredLegislationResponse"
        "403":
          $ref: "#/components/responses/ForbiddenError"
        "404":
          $ref: "#/components/responses/ResourceNotFoundErrorResponse"
        "429":
          $ref: "#/components/responses/RateLimitErrorResponse"
  /member/{bioguideId}/cosponsored-legislation:
    get:
      tags:
        - "Congress"
      summary: "Returns a list of legislation cosponsored by a congressional member."
      description: |
        Get a list of legislation cosponsored by a member.
        Supports query parameters for pagination.
      operationId: "getMemberCosponsoredLegislation"
      parameters:
        - $ref: "#/components/parameters/BioguideId"
        - $ref: "#/components/parameters/Offset"
        - $ref: "#/components/parameters/LimitMax250"
      responses:
        "200":
          $ref: "#/components/responses/MemberCosponsoredLegislationResponse"
        "403":
          $ref: "#/components/responses/ForbiddenError"
        "404":
          $ref: "#/components/responses/ResourceNotFoundErrorResponse"
        "429":
          $ref: "#/components/responses/RateLimitErrorResponse"
  /member/congress/{congress}:
    get:
      tags:
        - "Congress"
      summary: "Returns a list of congressional members by congress number."
      description: |
        Get congress member list by congress number.
        Supports query parameters for filtering.
      operationId: "getMembersByCongress"
      parameters:
      - $ref: "#/components/parameters/Offset"
      - $ref: "#/components/parameters/LimitMax250"
      - $ref: "#/components/parameters/FromDateTimeUpdateDate"
      - $ref: "#/components/parameters/ToDateTimeUpdateDate"
      - $ref: "#/components/parameters/CurrentMember"
      - $ref: "#/components/parameters/MemberCongressNumber"
      responses:
        "200":
          $ref: "#/components/responses/CongressMemberListResponse"
        "400":
          $ref: "#/components/responses/CongressMemberListErrorResponse"
        "403":
          $ref: "#/components/responses/ForbiddenError"
        "404":
          $ref: "#/components/responses/ResourceNotFoundErrorResponse"
        "429":
          $ref: "#/components/responses/RateLimitErrorResponse"
  /member/{stateCode}:
    get:
      tags:
        - "Congress"
      summary: "Returns a list of congressional members by state code."
      description: |
        Get congress member list by state code.
        Supports query parameters for filtering.
      operationId: "getMembersByState"
      parameters:
      - $ref: "#/components/parameters/Offset"
      - $ref: "#/components/parameters/LimitMax250"
      - $ref: "#/components/parameters/FromDateTimeUpdateDate"
      - $ref: "#/components/parameters/ToDateTimeUpdateDate"
      - $ref: "#/components/parameters/CurrentMember"
      - $ref: "#/components/parameters/MemberStateCode"
      responses:
        "200":
          $ref: "#/components/responses/CongressMemberListResponse"
        "400":
          $ref: "#/components/responses/CongressMemberListErrorResponse"
        "403":
          $ref: "#/components/responses/ForbiddenError"
        "404":
          $ref: "#/components/responses/ResourceNotFoundErrorResponse"
        "429":
          $ref: "#/components/responses/RateLimitErrorResponse"
  /member/{stateCode}/{district}:
    get:
      tags:
        - "Congress"
      summary: "Returns a list of congressional members by state code and district."
      description: |
        Get congress member list by state code and district.
        Supports query parameters for filtering.
      operationId: "getMembersByStateAndDistrict"
      parameters:
        - $ref: "#/components/parameters/Offset"
        - $ref: "#/components/parameters/LimitMax250"
        - $ref: "#/components/parameters/FromDateTimeUpdateDate"
        - $ref: "#/components/parameters/ToDateTimeUpdateDate"
        - $ref: "#/components/parameters/CurrentMember"
        - $ref: "#/components/parameters/MemberStateCode"
        - $ref: "#/components/parameters/MemberDistrictNumber"
      responses:
        "200":
          $ref: "#/components/responses/CongressMemberListResponse"
        "400":
          $ref: "#/components/responses/CongressMemberListErrorResponse"
        "403":
          $ref: "#/components/responses/ForbiddenError"
        "404":
          $ref: "#/components/responses/ResourceNotFoundErrorResponse"
        "429":
          $ref: "#/components/responses/RateLimitErrorResponse"
  /member/congress/{congress}/{stateCode}/{district}:
    get:
      tags:
        - "Congress"
      summary: "Returns a list of congressional members by congress number, state code, and district."
      description: |
        Get congress member list by congress number and state code and district.
        Supports query parameters for filtering.
      operationId: "getMembersByCongressAndStateAndDistrict"
      parameters:
        - $ref: "#/components/parameters/Offset"
        - $ref: "#/components/parameters/LimitMax250"
        - $ref: "#/components/parameters/FromDateTimeUpdateDate"
        - $ref: "#/components/parameters/ToDateTimeUpdateDate"
        - $ref: "#/components/parameters/CurrentMember"
        - $ref: "#/components/parameters/MemberCongressNumber"
        - $ref: "#/components/parameters/MemberStateCode"
        - $ref: "#/components/parameters/MemberDistrictNumber"
      responses:
        "200":
          $ref: "#/components/responses/CongressMemberListResponse"
        "400":
          $ref: "#/components/responses/CongressMemberListErrorResponse"
        "403":
          $ref: "#/components/responses/ForbiddenError"
        "404":
          $ref: "#/components/responses/ResourceNotFoundErrorResponse"
        "429":
          $ref: "#/components/responses/RateLimitErrorResponse"
components:
  parameters:
    BioguideId:
      name: "bioguideId"
      in: "path"
      required: true
      description: "The member's Biographical Directory ID."
      schema:
        $ref: "#/components/schemas/BioguideId"
    Offset:
      name: "offset"
      in: "query"
      description: "The starting record returned. 0 is the first record."
      required: false
      schema:
        type: "integer"
        minimum: 0
    LimitMax250:
      name: "limit"
      in: "query"
      description: "The number of records returned. The maximum limit is 250."
      required: false
      schema:
        type: "integer"
        minimum: 0
        maximum: 250
    FromDateTimeUpdateDate:
      name: "fromDateTime"
      in: "query"
      description: "The starting timestamp to filter by update date. Use format: YYYY-MM-DDT00:00:00Z."
      required: false
      schema:
        type: "string"
        pattern: "^\\d{4}-\\d{2}-\\d{2}T00:00:00Z$"
        format: "date-time"
    ToDateTimeUpdateDate:
      name: "toDateTime"
      in: "query"
      description: "The ending timestamp to filter by update date. Use format: YYYY-MM-DDT00:00:00Z."
      required: false
      schema:
        type: "string"
        pattern: "^\\d{4}-\\d{2}-\\d{2}T00:00:00Z$"
        format: "date-time"
    CurrentMember:
      name: "currentMember"
      in: "query"
      description: "The status of the member."
      required: false
      schema:
        type: "boolean"
    MemberCongressNumber:
      name: "congress"
      in: "path"
      required: true
      description: "The member's congress number (e.g., 118 for the 118th Congress, 2023-2025)"
      schema:
        type: integer
        minimum: 1
    MemberStateCode:
      name: "stateCode"
      in: "path"
      required: true
      description: "The member's state code (pattern: ^[A-Z]{2}$)."
      schema:
        $ref: "#/components/schemas/StateCode"
    MemberDistrictNumber:
      name: "district"
      in: "path"
      required: true
      description: "The member's district number (pattern: ^\\d{2}$)."
      schema:
        type: "string"
        pattern: "^\\d{2}$"
        minLength: 2
        maxLength: 2
  schemas:
    Pagination:
      title: "Pagination"
      description: "Pagination object."
      type: "object"
      required:
        - "count"
      properties:
        count:
          description: "Total number of records."
          type: "integer"
        next:
          description: "URL of the next page of records."
          type: "string"
          format: "uri"
        prev:
          description: "URL of the next page of records."
          type: "string"
          format: "uri"
    LegislationOverview:
      description: "Legislation overview."
      type: "object"
      required:
        - "congress"
        - "introducedDate"
        - "number"
        - "policyArea"
        - "title"
        - "type"
      properties:
        congress:
          $ref: "#/components/schemas/CongressNumber"
        introducedDate:
          $ref: "#/components/schemas/LegislationIntroducedDate"
        latestAction:
          $ref: "#/components/schemas/LegislationLatestAction"
        number:
          $ref: "#/components/schemas/LegislationNumber"
        policyArea:
          $ref: "#/components/schemas/PolicyArea"
        title:
          $ref: "#/components/schemas/LegislationTitle"
        type:
          $ref: "#/components/schemas/LegislationType"
    CongressNumber:
      description: "Congress number."
      type: "integer"
    LegislationNumber:
      description: "Legislation number."
      type: "string"
    DistrictNumber:
      description: "District number."
      type: integer
    BioguideId:
      description: "The member's Biographical Directory ID."
      type: "string"
      minLength: 7
      maxLength: 7
      pattern: "^[A-Z]\\d{6}$"
    BioguideDepiction:
      description: "The member's Biographical Directory picture."
      type: "object"
      required:
        - "attribution"
        - "imageUrl"
      properties:
        attribution:
          description: "The source of the image."
          type: "string"
        imageUrl:
          description: "The image URL."
          type: "string"
    Name:
      description: "Congress member name."
      type: "string"
    PartyName:
      description: "Party name."
      type: "string"
    State:
      description: "State name."
      type: "string"
    DetailedTerms:
      description: "Detailed terms served."
      type: "array"
      items:
        $ref: "#/components/schemas/DetailedTermItem"
    DetailedTermItem:
      description: "Detailed term in Congress."
      type: "object"
      required:
        - "chamber"
        - "congress"
        - "district"
        - "memberType"
        - "startYear"
        - "stateCode"
        - "stateName"
      properties:
        chamber:
          $ref: "#/components/schemas/Chamber"
        congress:
          $ref: "#/components/schemas/CongressNumber"
        district:
          $ref: "#/components/schemas/DistrictNumber"
        endYear:
          $ref: "#/components/schemas/TermEndYear"
        memberType:
          $ref: "#/components/schemas/MemberType"
        startYear:
          $ref: "#/components/schemas/TermStartYear"
        stateCode:
          $ref: "#/components/schemas/StateCode"
        stateName:
          $ref: "#/components/schemas/State"
    StateCode:
      description: "State code."
      type: "string"
      minLength: 2
      maxLength: 2
      pattern: "^[A-Z]{2}$"
    MemberType:
      description: "Member type."
      type: "string"
      enum:
        - "Representative"
        - "Senator"
    LeadershipRoles:
      description: "Leadership role."
      type: "array"
      items:
        type: "object"
        title: "LeadershipRole"
        properties:
          congress:
            $ref: "#/components/schemas/CongressNumber"
          current:
            description: "Is the member currently serving."
            type: "boolean"
          type:
            description: "Leadership role type."
            type: "string"
    Terms:
      description: "Terms served."
      type: "object"
      properties:
        item:
          type: "array"
          items:
            $ref: "#/components/schemas/TermItem"
      required:
        - "members"
    TermItem:
      description: "Term in Congress."
      type: "object"
      properties:
        chamber:
          $ref: "#/components/schemas/Chamber"
        endYear:
          $ref: "#/components/schemas/TermEndYear"
        startYear:
          $ref: "#/components/schemas/TermStartYear"
      required:
        - "startYear"
        - "chamber"
    Chamber:
      description: "Chamber of Congress."
      type: "string"
      enum:
        - "House of Representatives"
        - "Senate"
    TermEndYear:
      description: "End year of the term."
      type: "integer"
    TermStartYear:
      description: "Start year of the term."
      type: "integer"
    UpdateDate:
      description: "Time the record was last updated. Format: YYYY-MM-DDT00:00:00Z."
      type: "string"
      pattern: "^\\d{4}-\\d{2}-\\d{2}T00:00:00Z$"
      format: "date-time"
    LegislationIntroducedDate:
      description: "Date the legislation was introduced. Format: YYYY-MM-DD."
      type: "string"
      pattern: "^\\d{4}-\\d{2}-\\d{2}$"
      format: "date"
    LegislationLatestAction:
      description: "Latest action on the legislation."
      type: "object"
      required:
        - "actionDate"
        - "text"
      properties:
        actionDate:
          description: "Date of the action."
          type: "string"
          pattern: "^\\d{4}-\\d{2}-\\d{2}$"
          format: "date"
        actionTime:
          description: "Time of the action."
          type: "string"
          pattern: "^\\d{2}:\\d{2}:\\d{2}$"
          format: "time"
        text:
          description: "Action text."
          type: "string"
    PolicyArea:
      description: "Policy area."
      type: "object"
      required:
        - "name"
      properties:
        name:
          description: "Policy area name."
          type: "string"
    LegislationTitle:
      description: "Legislation title."
      type: "string"
    LegislationType:
      description: "Legislation type."
      type: "string"
    BirthYear:
      description: "Year of birth."
      type: "integer"
    AddressInformation:
      description: "Address information."
      type: "object"
      properties:
        city:
          description: "City."
          type: "string"
        district:
          description: "District."
          type: "string"
        officeAddress:
          description: "Office address."
          type: "string"
        phoneNumber:
          description: "Phone number."
          type: "string"
        zipCode:
          description: "Zip code."
          type: integer
    PartyHistory:
      description: "Party history."
      type: "array"
      items:
        $ref: "#/components/schemas/PartyHistoryItem"
    PartyHistoryItem:
      description: "Historical party information."
      type: "object"
      required:
        - "partyAbbreviation"
        - "partyName"
        - "startYear"
      properties:
        partyAbbreviation:
          description: "Party abbreviation."
          type: "string"
        partyName:
          description: "Party name."
          type: "string"
        startYear:
          description: "Start year."
          type: "integer"
        endYear:
          description: "End year."
          type: "integer"
    ForbiddenErrorResponse:
      type: "object"
      properties:
        error:
          title: "ForbiddenError"
          type: "object"
          properties:
            code:
              type: "string"
              enum:
                - "API_KEY_INVALID"
                - "API_KEY_MISSING"
              description: "The specific error code indicating the type of error."
            message:
              type: "string"
              description: "A human-readable message explaining the error."
          required:
            - "code"
            - "message"
      required:
        - "error"
  responses:
    ForbiddenError:
      description: "Forbidden - API key is missing or invalid."
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ForbiddenErrorResponse'
    CongressMemberListResponse:
      description: "Congress member list."
      content:
        application/json:
          schema:
            title: "CongressMemberListResponse"
            type: "object"
            required:
              - "members"
              - "pagination"
            properties:
              members:
                description: "List of Congress members."
                type: "array"
                items:
                  title: "CongressMemberOverview"
                  type: "object"
                  required:
                    - "bioguideId"
                    - "district"
                    - "name"
                    - "partyName"
                    - "state"
                    - "terms"
                    - "updateDate"
                  properties:
                    bioguideId:
                      $ref: "#/components/schemas/BioguideId"
                    depiction:
                      $ref: "#/components/schemas/BioguideDepiction"
                    district:
                      $ref: "#/components/schemas/DistrictNumber"
                    name:
                      $ref: "#/components/schemas/Name"
                    partyName:
                      $ref: "#/components/schemas/PartyName"
                    state:
                      $ref: "#/components/schemas/State"
                    terms:
                      $ref: "#/components/schemas/Terms"
                    updateDate:
                      $ref: "#/components/schemas/UpdateDate"
              pagination:
                $ref: "#/components/schemas/Pagination"
    CongressMemberListErrorResponse:
      description: "Bad request."
      content:
        application/json:
          schema:
            title: "CongressMemberListErrorResponse"
            type: "object"
            required:
              - "error"
            properties:
              error:
                description: "Error message."
                type: "string"
    CongressMemberDetailsResponse:
      description: "Congress member details."
      content:
        application/json:
          schema:
            title: "CongressMemberDetailsResponse"
            type: object
            required:
              - "member"
            properties:
              member:
                title: "CongressMemberDetails"
                type: "object"
                required:
                  - "bioguideId"
                  - "birthYear"
                  - "currentMember"
                  - "directOrderName"
                  - "firstName"
                  - "invertedOrderName"
                  - "lastName"
                  - "officialWebsiteUrl"
                  - "partyHistory"
                  - "state"
                  - "terms"
                  - "updateDate"
                properties:
                  addressInformation:
                    $ref: "#/components/schemas/AddressInformation"
                  bioguideId:
                    $ref: "#/components/schemas/BioguideId"
                  birthYear:
                    $ref: "#/components/schemas/BirthYear"
                  cosponsoredLegislation:
                    title: "CosponsoredLegislation"
                    type: "object"
                    properties:
                      count:
                        description: "Total number of cosponsored legislation."
                        type: "integer"
                  currentMember:
                    description: "Is the member currently serving."
                    type: "boolean"
                  depiction:
                    $ref: "#/components/schemas/BioguideDepiction"
                  directOrderName:
                    description: "Direct order name."
                    type: "string"
                  district:
                    $ref: "#/components/schemas/DistrictNumber"
                  firstName:
                    description: "First name."
                    type: "string"
                  honorificName:
                    description: "Honorific name."
                    type: "string"
                  invertedOrderName:
                    description: "Inverted order name."
                    type: "string"
                  lastName:
                    description: "Last name."
                    type: "string"
                  leadership:
                    $ref: "#/components/schemas/LeadershipRoles"
                  middleName:
                    description: "Middle name."
                    type: "string"
                  nickName:
                    description: "Nick name."
                    type: "string"
                  officialWebsiteUrl:
                    description: "Official website URL."
                    type: "string"
                  partyHistory:
                    $ref: "#/components/schemas/PartyHistory"
                  sponsoredLegislation:
                    title: "SponsoredLegislation"
                    type: "object"
                    properties:
                      count:
                        description: "Total number of sponsored legislation."
                        type: "integer"
                  state:
                    $ref: "#/components/schemas/State"
                  suffixName:
                    description: "Suffix name."
                    type: "string"
                  terms:
                    $ref: "#/components/schemas/DetailedTerms"
                  updateDate:
                    $ref: "#/components/schemas/UpdateDate"
    MemberSponsoredLegislationResponse:
      description: "Member sponsored legislation."
      content:
        application/json:
          schema:
            title: "MemberSponsoredLegislationResponse"
            type: "object"
            required:
              - "sponsoredLegislation"
              - "pagination"
            properties:
              sponsoredLegislation:
                description: "List of sponsored legislation."
                type: "array"
                items:
                  $ref: "#/components/schemas/LegislationOverview"
              pagination:
                $ref: "#/components/schemas/Pagination"
    MemberCosponsoredLegislationResponse:
      description: "Member cosponsored legislation."
      content:
        application/json:
          schema:
            title: "MemberCosponsoredLegislationResponse"
            type: "object"
            required:
              - "cosponsoredLegislation"
              - "pagination"
            properties:
              cosponsoredLegislation:
                description: "List of cosponsored legislation."
                type: "array"
                items:
                  $ref: "#/components/schemas/LegislationOverview"
              pagination:
                $ref: "#/components/schemas/Pagination"
    ResourceNotFoundErrorResponse:
      description: "Resource not found."
      content:
        application/json:
          schema:
            title: "ResourceNotFoundErrorResponse"
            type: "object"
            required:
              - "error"
            properties:
              error:
                description: "Error message."
                type: "string"
    RateLimitErrorResponse:
      description: "Rate limit exceeded."
      content:
        application/json:
          schema:
            title: "RateLimitErrorResponse"
            type: "object"
            required:
              - "error"
            properties:
              error:
                title: "RateLimitError"
                description: "Error object."
                type: "object"
                required:
                  - "code"
                  - "message"
                properties:
                  code:
                    description: "Error code."
                    type: "string"
                    enum:
                      - "OVER_RATE_LIMIT"
                  message:
                    description: "Error message."
                    type: "string"
  securitySchemes:
    ApiKeyAuth:
      type: "apiKey"
      in: "query"
      name: "api_key"
security:
  - ApiKeyAuth: []