# FEC API

> FEC provides federal candidate fundraising and spending data as a workflow and API.

Search candidates lists federal candidates by office and election year, ranked by money raised; Senate and House searches need a state.

- Page: https://fous.com/workflows/fec
- Handle: `@fec`
- Category: [Government](https://fous.com/workflows/category/government)
- Source website: https://fec.gov
- Last verified: Sep 29, 2026
- Fous is not affiliated with FEC.

## Methods

### Get candidate fundraising

Operation `get_candidate_fundraising`, version 1. 1 credit per call.

Get a federal candidate’s fundraising and spending for a two-year filing period from FEC candidate pages. Defaults to the FEC’s current two-year period. If several names match, returns the matching candidate with the most reported fundraising for that period.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `state` | string | no | `"NY"` | State postal abbreviation to distinguish candidates, for example MA. |
| `office` | string | no | `"house"` | Office to distinguish candidates, for example senate. Defaults to any. |
| `candidate` | string | yes | `"Alexandria Ocasio-Cortez"` | Candidate name, for example Elizabeth Warren. |
| `election_year` | integer | no | `2024` | Two-year election cycle, for example 2024. Defaults to the FEC’s current cycle. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "candidate"
  ],
  "properties": {
    "state": {
      "type": "string",
      "description": "State postal abbreviation to distinguish candidates, for example MA.",
      "examples": [
        "NY"
      ]
    },
    "office": {
      "enum": [
        "any",
        "president",
        "senate",
        "house"
      ],
      "type": "string",
      "default": "any",
      "description": "Office to distinguish candidates, for example senate. Defaults to any.",
      "examples": [
        "house"
      ]
    },
    "candidate": {
      "type": "string",
      "description": "Candidate name, for example Elizabeth Warren.",
      "examples": [
        "Alexandria Ocasio-Cortez",
        "Elizabeth Warren"
      ]
    },
    "election_year": {
      "type": "integer",
      "description": "Two-year election cycle, for example 2024. Defaults to the FEC’s current cycle.",
      "examples": [
        2024
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "state": "NY",
      "office": "house",
      "candidate": "Alexandria Ocasio-Cortez",
      "election_year": 2024
    },
    {
      "candidate": "Elizabeth Warren"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `cycle` | integer | `2024` |  |
| `debts` | number or null | `0` |  |
| `party` | string or null | `"Democratic Party"` |  |
| `state` | string or null | `"NY"` |  |
| `office` | string | `"House"` |  |
| `currency` | string | `"USD"` |  |
| `district` | string or null | `"14"` |  |
| `total_spent` | number or null | `16716492.89` |  |
| `cash_on_hand` | number or null | `3734646.88` |  |
| `total_raised` | number or null | `15299235.57` |  |
| `candidate_link` | string | `"https://www.fec.gov/data/candidate/H8NY15148/?cycle=2024&election_full=false"` |  |
| `candidate_name` | string | `"Alexandria Ocasio-Cortez"` |  |
| `fec_candidate_id` | string | `"H8NY15148"` |  |
| `fec_committee_id` | string or null | `"C00639591"` |  |
| `coverage_end_date` | string or null | `"2024-12-31"` |  |
| `individual_contributions` | number or null | `14866494.81` |  |
| `principal_campaign_committee` | string or null | `"Alexandria Ocasio-Cortez For Congress"` |  |
| `incumbent_challenger_open_seat` | string or null | `"Incumbent"` |  |

**Example input**

```json
{
  "state": "NY",
  "office": "house",
  "candidate": "Alexandria Ocasio-Cortez",
  "election_year": 2024
}
```

**Example output**

```json
{
  "cycle": 2024,
  "debts": 0,
  "party": "Democratic Party",
  "state": "NY",
  "office": "House",
  "currency": "USD",
  "district": "14",
  "total_spent": 16716492.89,
  "cash_on_hand": 3734646.88,
  "total_raised": 15299235.57,
  "candidate_link": "https://www.fec.gov/data/candidate/H8NY15148/?cycle=2024&election_full=false",
  "candidate_name": "Alexandria Ocasio-Cortez",
  "fec_candidate_id": "H8NY15148",
  "fec_committee_id": "C00639591",
  "coverage_end_date": "2024-12-31",
  "individual_contributions": 14866494.81,
  "principal_campaign_committee": "Alexandria Ocasio-Cortez For Congress",
  "incumbent_challenger_open_seat": "Incumbent"
}
```

### Search candidates

Operation `search_candidates`, version 1. 1 credit per call.

List federal candidates for an office and election year, ranked by total money raised. Senate and House searches require a state; fundraising and cash balances reflect the latest available filings, and candidates without reported totals may have missing amounts.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `state` | string | no | `"CA"` | State or territory name or two-letter code, for example Texas or TX. Required for Senate and House. |
| `office` | string | yes | `"house"` | Federal office to search, for example house. |
| `district` | integer | no | `12` | House district number, for example 12. Use 0 for an at-large district. |
| `max_results` | integer | no | `5` | Maximum candidates to return, for example 50. |
| `election_year` | integer | yes | `2026` | Election year, for example 2026. |
| `raised_money_only` | string | no | `"no"` | Use yes to include only candidates who have raised money; use no for all candidates. For example yes. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "office",
    "election_year"
  ],
  "properties": {
    "state": {
      "type": "string",
      "description": "State or territory name or two-letter code, for example Texas or TX. Required for Senate and House.",
      "examples": [
        "CA",
        "Texas"
      ]
    },
    "office": {
      "enum": [
        "president",
        "senate",
        "house"
      ],
      "type": "string",
      "description": "Federal office to search, for example house.",
      "examples": [
        "house",
        "senate",
        "president"
      ]
    },
    "district": {
      "type": "integer",
      "maximum": 99,
      "minimum": 0,
      "description": "House district number, for example 12. Use 0 for an at-large district.",
      "examples": [
        12
      ]
    },
    "max_results": {
      "type": "integer",
      "default": 50,
      "maximum": 200,
      "minimum": 1,
      "description": "Maximum candidates to return, for example 50.",
      "x-fous-developer": true,
      "examples": [
        5,
        4
      ]
    },
    "election_year": {
      "type": "integer",
      "maximum": 2100,
      "minimum": 1900,
      "description": "Election year, for example 2026.",
      "examples": [
        2026,
        2028
      ]
    },
    "raised_money_only": {
      "enum": [
        "yes",
        "no"
      ],
      "type": "string",
      "default": "yes",
      "description": "Use yes to include only candidates who have raised money; use no for all candidates. For example yes.",
      "examples": [
        "no"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "state": "CA",
      "office": "house",
      "district": 12,
      "max_results": 5,
      "election_year": 2026,
      "raised_money_only": "no"
    },
    {
      "state": "Texas",
      "office": "senate",
      "max_results": 5,
      "election_year": 2026
    },
    {
      "office": "president",
      "max_results": 4,
      "election_year": 2028
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `candidates` | array |  |  |
| `candidates[].party` | string or null | `"DEMOCRATIC PARTY"` |  |
| `candidates[].state` | string or null | `"California"` |  |
| `candidates[].district` | integer or null | `12` |  |
| `candidates[].incumbency` | string or null | `"Incumbent"` |  |
| `candidates[].candidate_id` | string or null | `"H4CA12154"` |  |
| `candidates[].candidate_url` | string or null | `"https://www.fec.gov/data/candidate/H4CA12154/?cycle=2026"` |  |
| `candidates[].candidate_name` | string or null | `"SIMON, LATEEFAH"` |  |
| `candidates[].candidate_status` | string or null | `"Present candidate"` |  |
| `candidates[].cash_on_hand_usd` | number or null | `777589.88` |  |
| `candidates[].total_raised_usd` | number or null | `1449191.49` |  |
| `candidates[].coverage_end_date` | string or null | `"2026-06-30"` |  |

**Example input**

```json
{
  "state": "CA",
  "office": "house",
  "district": 12,
  "max_results": 5,
  "election_year": 2026,
  "raised_money_only": "no"
}
```

**Example output**

```json
{
  "candidates": [
    {
      "party": "DEMOCRATIC PARTY",
      "state": "California",
      "district": 12,
      "incumbency": "Incumbent",
      "candidate_id": "H4CA12154",
      "candidate_url": "https://www.fec.gov/data/candidate/H4CA12154/?cycle=2026",
      "candidate_name": "SIMON, LATEEFAH",
      "candidate_status": "Present candidate",
      "cash_on_hand_usd": 777589.88,
      "total_raised_usd": 1449191.49,
      "coverage_end_date": "2026-06-30"
    },
    {
      "party": "DEMOCRATIC PARTY",
      "state": "California",
      "district": 12,
      "incumbency": "Challenger",
      "candidate_id": "H6CA12209",
      "candidate_url": "https://www.fec.gov/data/candidate/H6CA12209/?cycle=2026",
      "candidate_name": "JOYCE, JAMIE",
      "candidate_status": "Present candidate",
      "cash_on_hand_usd": 8800.3,
      "total_raised_usd": 31247.25,
      "coverage_end_date": "2026-06-30"
    },
    {
      "party": "REPUBLICAN PARTY",
      "state": "California",
      "district": 12,
      "incumbency": "Challenger",
      "candidate_id": "H6CA12191",
      "candidate_url": "https://www.fec.gov/data/candidate/H6CA12191/?cycle=2026",
      "candidate_name": "FULKERSON, HEATH VINCENT",
      "candidate_status": "Not yet a candidate",
      "cash_on_hand_usd": 0,
      "total_raised_usd": 0,
      "coverage_end_date": null
    }
  ]
}
```

## Quick start

Call the API with a Fous API key (`FOUS_API_KEY`). To create one, turn on Developer mode in Fous Studio, then open Keys & connections → API keys (https://app.fous.com/keys).

```bash
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
: "${FOUS_API_KEY:?Set FOUS_API_KEY before running this example}"

curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 120 \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@fec",
  "visibility": "public",
  "operation": "get_candidate_fundraising",
  "version": 1,
  "input": {
    "state": "NY",
    "office": "house",
    "candidate": "Alexandria Ocasio-Cortez",
    "election_year": 2024
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
import json
import os
import urllib.error
import urllib.request

api_key = os.environ.get("FOUS_API_KEY")
if not api_key:
    raise RuntimeError("Set FOUS_API_KEY before running this example")

body = json.loads("{\n  \"api\": \"@fec\",\n  \"visibility\": \"public\",\n  \"operation\": \"get_candidate_fundraising\",\n  \"version\": 1,\n  \"input\": {\n    \"state\": \"NY\",\n    \"office\": \"house\",\n    \"candidate\": \"Alexandria Ocasio-Cortez\",\n    \"election_year\": 2024\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=120) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
// First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
const apiKey = process.env.FOUS_API_KEY;
if (!apiKey) throw new Error("Set FOUS_API_KEY before running this example");

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(120_000),
  body: JSON.stringify({
  "api": "@fec",
  "visibility": "public",
  "operation": "get_candidate_fundraising",
  "version": 1,
  "input": {
    "state": "NY",
    "office": "house",
    "candidate": "Alexandria Ocasio-Cortez",
    "election_year": 2024
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

Or describe the data in plain language: send `{"api":"@fec","prompt":"Describe the data you need, with every detail"}` to the same URL. Fous fills in the input, runs the method that fits and returns only the fields you asked for; `data.route.calls[].request` is the exact call it made. Routing is free; the run costs the same.

## Use cases

- Compare federal candidates’ fundraising and spending by election cycle
- Find candidates ranked by money raised for an office and year
- Review candidate cash balances and reported fundraising
- Filter candidate searches by state, district, or fundraising status

## FAQ

### Is Fous affiliated with FEC?

No. Fous is not affiliated with FEC. This workflow reads the public fec.gov website and returns its data.

### How much does it cost?

Each run costs 1 credit. With pay-as-you-go, a credit costs 1¢; monthly plans cost less per credit.

### Do I need a FEC account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from fec.gov when you run it; repeating the same request within a day may return the saved result. Fous checks this workflow automatically; it last passed a check on Sep 29, 2026.

### How much has a federal candidate raised and spent?

Get candidate fundraising returns a candidate’s fundraising and spending for a two-year filing period.

### Which candidates raised the most for an office and year?

Search candidates lists federal candidates ranked by total money raised for the selected office and election year.

### How can I find candidates by state or House district?

Search candidates accepts a state for Senate and House searches, and a district number for House searches.

## Related

- [Ballotpedia API](https://fous.com/workflows/ballotpedia.md): Ballotpedia provides state and local election information, ballot measure coverage, statewide measure details and results by year, and candidate and officeholder profiles with available background and election results.
- [Congress.gov API](https://fous.com/workflows/congress-gov.md): Congress.gov returns federal bills and resolutions matching topic, Congress, status, or chamber, and provides an individual bill’s status, summary, titles, actions, and related bills; summaries may be unavailable.
- [SEC EDGAR API](https://fous.com/workflows/sec-edgar.md): SEC EDGAR provides filings, annual and quarterly financials, exact-phrase matches, up to 200 insider trades, and quarterly 13F manager holdings; older filings appear when available.
- [Grants.gov API](https://fous.com/workflows/grants-gov.md): U.S. federal grant opportunities and application information.
- [PolitiFact API](https://fous.com/workflows/politifact.md): Fact checks of political claims and public statements.
- [FEMA API](https://fous.com/workflows/fema.md): FEMA provides public U.S. flood maps and disaster information, including approximate address-based flood risk details and federal disaster declarations by state or county.
- [USAspending API](https://fous.com/workflows/usaspending.md): USAspending provides official federal spending data and searchable awards from October 1, 2007 onward; figures and agency account reports may be revised or lag published award updates.
- [ElectionGuide API](https://fous.com/workflows/electionguide.md): ElectionGuide provides worldwide election dates and information, including upcoming elections and referendums within six months and the latest held national election or referendum in a specified year, with results when published.
- [All Government workflows](https://fous.com/workflows/category/government)
