https://github.com/br-g/openf1
OpenF1 API - Real-time and historical Formula 1 data
https://github.com/br-g/openf1
Last synced: about 2 months ago
JSON representation
OpenF1 API - Real-time and historical Formula 1 data
- Host: GitHub
- URL: https://github.com/br-g/openf1
- Owner: br-g
- License: other
- Created: 2023-09-27T15:16:14.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2026-01-10T20:56:42.000Z (2 months ago)
- Last Synced: 2026-01-11T05:08:25.241Z (about 2 months ago)
- Language: Python
- Size: 578 KB
- Stars: 1,090
- Watchers: 28
- Forks: 86
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-repositories - br-g/openf1 - OpenF1 API - Real-time and historical Formula 1 data (Python)
README
# OpenF1 API
**OpenF1** is a free and open-source API that offers real-time and historical Formula 1 data.
Whether you're a developer, data analyst, or F1 enthusiast, OpenF1 provides comprehensive
access to lap timings, car telemetry, driver information, race control messages, and more.
Explore the data through JSON or CSV formats to build dashboards, analyze races, or
integrate F1 data into your projects.
For full API documentation, visit [openf1.org](https://openf1.org).
## Key Features
- **Real-Time Data**: Stay updated with live lap times, speeds, and driver positioning.
- **Historical Data**: Analyze past races, compare performance over seasons, and dive deep into race strategy.
- **Car Telemetry**: Access in-depth car data, including throttle, brake, DRS, and gear information.
- **Driver Information**: Get details on F1 drivers, including team affiliations and performance metrics.
## Example Usage
Here’s a quick example of how to fetch lap data for a specific driver using the API:
```bash
curl "https://api.openf1.org/v1/laps?session_key=9161&driver_number=63&lap_number=8"
```
For more detailed examples and documentation, visit the [API Documentation](https://openf1.org).
## Running the project locally
1. Install and start [MongoDB Community Server](https://www.mongodb.com/try/download/community) v7 or v8
2. Install pip>=23 and python>=3.10
3. Install the OpenF1 python package
```bash
git clone git@github.com:br-g/openf1.git
pip install -e openf1
```
4. Configure the MongoDB connection
Set the **MONGO_CONNECTION_STRING** environment variable to connect to your local MongoDB instance:
```bash
export MONGO_CONNECTION_STRING="mongodb://localhost:27017"
```
5. Run the project
- Fetch and ingest scraped data: [services/f1_scraping/](src/openf1/services/f1_scraping/README.md)
- Fetch and ingest live timing data: [services/ingestor_livetiming/](src/openf1/services/ingestor_livetiming/README.md)
- Start and query the API: [services/query_api/](src/openf1/services/query_api/README.md)
## Supporting OpenF1
If you find this project useful, consider supporting its long-term sustainability:
## Disclaimer
OpenF1 is an unofficial project and is not affiliated with Formula 1 companies.
All F1-related trademarks are owned by Formula One Licensing B.V.