Google Civic Information API
googleapis · Analytics
Provides polling places, early vote locations, contest data, election officials, and government representatives for U.S. residential addresses.
Authentication
Sample Requests
Searches for political divisions by their natural name or OCD ID.
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/divisions?alt=json&key=YOUR_API_KEY&query=test&fields=example&$.xgafv=1&callback=example"aUser=example&uploadType=example&oauth_token=example&prettyPrint=true&access_token=example&upload_protocol=example"
import requests
params = {
"alt": "json",
"key": "YOUR_API_KEY",
"query": "test",
"fields": "example",
"$.xgafv": "1",
"callback": "example",
"quotaUser": "example",
"uploadType": "example",
"oauth_token": "example",
"prettyPrint": "true",
"access_token": "example",
"upload_protocol": "example"
}
response = requests.get(
"https://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/divisions",
params=params,
)
print(response.json())const url = new URL('https://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/divisions');
url.searchParams.set('alt', 'json');
url.searchParams.set('key', 'YOUR_API_KEY');
url.searchParams.set('query', 'test');
url.searchParams.set('fields', 'example');
url.searchParams.set('$.xgafv', '1');
url.searchParams.set('callback', 'example');
url.searchParams.set('quotaUser', 'example');
url.searchParams.set('uploadType', 'example');
url.searchParams.set('oauth_token', 'example');
url.searchParams.set('prettyPrint', 'true');
url.searchParams.set('access_token', 'example');
url.searchParams.set('upload_protocol', 'example');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/divisions")
q := baseURL.Query()
q.Set("alt", "json")
q.Set("key", "YOUR_API_KEY")
q.Set("query", "test")
q.Set("fields", "example")
q.Set("$.xgafv", "1")
q.Set("callback", "example")
q.Set("quotaUser", "example")
q.Set("uploadType", "example")
q.Set("oauth_token", "example")
q.Set("prettyPrint", "true")
q.Set("access_token", "example")
q.Set("upload_protocol", "example")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
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://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/divisions")
uri.query = URI.encode_www_form({
"alt" => "json",
"key" => "YOUR_API_KEY",
"query" => "test",
"fields" => "example",
"$.xgafv" => "1",
"callback" => "example",
"quotaUser" => "example",
"uploadType" => "example",
"oauth_token" => "example",
"prettyPrint" => "true",
"access_token" => "example",
"upload_protocol" => "example"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/divisions?" . http_build_query([
"alt" => "json",
"key" => "YOUR_API_KEY",
"query" => "test",
"fields" => "example",
"$.xgafv" => "1",
"callback" => "example",
"quotaUser" => "example",
"uploadType" => "example",
"oauth_token" => "example",
"prettyPrint" => "true",
"access_token" => "example",
"upload_protocol" => "example"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Looks up political geography and representative information for a single address.
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/representatives?alt=json&key=YOUR_API_KEY&roles=example&fields=example&levels=example&$.xgafv=1&address=example&callback=example"aUser=example&uploadType=example&oauth_token=example&prettyPrint=true&access_token=example&includeOffices=true&upload_protocol=example"
import requests
params = {
"alt": "json",
"key": "YOUR_API_KEY",
"roles": "example",
"fields": "example",
"levels": "example",
"$.xgafv": "1",
"address": "example",
"callback": "example",
"quotaUser": "example",
"uploadType": "example",
"oauth_token": "example",
"prettyPrint": "true",
"access_token": "example",
"includeOffices": "true",
"upload_protocol": "example"
}
response = requests.get(
"https://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/representatives",
params=params,
)
print(response.json())const url = new URL('https://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/representatives');
url.searchParams.set('alt', 'json');
url.searchParams.set('key', 'YOUR_API_KEY');
url.searchParams.set('roles', 'example');
url.searchParams.set('fields', 'example');
url.searchParams.set('levels', 'example');
url.searchParams.set('$.xgafv', '1');
url.searchParams.set('address', 'example');
url.searchParams.set('callback', 'example');
url.searchParams.set('quotaUser', 'example');
url.searchParams.set('uploadType', 'example');
url.searchParams.set('oauth_token', 'example');
url.searchParams.set('prettyPrint', 'true');
url.searchParams.set('access_token', 'example');
url.searchParams.set('includeOffices', 'true');
url.searchParams.set('upload_protocol', 'example');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/representatives")
q := baseURL.Query()
q.Set("alt", "json")
q.Set("key", "YOUR_API_KEY")
q.Set("roles", "example")
q.Set("fields", "example")
q.Set("levels", "example")
q.Set("$.xgafv", "1")
q.Set("address", "example")
q.Set("callback", "example")
q.Set("quotaUser", "example")
q.Set("uploadType", "example")
q.Set("oauth_token", "example")
q.Set("prettyPrint", "true")
q.Set("access_token", "example")
q.Set("includeOffices", "true")
q.Set("upload_protocol", "example")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
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://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/representatives")
uri.query = URI.encode_www_form({
"alt" => "json",
"key" => "YOUR_API_KEY",
"roles" => "example",
"fields" => "example",
"levels" => "example",
"$.xgafv" => "1",
"address" => "example",
"callback" => "example",
"quotaUser" => "example",
"uploadType" => "example",
"oauth_token" => "example",
"prettyPrint" => "true",
"access_token" => "example",
"includeOffices" => "true",
"upload_protocol" => "example"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/representatives?" . http_build_query([
"alt" => "json",
"key" => "YOUR_API_KEY",
"roles" => "example",
"fields" => "example",
"levels" => "example",
"$.xgafv" => "1",
"address" => "example",
"callback" => "example",
"quotaUser" => "example",
"uploadType" => "example",
"oauth_token" => "example",
"prettyPrint" => "true",
"access_token" => "example",
"includeOffices" => "true",
"upload_protocol" => "example"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Looks up information relevant to a voter based on the voter's registered address.
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/voterinfo?alt=json&key=YOUR_API_KEY&fields=example&$.xgafv=1&address=example&callback=example"aUser=example&electionId=example&uploadType=example&oauth_token=example&prettyPrint=true&access_token=example&officialOnly=true&upload_protocol=example&returnAllAvailableData=true"
import requests
params = {
"alt": "json",
"key": "YOUR_API_KEY",
"fields": "example",
"$.xgafv": "1",
"address": "example",
"callback": "example",
"quotaUser": "example",
"electionId": "example",
"uploadType": "example",
"oauth_token": "example",
"prettyPrint": "true",
"access_token": "example",
"officialOnly": "true",
"upload_protocol": "example",
"returnAllAvailableData": "true"
}
response = requests.get(
"https://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/voterinfo",
params=params,
)
print(response.json())const url = new URL('https://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/voterinfo');
url.searchParams.set('alt', 'json');
url.searchParams.set('key', 'YOUR_API_KEY');
url.searchParams.set('fields', 'example');
url.searchParams.set('$.xgafv', '1');
url.searchParams.set('address', 'example');
url.searchParams.set('callback', 'example');
url.searchParams.set('quotaUser', 'example');
url.searchParams.set('electionId', 'example');
url.searchParams.set('uploadType', 'example');
url.searchParams.set('oauth_token', 'example');
url.searchParams.set('prettyPrint', 'true');
url.searchParams.set('access_token', 'example');
url.searchParams.set('officialOnly', 'true');
url.searchParams.set('upload_protocol', 'example');
url.searchParams.set('returnAllAvailableData', 'true');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/voterinfo")
q := baseURL.Query()
q.Set("alt", "json")
q.Set("key", "YOUR_API_KEY")
q.Set("fields", "example")
q.Set("$.xgafv", "1")
q.Set("address", "example")
q.Set("callback", "example")
q.Set("quotaUser", "example")
q.Set("electionId", "example")
q.Set("uploadType", "example")
q.Set("oauth_token", "example")
q.Set("prettyPrint", "true")
q.Set("access_token", "example")
q.Set("officialOnly", "true")
q.Set("upload_protocol", "example")
q.Set("returnAllAvailableData", "true")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
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://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/voterinfo")
uri.query = URI.encode_www_form({
"alt" => "json",
"key" => "YOUR_API_KEY",
"fields" => "example",
"$.xgafv" => "1",
"address" => "example",
"callback" => "example",
"quotaUser" => "example",
"electionId" => "example",
"uploadType" => "example",
"oauth_token" => "example",
"prettyPrint" => "true",
"access_token" => "example",
"officialOnly" => "true",
"upload_protocol" => "example",
"returnAllAvailableData" => "true"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/googleapis.com/civicinfo/v2/civicinfo/v2/voterinfo?" . http_build_query([
"alt" => "json",
"key" => "YOUR_API_KEY",
"fields" => "example",
"$.xgafv" => "1",
"address" => "example",
"callback" => "example",
"quotaUser" => "example",
"electionId" => "example",
"uploadType" => "example",
"oauth_token" => "example",
"prettyPrint" => "true",
"access_token" => "example",
"officialOnly" => "true",
"upload_protocol" => "example",
"returnAllAvailableData" => "true"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- See official documentation for authentication and setup.
What can you build with Google Civic Information API?
Google Civic Information API is a Analytics API. Developers commonly use analytics APIs for:
- tracking product usage and user behaviour
- building custom reporting and BI dashboards
- measuring marketing and campaign performance
- running funnel, retention, and cohort analysis
- aggregating metrics from multiple data sources
No authentication required. This API is open — no signup or key needed. Ideal for quick prototypes and public-facing features. Google Civic Information API is free to use, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide