FEC API

⭐ Beginner's Pick Government / API Key Intermediate HTTPS
Varies by plan (check documentation)

Overview

The FEC (Federal Election Commission) API lets you explore campaign finance data from US federal elections, including donations, candidate financials, and committee information. You need a free API key from api.data.gov to get started. This API is great for journalists, researchers, and civic tech developers who want to follow the money in US politics.

💡

Beginner Tip

Register for a free API key at api.data.gov/signup and you'll be approved instantly. The interactive documentation at api.open.fec.gov/developers lets you try every endpoint in your browser before writing any code.

Available Data

country name and code
population
capital city
region and subregion
flag image URL

Example Response

JSON Response
{
  "name": "Japan",
  "capital": "Tokyo",
  "population": 125800000,
  "region": "Asia",
  "languages": [
    "Japanese"
  ],
  "flag": "https://flagcdn.com/jp.svg",
  "currencies": [
    {
      "code": "JPY",
      "name": "Japanese yen"
    }
  ]
}

Field Reference

results Array of candidate or financial record objects matching the query
name Full name of the candidate
office Federal office sought: P for President, S for Senate, H for House
party Political party abbreviation (e.g., DEM, REP)
total_receipts Total campaign contributions received in dollars
pagination Object containing count, page, pages, and per_page for navigating large result sets

Implementation Example

const url = "https://api.open.fec.gov/developers/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

403 Forbidden or OVER_RATE_LIMIT Exceeding the default rate limit of 1,000 requests per hour per API key
Add delays between requests and cache responses. For higher limits, contact api.data.gov for a higher-tier key
400 Bad Request: invalid parameter Using a parameter name or value that the endpoint does not support
Use the interactive Swagger UI at api.open.fec.gov/developers to verify valid parameters for each endpoint before coding
Empty results despite correct query The election cycle or office filter does not match any records
Verify election_year is an even number (2022, 2024) and office is P, S, or H for President, Senate, or House

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 5/20
🔒 Security 15/15
🛠 Developer XP 12/20
✓ Reliability 10/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Category Government
Difficulty Intermediate
Verified: 2026-04-04

Similar APIs

View All →