> ## Documentation Index
> Fetch the complete documentation index at: https://docs.torrin.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Reseller / Partner API

> Provision and activate Torrin accounts from your own backend.

The reseller API lets a partner create Torrin accounts and activate plans
entirely from their own backend — no customer ever visits Torrin or pastes a
key. It's how white-label apps bundle Torrin into their own product and billing.

## Getting access

Reseller access is issued per partner — contact the operator to get your
**partner key**. There's no self-serve signup. Your single key works for both:

* **`X-Partner-Key`** — create accounts (skips captcha and per-IP signup limits).
* **`X-Reseller-Key`** — mint, list, and settle plan codes.

Your key is **scoped to your own codes** — you only ever see and settle codes
you minted.

## Provisioning flow

Three calls create a customer and put them on a plan:

### 1. Create the account

```bash theme={null}
curl -X POST https://api.torrin.app/api/auth/register \
  -H "X-Partner-Key: YOUR_PARTNER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email":"customer@example.com"}'
```

Returns the customer's API key:

```json theme={null}
{ "api_key": "YOUR_CUSTOMER_API_KEY", "email": "customer@example.com", "plan": "free" }
```

### 2. Mint a plan code

```bash theme={null}
curl -X POST https://api.torrin.app/api/reseller/codes \
  -H "X-Reseller-Key: YOUR_PARTNER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"plan_id":"standard","period":"monthly","quantity":1}'
```

```json theme={null}
{ "codes": ["TRN-XXXX-XXXX-XXXX"], "plan_id": "standard", "period": "monthly" }
```

`plan_id` is `standard` or `pro` — both include system Usenet + indexer with
nothing extra to buy (`starter` does not bundle Usenet). `period` is `monthly`,
`yearly`, `lifetime`, or `days` (see [Trials](#trials)).

### 3. Activate it on the account

```bash theme={null}
curl -X POST https://api.torrin.app/api/redeem \
  -H "Authorization: Bearer YOUR_CUSTOMER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"code":"TRN-XXXX-XXXX-XXXX"}'
```

```json theme={null}
{ "plan_id": "standard", "expires_at": "2026-11-15T00:00:00Z" }
```

The customer is now on Standard and ready to stream.

## Trials

Mint a short **`days`** code for a trial that auto-expires, then upgrade the same
account after payment:

```bash theme={null}
# 24-hour Standard trial
curl -X POST https://api.torrin.app/api/reseller/codes \
  -H "X-Reseller-Key: YOUR_PARTNER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"plan_id":"standard","period":"days","days":1,"quantity":1}'
```

Redeem it exactly as in step 3. After the window expires, redeem a `monthly`
code on the **same account** to continue — the new term starts from redemption.

## Billing

* **Codes never expire** until redeemed — prepay a batch and use it over time.
* **The plan term starts only when a code is redeemed**, not when it's minted.
* **Settlement** reconciles the codes you've activated so you can be invoiced.

```bash theme={null}
# list your codes (scoped to you)
curl "https://api.torrin.app/api/reseller/codes?redeemed=true" \
  -H "X-Reseller-Key: YOUR_PARTNER_KEY"

# mark your redeemed codes settled
curl -X POST https://api.torrin.app/api/reseller/settle \
  -H "X-Reseller-Key: YOUR_PARTNER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ref":"invoice-2026-10"}'
```

## Reconciliation

Calls are safe to retry after an uncertain response:

* **Redeem** is idempotent — redeeming an already-used code returns
  `409 this code has already been used`, confirming the first attempt worked.
* **List your codes** (`GET /api/reseller/codes`) to see exactly what was minted
  or redeemed.

## Included service & limits

| | Standard | Pro |
| - | - | - |
| System Usenet + indexer | Yes | Yes |
| Simultaneous streams | Unlimited | Unlimited |
| Device / IP limits | None | None |
| Monthly uncached downloads | 4 TB | 8 TB |

## White-label

Partner-created accounts can have the Torrin welcome email **suppressed** so the
experience stays fully your brand. Ask the operator to enable it on your key.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.