APIF1DB is a comprehensive, unofficial Formula 1 data API built with Python and FastAPI. It provides detailed historical data for Formula 1, from drivers and constructors to individual race results and season standings.
The entire API requires authentication, and access is granted via JWT tokens. The API's interactive documentation, powered by Swagger UI, is available at the root of the application (/).
You can run the application using Docker (recommended) or by setting up a local Python environment.
Prerequisites:
- Docker installed and running.
-
Build the image:
docker build -t apif1db . -
Run the container:
docker run -p 8000:8000 apif1db
The API will be available at http://localhost:8000.
Prerequisites:
- Python 3.11
- A running PostgreSQL instance
-
Clone the repository:
git clone <repository-url> cd APIF1DB
-
Install dependencies:
pip install -r requirements.txt
-
Configure the database: Ensure your PostgreSQL server is running and set the
DATABASE_URLenvironment variable to point to your database. -
Run the application:
uvicorn app.main:app --host 0.0.0.0 --port 8000
The API will be available at http://localhost:8000.
This API provides access to a rich and detailed set of Formula 1 historical data, including but not limited to:
- Seasons: Information on every F1 season.
- Grands Prix: Details of each race event.
- Circuits: Data on all racing circuits.
- Drivers: Comprehensive information about every driver.
- Constructors: Details on all teams and constructors.
- Race Results: Final classification for each race.
- Qualifying Results: Full qualifying session data.
- Standings: Driver and Constructor championship standings for each race and season.
- And much more: Including practice sessions, sprint races, fastest laps, and pit stops.
- Backend: Python 3.11 with FastAPI
- Database: PostgreSQL
- ORM: SQLAlchemy
- Authentication: JWT (JSON Web Tokens)
- Containerization: Docker
The source code of this project is licensed under the Apache License 2.0.
This project uses Formula 1 data from F1DB created by the F1DB contributors, licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) license.
The original data has been:
- Imported and structured into a PostgreSQL database
- Exposed through a custom REST API
- Optimized for efficient querying
The original data is provided "as-is" without warranties of any kind, as per the terms of the CC BY 4.0 license.
For complete attribution details, see ATTRIBUTIONS.md..
F1Analisys is unofficial and are not associated in any way with the Formula 1 companies. F1, FORMULA ONE, FORMULA 1, FIA FORMULA ONE WORLD CHAMPIONSHIP, GRAND PRIX and related marks are trade marks of Formula One Licensing B.V.