How to use the POPVOX API to get lawmaker ids
There are two ways POPVOX provides destination IDs for messages. Through our API or a simple CSV download.
A simple GET request can be made to the following endpoint with parameters that correspond to the Congress Member:
https://messages.popvox.com/api/congress_members?type=rep&state=TN&district=7
A successful lookup of this member will result in the following json response:
{ "response": "success", "members": [ { "member_id": 9172, "member_type": "Rep", "first_name": "Marsha", "last_name": "Blackburn", "party": "R", "state": "TN", "district": "7" } ] }
member_id
is the property that should be used as the destination_id in a delivery request.
A request made for senate offices will result in two elements in the members
array - one for each Senator.
The following paramters are used in this request:
type
: rep or senstate
: The state this member representsdistrict
: District this member represents (only include for House of Representatives)In case wrong data is passed or a member isn't found - the following will be returned:
{ "response": "error", "reason": "Member(s) not found" }
You may find that it's more convenient to simply have a copy of all the member ID's as you use the API. If that's the case - use the button below to download a current version.
Download CSV