OpenCongress API Documentation
Welcome. This API provides programmers with structured access to all the data on OpenCongress, everything from official bill info to news and blog coverage to user-generated votes on bills and much more. The data below is just a start -- we will continually add more unique info & useful enhancements in order to contribute public knowledge about Congress back to the data commons on the open Web. We're always interested in hearing requests or seeing use cases of how you're using this API -- see the Developer Resources at the bottom of this page.
This API defaults to returning XML. All queries can also return JSON by adding a .json file extension, or by specifying format=json as a URL parameter. JSONP is also supported, via a callback parameter. The API defaults to returning 30 results. You can pass the per_page variable to decrease this (30 is the max), and the page variable to flip through pages.
The people API is used to query the system for individuals, or groups of people matching given criteria. The following describes the parameters that can be used.
- First Name (first_name)
Specify the first name of the person
- Last Name (last_name)
Specify the last name of the person
- OpenCongress ID (person_id)
Specify the id of the person
- Gender (gender)
Specify the gender of the person, either 'M' or 'F'
- State (state)
Specify the two letter state of the person
- District (district)
Specify the congressional district of the person
- Party (party)
Specify the political party of the person, either 'Republican', 'Democrat', or 'Independent'
- User Approval Range (user_approval_from, user_approval_to)
Specify an average OpenCongress user approval rating range (0.0 to 10.0)
- Senators most in the news this week
- Representatives most in the news this week
- Most blogged Senators this week
- Most blogged Representatives this week
- Compare Two People
- Specify the ID's of two people to compare, and receive XML of their roll call vote comparisons.
- People Approved of by Open Congress Users are Also
Returns bills, representatives, and senators supported and opposed by users's approving of a given person.
- People Disapproved of by Open Congress Users are Also
Returns bills, representatives, and senators supported and opposed by users's disapproving of a given person.
- Open Congress Users tracking person are also tracking
Returns bills, people, and issues commonly tracked by people tracking a given person.
The Bills API is used to query OpenCongress for bills matching given criteria. The following describes the functions and parameters that can be used.
- Bills by session of congress
Returns bills matching the given congress.
- Bills by type
Returns bills matching the given type. Type can be: h (house),
s (senate), hj (house joint resolution), sj (senate joint resolution), hc (house concurrent resolution)
sc (senate concurrent resolution), hr (house resolution), sr (senate resolution)
- Bills by number
Returns bills matching the given number.
- Bills by ident
Returns bills matching the given OpenCongress identification strings (session + chamber + bill number).
- Bills Introduced Since
Returns bills that were introduced since the supplied date (30 at a time).
http://api.opencongress.org/bills_introduced_since?date=Jan 30th, 2009
- Bills by Query
Returns bills matching a text query.
http://api.opencongress.org/bills_by_query?q=Global Poverty Act of 2007
- Hot Bills
Returns bills that OpenCongress editors feel are "hot".
- Stalled Bills
Returns bills that have passed one chamber but have not received a vote on passage in the other (or a conference vote).
- Most Blogged Bills this Week
Returns the most bills most blogged about this week.
- Bills Most in the News this Week
Returns the most bills most reported on by news agencies this week.
- Most Commented-On Bills This Week
Returns 20 bills with the most comments added in the last week.
- Most Tracked Bills this Week
Returns the most bills most tracked by OpenCongress Users this week.
- Most Supported Bills this Week
Returns the most bills most supported by OpenCongress Users this week.
- Most Opposed Bills this Week
Returns the most bills most opposed by OpenCongress Users this week.
- Bills Supported by Open Congress Users are Also
Returns bills, representatives, and senators supported and opposed by users's supporting a given bill.
- Bills Opposed by Open Congress Users are Also
Returns bills, representatives, and senators supported and opposed by users's opposing a given bill.
- Open Congress Users tracking bill are also tracking
Returns bills, people, and issues commonly tracked by people tracking a given bill.
- Roll Calls by Bills
Returns the roll calls for a given list of bills.
- Issues by Keyword
Specify a Keyword, and receive an array of issue areas that match the keyword.
- OpenCongress Semantic MediaWiki API
Here is the API for query strings on wiki data, as well as help with writing query language. We'll be doing more extensive documentation of how to use Semantic MediaWiki and the data available through this API soon.
- Semantic MediaWiki Data
Here is the page to retrieve all the data on the OpenCongress Wiki, including a simpler query string format. Further documentation of data offerings to come.
OpenCongress Developer Resources
- To ask questions about the API, suggest enhancements, report bugs, or let us know how you're using data from our API, send us an email:
- To sign up for general site updates over e-mail: OpenCongress mailing list (low-volume, major announcements only).
- To subscribe to updates via RSS: Blog RSS feed.
- To sign up for detailed programming updates over e-mail: Site development list-serv.
- To join an associated Google Group: Sunlight Labs, Sunlight Wiki
- To chat with our open-source development team over IRC: #opencongress on irc.freenode.net.
- To check out our site code: GitHub page
- To file a bug report, interface improvement, data source, or feature suggestion: Trac project homepage.