# Getting started (/docs/getting-started)

## 1. Get your API key [#1-get-your-api-key]

Open your [TorBox settings page](https://torbox.app/settings) and copy the key from the **API key** section.
Keep it secret: it gives full access to your account. See [Authentication](/docs/authentication).

```bash
export TORBOX_API_KEY="your-api-key"
```

## 2. Check who you are [#2-check-who-you-are]

Use [Get User Data](/operations/get_user_data) to check that your key works. Choose a TorBox SDK or an HTTP
client in the request example to copy code for your language.

```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)

Every answer is the [standard envelope](/docs#the-standard-response): `success`, `error`, `detail`, `data`.

## 3. Add a torrent [#3-add-a-torrent]

[`POST /v1/api/torrents/createtorrent`](/operations/create_torrent) takes **either** a magnet link or a torrent file
as form data. Choose **Magnet link** or **Torrent file** in the example.

**Magnet link**

```python
import os
from torbox import TorBox

client = TorBox(api_key=os.environ["TORBOX_API_KEY"])
result = client.torrents.create_torrent(magnet="magnet:?xt=urn:btih:YOUR_TORRENT_HASH")
print(result)
```

**Torrent file**

```python
import os
from torbox import TorBox

client = TorBox(api_key=os.environ["TORBOX_API_KEY"])
result = client.torrents.create_torrent(file="./ubuntu.torrent")
print(result)
```

[View endpoint](/operations/create_torrent)

```json
{
  "success": true,
  "error": null,
  "detail": "Torrent Added Successfully",
  "data": { "hash": "string", "torrent_id": 0, "auth_id": "string" }
}
```

## 4. List your downloads [#4-list-your-downloads]

Use [Get Torrent List](/operations/get_torrent_list) with `limit=50` to fetch the first page of torrents.

```python
import os
from torbox import TorBox

client = TorBox(api_key=os.environ["TORBOX_API_KEY"])
result = client.torrents.get_torrent_list(limit=50)
print(result)
```

[View endpoint](/operations/get_torrent_list)

## 5. Get a download link [#5-get-a-download-link]

Use [Request Torrent Download Link](/operations/request_torrent_download_link) with a `torrent_id` and `file_id`.

```python
import os
from torbox import TorBox

client = TorBox(api_key=os.environ["TORBOX_API_KEY"])
result = client.torrents.request_torrent_download_link(torrent_id=123, file_id=0)
print(result)
```

[View endpoint](/operations/request_torrent_download_link)

This endpoint takes the key as the `token` **query parameter**, not as a header, so the URL itself can be used as
a link. See [Torrents](/docs/torrents#download-links).

## Try it in the browser [#try-it-in-the-browser]

The [API reference](/reference) has a playground that calls the real API. Use **Sign in with TorBox** in the
header and your key is filled in for you.