This document provides detailed information about the API endpoints exposed by the Congress.gov API Chatbot application, as well as the Congress.gov API endpoints that the application interacts with.
The application exposes the following API endpoints:
Process user messages and generate responses.
Endpoint: POST /api/chat
Query Parameters:
useTools(optional): Boolean flag to enable or disable the use of API tools. Default isfalse.
Request Body:
{
"message": "string"
}Response:
{
"response": "string"
}Example Request:
curl -X POST http://localhost:8080/api/chat?useTools=true \
-H "Content-Type: application/json" \
-d '{"message": "Who are the current senators from Washington state?"}'Example Response:
{
"response": "The current senators from Washington state are Patty Murray and Maria Cantwell, both Democrats. Patty Murray has been serving since 1993 and Maria Cantwell since 2001. They are both members of the 119th Congress (2025-2026)."
}Get the conversation history.
Endpoint: GET /api/history
Response:
{
"history": [
{
"role": "string",
"content": "string"
}
]
}Example Request:
curl -X GET http://localhost:8080/api/historyExample Response:
{
"history": [
{
"role": "system",
"content": "You are a helpful assistant that provides information about the U.S. Congress, bills, amendments, and legislation."
},
{
"role": "user",
"content": "Who are the current senators from Washington state?"
},
{
"role": "assistant",
"content": "The current senators from Washington state are Patty Murray and Maria Cantwell, both Democrats. Patty Murray has been serving since 1993 and Maria Cantwell since 2001. They are both members of the 119th Congress (2025-2026)."
}
]
}Clear the conversation history.
Endpoint: POST /api/clear
Response:
{
"status": "string"
}Example Request:
curl -X POST http://localhost:8080/api/clearExample Response:
{
"status": "Conversation history cleared"
}Check the health of the application.
Endpoint: GET /api/health
Response:
{
"status": "string",
"time": "string"
}Example Request:
curl -X GET http://localhost:8080/api/healthExample Response:
{
"status": "ok",
"time": "2025-04-29T16:57:00Z"
}The application integrates with the Congress.gov API to fetch information about bills, amendments, summaries, and members. The following sections describe the Congress.gov API endpoints that the application interacts with.
Search for bills in the Congress.gov API.
Method: SearchBills(query string, offset, limit int) (map[string]interface{}, error)
Parameters:
query: Search query for bills (e.g., "infrastructure", "healthcare", "education")offset: Offset for paginationlimit: Limit for pagination
Example Usage:
result, err := congressClient.SearchBills("infrastructure", 0, 5)Retrieve a specific bill by congress and bill number.
Method: GetBill(congress, billNumber string) (map[string]interface{}, error)
Parameters:
congress: Congress number (e.g., "119" for current congress, "118" for previous congress)billNumber: Bill number including type prefix (e.g., "hr1", "s2043", "hjres43")
Example Usage:
result, err := congressClient.GetBill("119", "hr1")Retrieve the summary of a specific bill.
Method: GetBillSummary(congress, billNumber string) (map[string]interface{}, error)
Parameters:
congress: Congress numberbillNumber: Bill number including type prefix
Example Usage:
result, err := congressClient.GetBillSummary("119", "hr1")Retrieve the actions taken on a specific bill.
Method: GetBillActions(congress, billNumber string) (map[string]interface{}, error)
Parameters:
congress: Congress numberbillNumber: Bill number including type prefix
Example Usage:
result, err := congressClient.GetBillActions("119", "hr1")Retrieve the cosponsors of a specific bill.
Method: GetBillCosponsors(congress, billNumber string) (map[string]interface{}, error)
Parameters:
congress: Congress numberbillNumber: Bill number including type prefix
Example Usage:
result, err := congressClient.GetBillCosponsors("119", "hr1")Retrieve bills related to a specific bill.
Method: GetBillRelatedBills(congress, billNumber string) (map[string]interface{}, error)
Parameters:
congress: Congress numberbillNumber: Bill number including type prefix
Example Usage:
result, err := congressClient.GetBillRelatedBills("119", "hr1")Search for members of Congress.
Method: SearchMembers(query string, offset, limit int) (map[string]interface{}, error)
Parameters:
query: Search query for members (e.g., "Washington state senators", "Maria Cantwell", "Texas representatives")offset: Offset for paginationlimit: Limit for pagination
Example Usage:
result, err := congressClient.SearchMembers("Washington state senators", 0, 5)Retrieve a specific member of Congress by bioguideId.
Method: GetMember(bioguideId string) (map[string]interface{}, error)
Parameters:
bioguideId: The bioguide ID of the member (e.g., "C001075" for Maria Cantwell)
Example Usage:
result, err := congressClient.GetMember("C001075")Retrieve sponsorship information for a specific member.
Method: GetMemberSponsorship(bioguideId string) (map[string]interface{}, error)
Parameters:
bioguideId: The bioguide ID of the member
Example Usage:
result, err := congressClient.GetMemberSponsorship("C001075")Retrieve senators from a specific state.
Method: GetSenatorsByState(stateCode string) (map[string]interface{}, error)
Parameters:
stateCode: Two-letter state code (e.g., "WA" for Washington, "TX" for Texas)
Example Usage:
result, err := congressClient.GetSenatorsByState("WA")Retrieve representatives from a specific state.
Method: GetRepresentativesByState(stateCode string) (map[string]interface{}, error)
Parameters:
stateCode: Two-letter state code (e.g., "WA" for Washington, "TX" for Texas)
Example Usage:
result, err := congressClient.GetRepresentativesByState("WA")Search for congressional committees.
Method: SearchCommittees(query string, offset, limit int) (map[string]interface{}, error)
Parameters:
query: Search query for committees (e.g., "judiciary", "armed services", "finance")offset: Offset for paginationlimit: Limit for pagination
Example Usage:
result, err := congressClient.SearchCommittees("judiciary", 0, 5)Retrieve a specific committee by ID.
Method: GetCommittee(committeeId string) (map[string]interface{}, error)
Parameters:
committeeId: The ID of the committee (e.g., "SSAP" for Senate Committee on Appropriations)
Example Usage:
result, err := congressClient.GetCommittee("SSAP")Search for amendments in Congress.
Method: SearchAmendments(query string, offset, limit int) (map[string]interface{}, error)
Parameters:
query: Search query for amendments (e.g., "infrastructure", "healthcare")offset: Offset for paginationlimit: Limit for pagination
Example Usage:
result, err := congressClient.SearchAmendments("infrastructure", 0, 5)Search the congressional record for debates, proceedings, or speeches.
Method: SearchCongressionalRecord(query string, offset, limit int) (map[string]interface{}, error)
Parameters:
query: Search query for the congressional record (e.g., "climate change debate", "infrastructure speech")offset: Offset for paginationlimit: Limit for pagination
Example Usage:
result, err := congressClient.SearchCongressionalRecord("climate change debate", 0, 5)Search for presidential nominations requiring Senate confirmation.
Method: SearchNominations(query string, offset, limit int) (map[string]interface{}, error)
Parameters:
query: Search query for nominations (e.g., "Supreme Court", "Cabinet", "Federal Reserve")offset: Offset for paginationlimit: Limit for pagination
Example Usage:
result, err := congressClient.SearchNominations("Supreme Court", 0, 5)Search for congressional hearings.
Method: SearchHearings(query string, offset, limit int) (map[string]interface{}, error)
Parameters:
query: Search query for hearings (e.g., "climate change", "tech regulation", "healthcare")offset: Offset for paginationlimit: Limit for pagination
Example Usage:
result, err := congressClient.SearchHearings("climate change", 0, 5)