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:
http://services.sunlightlabs.com/api/api.method.format?apikey=YOUR_API_KEY¶ms
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 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.
Latest Sunlight Labs API Legislator Dump
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.