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
Determines the default type of the returned result object:
'raw': ReturnsErgastRawResponsewith JSON-like data'pandas': ReturnsErgastSimpleResponseorErgastMultiResponsewith pandas DataFrames
Whether to automatically cast values from their default string representation to more appropriate types (int, float, datetime, etc.)
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
Filter by circuit ID (e.g., ‘monaco’, ‘silverstone’)
Filter by constructor ID (e.g., ‘mclaren’, ‘ferrari’)
Filter by driver ID (e.g., ‘alonso’, ‘hamilton’)
Filter by starting grid position
Filter by finishing position
Filter by fastest lap rank
Filter by finishing status
Override the default result type
Override the default auto_cast setting
Override the default limit
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
Season year (e.g., 2023) or ‘current’
Round number or ‘last’
get_seasons() (circuit, constructor, driver, etc.)
get_driver_info()
Get driver information.Parameters
Season year or ‘current’
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
Season year or ‘current’
Round number or ‘last’
Filter by driver ID
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
Season year or ‘current’
Round number or ‘last’
Specific lap number (if not provided, returns all laps)
Returns
ErgastMultiResponse or ErgastRawResponse
get_pit_stops()
Get pit stop data.Parameters
Season year or ‘current’
Round number or ‘last’
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
Total number of available results for this query
Whether the response contains all available results
Methods
Returns the next page of results. Raises
ValueError if no more pages exist.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
DataFrame describing each element in
content (one row per race/event)List of DataFrames, one for each race/event. Each contains the detailed data (e.g., all driver results for that race).
Total number of available results
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
Total number of available results
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
