TweetAtCongress is an API that provides information about Congress members on Twitter. (Read more...)

API

Make a GET request on the following URL to access the API.

http://tweetatcongress.com/api

Parameters

legtype
Required
Must be "federal". (State legislators will be added soon.)

state
Required
Two-letter abbreviation of the state to check.

leghouse
Optional
Filter results by house of Congress. One of "rep", "sen", or "all". Default is all.

party
Optional
Filter results by party. One of "d", "r", "i", or "all". Default is all.

format
Optional
One of either "xml" or "json". Default is xml.

jsonp_callback
Optional
Only valid for JSON format. If supplied, the response will use the JSONP format with a callback of the given name.

Example Response

Below are example responses. You may also use the test console to view real, live responses.

XML

<tweetatcongress>
	<count>2</count>
	<congressmembers>
		<member>
			<name>John Smith</name>
			<leghouse>Rep</leghouse>
			<party>D</party>
			<twitter>johnsmith</twitter>
		</member>
		<member>
			<name>Susan Smith</name>
			<leghouse>Sen</leghouse>
			<party>R</party>
			<twitter>susansmith</twitter>
		</member>
	</congressmembers>
</tweetatcongress>

JSON

{
	"count":"2",
	"congressmembers":[
		{
			"name":"John Smith",
			"leghouse":"Rep",
			"party":"D",
			"twitter":"johnsmith"
		},
		{
			"name":"Susan Smith",
			"leghouse":"Sen",
			"party":"R",
			"twitter":"susansmith"
		}
	]
}

NOTE: If there are no Congress members found for a given state, an empty congressmembers object will be returned, with a count of 0.

Error Response

An error will be thrown if a required parameter is omitted.

XML

<errors>
	<error>
		<code>1</code>
		<message>No state specified.</message>
	</error>
</errors>

JSON

{
	"errors":[
		{
			"code":"1",
			"message":"No state specified."
		}
	]
}

Feedback

If you have any questions or comments, please e-mail info@tweetatcongress.com or tweet @noah_cooper.