qbittorrent-api is a Python client library that implements the entire qBittorrent Web API, built for Python developers who need to script, automate, or monitor a qBittorrent instance programmatically instead of clicking through its WebUI.
What it is
qbittorrent-api is an MIT-licensed Python package, published on PyPI and developed in the rmartin16/qbittorrent-api repository, that provides a client implementation for qBittorrent's Web API. It lives in the Python ecosystem and follows the upstream API surface closely: the project currently supports qBittorrent v5.2.3, which ships Web API v2.15.1 and was released on July 7, 2026. Documentation is split into a User Guide and an API Reference hosted on Read the Docs, and the repository carries 513 stars, 77 forks, and 5 open issues.
The concrete problem it solves is the boilerplate of talking to qBittorrent's WebUI API by hand. A developer writing raw HTTP calls has to log in, capture the authentication cookie, detect when that cookie expires, and track which endpoints exist on the version of qBittorrent in front of them. qbittorrent-api replaces that work with a qbittorrentapi.Client object: version checking for an endpoint's existence and features is handled automatically, and if the authentication cookie expires, a new one is requested in line with any API call. What would otherwise be a hand-written HTTP layer plus a version compatibility table becomes a single configured client.
Key capabilities
- Implements the entire qBittorrent Web API, so torrent listing, adding, and control operations are reachable from Python rather than only from the WebUI.
- Automatic qBittorrent version checking resolves whether an endpoint exists and which features it supports, removing per-version branching in caller code.
- Automatic re-authentication: if the authentication cookie expires, a new one is requested inline with any API call, so long-lived clients do not silently fail.
- Explicit session control through
qbittorrentapi.Client.auth_log_in() and auth_log_out(), with qbittorrentapi.LoginFailed raised on bad credentials.
- Context-manager support (
with qbittorrentapi.Client(**conn_info) as qbt_client:) for short-lived scripts that should release their session when done.
- Torrent operations exposed as methods and grouped actions, including
torrents_add(urls="..."), torrents_info(), and torrents.stop.all().
- Instance introspection through
qbt_client.app.version, qbt_client.app.web_api_version, and the qbt_client.app.build_info dictionary.
Who uses it and how
- Python automation scripts that add torrents by URL and then raise an exception when
torrents_add does not return "Ok.", giving a clear failure point in a pipeline.
- Long-running services and daemons that keep one client instance alive and rely on the built-in cookie refresh instead of re-logging in on a timer.
- Short-lived jobs and batch tooling that create many clients in a short window, where the README recommends logging out explicitly or using the context manager.
- Monitoring and reporting workflows that enumerate every torrent with
torrents_info() and print the hash, name, and state of each entry.
- Bulk control scripts, such as stopping all torrents with
qbt_client.torrents.stop.all(), run against an instance configured on host, port, username, and password.
Getting started
Install from PyPI with python -m pip install qbittorrent-api, then instantiate qbittorrentapi.Client using the WebUI configuration — host, port, username, password — and optionally call auth_log_in() to verify credentials early.
How it compares
No list of paid products this project replaces is provided in the available facts, and no similar tools are named alongside it. Stated plainly, it stands alone in this registry.
When to use it — and when not to
Pick it when the goal is Python-side control of a qBittorrent instance and the instance already exists, since this library is a client only and comes with no server, storage, or background service of its own — the operator still runs qBittorrent and supplies WebUI credentials. It is a poor fit for non-Python stacks, for anyone who wants a graphical interface rather than code, and for deployments pinned to a qBittorrent release well outside the currently supported v5.2.3 / Web API v2.15.1 line, where endpoint behaviour may not match. The README is a quickstart plus badges rather than an operations manual, so expect to lean on the Read the Docs User Guide and API Reference.
project readme (upstream, from github) — read inline
qBittorrent Web API Client
Python client implementation for qBittorrent Web API

Currently supports qBittorrent v5.2.3 (Web API v2.15.1) released on July 7, 2026.
User Guide and API Reference available on Read the Docs.
Features
- The entire qBittorrent Web API is implemented.
- qBittorrent version checking for an endpoint's existence/features is automatically handled.
- If the authentication cookie expires, a new one is automatically requested in line with any API call.
Installation
Install via pip from PyPI
python -m pip install qbittorrent-api
Getting Started
import qbittorrentapi
# instantiate a Client using the appropriate WebUI configuration
conn_info = dict(
host="localhost",
port=8080,
username="admin",
password="adminadmin",
)
qbt_client = qbittorrentapi.Client(**conn_info)
# the Client will automatically acquire/maintain a logged-in state
# in line with any request. therefore, this is not strictly necessary;
# however, you may want to test the provided login credentials.
try:
qbt_client.auth_log_in()
except qbittorrentapi.LoginFailed as e:
print(e)
# if the Client will not be long-lived or many Clients may be created
# in a relatively short amount of time, be sure to log out:
qbt_client.auth_log_out()
# or use a context manager:
with qbittorrentapi.Client(**conn_info) as qbt_client:
if qbt_client.torrents_add(urls="...") != "Ok.":
raise Exception("Failed to add torrent.")
# display qBittorrent info
print(f"qBittorrent: {qbt_client.app.version}")
print(f"qBittorrent Web API: {qbt_client.app.web_api_version}")
for k, v in qbt_client.app.build_info.items():
print(f"{k}: {v}")
# retrieve and show all torrents
for torrent in qbt_client.torrents_info():
print(f"{torrent.hash[-6:]}: {torrent.name} ({torrent.state})")
# stop all torrents
qbt_client.torrents.stop.all()