Skip to main content
Get F1 Stats Archive up and running in just a few minutes. This guide will help you fetch your first Formula 1 race data from the Ergast API.

Prerequisites

Before you begin, make sure you have:
  • Python 3.7 or higher installed
  • Git installed on your system
  • An internet connection to access the Ergast API
1

Clone the repository

Clone the F1 Stats Archive repository to your local machine:
2

Install dependencies

Install the required Python packages using pip:
The project only requires the requests library for making API calls.
3

Fetch race events

Start by fetching race events for a season. Run the events script to get all races for 2026:
This script will:
  • Create a directory structure organized by year
  • Fetch all race events for the specified season(s)
  • Save event data to events.json in each year folder
  • Create individual folders for each race
By default, the script is configured to fetch 2026 data. You can modify the start_year and end_year variables in events.py to fetch different seasons.
4

Fetch race results

Now fetch the actual race results for a specific round:
The RaceResultsFetcher class handles:
  • Rate limiting (4 requests per second)
  • Automatic retry on rate limit errors
  • Organized folder structure by season and race
5

Explore the data

Your data is now organized in a structured folder hierarchy:
Each race folder contains JSON files with different data types:
  • results.json - Race finishing positions and details
  • quali_results.json - Qualifying session results
  • driverPoints.json - Driver championship standings after this race
  • laptimes.json - Lap-by-lap timing data

Example: Fetch Complete Race Data

Here’s a complete example to fetch all data for a specific race:

Understanding the Data Structure

The Ergast API returns data in a nested JSON structure. Here’s what a typical race result looks like:
The Ergast API has rate limits of 4 requests per second and 500 requests per hour. All scripts include automatic rate limiting to stay within these bounds.

Next Steps

Installation

Learn about detailed installation and configuration options

API Reference

Explore all available scripts and their parameters