API reference
OAuth2 and the add link
Discord's bot authorization link, sign in with tether, and the bot's own application.
Get Bot Authorization (scope=bot)
/oauth2/authorizePeople onlyWhat the add-a-bot page shows for Discord's link: the bot, its maker, the servers you may add it to.
The link people share is Discord's own: https://<app>/oauth2/authorize?client_id=<bot id>&scope=bot&permissions=<bits>. scope=bot or scope=bot applications.commands are accepted. guild_id preselects a server and disable_guild_select=true locks the choice. This route is what the page asks; call it with a person's session to see the same.
Query string
client_idstringrequired- The bot's id.
scopestring · 1 to 256 charactersrequiredbot, orbot applications.commands.permissionsstring- The bits the bot asks for, a decimal string.
guild_idstring- Preselect this server.
disable_guild_select"true" | "false"true: the person cannot pick another server.
Response
{
"bot": {
"id": "107441200000000300",
"username": "groove",
"discriminator": "0",
"global_name": null,
"avatar": "3f2a9c1e5b7d4a608c1e2f3a4b5c6d7e",
"banner": null,
"accent_color": null,
"bot": true,
"public_flags": 0
},
"maker": {
"id": "107441200000000200",
"username": "josh",
"discriminator": "0",
"global_name": "Josh",
"avatar": "3f2a9c1e5b7d4a608c1e2f3a4b5c6d7e",
"banner": null,
"accent_color": null,
"bot": false,
"public_flags": 0
},
"description": "Plays music in voice channels.",
"player": true,
"permissions": "3147776",
"prefix": "g!",
"guilds": [
{
"id": "107441200000000001",
"name": "The crew",
"icon": null,
"grantable": "3263553",
"already_in": false
}
],
"guild_id": null,
"disable_guild_select": false
}
Errors
BOT_NOT_PUBLIC90220 · HTTP 403- The bot is private and you are not its maker.
UNKNOWN_USER10013 · HTTP 404- No such bot.
Discord
Like Discord’s OAuth2 authorization, with differences.
Discord's link, with the add page served by the app. A server picker lists only servers where you have Manage Server.
Add Bot (scope=bot)
/oauth2/authorizePeople onlyPress Add on the add-a-bot page: the bot joins the server with a managed role.
The query string is the link's (client_id, scope=bot, …); the body is the answer. authorize: false is Cancel and answers 204 without changing anything. The role gets exactly what the link asked for, less any bits you do not hold (dropped). The audit log records BOT_ADD.
Permissions needed
MANAGE_GUILDbit 32- Manage server
Query string
client_idstringrequiredscopestring · 1 to 256 charactersrequiredpermissionsstringguild_idstringdisable_guild_select"true" | "false"
Body
application/json
authorizebooleanrequiredtrueto add,falseto cancel.guild_idstring- The server to add the bot to.
permissionsstring
Example request
{
"authorize": true,
"guild_id": "107441200000000001"
}
Response
{
"guild_id": "107441200000000001",
"role_id": "107441200000000301",
"permissions": "3147776",
"dropped": "0"
}
Errors
BOT_ALREADY_IN_GUILD90221 · HTTP 409- The bot is already in that server.
BOT_NOT_PUBLIC90220 · HTTP 403- The bot is private and you are not its maker.
MISSING_PERMISSIONS50013 · HTTP 403- You do not have Manage Server in that server.
UNKNOWN_GUILD10004 · HTTP 404- The server does not exist, or you are not in it.
Rate limits
botAddPerUserbucket 70d09ffd- 30 per 3600 seconds, counted per user. See Rate limits.
Gateway events it causes
Discord
Like Discord’s OAuth2 authorization, with differences.
Discord has no JSON route for this; the page is the app's.
Check an App Sign-in
/oauth2/authorizePeople onlySign in with tether: check an app's request before asking the person.
Sign in with tether is not open to everyone: it is OAuth 2.0 with PKCE (S256) for a fixed list of apps (today grapple, and the developer site). There is no registration and no client secret. A request that is wrong in any way is shown on the page and never redirected to.
Query string
client_idstring · 1 to 64 charactersrequiredresponse_typestring · max 32 charactersrequiredredirect_uristring · 1 to 256 charactersrequiredscopestring · 1 to 256 charactersrequiredstatestring · 8 to 256 charactersrequiredcode_challengestring · max 256 charactersrequiredcode_challenge_methodstring · max 16 charactersrequired
Response
200 APIAuthorizeInfo
{
"application": {
"id": "developer",
"name": "tether developer",
"description": "Make and manage your bots.",
"icon": null
},
"scopes": [
"identify",
"bots"
],
"user": {
"id": "107441200000000200",
"username": "josh",
"discriminator": "0",
"global_name": "Josh",
"avatar": "3f2a9c1e5b7d4a608c1e2f3a4b5c6d7e",
"banner": null,
"accent_color": null,
"bot": false,
"public_flags": 0
},
"redirect_uri": "https://developer.example.com/callback"
}
Errors
INVALID_FORM_BODY50035 · HTTP 400- The redirect address, scope, response type or PKCE challenge is not allowed.
UNKNOWN_APPLICATION10002 · HTTP 404- The client_id is not a known app.
Discord
Like Discord’s OAuth2 authorize, with differences.
A fixed list of apps, PKCE S256 only, no client secret.
Answer an App Sign-in
/oauth2/authorizePeople onlyAllow or Cancel: the answer is the address to send the browser to.
Body
application/json
client_idstring · 1 to 64 charactersrequiredresponse_typestring · max 32 charactersrequiredredirect_uristring · 1 to 256 charactersrequiredscopestring · 1 to 256 charactersrequiredstatestring · 8 to 256 charactersrequiredcode_challengestring · max 256 charactersrequiredcode_challenge_methodstring · max 16 charactersrequiredauthorizebooleanrequired
Response
{
"location": "https://developer.example.com/callback?code=…&state=…"
}
Errors
INVALID_FORM_BODY50035 · HTTP 400- A field is missing, the wrong type or outside its limits.
Rate limits
appAuthorizePerUserbucket d7d9b546- 30 per 3600 seconds, counted per user. See Rate limits.
Discord
Like Discord’s OAuth2 authorize, with differences.
A fixed list of apps; the answer is JSON for the page.
Get Tokens
/oauth2/tokenNo sign-in neededTrade a code and its PKCE verifier, or a refresh token, for app tokens.
Form-encoded (application/x-www-form-urlencoded, RFC 6749) or JSON. Access tokens (tapp.…) last 7 days; each refresh gives a new pair and the old pair stops working at once. A refresh token lapses after 90 days unused. Errors are RFC 6749's {"error", "error_description"}, not tether's {code, message}, as on Discord's token endpoint. App tokens open only the routes their scopes name; everything else is 401.
Who can call it
- No sign-in is needed (public).
- A person, with a session token.
- A bot, with its token.
Body
application/x-www-form-urlencoded, application/json
{
"oneOf": [
{
"type": "object",
"properties": {
"grant_type": {
"type": "string",
"const": "authorization_code"
},
"client_id": {
"type": "string",
"minLength": 1,
"maxLength": 64
},
"code": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"redirect_uri": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"code_verifier": {
"type": "string",
"minLength": 1,
"maxLength": 256
}
},
"required": [
"grant_type",
"client_id",
"code",
"redirect_uri",
"code_verifier"
]
},
{
"type": "object",
"properties": {
"grant_type": {
"type": "string",
"const": "refresh_token"
},
"client_id": {
"type": "string",
"minLength": 1,
"maxLength": 64
},
"refresh_token": {
"type": "string",
"minLength": 1,
"maxLength": 256
}
},
"required": [
"grant_type",
"client_id",
"refresh_token"
]
}
]
}
Example request
{
"grant_type": "refresh_token",
"client_id": "developer",
"refresh_token": "tapr.Zm9vYmFyYmF6cXV4c2FtcGxlcmVmcmVzaHRva2VuMDEyMzQ="
}
Response
{
"access_token": "tapp.Zm9vYmFyYmF6cXV4c2FtcGxlYWNjZXNzdG9rZW4wMTIzNDU2",
"token_type": "Bearer",
"expires_in": 604800,
"refresh_token": "tapr.Zm9vYmFyYmF6cXV4c2FtcGxlcmVmcmVzaHRva2VuMDEyMzQ=",
"scope": "identify bots"
}
Errors
RATE_LIMITED90003 · HTTP 429- More than 30 token requests in 5 minutes from one address.
Rate limits
appTokenPerIpbucket 8aea4feb- 30 per 300 seconds, counted per user. See Rate limits.
Discord
Like Discord’s Token exchange, with differences.
No client secret (public clients with PKCE).
Revoke Token
/oauth2/token/revokeNo sign-in neededAn app signs out: either of its tokens ends that sign-in. Always answers 200.
Who can call it
- No sign-in is needed (public).
- A person, with a session token.
- A bot, with its token.
Body
application/x-www-form-urlencoded, application/json
tokenstring · 1 to 256 charactersrequiredclient_idstring · 1 to 64 charactersrequiredtoken_type_hintstring · max 32 characters
Response
200 no body
An empty body, whether or not the token was known (RFC 7009).
Rate limits
appTokenPerIpbucket 8aea4feb- 30 per 300 seconds, counted per user. See Rate limits.
Discord
The same as Discord’s Token revocation.