Sunlight Congress API

New Congress API

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.

Old Documentation

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.

Getting Started

Client Libraries

Technical Information

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&<params>

  • api.method: any of the methods listed below.
  • .format: .xml or .json, if omitted defaults to JSON
  • YOUR_API_KEY: the API key you received when signing up
  • params: the appropriate parameters to the API method

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.

JSONP support

The API also supports JSONP. Provide a callback named jsonp (eg. &jsonp=my_callback)

The API currently provides the following methods:

Legislator Methods

Methods for US Representatives and Senators, providing basic contact information as well as all the various IDs we track for legislators.

District Methods

Methods for Congressional districts, providing lookups to obtain district information from a zipcode or latitude and longitude.

Committee Methods

Methods for Congressional Committees, providing membership information.

About the Data

Download All Data

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

Photos of Members of Congress

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.