FEC Campaign Finance API
api.open.fec.gov · Government
US Federal Election Commission data — campaign contributions, expenditures, candidate filings, PAC data, and election results. Free, API key from FEC.
Authentication
Sample Requests
Search for federal election candidates.
Hover any highlighted part to learn what it does
curl -X GET "https://api.open.fec.gov/v1/candidates/search/?q=Biden&api_key=YOUR_KEY&per_page=5"
import requests
params = {
"q": "Biden",
"api_key": "YOUR_KEY",
"per_page": "5"
}
response = requests.get(
"https://api.open.fec.gov/v1/candidates/search/",
params=params,
)
print(response.json())const url = new URL('https://api.open.fec.gov/v1/candidates/search/');
url.searchParams.set('q', 'Biden');
url.searchParams.set('api_key', 'YOUR_KEY');
url.searchParams.set('per_page', '5');
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.open.fec.gov/v1/candidates/search/")
q := baseURL.Query()
q.Set("q", "Biden")
q.Set("api_key", "YOUR_KEY")
q.Set("per_page", "5")
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.open.fec.gov/v1/candidates/search/")
uri.query = URI.encode_www_form({
"q" => "Biden",
"api_key" => "YOUR_KEY",
"per_page" => "5"
})
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.open.fec.gov/v1/candidates/search/?" . http_build_query([
"q" => "Biden",
"api_key" => "YOUR_KEY",
"per_page" => "5"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Get recent campaign contributions from New York.
Hover any highlighted part to learn what it does
curl -X GET "https://api.open.fec.gov/v1/schedules/schedule_a/?sort=-contribution_receipt_date&api_key=YOUR_KEY&per_page=5&contributor_state=NY"
import requests
params = {
"sort": "-contribution_receipt_date",
"api_key": "YOUR_KEY",
"per_page": "5",
"contributor_state": "NY"
}
response = requests.get(
"https://api.open.fec.gov/v1/schedules/schedule_a/",
params=params,
)
print(response.json())const url = new URL('https://api.open.fec.gov/v1/schedules/schedule_a/');
url.searchParams.set('sort', '-contribution_receipt_date');
url.searchParams.set('api_key', 'YOUR_KEY');
url.searchParams.set('per_page', '5');
url.searchParams.set('contributor_state', 'NY');
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.open.fec.gov/v1/schedules/schedule_a/")
q := baseURL.Query()
q.Set("sort", "-contribution_receipt_date")
q.Set("api_key", "YOUR_KEY")
q.Set("per_page", "5")
q.Set("contributor_state", "NY")
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.open.fec.gov/v1/schedules/schedule_a/")
uri.query = URI.encode_www_form({
"sort" => "-contribution_receipt_date",
"api_key" => "YOUR_KEY",
"per_page" => "5",
"contributor_state" => "NY"
})
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.open.fec.gov/v1/schedules/schedule_a/?" . http_build_query([
"sort" => "-contribution_receipt_date",
"api_key" => "YOUR_KEY",
"per_page" => "5",
"contributor_state" => "NY"
]);
$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
- Get a free API key at api.open.fec.gov
- Pass api_key=YOUR_KEY as query param
- Candidates: GET /candidates/search/?q=name&api_key=KEY
- Contributions: GET /schedules/schedule_a/?api_key=KEY&per_page=10
- Spending: GET /schedules/schedule_b/?api_key=KEY&per_page=10
What can you build with FEC Campaign Finance API?
FEC Campaign Finance API is a Government API. Developers commonly use government APIs for:
- surfacing public datasets in citizen-facing apps
- building transparency and civic engagement tools
- accessing legislation, court records, and official data
- powering research and journalism tools
- creating compliance and regulatory monitoring dashboards
API Key authentication. You'll receive a key after signing up. Send it with every request — in a header or query parameter. Keep it out of client-side code and never commit it to version control. FEC Campaign Finance API is free to use up to a usage limit, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide