TorBoxSDK
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
TorBoxResponseenvelope and surfaces API failures throughTorBoxException - 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
- Getting Started Overview - Install and make your first request
- Architecture Overview - Understand the client hierarchy
- Configuration Overview - Configure options and base URLs
- Error Handling Overview - Handle API errors
- Examples Overview - Browse runnable examples by scenario
- Examples Source Project - 38 runnable scenarios
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:
MAJORfor incompatible API changesMINORfor new backward-compatible functionalityPATCHfor backward-compatible bug fixes
License
MIT License. See LICENSE for details.