Look at the top-level financial information for all candidates running for the same office. Choose a 2-year cycle, and house
, senate
or presidential
. If you are looking for a Senate seat, you will need to select the state using a two-letter abbreviation. House races require state and a two-digit district number. Since this endpoint reflects financial information, it will only have candidates once they file financial reporting forms. Query the /candidates
endpoint to retrieve an-up-to-date list of all the candidates that filed to run for a particular seat.
Usage
fec_get_elections(
office,
page,
district,
state,
cycle,
sort_hide_null,
election_full,
sort_nulls_last,
sort_null_only,
per_page,
sort,
api_key = Sys.getenv("FEC_API_KEY", unset = "DEMO_KEY")
)
Arguments
- office
Federal office candidate runs for: H, S or P
- page
For paginating through results, starting at page 1
- district
Two-digit US House distirict of the office the candidate is running for. Presidential, Senate and House at-large candidates will have District 00.
- state
US state or territory where a candidate runs for office
- cycle
Two-year election cycle in which a candidate runs for office. Calculated from Form 2. The cycle begins with an odd year and is named for its ending, even year. This cycle follows the traditional house election cycle and subdivides the presidential and Senate elections into comparable two-year blocks. To retrieve data for the entire four years of a presidential term or six years of a senatorial term, you will need the
election_full
flag.- sort_hide_null
Hide null values on sorted column(s).
- election_full
True
indicates that full election period of a candidate.False
indicates that two year election cycle.- sort_nulls_last
Toggle that sorts null values last
- sort_null_only
Toggle that filters out all rows having sort column that is non-null
- per_page
The number of results returned per page. Defaults to 20.
- sort
Provide a field to sort by. Use
-
for descending order.- api_key
An API key provided by the API provider. This key is not clearly documented in the API description. Check the API documentation for details.