Skip to Content
TorBox API
Integrations

Upload To Google Drive

POST /v1/api/integration/googledrive

Try it in the playground

POST https://api.torbox.app/v1/api/integration/googledrive

  • Operation ID: upload_to_google_drive
  • 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 a Google Drive. 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. In google_token you send a Google OAuth access token for the Drive to upload to. The login started by Authenticate OAuth with the provider google asks Google for the drive.file scope and ends with such a token.

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 Google before the answer, so a token Google 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 link to the file on Google Drive 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.

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 google_drive_folder_id, the file is put in that folder.

Authorization

Requires an API key using the Authorization Bearer Header.

Request body (application/json)

FieldTypeRequiredDescription
idintegeryesId of the torrent, usenet download or web download to upload. It has to be one of your own downloads. Required.
file_idintegernoId of the file to upload, from the download's files. Leave out when zip is true.
zipbooleannoUpload the whole download as one zip instead of a single file. Takes precedence over file_id. Optional, default false.
typestringnoWhich kind of download id refers to. One of torrent, usenet or webdownload. Optional, default torrent.
google_tokenstringyesGoogle OAuth access token for the Drive to upload to. It is issued by Google, not by TorBox. Required.

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