Qbit-rs
A Rust library for interacting with qBittorrent's Web API.
Implemented according to the official WebUI API (qBittorrent 5.0+). The crate also supports endpoints introduced through qBittorrent 5.2 (Web API v2.16.0), including features not yet covered by the official reference. For the most accurate and complete list of supported API methods and model fields, please refer to this crate's documentation on docs.rs.
Usage
Add dependency by running:
or manually add to Cargo.toml:
[]
= "0.5"
Authentication
Username and password
With WebUI credentials, Qbit logs in automatically and renews the session if
its cookie expires:
use Qbit;
use Credential;
let credential = new;
let api = new;
let version = api.get_version.await;
Cookie
To reuse an existing WebUI session, provide its SID cookie:
use Qbit;
let api = builder
.endpoint
.cookie
.build;
let version = api.get_version.await;
API key
qBittorrent 5.2 and newer versions support stateless API-key authentication.
Qbit adds the required Bearer authorization scheme automatically:
use Qbit;
let api = builder
.endpoint
.api_key
.build;
let version = api.get_version.await;
API keys cannot access the WebUI's static assets or authentication endpoints
such as login and logout.
HTTP Client
The crate by default uses reqwest as the HTTP client. It also supports cyper (HTTP client for compio based on hyper) under the cyper feature flag. To use it, disable default features and enable cyper:
Notice that this will also disable tls and typed-builder support for args. Make sure to enable builder, native-tls or rustls-tls if you need them.
API Coverage
For all methods, see Qbit.
The authentication, application, log, sync, transfer, and torrent-management APIs are covered. RSS support is partial, while the Search API is not yet implemented. PRs are welcome for the remaining methods.
- Authentication
- Application
- Log
- Sync
- Transfer info
- Torrent management
- Get torrent list
- Download torrent file
- Get torrent generic properties
- Get torrent piece availability
- Get torrent trackers
- Get torrent web seeds
- Get torrent contents
- Get torrent pieces' states
- Get torrent pieces' hashes
- Add new torrent
- Stop torrents
- Start torrents
- Delete torrents
- Recheck torrents
- Reannounce torrents
- Reannounce torrents with selected trackers
- Edit trackers
- Remove trackers
- Add peers
- Add trackers to torrent
- Increase torrent priority
- Decrease torrent priority
- Maximal torrent priority
- Minimal torrent priority
- Set file priority
- Get torrent download limit
- Set torrent download limit
- Set torrent share limit
- Get torrent upload limit
- Set torrent upload limit
- Set torrent location
- Set torrent name
- Set torrent comment
- Set torrent category
- Get all categories
- Add new category
- Edit category
- Remove categories
- Add torrent tags
- Remove torrent tags
- Get all tags
- Create tags
- Delete tags
- Set automatic torrent management
- Toggle sequential download
- Set first/last piece priority
- Set force start
- Set super seeding
- Rename file
- Rename folder
- RSS (experimental)
- Add folder
- Add feed
- Remove item
- Move item
- Get all items
- Mark as read
- Refresh item
- Set auto-downloading rule
- Rename auto-downloading rule
- Remove auto-downloading rule
- Get all auto-downloading rules
- Get all articles matching a rule
- Search
- Start search
- Stop search
- Get search status
- Get search results
- Delete search
- Get search plugins
- Install search plugin
- Uninstall search plugin
- Enable search plugin
- Update search plugins
- Undocumented
- Export torrent[^1]
[^1]: The endpoint is added in this PR