How Sonarr and Radarr Integrate with Torrent Clients
Automated media managers like Sonarr and Radarr integrate seamlessly with torrent downloaders by utilizing Application Programming Interfaces (APIs) to automate the entire media acquisition pipeline. By linking these platforms, users eliminate the manual work of finding releases, adding torrent files to a client, monitoring completion, and renaming or moving files to a designated media server directory. This article explains the technical workflow of how these managers communicate with torrent clients, track download states, and handle post-processing.
API Connection and Authentication
Integration begins at the configuration level where the media manager establishes communication with the torrent client’s WebUI or API. In the settings for Sonarr or Radarr, users add a “Download Client” by specifying:
- Client Type: Pre-configured profiles for clients like qBittorrent, Transmission, Deluge, or rTorrent.
- Host and Port: The IP address and network port hosting the torrent client’s interface.
- Credentials: The username, password, or API key required to authenticate requests.
- Category or Label: A dedicated tag (such as
tv-sonarrorradarr) assigned to downloads to isolate automated tasks from manual downloads.
The Search and Dispatch Workflow
When Sonarr or Radarr detects that a requested episode or movie is missing or meets an upgrade condition, it queries configured indexers. Once the best release is selected according to user-defined quality profiles, the media manager pushes the release directly to the download client via an API call.
The payload sent to the client includes either the
.torrent file or a magnet link, along with instructions to
apply the designated category/tag and save path.
Real-Time Monitoring and Polling
After dispatching the download, the media manager actively tracks its state through scheduled polling intervals:
- Status Tracking: The manager queries the torrent client’s API to check download speed, progress percentage, ETA, and client health.
- Activity Queue: The user interface reflects the active download in an “Activity” queue, matching the unique torrent hash provided by the client.
- Failure Handling: If a download stalls, fails to connect to peers, or reports corrupted data, the media manager can automatically remove the torrent, blacklist that specific release, and search for an alternative.
Post-Processing, Renaming, and Organizing
When the torrent client signals that the download reaches 100% completion, the automated manager begins post-processing:
- File Inspection: The manager inspects the completed files to ensure they match the requested media type and meet quality requirements.
- Hardlinking or Copying: To maintain seeding without wasting storage, the software typically creates a hardlink from the download folder to the final media library folder. If hardlinks are not supported across different file systems, it performs a copy or move operation.
- Standardized Renaming: Files are renamed according
to user-defined naming conventions (e.g.,
Show Name - S01E01 - Episode Title [Bluray-1080p].mkv). - Library Notification: After the file is organized, the manager can trigger a notification to media servers like Plex, Jellyfin, or Emby to update library metadata immediately.
Seeding Management and Cleanup
The integration also respects seeding rules defined in either the torrent client or the media manager. Once a torrent satisfies its configured seed ratio or time limit, Sonarr or Radarr can send an API command to remove the torrent from the client, with an option to delete the original downloaded payload if a hardlink or copy was successfully created.