Sunlight Labs API Documentation

This page provides information on directly interfacing with the Sunlight Labs API, note that all calls require an API key.

If you don't already have an API key, registration is fast and simple: Register for your Sunlight Labs API key now!

Technical Information

The Sunlight Labs API is RESTful 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

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.

Methods

The Sunlight Labs API currently provides the following methods:

Legislator Methods

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

District Methods

These methods relate to Congressional districts, providing lookups to obtain district information from a zipcode or latitude and longitude.

More methods are coming soon providing enhanced functionality, the goal in phase one of the new API was to replace the most-used functionality from the original labs API.