Open States API
v3.openstates.org · Government
US state legislative data — bills, votes, legislators, and committees from all 50 states, DC, and Puerto Rico. Real-time tracking of state legislation. Free API key.
Authentication
API Key
Free API key at openstates.org/accounts/profile/. Pass as X-API-KEY header.
Sample Requests
GET
Search bills
Search California bills about climate.
https://v3.openstates.org/bills?q=climate&per_page=5&jurisdiction=California
Hover any highlighted part to learn what it does
Headers — extra info sent with the request
| X-API-KEY | YOUR_KEY |
curl -X GET "https://v3.openstates.org/bills?q=climate&per_page=5&jurisdiction=California" \ -H "X-API-KEY: YOUR_KEY"
import requests
params = {
"q": "climate",
"per_page": "5",
"jurisdiction": "California"
}
headers = {
"X-API-KEY": "YOUR_KEY"
}
response = requests.get(
"https://v3.openstates.org/bills",
params=params,
headers=headers,
)
print(response.json())const url = new URL('https://v3.openstates.org/bills');
url.searchParams.set('q', 'climate');
url.searchParams.set('per_page', '5');
url.searchParams.set('jurisdiction', 'California');
const response = await fetch(url, {
headers: {
'X-API-KEY': 'YOUR_KEY'
},
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://v3.openstates.org/bills")
q := baseURL.Query()
q.Set("q", "climate")
q.Set("per_page", "5")
q.Set("jurisdiction", "California")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
req.Header.Set("X-API-KEY", "YOUR_KEY")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://v3.openstates.org/bills")
uri.query = URI.encode_www_form({
"q" => "climate",
"per_page" => "5",
"jurisdiction" => "California"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
req["X-API-KEY"] = "YOUR_KEY"
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://v3.openstates.org/bills?" . http_build_query([
"q" => "climate",
"per_page" => "5",
"jurisdiction" => "California"
]);
$opts = ["http" => [
"method" => "GET",
"header" => implode("\r\n", [
"X-API-KEY: YOUR_KEY"
]),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET
Find legislators
Get Texas state legislators.
https://v3.openstates.org/people?per_page=5&jurisdiction=Texas
Hover any highlighted part to learn what it does
Headers — extra info sent with the request
| X-API-KEY | YOUR_KEY |
curl -X GET "https://v3.openstates.org/people?per_page=5&jurisdiction=Texas" \ -H "X-API-KEY: YOUR_KEY"
import requests
params = {
"per_page": "5",
"jurisdiction": "Texas"
}
headers = {
"X-API-KEY": "YOUR_KEY"
}
response = requests.get(
"https://v3.openstates.org/people",
params=params,
headers=headers,
)
print(response.json())const url = new URL('https://v3.openstates.org/people');
url.searchParams.set('per_page', '5');
url.searchParams.set('jurisdiction', 'Texas');
const response = await fetch(url, {
headers: {
'X-API-KEY': 'YOUR_KEY'
},
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://v3.openstates.org/people")
q := baseURL.Query()
q.Set("per_page", "5")
q.Set("jurisdiction", "Texas")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
req.Header.Set("X-API-KEY", "YOUR_KEY")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://v3.openstates.org/people")
uri.query = URI.encode_www_form({
"per_page" => "5",
"jurisdiction" => "Texas"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
req["X-API-KEY"] = "YOUR_KEY"
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://v3.openstates.org/people?" . http_build_query([
"per_page" => "5",
"jurisdiction" => "Texas"
]);
$opts = ["http" => [
"method" => "GET",
"header" => implode("\r\n", [
"X-API-KEY: YOUR_KEY"
]),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- Get a free API key at openstates.org/accounts/profile/
- Set X-API-KEY: YOUR_KEY header
- Bills: GET /bills?jurisdiction=New+York&q=housing&per_page=10
- Legislators: GET /people?jurisdiction=Florida&per_page=10
- Jurisdictions: use state names or abbreviations