NOTE: This API has been deprecated in favor of a new Sunlight Congress API. The old API, documented below, will continue to operate until at least January 3, 2015 (the end of the 113th Congress).
In the meantime, if you're using the below Congress API, please consider migrating your code to use our new one. We will be updating our Python and Ruby client libraries soon to make this easier. We have also prepared a migration guide to help make it clear what's changed, and how to transition.
The Sunlight Labs Congress API provides methods for obtaining basic information on Members of Congress, legislator IDs used by various websites, and lookups between places and the politicians that represent them. The primary purpose of the API is to facilitate mashups involving politicians and the various other APIs that are out there.
Anyone can use the Sunlight Labs Congress API, all it takes is a 15 second sign-up so that we can keep track of how many people are using the API and have a way to get in contact with you should there be any changes or API related news.
The Sunlight Labs API is RESTish and the preferred output format is JSON, although XML is available as well.
The base URL for all calls to the API is http://services.sunlightlabs.com/api/ and calling an API method looks like:
All API methods return a JSON or XML container named response that contains the object(s) returned by the appropriate API call. For detailed output examples view the specific documentation a particular method.
If an error is encountered the HTTP status code will be set to 400 and a plain text string describing the error is returned regardless of output format. If authentication fails due to a missing or invalid key the HTTP status code 403 is used.
The API also supports JSONP. Provide a callback named
jsonp (eg. &jsonp=my_callback)
The API currently provides the following methods:
Methods for US Representatives and Senators, providing basic contact information as well as all the various IDs we track for legislators.
Methods for Congressional districts, providing lookups to obtain district information from a zipcode or latitude and longitude.
Methods for Congressional Committees, providing membership information.
We provide a dump of all of the data in the API for those users that are best served by a full copy of this data. If you are making heavy use of the API, particularly in an application that involves pulling in nearly all of the information the API provides it is recommended that you use this archive. This dump is always synced to the latest data in the API.
We also have taken the effort to compile all of the images of Members of Congress into an archive. The following two archives are provided for convenience with images pulled from the Congressional Directory.
Note: Photos in these archives are named according to bioguide ID, these archives contain all representatives present in our API for which we have photos.