# SDKs (/docs/sdks)

The SDKs are generated from the [OpenAPI spec](https://api.torbox.app/openapi.json) with
[OpenAPI Generator](https://openapi-generator.tech). Releases use the latest public [TorBox changelog](https://torbox.app/changelog)
version followed by the UTC build date. Each SDK wraps the generated client with TorBox-specific behavior.

- **Response envelopes.** Python and TypeScript methods and PHP's `send()` return `data`. Go and Rust validate
  `success` through `torbox.Result` and `torbox::send`. Kotlin, C++, and C# expose `success` on the response model.
- **Errors.** Use the generated HTTP errors in Kotlin, C++, and C#. The other SDKs also provide helpers for
  TorBox error codes and details. In PHP, catch `TorBoxException`.
- **Retries.** Python, TypeScript, Go, and Rust retry `429` and `503` with backoff and honor `Retry-After`.
- **Uploads.** `create_torrent` and `create_usenet_download` accept a file.
- **Download links.** Python and TypeScript add the `token` query parameter. In Go, Rust, PHP, Kotlin, C++, and C#,
  pass your API key as that parameter.

<Callout type="warn">
Single-item lookups such as `mylist?id=...` answer an object while the spec only describes the list, so typed SDKs
cannot parse them yet. Fetch the list and filter until the spec is fixed.
</Callout>

## Install [#install]

These are the SDK releases for TorBox v9.3.1, built on 2026-11-25.

### Python

- Package: `torbox-sdk`, version 9.3.2026112508
- Registry: https://pypi.org/project/torbox-sdk/
- Source code and README: https://github.com/TorBox-App/torbox-sdk-py

```sh
pip install torbox-sdk==9.3.2026112508
```

First request with the Python SDK:

```python
import os
from torbox import TorBox

client = TorBox(api_key=os.environ["TORBOX_API_KEY"])
result = client.user.get_user_data()
print(result)
```

### TypeScript

- Package: `@torbox/torbox-api`, version 9.3.2026112508
- Registry: https://www.npmjs.com/package/@torbox/torbox-api
- Source code and README: https://github.com/TorBox-App/torbox-sdk-js

```sh
npm install @torbox/torbox-api@9.3.2026112508
```

First request with the TypeScript SDK:

```typescript
import { TorBox } from "@torbox/torbox-api";

const client = new TorBox({ apiKey: process.env.TORBOX_API_KEY! });
const result = await client.user.getUserData();
console.log(result);
```

### Go

- Package: `github.com/TorBox-App/torbox-sdk-go/v9`, version 9.3.2026112508
- Source code and README: https://github.com/TorBox-App/torbox-sdk-go

```sh
go get github.com/TorBox-App/torbox-sdk-go/v9@v9.3.2026112508
```

First request with the Go SDK:

```go
package main

import (
    "context"
    "fmt"
    "log"
    "os"

    "github.com/TorBox-App/torbox-sdk-go/v9"
)

func main() {
    ctx := context.Background()
    client := torbox.New(os.Getenv("TORBOX_API_KEY"))
    result, err := torbox.Result(client.UserAPI.GetUserData(ctx).Execute())
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(result.GetData())
}
```

### Rust

- Package: `torbox`, version 9.3.2026112508
- Registry: https://crates.io/crates/torbox
- Source code and README: https://github.com/TorBox-App/torbox-sdk-rs

```sh
cargo add torbox@9.3.2026112508
```

First request with the Rust SDK:

```rust
// cargo add tokio --features macros,rt-multi-thread
use torbox::Client;
use torbox::apis::user_api;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new(std::env::var("TORBOX_API_KEY")?);
    let result = torbox::send(user_api::get_user_data(&client.config, Default::default())).await?;
    println!("{:?}", result.data);
    Ok(())
}
```

### PHP

- Package: `torbox/sdk`, version 9.3.2026112508
- Registry: https://packagist.org/packages/torbox/sdk
- Source code and README: https://github.com/TorBox-App/torbox-sdk-php

```sh
composer require "torbox/sdk:9.3.2026112508"
```

First request with the PHP SDK:

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use TorBox\Sdk\TorBox;
use TorBox\Sdk\Api\UserApi;

$client = new TorBox(getenv('TORBOX_API_KEY'));
$result = $client->send(fn () => $client->api(UserApi::class)->getUserData());
print_r($result);
```

### Kotlin

- Package: `app.torbox:torbox-sdk`, version 9.3.2026112508
- Registry: https://central.sonatype.com/artifact/app.torbox/torbox-sdk
- Source code and README: https://github.com/TorBox-App/torbox-sdk-kotlin

```kotlin
repositories { mavenCentral() }
dependencies { implementation("app.torbox:torbox-sdk:9.3.2026112508") }
```

First request with the Kotlin SDK:

```kotlin
import app.torbox.sdk.TorBox
import app.torbox.sdk.apis.UserApi

fun main() {
    val client = TorBox(requireNotNull(System.getenv("TORBOX_API_KEY")))
    val response = client.api(::UserApi).getUserData()
    check(response.success) { response.detail }
    println(response.data)
}
```

### C++

- Package: `torbox-sdk`, version 9.3.2026112508
- Source code and README: https://github.com/TorBox-App/torbox-sdk-cpp

```cmake
include(FetchContent)
FetchContent_Declare(torbox
  GIT_REPOSITORY https://github.com/TorBox-App/torbox-sdk-cpp.git
  GIT_TAG v9.3.2026112508
)
FetchContent_MakeAvailable(torbox)
target_link_libraries(your_app PRIVATE torbox-sdk)
```

First request with the C++ SDK:

```cpp
#include <cstdlib>
#include <iostream>
#include <stdexcept>
#include "api/TorBoxClient.h"
#include "api/UserApi.h"

int main() {
    const auto* key = std::getenv("TORBOX_API_KEY");
    if (key == nullptr) throw std::runtime_error("Set TORBOX_API_KEY.");
    torbox::Client client(key);
    auto response = client.api<torbox::api::UserApi>().getUserData({}, {}, {});
    if (!response->isSuccess()) throw std::runtime_error(response->getDetail());
    std::cout << boost::json::serialize(response->toJsonValue()) << '\n';
}
```

### C#

- Package: `TorBox.Sdk`, version 9.3.2026112508
- Registry: https://www.nuget.org/packages/TorBox.Sdk
- Source code and README: https://github.com/TorBox-App/torbox-sdk-csharp

```sh
dotnet add package TorBox.Sdk --version 9.3.2026112508
```

First request with the C# SDK:

```csharp
using System;
using TorBox.Sdk;
using TorBox.Sdk.Api;

using var client = new TorBoxClient(Environment.GetEnvironmentVariable("TORBOX_API_KEY")
    ?? throw new InvalidOperationException("Set TORBOX_API_KEY."));
var response = (await client.Api<IUserApi>().GetUserDataAsync()).Ok();
if (response is not { Success: true })
    throw new InvalidOperationException(response?.Detail ?? "TorBox request failed.");
Console.WriteLine(response.Data);
```

## Quick start [#quick-start]

Set `TORBOX_API_KEY` to your key from [TorBox settings](https://torbox.app/settings). Choose your SDK in
[Get User Data](/operations/get_user_data)'s request example to see how to initialize the client and make a request.

```python
import os
from torbox import TorBox

client = TorBox(api_key=os.environ["TORBOX_API_KEY"])
result = client.user.get_user_data()
print(result)
```

[View endpoint](/operations/get_user_data)

Each SDK's README covers authentication, pagination, and error handling. The PHP SDK requires PHP 8.1 or later.
Kotlin targets the JVM on Java 17 or later. C++ requires C++17, Boost.JSON, and OpenSSL. C# targets .NET 10.