# openf1
Unofficial Rust client for the [OpenF1 API](https://openf1.org).
All data comes from [OpenF1](https://openf1.org). This crate is not affiliated with, endorsed by, or maintained by the OpenF1 project.
## Install
```toml
[dependencies]
openf1 = "0.1.0"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
```
Requires Rust 1.96+.
## Usage
Typed resource clients:
```rust
use openf1::{MeetingsListParams, OpenF1Client, SessionsListParams};
#[tokio::main]
async fn main() -> Result<(), openf1::OpenF1Error> {
let client = OpenF1Client::new(std::env::var("OPENF1_TOKEN").ok());
let meetings = client
.meetings()
.list(MeetingsListParams {
year: Some(2026),
country_name: None,
})
.await?;
let sessions = client
.sessions()
.list(SessionsListParams {
year: Some(2026),
country_name: None,
session_name: None,
})
.await?;
println!("{} meetings, {} sessions", meetings.len(), sessions.len());
Ok(())
}
```
Query filters:
```rust
use openf1::{LapsListParams, OpenF1Key, OpenF1Client, QueryFilter, QueryValue};
let client = OpenF1Client::new(None);
let laps = client
.laps()
.list(LapsListParams {
session_key: Some(OpenF1Key::Id(9161)),
driver_number: Some(63),
lap_number: Some(QueryFilter {
lte: Some(QueryValue::Number(3)),
..QueryFilter::default()
}),
})
.await?;
```
## Resources
Covers all OpenF1 v1 endpoints: `car_data`, `championship_drivers`, `championship_teams`, `drivers`, `intervals`, `laps`, `location`, `meetings`, `overtakes`, `pit`, `position`, `race_control`, `sessions`, `session_result`, `starting_grid`, `stints`, `team_radio`, and `weather`.
Each resource exposes `.list(params)` and `.list_csv(params)`.
## Documentation
Full guides: [openf1-client docs](https://aaanh.gitlab.io/openf1-client/#/sdks/rust.md)
## License
Licensed under the [EUPL-1.2](https://interoperable-europe.ec.europa.eu/collection/eupl/eupl-text-eupl-12).