npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

congress-dot-gov

v0.6.1

Published

TypeScript SDK for the Congress.gov API

Downloads

19

Readme

Congress.gov TypeScript SDK

A TypeScript SDK for interacting with the Congress.gov API. The goal this sdk is to provide a normalized typesafe interface for interacting with the Congress.gov api. Where possible effort has been made to standardize the returned data see the (irregularities section)[#] for more details.

Detailed documentation of the schemas can be found on the Library of Congress github. Effort has been made to match the published schemas. If any irregularities or failed validations are found please open an issue so it can be fixed.

Available methods can be previewed on the Swagger docs;

SDK Docs

Installation

yarn install congress-dot-gov

Usage

First, you'll need to obtain an API key from Congress.gov.

The SDK is broken into two parts, clients and schemas. You can instantiate the full sdk or only the clients that you need. Types for all responses are also exported and derived from the schemas.

The schemas are optional and require the optional zod dependency. The schemas are used for validate responses in end to end tests of the SDK. They are useful for detecting any irregularities or typos in the data.

Full Client

import { CongressDotGovClient } from 'congress-dot-gov';

const client = new CongressDotGovClient({
  apiKey: 'YOUR_API_KEY'
});

await client.bill.getBills();

await client.member.getMembers();

Using Individual Clients

import { BillClient } from 'congress-dot-gov';

const billClient = new BillClient({
  apiKey: 'YOUR_API_KEY'
});

await billClient.getBills();

Rate Limiting

The Congress.gov API has a rate limit of 5,000 requests per hour. To help handle rate limits, clients accept an optional rate limiter to track and throttle requests automatically.

Rate Limiter Interface

interface RateLimitInfo {
  limit: number;
  remaining: number;
}

interface RateLimiter {
  waitForNextRequest: () => Promise<void>;
  updateRateLimitInfo: (rateLimitInfo: RateLimitInfo) => void;
}

For convenience, the SDK includes an adaptive rate limiter that automatically adjusts delays based on your current rate limit status:

import { BillClient } from 'congress-dot-gov';
import { AdaptiveRateLimiter } from 'congress-dot-gov/rate-limiter';

const rateLimiter = new AdaptiveRateLimiter();

const billClient = new BillClient({
  apiKey: 'YOUR_API_KEY',
  rateLimiter: rateLimiter
});

Custom Rate Limiter

You can also implement your own rate limiter by implementing the RateLimiter interface:

class CustomRateLimiter implements RateLimiter {
  async waitForNextRequest(): Promise<void> {
    // Custom throttling logic
  }
  
  updateRateLimitInfo(rateLimitInfo: RateLimitInfo): void {
    // Update internal state based on API response headers
  }
}

const billClient = new BillClient({
  apiKey: 'YOUR_API_KEY',
  rateLimiter: new CustomRateLimiter()
});

Schemas and Irregularities

Validation schemas can be imported from the schemas path. You can then assert any responses with these schemas. These schemas are inferred to type the responses from the API and do not transform the returned data.

import { BillClient } from 'congress-dot-gov';
import { BillSchema } from 'congress-dot-gov/schemas';


const billClient = new BillClient({
  apiKey: 'YOUR_API_KEY'
});

const response = await billClient.getBills();

BillSchema.parse(response)

Irregularities

There are some known irregularities and probably more unknown irregularities with the returned data. Schemas to standardize returned data according to the documentation are provided

Standardization schemas:

  • BillCommitteeStandardizeSchema
  • CongressStandardizeSchema

Known Issues:

  • Congress startYear and endYear are returned as strings, where as in other places they are numbers

  • The committee report for report number 617 of type HRPT for congress 116 contains a period H.Rept. instead of H.Rept. This returned as is and reflected with an extra entry in the CommitteeReportType enum.

  • Bill committee name Referred to may be returned as Referred To.

Responses that aren't properly transformed from xml to JSON or have improper casing are standardized by the client.

Known Issues:

  • The Congressional Record endpoint returns an abnormal data shape. The handler for this endpoint uses an adapter to reshape it to the standard response.

  • On the Committee client, the response for getCommitteeBills renames committee-bills to committeeBills in the response.

  • On the House Communication client, the response for getCommunication renames house-communication to houseCommunication in the response.

License

MIT