Open Trivia DB API Library, written in Rust
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Build Status MIT licensed Released API docs dependency status codecov

An implementation of the Open Trivia Database API in Rust.

The library is built with forward-compatibility in mind, you can handle your own custom things, provide your own custom base url, and handle custom error codes or elements that MAY be implemented in the future that aren't mapped to the library.



cargo add opentdb


For usage, review the examples here: examples/


  • Only 1 Category can be requested per API Call. To get questions from any category, don't specify a category.
  • A Maximum of 50 Questions can be retrieved per call.

License and Acknowledgements

opentdb-rs itself is licensed under the MIT license, opentdb-rs is not affiliated with the website or API it is using.

opentdb-rs depends on serde (for (de)serialization) and reqwest (for sending HTTP requests), percent-encoding for encoding URLs conform to RFCs. It also uses a dev-dependency mockito for integration tests.

The Open Trivia Database is a collection of user-contributed trivia questions. This project would not be possible without it.

All data provided by their API is available under the Creative Commons Attribution-ShareAlike 4.0 International License as is written on the Open Trivia Database website.