Skip to contents

get_congress takes in a Congress API endpoint path and returns data on bills, amendments, congressional records, and other content.

Usage

get_congress(endpoint, key = congress_get_key(), return.data = TRUE, ...)

Arguments

endpoint

Character string, complete endpoint path.

key

Character string, Congress API key. Defaults to congress_get_key()

return.data

Return content as a data frame? Not all endpoints are supported (e.g., "member/bioguideId"). In this case, the call will return JSON and throw a non-fatal warning.

...

Additional formatting options passed to the end of the API call (e.g., sort = "desc"). Arguments passed via dots must be named.

Value

If return.data = TRUE, returns a data.frame object of 20 rows by default. Otherwise, a JSON structure is returned.

Details

11 base endpoints may be specified: bill, amendments, summaries, congress, member, committee, committee-report, congressional-record, house-communication, nomination, and treaty.

Within each endpoint, multiple additional parameters may be specified to filter data based on, for example, congressional session or chamber ("hr" vs. "s"). In addition, additional sorting and subsetting parameters may be passed through ..., such as sort = "desc" or fromDateTime = "2022-04-01T00:00:00Z". Pagination may be executed using offset. Amount of rows returned may be increased using limit.

Visit https://api.congress.gov/ for more details.

Examples

if (FALSE) {
get_congress("bill")
get_congress("congress/116")
get_congress("member/L000174", return.data = FALSE)
get_congress("committee-report/116/hrpt/617/text")
}