TorBoxSDK

NuGet License: MIT Documentation .NET

Important: This SDK is unofficial and is not affiliated with or endorsed by TorBox.

TorBoxSDK is an open-source, MIT-licensed C# SDK for the TorBox API. It gives .NET applications typed access to the TorBox Main, Search, and Relay APIs with dependency injection support and consistent response handling.

Key Features

  • Covers the TorBox Main, Search, and Relay APIs through a single root client
  • Organizes the Main API into focused resource clients (Torrents, Usenet, Web Downloads, User, Notifications, RSS, Integrations)
  • Multi-targets .NET 6 through .NET 10
  • Integrates with IServiceCollection, IHttpClientFactory, and configuration binding
  • Uses the standard TorBoxResponse envelope and surfaces API failures through TorBoxException
  • Full XML documentation and SourceLink support

Installation

dotnet add package TorBoxSDK

Quick Start

using Microsoft.Extensions.DependencyInjection;
using TorBoxSDK;
using TorBoxSDK.DependencyInjection;

ServiceCollection services = new();
services.AddTorBox(options =>
{
    options.ApiKey = Environment.GetEnvironmentVariable("TORBOX_API_KEY")
        ?? throw new InvalidOperationException("Set TORBOX_API_KEY.");
});

using ServiceProvider provider = services.BuildServiceProvider();
ITorBoxClient client = provider.GetRequiredService<ITorBoxClient>();

var torrents = await client.Main.Torrents.GetMyTorrentListAsync();

Or standalone mode:

using TorBoxClient client = new("your-api-key");
var result = await client.Main.User.GetMeAsync();

Documentation

Contributing

Contributions are welcome! Read the Contributing Guide for development workflow and review the Code of Conduct.

Versioning

This package follows Semantic Versioning (SemVer) and uses the MAJOR.MINOR.PATCH format:

  • MAJOR for incompatible API changes
  • MINOR for new backward-compatible functionality
  • PATCH for backward-compatible bug fixes

License

MIT License. See LICENSE for details.