# Fec Filing Parser (`logical_vivacity/fec-filing-parser`) Actor

Turn raw U.S. Federal Election Commission electronic filings into clean, structured JSON you can drop straight into a database, spreadsheet, or analytics pipeline.

- **URL**: https://apify.com/logical\_vivacity/fec-filing-parser.md
- **Developed by:** [Logical Vivacity](https://apify.com/logical_vivacity) (community)
- **Categories:** Developer tools, Automation, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## FEC Campaign Finance Filing Parser

Turn raw U.S. Federal Election Commission electronic filings into clean,
structured JSON you can drop straight into a database, spreadsheet, or
analytics pipeline. Give the actor one or more filing IDs and it returns a
header / summary record plus every itemized contribution, disbursement, or
loan row contained in the filing.

### What it does

- Fetches the raw `.fec` document for each filing ID you supply from the
  FEC's public electronic-filings index.
- Parses the filing's fixed-format text into typed Python objects.
- Splits the result into:
  - One **filing header** record (filer name, committee ID, period covered,
    totals, etc.).
  - One **itemized row** record for each Schedule A / B / C / D / E line
    item, tagged with its schedule bucket.
- Pushes every record to the actor's default dataset.

### Inputs

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `filingIds` | array of string / integer | _required_ | FEC electronic filing IDs to download and parse, e.g. `["1666999"]`. |
| `includeItemizedRows` | boolean | `true` | If `false`, only the filing header / summary is returned. |
| `maxRowsPerFiling` | integer | `10000` | Cap on itemized rows returned per filing. Large filings can contain 100,000+ rows. |

#### Example input

```json
{
  "filingIds": ["1666999"],
  "includeItemizedRows": true,
  "maxRowsPerFiling": 10000
}
````

### Output

Every record is pushed to the default dataset and tagged with a
`record_type` of either `filing_header` or `itemized_row`.

#### Sample header record

```json
{
  "record_type": "filing_header",
  "filing_id": "1666999",
  "source_url": "https://docquery.fec.gov/dcdev/posted/1666999.fec",
  "data": {
    "header": {
      "record_type": "HDR",
      "ef_type": "FEC",
      "fec_version": "8.4",
      "soft_name": "...",
      "report_id": "..."
    },
    "filer_committee_id_number": "C00000000",
    "committee_name": "EXAMPLE FOR CONGRESS",
    "form_type": "F3",
    "coverage_from_date": "2024-01-01",
    "coverage_through_date": "2024-03-31",
    "total_receipts_period": 123456.78
  }
}
```

#### Sample itemized row record

```json
{
  "record_type": "itemized_row",
  "filing_id": "1666999",
  "schedule": "Schedule A",
  "row_index": 0,
  "data": {
    "form_type": "SA11AI",
    "filer_committee_id_number": "C00000000",
    "contributor_last_name": "Smith",
    "contributor_first_name": "Jane",
    "contributor_city": "Austin",
    "contributor_state": "TX",
    "contribution_date": "2024-02-14",
    "contribution_amount": 250.0,
    "contribution_aggregate": 750.0,
    "contributor_employer": "Acme Corp",
    "contributor_occupation": "Engineer"
  }
}
```

The exact fields available depend on the form type (F3, F3X, F24, etc.) and
the schedule (A = receipts, B = disbursements, C = loans, D = debts,
E = independent expenditures).

### Limitations

- The FEC's public document host can be slow or temporarily unavailable;
  failed fetches are logged and skipped without aborting the run.
- Very large filings (50,000+ itemizations) are split into thousands of
  dataset records — raise `maxRowsPerFiling` if you need the full extract.
- Only electronic filings are supported. Paper-filed reports do not have a
  raw `.fec` document and cannot be parsed.
- Field names follow the FEC's published form schemas. See
  [fec.gov filing types](https://www.fec.gov/help-candidates-and-committees/filing-reports/)
  for the canonical column dictionary.

# Actor input Schema

## `filingIds` (type: `array`):

List of FEC electronic filing IDs to fetch and parse (e.g. \["1666999"]). Numeric strings or integers both accepted.

## `includeItemizedRows` (type: `boolean`):

If true, output each itemized contribution / disbursement / loan row in addition to the filing header. If false, only the filing header / summary is returned.

## `maxRowsPerFiling` (type: `integer`):

Cap on itemized rows returned per filing. Large filings can contain 100,000+ rows; raise this for full extracts.

## Actor input object example

```json
{
  "filingIds": [
    "1666999"
  ],
  "includeItemizedRows": true,
  "maxRowsPerFiling": 10000
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "filingIds": [
        "1666999"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("logical_vivacity/fec-filing-parser").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "filingIds": ["1666999"] }

# Run the Actor and wait for it to finish
run = client.actor("logical_vivacity/fec-filing-parser").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "filingIds": [
    "1666999"
  ]
}' |
apify call logical_vivacity/fec-filing-parser --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=logical_vivacity/fec-filing-parser",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Fec Filing Parser",
        "description": "Turn raw U.S. Federal Election Commission electronic filings into clean, structured JSON you can drop straight into a database, spreadsheet, or analytics pipeline.",
        "version": "0.1",
        "x-build-id": "Y44g5Prs16P2PBhQN"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/logical_vivacity~fec-filing-parser/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-logical_vivacity-fec-filing-parser",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/logical_vivacity~fec-filing-parser/runs": {
            "post": {
                "operationId": "runs-sync-logical_vivacity-fec-filing-parser",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/logical_vivacity~fec-filing-parser/run-sync": {
            "post": {
                "operationId": "run-sync-logical_vivacity-fec-filing-parser",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "filingIds"
                ],
                "properties": {
                    "filingIds": {
                        "title": "Filing IDs",
                        "type": "array",
                        "description": "List of FEC electronic filing IDs to fetch and parse (e.g. [\"1666999\"]). Numeric strings or integers both accepted."
                    },
                    "includeItemizedRows": {
                        "title": "Include itemized rows",
                        "type": "boolean",
                        "description": "If true, output each itemized contribution / disbursement / loan row in addition to the filing header. If false, only the filing header / summary is returned.",
                        "default": true
                    },
                    "maxRowsPerFiling": {
                        "title": "Max rows per filing",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Cap on itemized rows returned per filing. Large filings can contain 100,000+ rows; raise this for full extracts.",
                        "default": 10000
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
