Skip to content

Repository files navigation

TorBox.NET

TorBox.NET is a .NET wrapper library for the TorBox API, written in C#.

Forked from rogerfar's RD.NET.

Currently supports Torrents, Usenet, WebDL, queued downloads, and user API calls.

Installation

Install the package from NuGet:

dotnet add package TorBox.NET

Usage

Create an instance of TorBoxNetClient for each user you want to authenticate. If you need to support multiple users, create a new instance whenever you switch users.

varclient=newTorBoxNetClient();

The client follows the TorBox API closely in naming and parameters:

varclient=newTorBoxNetClient();client.UseApiAuthentication("my-api-key");vartorrents=awaitclient.Torrents.GetCurrentAsync(skipCache:true);varwebDownloads=awaitclient.WebDownloads.GetCurrentAsync(skipCache:true);

Authentication

API Token

Call UseApiAuthentication with the user's TorBox API key:

client.UseApiAuthentication("user API key");

You can find your TorBox API key in your TorBox account settings.

Torrents

Deprecation notices

GetHashInfoAsync is deprecated. On or after 31 August 2026, it will be removed. Migrate to GetIdInfoAsync and use torrent ID instead of torrent hash.

ControlAsync currently accepts a torrent hash. On or after 31 August 2026, it will require a torrentId instead. Migrate to ControlByIdAsync.

On or after 31 August 2026, ControlByIdAsync is expected to become an alias for ControlAsync after ControlAsync changes to require a torrentId.

Add a magnet link:

varresult=awaitclient.Torrents.AddMagnetAsync("magnet:?xt=urn:btih:...",seeding:1,allowZip:false,name:"Example torrent");

Add a .torrent file:

varbytes=awaitFile.ReadAllBytesAsync("example.torrent");varresult=awaitclient.Torrents.AddFileAsync(bytes,seeding:1);

List current torrents:

vartorrents=awaitclient.Torrents.GetCurrentAsync(skipCache:true);

Request a download link after TorBox has cached the torrent:

vardownload=awaitclient.Torrents.RequestDownloadAsync(torrent_id:123,file_id:456,zip:false);

Usenet

Add an NZB link:

varresult=awaitclient.Usenet.AddLinkAsync("https://example.com/file.nzb",post_processing:3,name:"Example NZB");

Add an NZB file:

varbytes=awaitFile.ReadAllBytesAsync("example.nzb");varresult=awaitclient.Usenet.AddFileAsync(bytes,post_processing:3);

Request a download link after TorBox has cached the Usenet download:

vardownload=awaitclient.Usenet.RequestDownloadAsync(usenet_id:123,file_id:0,zip:false);

WebDL

Create a WebDL from a direct download or supported hoster link:

varresult=awaitclient.WebDownloads.AddLinkAsync("https://example.com/file.zip",name:"file.zip",as_queued:false,add_only_if_cached:false);

List current WebDL items:

varwebDownloads=awaitclient.WebDownloads.GetCurrentAsync(skipCache:true);

Request a generated download link after TorBox has cached the WebDL:

vardownload=awaitclient.WebDownloads.RequestDownloadAsync(web_id:123,file_id:0,zip:false);

Check supported WebDL hosters:

varhosters=awaitclient.WebDownloads.GetHostersAsync();

Queued Downloads

Queued downloads can be queried directly:

varqueuedTorrents=awaitclient.Queued.GetQueuedAsync(type:"torrent");varqueuedUsenet=awaitclient.Queued.GetQueuedAsync(type:"usenet");varqueuedWebDl=awaitclient.Queued.GetQueuedAsync(type:"webdl");

Unit Tests

To run tests, create TorBoxNET.Test/secret.json. An example file exists at TorBoxNET.Test/secret.json.example.

You will need a link from a supported provider to run WebDL tests.

About

A .NET wrapper for the TorBox API, based upon rogerfar's RDNET

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages