Skill: Deluge API
Purpose
Use this skill when you need to integrate with Deluge Web or reason about Deluge RPC calls exposed through the Web UI.
Protocols
Web API
- Endpoint:
/json
- Spec: JSON-RPC v1-style request body
- Typical request body:
{
"method": "web.update_ui",
"params": [["name", "progress"], {}],
"id": 1
}
- File uploads are sent to
/upload
Core daemon RPC
DelugeRPC is the daemon/client wire protocol. Messages are zlib-compressed, rencode-encoded payloads.
- Request:
[[request_id, method, [args], {kwargs}], ...]
- Response:
[message_type, request_id, [return_value]]
- Error:
[message_type, request_id, exception_type, exception_msg, traceback]
- Event:
[message_type, event_name, data]
The Web UI exposes many core methods directly through the JSON endpoint, so callers often use JSON requests with core.*, auth.*, and web.* method names.
Session flow
Typical Web UI flow:
auth.login(password)
web.get_hosts()
web.connect(host_id)
- Use
web.* and core.* methods against the connected daemon
Main Web methods
| Method |
Parameters |
Purpose |
web.add_host |
host, port, username='', password='' |
Add daemon to host list |
web.edit_host |
host_id, host, port, username='', password='' |
Edit host entry |
web.remove_host |
host_id |
Remove host entry |
web.get_hosts |
none |
Return configured hosts |
web.get_host_status |
host_id |
Get daemon status |
web.connect |
host_id |
Connect Web UI to a daemon |
web.connected |
none |
Check connected state |
web.disconnect |
none |
Disconnect current daemon |
web.get_events |
none |
Drain queued events |
web.register_event_listener |
event |
Subscribe to event queue |
web.deregister_event_listener |
event |
Remove subscription |
web.get_config |
none |
Read Web UI config |
web.set_config |
config |
Update Web UI config |
web.set_theme |
theme |
Change theme |
web.get_plugins |
none |
Available/enabled Web UI plugins |
web.get_plugin_info |
name |
Plugin details |
web.get_plugin_resources |
name |
Plugin resource files |
web.upload_plugin |
filename, path |
Upload plugin |
web.download_torrent_from_url |
url, cookie=None |
Download torrent to temp path |
web.get_magnet_info |
uri |
Parse magnet metadata |
web.get_torrent_info |
filename |
Inspect torrent file on disk |
web.get_torrent_files |
torrent_id |
Torrent files tree |
web.get_torrent_status |
torrent_id, keys |
Selected torrent fields |
web.update_ui |
keys, filter_dict |
Incremental UI snapshot |
web.add_torrents |
[{path, options}] |
Add uploaded/downloaded torrent files |
Core methods commonly used through Web API
| Method |
Parameters |
Purpose |
core.get_config_values |
[keys] |
Read daemon config such as download_location |
core.resume_torrent |
[hashes] |
Resume torrents |
core.pause_torrent |
[hashes] |
Pause torrents |
core.force_recheck |
[hashes] |
Recheck torrents |
core.remove_torrent |
[hash, remove_data] |
Remove torrent, optionally deleting data |
core.queue_up |
[hashes] |
Move up in queue |
core.queue_down |
[hashes] |
Move down in queue |
core.queue_top |
[hashes] |
Move to top |
core.queue_bottom |
[hashes] |
Move to bottom |
Important request and response details
web.connect(host_id) returns the list of methods the daemon supports
web.update_ui(keys, filter_dict) returns torrent/UI data keyed by torrent hash
web.add_torrents() expects uploaded files to be referenced by temporary path
web.download_torrent_from_url() returns the temporary filename to pass into web.add_torrents()
web.get_torrent_info() returns name, files_tree, and info_hash
Common options for web.add_torrents
Common per-torrent options include:
download_location
file_priorities
add_paused
compact_allocation
max_connections
max_download_speed
max_upload_slots
max_upload_speed
prioritize_first_last_pieces
Electorrent usage
Electorrent uses:
auth.login
web.get_hosts
web.connect
web.update_ui
web.download_torrent_from_url
web.add_torrents
core.get_config_values
core.resume_torrent
core.pause_torrent
core.force_recheck
core.remove_torrent
core.queue_up, core.queue_down, core.queue_top, core.queue_bottom
References
1---2name: deluge-api3description: Deluge Web JSON-RPC and core RPC reference covering session login, web methods, and commonly used core torrent operations.4---56# Skill: Deluge API78## Purpose910Use this skill when you need to integrate with Deluge Web or reason about Deluge RPC calls exposed through the Web UI.1112## Protocols1314### Web API1516- Endpoint: `/json`17- Spec: JSON-RPC v1-style request body18- Typical request body:1920```json21{22 "method": "web.update_ui",23 "params": [["name", "progress"], {}],24 "id": 125}26```2728- File uploads are sent to `/upload`2930### Core daemon RPC3132DelugeRPC is the daemon/client wire protocol. Messages are zlib-compressed, rencode-encoded payloads.3334- Request: `[[request_id, method, [args], {kwargs}], ...]`35- Response: `[message_type, request_id, [return_value]]`36- Error: `[message_type, request_id, exception_type, exception_msg, traceback]`37- Event: `[message_type, event_name, data]`3839The Web UI exposes many core methods directly through the JSON endpoint, so callers often use JSON requests with `core.*`, `auth.*`, and `web.*` method names.4041## Session flow4243Typical Web UI flow:44451. `auth.login(password)`462. `web.get_hosts()`473. `web.connect(host_id)`484. Use `web.*` and `core.*` methods against the connected daemon4950## Main Web methods5152| Method | Parameters | Purpose |53|---|---|---|54| `web.add_host` | `host, port, username='', password=''` | Add daemon to host list |55| `web.edit_host` | `host_id, host, port, username='', password=''` | Edit host entry |56| `web.remove_host` | `host_id` | Remove host entry |57| `web.get_hosts` | none | Return configured hosts |58| `web.get_host_status` | `host_id` | Get daemon status |59| `web.connect` | `host_id` | Connect Web UI to a daemon |60| `web.connected` | none | Check connected state |61| `web.disconnect` | none | Disconnect current daemon |62| `web.get_events` | none | Drain queued events |63| `web.register_event_listener` | `event` | Subscribe to event queue |64| `web.deregister_event_listener` | `event` | Remove subscription |65| `web.get_config` | none | Read Web UI config |66| `web.set_config` | `config` | Update Web UI config |67| `web.set_theme` | `theme` | Change theme |68| `web.get_plugins` | none | Available/enabled Web UI plugins |69| `web.get_plugin_info` | `name` | Plugin details |70| `web.get_plugin_resources` | `name` | Plugin resource files |71| `web.upload_plugin` | `filename, path` | Upload plugin |72| `web.download_torrent_from_url` | `url, cookie=None` | Download torrent to temp path |73| `web.get_magnet_info` | `uri` | Parse magnet metadata |74| `web.get_torrent_info` | `filename` | Inspect torrent file on disk |75| `web.get_torrent_files` | `torrent_id` | Torrent files tree |76| `web.get_torrent_status` | `torrent_id, keys` | Selected torrent fields |77| `web.update_ui` | `keys, filter_dict` | Incremental UI snapshot |78| `web.add_torrents` | `[{path, options}]` | Add uploaded/downloaded torrent files |7980## Core methods commonly used through Web API8182| Method | Parameters | Purpose |83|---|---|---|84| `core.get_config_values` | `[keys]` | Read daemon config such as `download_location` |85| `core.resume_torrent` | `[hashes]` | Resume torrents |86| `core.pause_torrent` | `[hashes]` | Pause torrents |87| `core.force_recheck` | `[hashes]` | Recheck torrents |88| `core.remove_torrent` | `[hash, remove_data]` | Remove torrent, optionally deleting data |89| `core.queue_up` | `[hashes]` | Move up in queue |90| `core.queue_down` | `[hashes]` | Move down in queue |91| `core.queue_top` | `[hashes]` | Move to top |92| `core.queue_bottom` | `[hashes]` | Move to bottom |9394## Important request and response details9596- `web.connect(host_id)` returns the list of methods the daemon supports97- `web.update_ui(keys, filter_dict)` returns torrent/UI data keyed by torrent hash98- `web.add_torrents()` expects uploaded files to be referenced by temporary `path`99- `web.download_torrent_from_url()` returns the temporary filename to pass into `web.add_torrents()`100- `web.get_torrent_info()` returns `name`, `files_tree`, and `info_hash`101102## Common options for `web.add_torrents`103104Common per-torrent options include:105106- `download_location`107- `file_priorities`108- `add_paused`109- `compact_allocation`110- `max_connections`111- `max_download_speed`112- `max_upload_slots`113- `max_upload_speed`114- `prioritize_first_last_pieces`115116## Electorrent usage117118Electorrent uses:119120- `auth.login`121- `web.get_hosts`122- `web.connect`123- `web.update_ui`124- `web.download_torrent_from_url`125- `web.add_torrents`126- `core.get_config_values`127- `core.resume_torrent`128- `core.pause_torrent`129- `core.force_recheck`130- `core.remove_torrent`131- `core.queue_up`, `core.queue_down`, `core.queue_top`, `core.queue_bottom`132133## References134135- https://deluge.readthedocs.io/en/latest/reference/webapi.html136- https://deluge.readthedocs.io/en/latest/reference/rpc.html