Manage qBittorrent Web UI end-to-end (add, monitor, control torrents)
Before using this skill, verify credentials are configured:
source .env && echo "QB URL: $QB_URL" && echo "User: $QB_USER"
If this shows nothing or errors, guide the user through First-Time Setup below.
Credentials are stored in .env (gitignored):
QB_URL=http://localhost:8080
QB_USER=admin
QB_PASS=your-password
The tracked, portable template is .opencode/skill/qbittorrent/torrent-sources.example.json.
During setup, copy it to .opencode/skill/qbittorrent/torrent-sources.json (gitignored) and customize it for your environment:
cp .opencode/skill/qbittorrent/torrent-sources.example.json .opencode/skill/qbittorrent/torrent-sources.json
List the configured sources:
jq -r '.sources[] | "\(.name)\t\(.url)\(.searchPath)"' .opencode/skill/qbittorrent/torrent-sources.json
.opencode/skill/qbittorrent/torrent-sources.json (create it from the example if missing) and grab a magnet link or .torrent file from the official page.SID cookie in /tmp/qb.txt)..torrent).source .env && curl -s -c /tmp/qb.txt -b /tmp/qb.txt \
"$QB_URL/api/v2/auth/login" \
-d "username=$QB_USER&password=$QB_PASS"
# IMPORTANT: Must use -F (multipart/form-data), NOT -d!
curl -s -c /tmp/qb.txt -b /tmp/qb.txt \
"$QB_URL/api/v2/torrents/add" \
-F "urls=magnet:?xt=urn:btih:HASH&dn=NAME"
curl -s -c /tmp/qb.txt -b /tmp/qb.txt \
"$QB_URL/api/v2/torrents/add" \
-F "torrents=@/path/to/file.torrent"
Response meanings:
Ok. = Successfully addedFails. = Torrent already exists (duplicate) - NOT an error!curl -s -c /tmp/qb.txt -b /tmp/qb.txt \
"$QB_URL/api/v2/torrents/add" \
-F "urls=MAGNET_LINK" \
-F "savepath=/downloads/movies" \
-F "category=movies"
curl -s -b /tmp/qb.txt "$QB_URL/api/v2/torrents/info"
curl -s -b /tmp/qb.txt "$QB_URL/api/v2/torrents/info?hashes=HASH_LOWERCASE"
curl -s -b /tmp/qb.txt "$QB_URL/api/v2/torrents/info" | jq -r '
if length==0 then "No torrents"
else (sort_by(.added_on) | last) as $t
| "name=\($t.name)\nhash=\($t.hash)\nstate=\($t.state)\nprogress=\($t.progress)\nadded_on=\($t.added_on)\ncompletion_on=\($t.completion_on)\nsave_path=\($t.save_path)"
end'
Rule of thumb: a torrent is finished when progress is 1 and state is uploading/stoppedUP/pausedUP.
source .env && \
curl -s -c /tmp/qb.txt "$QB_URL/api/v2/auth/login" -d "username=$QB_USER&password=$QB_PASS" && \
curl -s -b /tmp/qb.txt "$QB_URL/api/v2/torrents/add" -F "urls=MAGNET_LINK_HERE"
| State | Meaning |
|---|---|
downloading |
Currently downloading |
stoppedDL |
Paused while downloading |
uploading |
Currently seeding |
stoppedUP |
Completed, seeding stopped |
stalledDL |
No peers available |
error |
Error occurred |
-F not -d for adding torrents (multipart/form-data required)Fails. response = duplicate torrent, not an error/api/v2/app/version) may return 403 Forbidden until you authenticate and send the SID cookie/tmp/qb.txt - re-login if expiredcurl -s -b /tmp/qb.txt -X POST "$QB_URL/api/v2/torrents/pause" \
-d "hashes=HASH"
curl -s -b /tmp/qb.txt -X POST "$QB_URL/api/v2/torrents/resume" \
-d "hashes=HASH"
curl -s -b /tmp/qb.txt -X POST "$QB_URL/api/v2/torrents/delete" \
-d "hashes=HASH&deleteFiles=false"
curl -s -b /tmp/qb.txt -X POST "$QB_URL/api/v2/torrents/delete" \
-d "hashes=HASH&deleteFiles=true"
http://localhost:8080admincp .opencode/skill/qbittorrent/torrent-sources.example.json .opencode/skill/qbittorrent/torrent-sources.json
Tell the user:
- Open qBittorrent
- Go to Tools > Options > Web UI
- Check "Web User Interface (Remote control)"
- Set port (default 8080)
- Set username and password
- Click OK
cat >> .env << 'EOF'
# qBittorrent
QB_URL=http://localhost:8080
QB_USER=admin
QB_PASS=your-password-here
EOF
source .env && \
curl -s -c /tmp/qb.txt "$QB_URL/api/v2/auth/login" -d "username=$QB_USER&password=$QB_PASS" >/dev/null && \
curl -s -b /tmp/qb.txt "$QB_URL/api/v2/app/version"
# Should return version like "v5.1.2" (some setups return 403 until authenticated)
| Endpoint | Method | Description |
|---|---|---|
/api/v2/auth/login |
POST | Login (username, password) |
/api/v2/torrents/add |
POST | Add torrent (-F urls=magnet) |
/api/v2/torrents/info |
GET | List all torrents |
/api/v2/torrents/info?hashes=X |
GET | Get specific torrent |
/api/v2/torrents/pause |
POST | Pause (hashes=X) |
/api/v2/torrents/resume |
POST | Resume (hashes=X) |
/api/v2/torrents/delete |
POST | Delete (hashes=X, deleteFiles=bool) |
/api/v2/app/version |
GET | Get qBittorrent version |