# Upload To Pixeldrain

`POST https://api.torbox.app/v1/api/integration/pixeldrain`

- Operation ID: `upload_to_pixeldrain`
- Group: Integrations
- Auth: API key, `Authorization: Bearer <api key>` (Sign in with TorBox gives the same key)

### Overview

Uploads a file, or a zip of a whole download, from your TorBox account to Pixeldrain. Send the `id` of the torrent, usenet download or web download, its `type`, either the `file_id` of one file or `zip` set to true, and the API key of the Pixeldrain account to upload to in `pixeldrain_token`.

The route accepts a request without `pixeldrain_token`, but nothing can be uploaded without one: the job then fails with the detail "No API key provided. Please provide an API key to upload to Pixeldrain." Only the key sent in the request is used.

The route answers at once with a `job_id`. The upload itself runs in the background as a transfer job, and nothing is checked with Pixeldrain before the answer, so a key Pixeldrain does not accept only shows up as a failed job. Follow the job with Get Specific Job (`/v1/api/integration/job/{job_id}`), Get All Jobs (`/v1/api/integration/jobs`) or Get All Jobs By Hash (`/v1/api/integration/jobs/{hash}`), and stop it with Cancel Specific Job.

The job goes from "pending" through "preparing" and "uploading" to "completed" or "failed". Its `detail` says what it is doing or why it failed, and its `progress` runs from 0 to 1. When it is completed, its `download_url` is the Pixeldrain link of the file (`https://pixeldrain.com/u/...`) and you get an "Upload Complete" notification. A failed job is deleted about an hour after it failed, a completed job about 7 days after it completed.

A file of 100 GB (107,374,182,400 bytes) or more is not uploaded: the request is queued and the job fails. The download has to be cached on TorBox, otherwise the job fails. Send `file_id` or `zip`: with neither there is no file to upload and the job never completes.

### Authorization

Requires an API key using the Authorization Bearer Header.

## Request body (`application/json`)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer | yes | Id of the torrent, usenet download or web download to upload. It has to be one of your own downloads. Required. |
| `file_id` | integer | no | Id of the file to upload, from the download's files. Leave out when `zip` is true. |
| `zip` | boolean | no | Upload the whole download as one zip instead of a single file. Takes precedence over `file_id`. Optional, default false. |
| `type` | string | no | Which kind of download `id` refers to. One of `torrent`, `usenet` or `webdownload`. Optional, default `torrent`. |
| `pixeldrain_token` | string | no | Pixeldrain API key of the account to upload to. It is issued by Pixeldrain, not by TorBox. The route accepts a request without it, but the job fails without it. |

## Responses

- `200` Successful Response
- `400` Bad Request
- `401` Unauthorized
- `403` Forbidden
- `404` Not Found
- `422` Validation Error
- `429` Too Many Requests
- `500` Internal Server Error
- `503` Service Unavailable
