Skip to Content
TorBox API
Integrations

Link Discord Roles

POST /v1/api/integration/oauth/discord/linked_roles

Try it in the playground

POST https://api.torbox.app/v1/api/integration/oauth/discord/linked_roles

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

Overview

Updates the Discord linked roles of a user from their TorBox account. Send a Discord OAuth access token of the user in discord_token. The token is issued by Discord, not by TorBox: it is the token handed over at the end of the login started by Authenticate OAuth with the provider discord, which asks Discord for the identify and role_connections.write scopes.

TorBox reads the Discord user behind the token and writes the TorBox role connection of that Discord user: the platform name "TorBox", that the user has signed up, the date the TorBox account was created, and the key of the account's plan: essential_plan for plan 1, pro_plan for plan 2 or standard_plan for plan 3.

Once Discord has accepted the update, the Discord user id is saved as the discord_id of your TorBox settings. The answer carries no data.

When Discord returns no user for the token, or does not accept the update, the answer is an error and the Discord user id is not saved.

Authorization

Requires an API key using the Authorization Bearer Header.

Request body (application/json)

FieldTypeRequiredDescription
discord_tokenstringyesDiscord OAuth access token of the user. It is issued by Discord, not by TorBox. Required.

Responses

  • 200 Successful Response
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 422 Validation Error
  • 429 Too Many Requests
  • 500 Internal Server Error
  • 503 Service Unavailable