Skip to content

CapitolTrace/congress-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

🏛️ congress-api

TypeScript client for the Congress.gov API
Bills, members, votes, committees, nominations — typed and simple.

TypeScript Zero deps Node MIT


Status: Coming Soon — Star this repo to get notified when the first release ships.


Why this exists

The Congress.gov API is powerful but raw — no official SDK, inconsistent response shapes, pagination quirks, and rate limiting that'll bite you. This client handles all of that so you can focus on building.

Planned features

import { Congress } from '@capitoltrace/congress-api';

const congress = new Congress({ apiKey: 'your-key' });

// Get a bill
const bill = await congress.bill('118', 'hr', '1');

// Search members
const members = await congress.members({ chamber: 'senate', state: 'CA' });

// Get vote details
const vote = await congress.vote('118', 'senate', '1');

// List committees
const committees = await congress.committees({ chamber: 'house' });

// Auto-paginate
for await (const bill of congress.bills.list({ congress: 118 })) {
  console.log(bill.title);
}

What you get

  • Full type safety — Every endpoint returns typed responses, no any
  • Auto-pagination — Async iterators for list endpoints, no manual offset management
  • Rate limit handling — Built-in retry with backoff for 429 responses
  • Zero dependencies — Uses native fetch() (Node 18+, Deno, Bun, browsers)
  • Tree-shakeable — Import only what you need

Endpoints covered

Resource Methods
📜 Bills list, get, actions, cosponsors, subjects, text
👥 Members list, get, sponsoredLegislation, cosponsoredLegislation
🗳️ Votes list, get (House + Senate roll calls)
🏛️ Committees list, get, bills, reports, nominations
📋 Nominations list, get, actions, hearings
🤝 Treaties list, get, actions
✏️ Amendments list, get, actions, cosponsors
📰 Congressional Record list daily issues
📅 Congress list, get session info

Installation

# npm
npm install @capitoltrace/congress-api

# yarn
yarn add @capitoltrace/congress-api

# pnpm
pnpm add @capitoltrace/congress-api

Get your API key

Congress.gov API keys are freesign up here (takes 30 seconds).

Contributing

This is an open-source project by Capitol Trace. PRs welcome — especially for:

  • Additional endpoint coverage
  • Better TypeScript types from real API responses
  • Deno / Bun compatibility testing
  • Documentation improvements

License

MIT


Part of the Capitol Trace ecosystem.
Built with data from api.congress.gov

About

TypeScript client for the Congress.gov API — bills, members, votes, committees, nominations, and more

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors