Applications
An application is an OAuth2 client with one bot account, and a user can own up to 25 of them. The routes on this page need a user session unless they say otherwise. A bot or OAuth2 bearer token on one of those routes gets 403 ACCESS_DENIED. A route that takes an application ID returns 404 UNKNOWN_APPLICATION when the application does not exist and 403 ACCESS_DENIED when you do not own it. The authorization flow and its tokens are on OAuth2.
Application object
Section titled “Application object”The routes for an application you own return this object.
Structure
Section titled “Structure”| Field | Type | Description |
|---|---|---|
| id | snowflake | The ID of the application |
| name | string | The name of the application (1-100 characters) |
| redirect_uris | array[string] | The redirect URIs registered for the application |
| bot_public | boolean | Whether any eligible user can install the bot |
| bot_require_code_grant | boolean | Whether installing the bot needs an OAuth2 code grant |
| client_secret?1 | string | The client secret for token exchange, introspection and revocation |
| bot?2 | application bot object | The bot account the application owns |
1 Returned only by Create application and Reset client secret
2 Not returned by Reset client secret
Example
Section titled “Example”{ "id": "1501314428688998182", "name": "Party Parrot", "redirect_uris": ["https://example.com/callback"], "bot_public": true, "bot_require_code_grant": false}Application bot object
Section titled “Application bot object”Each application has one bot account, and the bot's user ID is the same as the application ID.
Structure
Section titled “Structure”| Field | Type | Description |
|---|---|---|
| id | snowflake | The ID of the bot user |
| username | string | The username of the bot account |
| discriminator | string | The four-digit discriminator of the bot account |
| avatar? | ?string | The avatar hash of the bot account |
| banner? | ?string | The banner hash of the bot account |
| bio | ?string | The profile biography of the bot account |
| token?1 | string | The bot token |
| mfa_enabled? | boolean | Whether the bot account has an authenticator |
| authenticator_types? | array[integer] | The authenticator types on the bot account |
| flags | integer | The account's public user flags, including bot flags |
1 Returned only by Create application
Public application object
Section titled “Public application object”Anyone can see this version of an application, with or without a credential.
Structure
Section titled “Structure”| Field | Type | Description |
|---|---|---|
| id | snowflake | The ID of the application |
| name | string | The name of the application |
| icon | ?string | The avatar hash of the bot account |
| description | ?string | Always null |
| redirect_uris | array[string] | The redirect URIs registered for the application |
| scopes | array[string] | The OAuth2 scopes the application can be authorized for |
| bot_public1 | boolean | Whether the requester can install the bot |
| bot | ?application bot object | The bot account, without token, mfa_enabled or authenticator_types |
| current_user? | ?partial user object | The requesting account, or null without a credential |
1 Always true for the application owner
Current bot application object
Section titled “Current bot application object”This is the application that issued the bot token making the request.
Structure
Section titled “Structure”| Field | Type | Description |
|---|---|---|
| id | snowflake | The ID of the application |
| name | string | The name of the application |
| icon | ?string | The avatar hash of the bot account |
| description | ?string | The biography of the bot account |
| bot_public | boolean | Whether any eligible user can install the bot |
| bot_require_code_grant | boolean | Whether installing the bot needs an OAuth2 code grant |
| verify_key | string | A placeholder of 64 0 characters |
| owner | partial user object | The account that owns the application |
| bot? | application bot object | The bot account, without token |
| redirect_uris? | array[string] | The redirect URIs registered for the application |
Bot profile object
Section titled “Bot profile object”Update bot profile returns this object.
Structure
Section titled “Structure”| Field | Type | Description |
|---|---|---|
| id | snowflake | The ID of the bot user |
| username | string | The username of the bot account |
| discriminator | string | The four-digit discriminator of the bot account |
| avatar | ?string | The avatar hash of the bot account |
| banner | ?string | The banner hash of the bot account |
| bio | ?string | The profile biography of the bot account |
| flags | integer | The account's public user flags, including bot flags |
Bot flags
Section titled “Bot flags”These bits are in the bot account's flags, and you set them with bot_flags in Update bot profile.
| Value | Name | Description |
|---|---|---|
| 1 << 4 | FRIENDLY_BOT | The bot accepts friend requests from users |
| 1 << 5 | FRIENDLY_BOT_MANUAL_APPROVAL | The bot needs manual approval for friend requests |
Bot token reset object
Section titled “Bot token reset object”Reset bot token returns this object.
Structure
Section titled “Structure”| Field | Type | Description |
|---|---|---|
| token | string | The new bot token |
| bot | application bot object | The bot account, without token |
List owned applications
Section titled “List owned applications”GET/v1/users/@me/applicationsReturns every application the current user owns, without client secrets or bot tokens.
Response
Section titled “Response”| Status | Body | Condition |
|---|---|---|
| 200 | array[application object] | The applications were returned |
The rate limit is 60 requests per minute, on the oauth_dev:clients:list bucket.
Get current application
Section titled “Get current application”GET/v1/oauth2/applications/@meReturns the same array as List owned applications for a user session, and the current bot application object for a bot token. OAuth2 bearer tokens get 403 ACCESS_DENIED.
Response
Section titled “Response”| Status | Body | Condition |
|---|---|---|
| 200 | array[application object] | current bot application object | The current application data was returned |
The rate limit is 60 requests per minute, on the oauth_dev:clients:list bucket.
Get bot application
Section titled “Get bot application”GET/v1/applications/@meReturns the current bot application object for the bot token in the Authorization header.
Response
Section titled “Response”| Status | Body | Condition |
|---|---|---|
| 200 | current bot application object | The application was returned |
| 401 | error response | INVALID_TOKEN when the header is missing, isn't a bot token or the application was deleted |
The rate limit is 60 requests per minute, on the oauth_dev:clients:list bucket.
Get public application
Section titled “Get public application”GET/v1/oauth2/applications/{id}/publicReturns the public application object for any application.
Response
Section titled “Response”| Status | Body | Condition |
|---|---|---|
| 200 | public application object | The application was returned |
The rate limit is 60 requests per minute, on the oauth_dev:clients:list bucket.
Create application
Section titled “Create application”POST/v1/oauth2/applicationsCreates an application and its bot account, and returns the application object with the client secret and bot token. After this, only the reset routes return them. The bot's username is the application name when it's available, and a random name otherwise.
Request headers
Section titled “Request headers”| Field | Type | Description |
|---|---|---|
| X-Captcha-Token? | string | The solved CAPTCHA token |
JSON body
Section titled “JSON body”| Field | Type | Description |
|---|---|---|
| name | string | The name of the application (1-100 characters) |
| redirect_uris?1 | ?array[string] | The redirect URIs to register (at most 10, each 1-256 characters) |
| bot_public? | boolean | Whether any eligible user can install the bot (default true) |
| bot_require_code_grant? | boolean | Whether installing the bot needs an OAuth2 code grant (default false) |
1 Each URI must be an absolute HTTPS URL. HTTP is allowed for localhost, *.localhost and IP literals
Response
Section titled “Response”| Status | Body | Condition |
|---|---|---|
| 200 | application object | The application and its bot were created |
| 400 | error response | MAX_APPLICATIONS when you already own 25 applications |
| 403 | error response | Your account is unclaimed2 |
| 403 | error response | ACCOUNT_VERIFICATION_REQUIRED when the instance needs a verified account and yours is not |
| 403 | error response | CONTENT_BLOCKED when the name, a redirect URI or the bot username is blocked |
| 500 | error response | BOT_USER_GENERATION_FAILED when no bot username is free |
2 The error code is UNCLAIMED_ACCOUNT_CANNOT_CREATE_APPLICATIONS
The rate limit is 10 requests per hour, on the oauth_dev:clients:create bucket.
Get application
Section titled “Get application”GET/v1/oauth2/applications/{id}Returns one application object you own.
Response
Section titled “Response”| Status | Body | Condition |
|---|---|---|
| 200 | application object | The application was returned |
The rate limit is 60 requests per minute, on the oauth_dev:clients:list bucket.
Update application
Section titled “Update application”PATCH/v1/oauth2/applications/{id}Updates an application you own and returns the application object.
JSON body
Section titled “JSON body”| Field | Type | Description |
|---|---|---|
| name? | string | The name of the application (1-100 characters) |
| redirect_uris?1 | ?array[string] | The redirect URIs to register (at most 10) |
| bot_public? | boolean | Whether any eligible user can install the bot |
| bot_require_code_grant? | boolean | Whether installing the bot needs an OAuth2 code grant |
1 The array replaces the whole set, and null clears it. Each URI follows the same rules as in Create application
Response
Section titled “Response”| Status | Body | Condition |
|---|---|---|
| 200 | application object | The application was updated |
| 403 | error response | CONTENT_BLOCKED when the name or a redirect URI is blocked |
The rate limit is 30 requests per minute, on the oauth_dev:clients:update::client_id bucket.
Update bot profile
Section titled “Update bot profile”PATCH/v1/oauth2/applications/{id}/botUpdates the bot account of an application you own and returns the bot profile object. An omitted field stays as it is, and null clears it. The update also clears the bot's display name, and Fluxer sends User Update to the bot's sessions.
JSON body
Section titled “JSON body”| Field | Type | Description |
|---|---|---|
| username?1 | string | The username of the bot account (1-32 letters, digits or underscores) |
| discriminator?2 | string | integer | The current discriminator of the bot account |
| avatar?3 | ?string | The base64-encoded avatar image |
| banner?3 | ?string | The base64-encoded banner image |
| bio? | ?string | The profile biography (0-1024 characters) |
| bot_flags?4 | integer | Bot flags |
1 Changing the username beyond letter case gives the bot a new random discriminator. You can change the username 5 times per 3 hours, and after that the request fails with USERNAME_CHANGED_TOO_MANY_TIMES
2 Any value other than the current discriminator fails with BOT_DISCRIMINATOR_CANNOT_BE_CHANGED
3 The image must fit the avatar_max_size limit
4 Fluxer sets or clears only the bot flags and ignores other bits
Response
Section titled “Response”| Status | Body | Condition |
|---|---|---|
| 200 | bot profile object | The profile was updated |
| 400 | error response | USERNAME_NOT_AVAILABLE when no discriminator is free for the username |
| 403 | error response | CONTENT_BLOCKED when the username or biography is blocked |
| 404 | error response | BOT_USER_NOT_FOUND when the application has no bot account |
The rate limit is 30 requests per minute, on the oauth_dev:clients:update::client_id bucket.
Reset bot token
Section titled “Reset bot token”POST/v1/oauth2/applications/{id}/bot/reset-tokenIssues a new bot token for an application you own and returns the bot token reset object. You need sudo mode.
JSON body
Section titled “JSON body”The body is a sudo verification object.
Response
Section titled “Response”| Status | Body | Condition |
|---|---|---|
| 200 | bot token reset object | The token was rotated |
| 404 | error response | BOT_USER_NOT_FOUND when the application has no bot account |
The rate limit is 10 requests per hour, on the oauth_dev:clients:rotate_secret::client_id bucket.
Reset client secret
Section titled “Reset client secret”POST/v1/oauth2/applications/{id}/client-secret/resetIssues a new client secret for an application you own and returns the application object with it. You need sudo mode. The old secret stops working at once, and access and refresh tokens already issued stay valid.
JSON body
Section titled “JSON body”The body is a sudo verification object.
Response
Section titled “Response”| Status | Body | Condition |
|---|---|---|
| 200 | application object | The client secret was rotated |
The rate limit is 10 requests per hour, on the oauth_dev:clients:rotate_secret::client_id bucket.
Delete application
Section titled “Delete application”DELETE/v1/oauth2/applications/{id}Deletes an application you own. You need sudo mode.
JSON body
Section titled “JSON body”The body is a sudo verification object.
Response
Section titled “Response”| Status | Body | Condition |
|---|---|---|
| 204 | empty | The application was deleted |
The rate limit is 10 requests per hour, on the oauth_dev:clients:delete::client_id bucket.