Overview
The Ergast API provides access to historical Formula 1 data from 1950 onwards. FastF1’s Ergast interface wraps the Ergast Developer API and provides convenient methods for querying race results, driver standings, lap times, and more.Ergast Class
The main interface to the Ergast API.Constructor
Parameters
Literal['raw', 'pandas']
default:"'pandas'"
Determines the default type of the returned result object:
'raw': ReturnsErgastRawResponsewith JSON-like data'pandas': ReturnsErgastSimpleResponseorErgastMultiResponsewith pandas DataFrames
bool
default:"True"
Whether to automatically cast values from their default string representation to more appropriate types (int, float, datetime, etc.)
int | None
default:"None"
Maximum number of results returned by the API. Defaults to 30 if not set. Maximum: 1000. See Ergast Response Paging.
Query Methods
All query methods support filtering by various parameters and return response objects with pagination support.get_seasons()
Get a list of seasons.Parameters
str | None
Filter by circuit ID (e.g., ‘monaco’, ‘silverstone’)
str | None
Filter by constructor ID (e.g., ‘mclaren’, ‘ferrari’)
str | None
Filter by driver ID (e.g., ‘alonso’, ‘hamilton’)
int | None
Filter by starting grid position
int | None
Filter by finishing position
int | None
Filter by fastest lap rank
str | None
Filter by finishing status
Literal['pandas', 'raw'] | None
Override the default result type
bool | None
Override the default auto_cast setting
int | None
Override the default limit
int | None
Offset into the result set for pagination (default: 0)
Returns
ErgastSimpleResponse or ErgastRawResponse depending on result_type
get_race_schedule()
Get the race schedule for one or more seasons.Parameters
Literal['current'] | int
required
Season year (e.g., 2023) or ‘current’
Literal['last'] | int | None
Round number or ‘last’
get_seasons() (circuit, constructor, driver, etc.)
get_driver_info()
Get driver information.Parameters
Literal['current'] | int | None
Season year or ‘current’
Literal['last'] | int | None
Round number or ‘last’
get_seasons()
get_constructor_info()
Get constructor (team) information.get_driver_info()
get_circuits()
Get circuit information.get_driver_info() (no circuit parameter)
get_finishing_status()
Get finishing status codes and descriptions.get_seasons()
get_race_results()
Get race results for one or multiple races.get_race_schedule()
Returns
ErgastMultiResponse or ErgastRawResponse - contains results for multiple races if filters match multiple events
get_qualifying_results()
Get qualifying results.get_race_schedule()
Returns
ErgastMultiResponse or ErgastRawResponse
get_sprint_results()
Get sprint race results.get_race_schedule()
Returns
ErgastMultiResponse or ErgastRawResponse
get_driver_standings()
Get driver championship standings.Parameters
Literal['current'] | int | None
Season year or ‘current’
Literal['last'] | int | None
Round number or ‘last’
str | None
Filter by driver ID
int | None
Filter by standings position
Returns
ErgastMultiResponse or ErgastRawResponse
get_constructor_standings()
Get constructor championship standings.get_driver_standings() with standings_position filter
Returns
ErgastMultiResponse or ErgastRawResponse
get_lap_times()
Get lap times for a specific lap.Parameters
Literal['current'] | int
required
Season year or ‘current’
Literal['last'] | int
required
Round number or ‘last’
int | None
Specific lap number (if not provided, returns all laps)
Returns
ErgastMultiResponse or ErgastRawResponse
get_pit_stops()
Get pit stop data.Parameters
Literal['current'] | int
required
Season year or ‘current’
Literal['last'] | int
required
Round number or ‘last’
int | None
Filter by pit stop number (1st stop, 2nd stop, etc.)
Returns
ErgastMultiResponse or ErgastRawResponse
Response Objects
All Ergast query methods return response objects that wrap the data and provide pagination support.ErgastSimpleResponse
Wraps a pandas DataFrame with additional response metadata.Properties
int
Total number of available results for this query
bool
Whether the response contains all available results
Methods
method
Returns the next page of results. Raises
ValueError if no more pages exist.method
Returns the previous page of results. Raises
ValueError if already at the first page.ErgastMultiResponse
Wraps multiple pandas DataFrames for queries that return data about multiple races/events.Properties
ErgastResultFrame
DataFrame describing each element in
content (one row per race/event)list[ErgastResultFrame]
List of DataFrames, one for each race/event. Each contains the detailed data (e.g., all driver results for that race).
int
Total number of available results
bool
Whether the response contains all available results
Methods
Same pagination methods asErgastSimpleResponse
ErgastRawResponse
Wraps a list of JSON-like dictionaries with raw API response data.Properties
int
Total number of available results
bool
Whether the response contains all available results
Methods
Same pagination methods asErgastSimpleResponse
ErgastResultFrame
A specialized pandas DataFrame that contains Ergast response data with automatic type casting and flattening.Examples
Basic Usage
Filtering
Pagination
Raw Response
Notes
The Ergast API has rate limits:
- 4 requests per second (enforced by FastF1)
- 200 requests per hour
fastf1.Cache.enable_cache().See Also
- Ergast Developer API Documentation
- Caching - Learn how to enable caching
- Ergast Guide - Detailed guide with examples
