# Upload To 1Fichier

`POST https://api.torbox.app/v1/api/integration/1fichier`

- Operation ID: `upload_to_1fichier`
- 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 1Fichier. Send the `id` of the torrent, usenet download or web download, its `type`, and either the `file_id` of one file or `zip` set to true. `onefichier_token` is optional: with it the upload is made with that 1Fichier account's API token, without it the upload is sent without a 1Fichier login.

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 1Fichier before the answer, so a token 1Fichier 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 1Fichier download link of the file 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 larger than 2 GB (2,147,483,647 bytes) is not uploaded: the request is queued and the job fails. The download has to be cached on TorBox, otherwise the job fails. If you send neither `file_id` nor `zip`, the request is still queued, but there is no file to upload and the job fails. If your settings have a `onefichier_folder_id`, the file is put in that folder, but only when a `onefichier_token` is sent.

### 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`. |
| `onefichier_token` | string | no | 1Fichier API token of the account to upload to. It is issued by 1Fichier, not by TorBox. Optional. |

## 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
