OpenFEC API
OpenFEC API for US campaign finance: 54,000+ candidates, committees, contributions and spending filings from the Federal Election Commission. Free key. Tested example.
Endpoint tested and returned HTTP 200 on 2026-08-21
What is the OpenFEC API?
OpenFEC is the Federal Election Commission's official API for US campaign finance data, covering more than 54,000 candidates plus committees, individual contributions, disbursements and filings. It requires a free api.data.gov key, with DEMO_KEY available for evaluation.
Campaign finance is the domain where an official API matters most, because the underlying filings are messy and third-party reconstructions disagree. OpenFEC serves the FEC's own processed data, including the itemised contributions that make donor-level analysis possible. The candidate records alone illustrate the messiness the FEC has to accommodate: a real record in the catalogue is filed under the name "212 N HALF W. JOHN, RODNEY HOWARD MR.", exactly as it was submitted, because the Commission publishes what was filed rather than cleaning it up.
Two structural details shape any query. `candidate_id` encodes the office in its first character — `P` presidential, `S` Senate, `H` House — so you can filter by office from the ID alone. And candidates are tracked per election cycle through the `cycles` and `election_years` arrays, so the same person appears with different financial totals depending on which cycle you ask about; `active_through` tells you the last cycle they were live in. Get your own free key rather than using DEMO_KEY, which api.data.gov shares globally and caps at roughly 30 requests per hour per IP.
Quick facts
- Base URL
https://api.open.fec.gov/v1- Authentication
- A free api.data.gov key is required. DEMO_KEY works for a few test calls but is globally shared and throttled to about 30 requests per hour per IP — register your own before real use.
- Rate limit
- 1,000 requests per hour with a registered key on most endpoints. DEMO_KEY is far lower and shared.
- Pricing
- Free. FEC filings are public records.
- CORS
- Enabled — callable directly from browser JavaScript
- Official docs
- Read the docs
How to use the OpenFEC API
Every request below was executed against the live API on 2026-08-21, and the response shown is the real body it returned — not an illustration.
1. Fetch a candidate from the OpenFEC API
GET https://api.open.fec.gov/v1/candidates/?api_key=DEMO_KEY&per_page=1
curl 'https://api.open.fec.gov/v1/candidates/?api_key=DEMO_KEY&per_page=1'const res = await fetch("https://api.open.fec.gov/v1/candidates/?api_key=DEMO_KEY&per_page=1");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
res = requests.get("https://api.open.fec.gov/v1/candidates/?api_key=DEMO_KEY&per_page=1", timeout=20)
res.raise_for_status()
print(res.json()){
"api_version": "1.0",
"pagination": {
"count": 54400,
"is_count_exact": true,
"page": 1,
"pages": 54400,
"per_page": 1
},
"results": [
{
"active_through": 2024,
"candidate_id": "P40014052",
"candidate_inactive": false,
"candidate_status": "N",
"cycles": [
2024,
2026
],
"district": "00",
"district_number": 0,
"election_districts": [
"00"
],
"election_years": [
2024
],
"federal_funds_flag": false,
"first_file_date": "2023-06-24",
"has_raised_funds": false,
"inactive_election_years": null,
"incumbent_challenge": "C",
"incumbent_challenge_full": "Challenger",
"last_f2_date": "2023-06-24",
"last_file_date": "2023-06-24",
"load_date": "2023-07-10T21:05:09",
"name": "212 N HALF W. JOHN, RODNEY HOWARD MR.",
"office": "P",
"office_full": "President",
"party": "IND",
"party_full": "INDEPENDENT",
"state": "US"
}
]
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | query | Required | Your api.data.gov key. `DEMO_KEY` for evaluation only. DEMO_KEY |
per_page | query | Optional | Records per page, up to 100. 1 |
page | query | Optional | Page number. 2 |
candidate_status | query | Optional | `C` current, `F` future, `N` not yet a candidate, `P` prior. C |
office | query | Optional | `P`, `S` or `H` for presidential, Senate or House. S |
cycle | query | Optional | Two-year election cycle to report against. 2024 |
state | query | Optional | Two-letter state code. CA |
Response fields
api_versionstring- API contract version, currently `1.0`.
paginationobject- `count`, `page`, `pages` and `per_page`, with `is_count_exact` flagging when the total is an estimate.
resultsarray- The candidate records.
results[].candidate_idstring- FEC identifier. The first character encodes the office — `P`, `S` or `H`.
results[].namestring- Name exactly as filed, including any oddities the filer submitted. Not normalised.
results[].office / office_fullstring- Office code and its expanded name.
results[].party / party_fullstring- Party code and full name; `IND` for independents.
results[].cycles / election_yearsarray- Election cycles the candidate is associated with. The same person recurs across cycles with different totals.
results[].active_throughinteger- Last cycle the candidacy was active.
results[].incumbent_challenge / incumbent_challenge_fullstring- `I` incumbent, `C` challenger, `O` open seat.
results[].has_raised_fundsboolean- Whether any receipts have been filed — useful for excluding paper candidacies.
What you can build with the OpenFEC API
- Analyse campaign contributions to a candidate or committee
- Track spending across an election cycle
- Build a donor lookup tool from itemised filings
- Compare fundraising between challengers and incumbents
- Monitor new FEC filings as they are processed
Common errors and how to fix them
429 or OVER_RATE_LIMIT
DEMO_KEY's shared quota is exhausted.
Fix: Register a free api.data.gov key; DEMO_KEY is capped at roughly 30 requests per hour per IP across all users on your network.
Duplicate-looking candidates
Records are tracked per election cycle.
Fix: Filter by `cycle`, and use `candidate_id` rather than `name` as the identity key.
Names look malformed
The FEC publishes names exactly as filed.
Fix: Normalise on your side if you need clean display names; do not assume a `LAST, FIRST` format holds.
Counts differ between calls
`is_count_exact` is false on some queries.
Fix: Read that flag before presenting a total as authoritative.
OpenFEC API — frequently asked questions
Do I need a key for the OpenFEC API?
Yes, a free one from api.data.gov. DEMO_KEY works for evaluation but is shared globally and throttled to about 30 requests per hour per IP, so register your own before building anything.
What do the candidate ID letters mean?
The first character encodes the office sought: `P` for president, `S` for Senate and `H` for House. That means you can filter by office directly from the ID without a separate lookup.
Can I get individual donor records?
Yes. The itemised contribution endpoints expose individual receipts above the FEC reporting threshold, including donor name, employer and occupation as filed.
Why does the same candidate appear more than once?
Because records are maintained per election cycle. Use `candidate_id` as the stable identity and read `cycles` and `active_through` to understand which elections each record covers.
Tools that pair with this API
JSON to CSV Converter
Convert a JSON array of objects to CSV online. Automatic column headers from the union of all keys, delimiter choice and proper quoting — all in-browser.
CSV Viewer & Table
View CSV as a clean HTML table online. Live search filter, row and column counts, delimiter and header options — all processed locally in your browser.
Percentage Calculator
Calculate what X% of a number is, what percent one number is of another, and percentage increase or decrease between two values — instantly and free.
OpenFEC is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.