http://localhost:5173/api
All API responses follow a consistent format:
{
"success": true,
"data": { /* response data */ },
"pagination": { /* pagination info if applicable */ }
}Error responses:
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Error description"
}
}For endpoints that return lists, pagination is supported:
limit: Number of items per page (default: 20, max: 100)offset: Number of items to skipcursor: Next page cursor (when available)
Pagination response format:
{
"pagination": {
"total": 100,
"limit": 20,
"offset": 0,
"has_more": true,
"next_cursor": "20"
}
}GET /api/congressesQuery Parameters:
year(integer): Filter by yearordinal(string): Filter by ordinal (e.g., "20th")limit(integer): Items per pageoffset(integer): Items to skip
Example:
curl "http://localhost:5173/api/congresses?year=2020&limit=10"GET /api/congresses/:idParameters:
id: Congress ULID or congress number
Examples:
# Get by congress number
curl "http://localhost:5173/api/congresses/20"
# Get by ULID
curl "http://localhost:5173/api/congresses/01H8ZXR5KBQZ..."GET /api/congresses/:id/senatorsQuery Parameters:
limit(integer): Items per pageoffset(integer): Items to skip
Example:
curl "http://localhost:5173/api/congresses/20/senators"GET /api/congresses/:id/representativesQuery Parameters:
limit(integer): Items per pageoffset(integer): Items to skip
Example:
curl "http://localhost:5173/api/congresses/20/representatives"GET /api/congresses/:id/committeesQuery Parameters:
type(string): Filter by committee typelimit(integer): Items per pageoffset(integer): Items to skip
Example:
curl "http://localhost:5173/api/congresses/20/committees?type=regular"GET /api/peopleQuery Parameters:
type(string): Filter by type ("senator" or "representative")congress(integer): Filter by congress numberlast_name(string): Filter by last namesearch(string): Search by name or aliaslimit(integer): Items per pageoffset(integer): Items to skip
Example:
curl "http://localhost:5173/api/people?type=senator&congress=20"GET /api/people/:idParameters:
id: Person ULID
Example:
curl "http://localhost:5173/api/people/01H8ZXR5KBQZ..."GET /api/people/:id/congressesReturns all congresses where the person served.
Example:
curl "http://localhost:5173/api/people/01H8ZXR5KBQZ.../congresses"GET /api/committeesQuery Parameters:
type(string): Filter by committee typecongress_number(integer): Filter by congress numbername(string): Search by committee namelimit(integer): Items per pageoffset(integer): Items to skip
GET /api/committees/:idGET /api/committees/:id/membersGET /api/billsQuery Parameters:
congress(integer): Filter by congress numbertype(string): Filter by type ("hb" for House Bills, "sb" for Senate Bills)author(string): Filter by author's last namesearch(string): Search in bill titledate_from(string): Filter by date filed (ISO date)date_to(string): Filter by date filed (ISO date)limit(integer): Items per pageoffset(integer): Items to skip
Example:
curl "http://localhost:5173/api/bills?congress=19&type=sb"GET /api/bills/:idParameters:
id: Bill ULID or bill number (e.g., "HB00001", "SB00001")
Example:
curl "http://localhost:5173/api/bills/HB00001"GET /api/bills/:id/authorsReturns all authors of a specific bill.
Example:
curl "http://localhost:5173/api/bills/SB00001/authors"GET /api/people/:id/billsQuery Parameters:
congress(integer): Filter by congress numbertype(string): Filter by bill type ("hb" or "sb")limit(integer): Items per pageoffset(integer): Items to skip
Returns all bills authored by a specific person.
Example:
curl "http://localhost:5173/api/people/01H8ZXR5KBQZ.../bills?congress=19"GET /api/congresses/:id/billsQuery Parameters:
type(string): Filter by type ("hb", "sb", or "all")author(string): Filter by author's last namelimit(integer): Items per pageoffset(integer): Items to skip
Returns all bills filed in a specific congress.
Example:
curl "http://localhost:5173/api/congresses/19/bills?type=hb"GET /api/statsReturns comprehensive statistics about the database including:
- Total counts for bills, people, congresses, and committees
- Breakdown of bills by type (House vs Senate)
- Bills by congress
- Bills with and without filing dates
Example response:
{
"success": true,
"data": {
"total_bills": 54321,
"total_house_bills": 32109,
"total_senate_bills": 22212,
"total_congresses": 20,
"total_people": 2134,
"total_committees": 450,
"bills_with_dates": 1234,
"bills_without_dates": 53087,
"bills_by_congress": [
{
"congress": 20,
"total": 3456,
"house_bills": 2100,
"senate_bills": 1356
}
]
}
}GET /api/searchQuery Parameters:
q(string): Search querytype(string): Entity type ("congress", "person", "committee", "bill", or "all")limit(integer): Items per pageoffset(integer): Items to skip
GET /api/stats/overviewReturns general statistics about the database.
GET /api/stats/congress/:idReturns detailed statistics for a specific congress, including bill counts.
The API uses a Neo4j graph database with the following structure:
- Congress nodes represent congressional sessions
- Group nodes represent chambers (Senate/House) for each congress
- Person nodes represent senators and representatives
- Committee nodes represent congressional committees
- Document nodes represent legislative bills (House Bills and Senate Bills)
Key relationships:
- Person → MEMBER_OF → Group → BELONGS_TO → Congress
- Committee → BELONGS_TO → Congress
- Person → AUTHORED → Document → FILED_IN → Congress
This structure allows tracking of:
- People's service across multiple congresses and chambers
- Bill authorship and co-authorship
- Committee memberships
- Legislative activity by congress
{
id: string;
congress_number: number;
congress_website_key?: number;
name: string;
ordinal: string;
start_date?: string;
end_date?: string;
start_year?: number;
end_year?: number;
year_range?: string;
// Extended with stats when fetching single congress
total_senators?: number;
total_representatives?: number;
total_committees?: number;
}{
id: string;
first_name?: string;
last_name?: string;
middle_name?: string;
name_prefix?: string;
name_suffix?: string;
full_name: string;
professional_designations?: string[];
senate_website_keys?: string[];
congress_website_primary_keys?: number[];
congress_website_author_keys?: string[];
aliases?: string[];
// Extended when fetching single person
congresses?: CongressMembership[];
}{
congress_id: string;
congress_number: number;
congress_ordinal: string;
position: "senator" | "representative";
chamber?: "senate" | "house";
start_date?: string;
end_date?: string;
year_range?: string;
}{
id: string;
name: string;
type?: string;
senate_website_keys?: string[];
// Extended when fetching single committee
congress_id?: string;
congress_number?: number;
congress_ordinal?: string;
}{
id: string;
type: "document";
subtype: "hb" | "sb";
bill_number: string;
congress: number;
title: string;
long_title?: string;
date_filed?: string;
scope?: string;
subjects?: string[];
authors_raw?: string;
senate_website_permalink?: string;
download_url_sources?: string[];
// Extended when fetching single bill
authors?: Person[];
congress_details?: Congress;
}DB_NOT_INITIALIZED: Database connection not availableNOT_FOUND: Requested resource not foundFETCH_ERROR: Error fetching data from databaseVALIDATION_ERROR: Invalid request parametersINTERNAL_ERROR: Internal server error
Currently, no rate limiting is implemented. This will be added in future versions.
Currently, all endpoints are public. Authentication will be added for write operations in future versions.
curl "http://localhost:5173/api/congresses/20"Response:
{
"success": true,
"data": {
"id": "01H8ZXR5KBQZ...",
"congress_number": 20,
"name": "20th Congress of the Philippines",
"ordinal": "20th",
"start_date": "2022-06-30",
"end_date": "2025-06-30",
"start_year": 2022,
"end_year": 2025,
"year_range": "2022-2025",
"total_senators": 24,
"total_representatives": 316,
"total_committees": 39
}
}curl "http://localhost:5173/api/people?search=Aquino"curl "http://localhost:5173/api/congresses/20/senators"curl "http://localhost:5173/api/people/01H8ZXR5KBQZ.../congresses"Response:
{
"success": true,
"data": [
{
"congress_id": "01H8ZXR5KBQZ...",
"congress_number": 20,
"congress_ordinal": "20th",
"position": "senator",
"chamber": "senate",
"start_date": "2022-06-30",
"end_date": "2025-06-30",
"year_range": "2022-2025"
},
{
"congress_id": "01H8ZXR5KBQY...",
"congress_number": 19,
"congress_ordinal": "19th",
"position": "senator",
"chamber": "senate",
"start_date": "2019-06-30",
"end_date": "2022-06-30",
"year_range": "2019-2022"
}
]
}curl "http://localhost:5173/api/bills?congress=19&type=sb&limit=10"Response:
{
"success": true,
"data": [
{
"id": "01H8ZXR5KB...",
"bill_number": "SB00001",
"title": "Better Healthcare Act",
"date_filed": "2019-07-01",
"congress": 19,
"subtype": "sb"
}
],
"pagination": {
"total": 2500,
"limit": 10,
"offset": 0,
"has_more": true,
"next_cursor": "10"
}
}curl "http://localhost:5173/api/bills/SB00001/authors"Response:
{
"success": true,
"data": [
{
"id": "01H8ZXR5KBQZ...",
"first_name": "Juan",
"last_name": "Dela Cruz",
"full_name": "Juan Dela Cruz"
},
{
"id": "01H8ZXR5KBQY...",
"first_name": "Maria",
"last_name": "Santos",
"full_name": "Maria Santos"
}
]
}curl "http://localhost:5173/api/people/01H8ZXR5KBQZ.../bills?congress=19"Response:
{
"success": true,
"data": [
{
"id": "01H8ZXR5KB...",
"bill_number": "SB00001",
"title": "Better Healthcare Act",
"date_filed": "2019-07-01",
"congress": 19,
"subtype": "sb"
},
{
"id": "01H8ZXR5KC...",
"bill_number": "SB00015",
"title": "Education Reform Act",
"date_filed": "2019-07-15",
"congress": 19,
"subtype": "sb"
}
]
}- Bill tracking endpoints
- Voting records
- Committee membership details
- Political party affiliations
- Advanced search with filters
- GraphQL endpoint
- WebSocket for real-time updates
- Authentication and authorization
- Rate limiting
- Caching layer
- Data export endpoints (CSV, JSON)