API Documentation

Access comprehensive U.S. government data through our RESTful API endpoints. All data is sourced from official government repositories and updated regularly.

Data Sources

Our data comes from official, maintained repositories ensuring accuracy and reliability.

unitedstates/congress-legislators

View Repository

Official Congress legislator data maintained by the @unitedstates project

Data Includes:

  • Current legislators (537 active members)
  • Historical legislators (12,000+ records)
  • Presidents and Vice Presidents
  • Social media accounts
  • Biographical information

Source Files:

legislators-current.yamllegislators-historical.yamlexecutive.yamllegislators-social-media.yaml

U.S. States Data

Comprehensive state information compiled from official sources

Data Includes:

  • All 50 states + District of Columbia
  • State capitals and largest cities
  • Population and area statistics
  • State mottos and nicknames
  • Electoral votes
  • Timezone information

Source Files:

states-data.ts (internal)

Data Attribution & Licensing

The congressional data is provided by the @unitedstates project on GitHub, a collaborative effort to gather and maintain high-quality data about the United States government. This data is in the public domain and freely available for use. We sync with their repository regularly to ensure our data remains current and accurate.

API Endpoints

All endpoints return JSON data and support pagination, filtering, and search.

GET/api/data/senators

Returns all current U.S. Senators with contact information

Query Parameters

limit(number) - Number of results per page (default: 50)
page(number) - Page number for pagination (default: 1)
search(string) - Search term to filter results

Example

Request

GET /api/data/senators?limit=2

Response

{
  "success": true,
  "data": [
    {
      "name": "Maria Cantwell",
      "state": "WA",
      "party": "Democrat",
      "phone": "202-224-3441",
      "address": "511 Hart Senate Office Building",
      "url": "https://www.cantwell.senate.gov",
      "term": "2025-01-03 - 2031-01-03",
      "bioguide_id": "C000127",
      "gender": "F",
      "birthday": "1958-10-13"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 2,
    "total": 100,
    "totalPages": 50
  }
}
GET/api/data/representatives

Returns all current U.S. House Representatives

Query Parameters

limit(number) - Number of results per page
page(number) - Page number
search(string) - Search term
state(string) - Filter by state abbreviation

Example

Request

GET /api/data/representatives?state=CA&limit=2

Response

{
  "success": true,
  "data": [
    {
      "name": "Nancy Pelosi",
      "state": "CA",
      "district": 11,
      "party": "Democrat",
      "phone": "202-225-4965",
      "address": "1236 Longworth HOB",
      "url": "https://pelosi.house.gov",
      "term": "2023-01-03 - 2025-01-03"
    }
  ],
  "pagination": {...}
}
GET/api/data/presidents

Returns all U.S. Presidents from George Washington to present

Query Parameters

limit(number) - Number of results
page(number) - Page number
search(string) - Search presidents by name

Example

Request

GET /api/data/presidents?limit=3

Response

{
  "success": true,
  "data": [
    {
      "name": "George Washington",
      "term": "1789-04-30 - 1797-03-04",
      "party": "no party",
      "terms_count": 2,
      "birthday": "1732-02-22",
      "gender": "M"
    },
    {
      "name": "John Adams",
      "term": "1797-03-04 - 1801-03-04",
      "party": "Federalist",
      "terms_count": 1,
      "birthday": "1735-10-19",
      "gender": "M"
    }
  ]
}
GET/api/data/states

Returns comprehensive information for all 50 U.S. states plus DC

Query Parameters

limit(number) - Number of results
page(number) - Page number
search(string) - Search states

Example

Request

GET /api/data/states?limit=1

Response

{
  "success": true,
  "data": [
    {
      "name": "Alabama",
      "abbreviation": "AL",
      "capital": "Montgomery",
      "largestCity": "Huntsville",
      "statehood": "1819-12-14",
      "population": "5,024,279",
      "area": "52,420 sq mi",
      "nickname": "The Heart of Dixie",
      "motto": "We dare defend our rights",
      "region": "South",
      "timezone": "CST",
      "electoralVotes": 9,
      "senators_count": 2,
      "representatives_count": 7,
      "senators": ["Tommy Tuberville", "Katie Britt"]
    }
  ]
}
GET/api/data/search

Search across all legislators (current and historical)

Query Parameters

search(string)* - Search query (required)

Example

Request

GET /api/data/search?search=obama

Response

{
  "success": true,
  "data": [
    {
      "name": "Barack Obama",
      "type": "President",
      "party": "Democrat",
      "term": "2009-01-20 - 2017-01-20",
      "current": false
    }
  ]
}

Rate Limiting & Authentication

  • No authentication required for public endpoints
  • Data is cached for 1 hour to ensure optimal performance
  • No hard rate limits currently enforced
  • Please be respectful and avoid excessive requests

Data Synchronization

  • Data syncs with official repositories daily
  • Manual sync available via npm run sync-data
  • Last sync timestamp included in responses
  • Automatic fallback to cached data if source unavailable

Ready to Get Started?

Explore the dashboard to see the API in action, or start making requests directly to our endpoints.