The Congress.gov API v3 (https://api.congress.gov/v3): bills and resolutions, with detail, actions, text versions and CRS summaries.

Auth: a free api.data.gov key, sent in the X-Api-Key header so it stays out of URLs. Set congress-gov.api-key or pass {api-key: ...} per call.

Rate limit: 5,000 requests per hour. A 429 is an HttpError.

Paging: lists take limit (default 20, at most 250) and offset. next-offset reads the API's own next link, and collect follows it.

Context Vars

Optional
  • congress-gov.api-key
  • congress-gov.base-url

Values

BILL_TYPES

BILL_TYPES: Vec [
  "hr",
  "s",
  "hjres",
  "sjres",
  "hconres",
  "sconres",
  "hres",
  "sres"
]

LIST_KEYS

LIST_KEYS: Vec [
  "bills",
  "actions",
  "summaries",
  "textVersions"
]

MAX_LIMIT

MAX_LIMIT: Int 250

Functions

actions

fn (congress: Any, kind: Any, number: Any): Map
fn (congress: Any, kind: Any, number: Any, opts: Map): Map

One page of a bill's actions, newest first: {actions, pagination, request}. Each action has actionDate, text, type, actionCode and sourceSystem. opts: limit, offset, from-date-time, to-date-time, plus api-key.

bill

fn (congress: Any, kind: Any, number: Any): Map?
fn (congress: Any, kind: Any, number: Any, opts: Map): Map?

One bill or resolution, or null when there is no such bill. Has title, introducedDate, sponsors, policyArea, latestAction, laws, and {count, url} links for actions, cosponsors, committees, relatedBills, subjects, summaries, textVersions and titles.

Example

b ::congress-gov/bill(117, "hr", 3076)
b.latestAction.text  // "Became Public Law No: 117-108."

bill-path

fn (congress: Any, kind: Any, number: Any): Str

/bill/{congress}/{kind}/{number}, or as much of it as is given (pure). kind and number may be null. An Err for a bad value.

Example

::congress-gov/bill-path(117, "HR", 3076)  // "/bill/117/hr/3076"
::congress-gov/bill-path(117, null, null)  // "/bill/117"

bill-sub

fn (congress: Any, kind: Any, number: Any, sub: Str, params: Map, opts: Map): Map

bill-type

fn (value: Any): Str

Normalize a bill type to the path form: "HR" → "hr". An Err for anything but hr, s, hjres, sjres, hconres, sconres, hres or sres.

bills

fn (): Map
fn (opts: Map): Map
fn (congress: Any, opts: Map): Map
fn (congress: Any, kind: Any, opts: Map): Map

One page of bills and resolutions: all of them, one Congress's, or one type within a Congress. Returns {bills, pagination, request}; each bill has congress, type, number, title, originChamber, latestAction, updateDate, updateDateIncludingText, url. opts: limit, offset, from-date-time, to-date-time, plus api-key.

Example

page ::congress-gov/bills(119, "hr", {limit: 50, from-date-time: "2026-11-01T00:00:00Z"})
first(page.bills).title

collect

fn (fetch: Fn, opts: Map, limit: Int): Vec

Follow the pages of a list call until limit rows or the end. fetch takes opts (with limit and offset set) and returns one page. Each page is one request against the hourly limit.

Example

::cg ::congress-gov
all-actions ::cg/collect((o) { ::cg/actions(117, "hr", 3076, o) }, {}, 500)

collect-pages

fn (fetch: Fn, offset: Int, limit: Int, acc: Vec): Any

congress-get

fn (path: Str, params: Map, opts: Map): Any

list-bills

fn (congress: Any, kind: Any, opts: Map): Map

next-offset

fn (page: Any): Int?

The offset of the page after page, from the offset in pagination.next, or null on the last page (pure). The row count can't be used for this: the text endpoint has returned more rows than limit asked for.

page-items

fn (page: Any): Vec

The rows of a list response, whichever endpoint it came from; [] when there are none (pure).

page-params

fn (opts: Map): Map

limit (capped at 250) and offset from opts, omitted when unset (pure).

summaries

fn (congress: Any, kind: Any, number: Any): Map
fn (congress: Any, kind: Any, number: Any, opts: Map): Map

One page of a bill's CRS summaries: {summaries, pagination, request}. Each summary has actionDate, actionDesc, updateDate, versionCode and text, which is HTML. opts: limit, offset, plus api-key.

text-versions

fn (congress: Any, kind: Any, number: Any): Map
fn (congress: Any, kind: Any, number: Any, opts: Map): Map

One page of a bill's text versions: {textVersions, pagination, request}. Each version has type, date (null on some versions) and formats, a list of {type, url} links to congress.gov ("PDF", "Formatted Text", "Formatted XML"). opts: limit, offset, plus api-key.

Example

page ::congress-gov/text-versions(117, "hr", 3076)
first(first(page.textVersions).formats).url

update-params

fn (opts: Map): Map

fromDateTime and toDateTime from opts.from-date-time and opts.to-date-time, in YYYY-MM-DDT00:00:00Z form, omitted when unset (pure). They filter on the record's update date.

whole-number

fn (label: Str, value: Any): Str

with-key

fn (opts: Map, f: Fn): Any