Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking to determine the congressional district based on an address my user is providing. This will avoid having the user to look it up themselves.

Does an API of this sort exist?


Through my attempts to find one, I've only come across these:

    (not sure how to submit an an address or zip code however)

    The following resources are available in the API

    ...Bills and resolutions in the U.S. Congress since 1973 (the 93rd Congress).

    ...A (bill, person) pair indicating cosponsorship, with join and withdrawn dates.

    ...Members of Congress and U.S. Presidents since the founding of the nation.

    ...Terms held in office by Members of Congress and U.S. Presidents. Each term corresponds with an election, meaning each term in the House covers two years (one 'Congress'), as President four years, and in the Senate six years (three 'Congresses').

    ...Roll call votes in the U.S. Congress since 1789. How people voted is accessed through the Vote_voter API.

    ...How people voted on roll call votes in the U.S. Congress since 1789. See the Vote API. Filter on the vote field to get the results of a particular vote...

    (seems to be a way to find congress information, but not districts)

    This API provides programmers with structured access to all the data on OpenCongress, everything from official bill info to news and blog coverage to user-generated votes on bills and much more...

    This API defaults to returning XML. All queries can also return JSON...

    (similar question, no resolution)

    I've been looking over Open Dems, and seeing what's exposed at this point and what isn't. I work with Democrats Abroad, and am interested in using stuff from the lab for their sites.

    I quickly looked over the Precinct API, which does both more and less than what I'd need. An ideal resource would be any way of translating addresses into CD at the very least (getting state district data would be good as well), since that would make it easier for DA's membership to make a difference in races like last month's NY26 race...


I'm looking at the source for the website and the 'doGeoCode' function may be useful.


If no one has any suggestions, I will try to go off of what they are doing.

share|improve this question

closed as off-topic by gbjbaanb, Jules, JeffO, Brian, enderland Feb 24 at 0:06

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to find or recommend tools, libraries, programming languages, resources (including books, blogs, tutorials, and examples), or projects to undertake are off-topic on Programmers as they attract opinionated answers that won't have lasting value to others. You may be able to get help in The Whiteboard, our chat room." – gbjbaanb, Jules, JeffO, Brian, enderland
If this question can be reworded to fit the rules in the help center, please edit the question.

what have you tried? what did you search before asking here? – gnat Nov 9 '12 at 14:27
I have updated my question with some places I have been looking at. – ardavis Nov 9 '12 at 14:31
up vote 6 down vote accepted

I haven't used it, but a quick search brought me to Congress API from Sunlight Labs. Check out their districts.getDistrictsFromZip method -- it seems to be what you're looking for. You might get better (more accurate) results geocoding the address yourself and then using districts.getDistrictFromLatLong -- I'd assume that a given zip code could cross district boundaries.

share|improve this answer
Thank you @Caleb. I didn't come across that when I was searching, that seems to be exactly what I am looking for. I appreciate it. – ardavis Nov 9 '12 at 17:05

I realize this question is old, but I figured I'd throw in my two cents for anyone who might still be looking.

First, some background info. Congressional districts are extremely specific - down to an address itself, not just the street. Me and my neighbor across the street could be in different congressional districts. This is why it's so important to get a good ZIP+4 code to ensure that you're placing the address in the correct district. A system (like SmartyStreets or Melissa Data or QAS, etc.) that does address validation would give you a reliable ZIP+4 to ensure that the district is correct.

SmartyStreets has their LiveAddress API, which returns congressional data along with over 40 other data points (geocodes, residential vs commercial, etc.).

share|improve this answer
Given IL-04 I'm not even sure that the ZIP+4 would get the proper district. (geojson in a gist at copied from… because that's not rendering at the moment). – user40980 Apr 25 '14 at 20:32
... though, it says that zip+4 should get you to a building and includes information like what side of the street you are on. So maybe, but then consider that the set of zip+4 that maps to a district would be the number of buildings in that district which could get unwieldy. – user40980 Apr 25 '14 at 23:18

Melissa Data makes tools for address verification that includes information on political districts. I do not know if they have a public api; the link above will take you to an address look up page. They offer a limited number of free look ups that can be increased with a subscription. Please check their terms of use before putting this into a production application.

While their data is updated monthly, I have noticed that some of it does not reflect recent redistricting.

Many states have this information available, but I doubt that there is any consistency in their implementation.

share|improve this answer

The Congress API from Sunlight Foundation is Federal-only - no state-level, if that matters to you. And Sunlight Foundation is shutting down, because they don't want to be duplicating the efforts of GovTrack.

GovTrack's API is more complete. Their /role is closest to your question:

It tells you all the current Senators and House members, and when their next election is. So you'd have a filtering burden.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.