GovTrack.us

 

APIs: Special Access to Source Data

APIs are URLs on GovTrack that serve XML rather than HTML. They are intended to be called by applications to retrieve data dynamically. There's no API key. There are no terms of use. Do whatever you want with these APIs, but don't overload my server by calling them too much.

If you use the APIs regularly, you might want to join the GovTrack mail list to be aware of any API changes.

Source Data API

The APIs below are only half of the way to retreive GovTrack data. The preferred way is via the source data, which are static XML files that you can access via HTTP or rsync. Everything you see on GovTrack is in one of the static XML files. Described below are special API methods that cover some additional needs, but check out the source data first.

Bill Search API

Get the results of a bill search in XML using the bill search API. See this example. The query string parameters mimic those on the bill search page.

Member of Congress API

Get some information about a Member of Congress in XML using the MoC API. See this example. You can also pass a "session" parameter to get sponsored and cosponsored bills from the current or a previous Congresses, i.e. this example with bills. (There's no other documentation other than the example, and there are no other query string options. On Nov 14, 2008, the API now requires the session parameter to get the list of bills.)

Vote Database API

Get voting records in XML. To get an overall list, use the roll call votes API: example or use the master vote index file in the source data. To get the voting record of a single Member of Congress, use the voting record API (example), or scan the complete roll vote XML files in the source data.

Congressional District Look-up API

Look up a congressional district by ZIP code (ZIP or ZIP+4) latitude/longitude, or by street address (which uses geocoder.us underlyingly). It'll also tell you the GovTrack IDs for the senators and representatives for the district (as of Nov 14, 2008). Here are four examples: by 5-digit ZIP code (which happens to yield multiple matches but can also return a single match as with the rest of the examples), by 9-digit ZIP code, by address, and by latitude/longitude. Try fake zip codes, addresses, etc. to see what the results look like if no match is found. ZIP+4 lookups is based on USPS data purchased by Public.Resource.Org. I have compactified the ZIP+4 database here so that if all ZIP+4 codes starting with "XYZ" map to the same district, then there is a single entry in the file for "XYZ". (The information in the API and file is current as of Summer 2008.)

Google Maps Overlays

This isn't an API but it's worth noting here. The Google Maps overlays used here can be used on your own Google Maps API mash-ups. See these instructions.