A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
docs: rewrite every page shorter from one style guide
Hampusd014579933b5
diff --git a/fluxer_docs/src/content/docs/admin-api/api-keys.mdx b/fluxer_docs/src/content/docs/admin-api/api-keys.mdxindex ab934e16c..bdb537bdc 100644--- a/fluxer_docs/src/content/docs/admin-api/api-keys.mdx+++ b/fluxer_docs/src/content/docs/admin-api/api-keys.mdx@@ -6,49 +6,23 @@ description: Admin API key objects and the operations that manage them.import RouteHeader from '@/components/RouteHeader.astro';-An Admin API key is a long-lived credential for the [Admin API](/admin-api/). It authenticates as the account that created it, has its own [ACL](/admin-api/#acl-registry) set, and authenticates only requests to paths below `/v1/admin`.+An Admin API key is a long-lived credential for the [Admin API](/admin-api/). It acts as the account that created it and only works on paths below `/v1/admin`. A request made with a key passes only when both the key and that account have the [ACL](/admin-api/#acl-registry) the route needs, or `*`.-Every operation on this page requires `admin_api_key:manage`. A successful operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with target type `admin_api_key` and the `X-Audit-Log-Reason` header as its reason. A request that returns an error records no entry. An operation that addresses one key returns 404 `ADMIN_API_KEY_NOT_FOUND` when any of these holds:--- No key has that identifier.-- Another account created the key.-- The key has expired.--:::caution[Key management is scoped to the creating account]-The wildcard ACL reaches no key created by another account, and such a key reports `ADMIN_API_KEY_NOT_FOUND`.-:::+Every route on this page needs `admin_api_key:manage` and records an [Admin audit entry](/admin-api/#admin-audit-entry-object) with target type `admin_api_key`. You can only see and change keys your account created.## Admin API key object-A key is owned by the account that created it, and it stores its own ACL set. Removing an ACL from the owning account and removing an ACL from the key are separate changes.--Fluxer checks both sets when a request presents a key. A request passes when all of these hold:--- The owning account holds `admin:authenticate` or `*`.-- The owning account holds the ACL the operation requires, or `*`.-- The key itself has that ACL, or `*`.--A key therefore never has wider permission than the account behind it.-### Structure| Field | Type | Description || --- | --- | --- || key_id | snowflake | The ID of the key |-| name | string | The name given to the key (1-100 characters) |-| acls<sup>1</sup> | array[string] | The [ACLs](/admin-api/#acl-registry) stored on the key |-| created_by_user_id<sup>2</sup> | snowflake | The ID of the account that created the key, and whose identity the key assumes |+| name | string | The name of the key (1-100 characters) |+| acls | array[string] | The [ACLs](/admin-api/#acl-registry) stored on the key |+| created_by_user_id | snowflake | The ID of the account that created the key || created_at | ISO8601 timestamp | Time the key was created |-| last_used_at<sup>3</sup> | ?ISO8601 timestamp | Time the key last authenticated a request, or null when it never has |-| expires_at<sup>4</sup> | ?ISO8601 timestamp | Time the key expires, or null when the key does not expire |--<sup>1</sup> Bounded at the size of the [ACL registry](/admin-api/#acl-registry). Every value written through this API is a registry member--<sup>2</sup> Never changes, so a key cannot be transferred to another account--<sup>3</sup> Written on every successful authentication, including when the authenticated operation is a read--<sup>4</sup> An expired key is absent from every listing and is reported as not found+| last_used_at | ?ISO8601 timestamp | Time the key last authenticated a request, or null if it has never been used |+| expires_at | ?ISO8601 timestamp | Time the key expires, or null when it does not expire |### Example@@ -66,200 +40,105 @@ A key therefore never has wider permission than the account behind it.## Admin API key creation object-Only [Create Admin API key](#create-admin-api-key) returns this object. It has the raw credential and omits `last_used_at` and `created_by_user_id`.+Only [Create Admin API key](#create-admin-api-key) returns this object. Its `key` field is the value you send as `Admin <token>` in the [Authorization header](/authentication/#authorization-schemes).### Structure| Field | Type | Description || --- | --- | --- || key_id | snowflake | The ID of the key |-| key<sup>1</sup> | string | The raw credential the key authenticates with |-| name | string | The name given to the key (1-100 characters) |+| key | string | The raw credential the key authenticates with |+| name | string | The name of the key (1-100 characters) || created_at | ISO8601 timestamp | Time the key was created |-| expires_at<sup>2</sup> | ?ISO8601 timestamp | Time the key expires, or null when the key does not expire |-| acls<sup>3</sup> | array[string] | The [ACLs](/admin-api/#acl-registry) stored on the key |--<sup>1</sup> An opaque key, presented as `Admin <token>` in the [Authorization header](/authentication/#authorization-schemes)--<sup>2</sup> Derived from `expires_in_days` at the instant the key is created, and null when that field is omitted--<sup>3</sup> Reflects the stored set, so a value repeated in the request appears once and a value outside the [ACL registry](/admin-api/#acl-registry) is left out+| expires_at | ?ISO8601 timestamp | Time the key expires, or null when it does not expire |+| acls | array[string] | The [ACLs](/admin-api/#acl-registry) stored on the key |-:::caution[The secret is returned once]-The secret cannot be retrieved or rotated later. If it is lost, revoke the key and create a replacement.+:::caution[The key is returned once]+You can't get the `key` value again or rotate it. If you lose it, revoke the key and create a new one.:::-### Example--```json-{- "key_id": "1501314428688998182",- "key": "fa_1501314428688998182_7Qk2ZbW9xLmR4TnP0vAeJdCyHs6UgF1B",- "name": "moderation-tooling",- "created_at": "2026-05-14T09:12:44.183000+00:00",- "expires_at": "2026-08-12T09:12:44.183000+00:00",- "acls": ["user:lookup", "report:view"]-}-```-## List Admin API keys<RouteHeader method="GET" path="/v1/admin/api-keys" auditReason />-Returns every [Admin API key](#admin-api-key-object) object the acting account created, as a bare JSON array with no ordering guarantee. Requires `admin_api_key:manage`.--A key past its expiry is never returned.+Returns an array of the [Admin API key](#admin-api-key-object) objects your account created.### Response| Status | Body | Condition || --- | --- | --- |-| 200<sup>1</sup> | array[[Admin API key](#admin-api-key-object) object] | Keys were returned |--<sup>1</sup> An account that created no key receives an empty array--### Side effects+| 200 | array[[Admin API key](#admin-api-key-object) object] | Keys were returned |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_admin_api_keys`, target type `admin_api_key`, target ID `0`, and metadata key `result_count`.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Create Admin API key<RouteHeader method="POST" path="/v1/admin/api-keys" auditReason />-Creates a key and returns an [Admin API key creation](#admin-api-key-creation-object) object that has the raw credential, with HTTP 200, not 201. Requires `admin_api_key:manage`.--The acting credential must already have every value in `acls`, unless it has `*`. The key authenticates immediately, and its effective permission is the intersection described under [Admin API key object](#admin-api-key-object).+Creates a key and returns an [Admin API key creation](#admin-api-key-creation-object) object. You can only give the key ACLs your credential has, unless it has `*`. When you call with an Admin API key, that means the key's own ACLs, so a key can't create a broader key.### JSON body| Field | Type | Description || --- | --- | --- |-| name<sup>1</sup> | string | The name given to the key (1-100 characters) |-| expires_in_days?<sup>2</sup> | integer | The number of days until the key expires (1-365) |-| acls<sup>3</sup> | array[string] | The [ACLs](/admin-api/#acl-registry) stored on the key, each a registry value (at most 106) |--<sup>1</sup> A value that is empty after trimming is rejected, so whitespace alone is not a name--<sup>2</sup> The stored expiry is the request instant plus this many days. Omitting the field creates a key that does not expire--<sup>3</sup> An empty array produces a key that satisfies no operation. Fluxer compares `acls` against the presenting key's own ACLs, so a key cannot issue a broader key--Fluxer rejects the request with 403 `MISSING_ACL` on the first ungrantable value. A request that names several ungrantable ACLs reports only that one.+| name | string | The name of the key (1-100 characters) |+| expires_in_days? | integer | The number of days until the key expires (1-365) |+| acls | array[string] | The [ACLs](/admin-api/#acl-registry) to store on the key |### Response| Status | Body | Condition || --- | --- | --- || 200 | [Admin API key creation](#admin-api-key-creation-object) object | Key was created |-| 400 | [error response](/admin-api/#error-response) | Body validation fails, including an `acls` value outside the [ACL registry](/admin-api/#acl-registry), returned as `INVALID_FORM_BODY` |-| 403 | [error response](/admin-api/#error-response) | Credential type is refused, `admin_api_key:manage` is absent, or `acls` names a value the acting credential does not have |--### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `create_admin_api_key`, target type `admin_api_key`, target ID equal to the new `key_id`, and metadata keys `acls` and `expires_in_days`. `acls` is the stored ACL set joined with commas. `expires_in_days` is present only when the request supplied it. The entry has no name and no raw credential.+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` when an `acls` value is not in the registry |+| 403 | [error response](/admin-api/#error-response) | `MISSING_ACL` when `acls` has a value you don't have |-### Rate limit--30 requests per minute for each authenticated user, on the `admin:code:generation` bucket.+The rate limit is 30 requests per minute, on the `admin:code:generation` bucket.## Get Admin API key<RouteHeader method="GET" path="/v1/admin/api-keys/{key_id}" auditReason />-Returns one [Admin API key](#admin-api-key-object) object. Requires `admin_api_key:manage`.--This operation never returns the raw credential.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| key_id | snowflake | The ID of the key |+Returns an [Admin API key](#admin-api-key-object) object.### Response| Status | Body | Condition || --- | --- | --- || 200 | [Admin API key](#admin-api-key-object) object | Key was returned |-| 404 | [error response](/admin-api/#error-response) | `ADMIN_API_KEY_NOT_FOUND`, which also covers an expired key and a key created by another account |--### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `get_admin_api_key`, target type `admin_api_key`, target ID equal to `key_id`, and no metadata.+| 404 | [error response](/admin-api/#error-response) | `ADMIN_API_KEY_NOT_FOUND` when the key is missing, expired or not yours |-### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Update Admin API key<RouteHeader method="PATCH" path="/v1/admin/api-keys/{key_id}" auditReason />-Renames a key or replaces its ACL set, and returns the updated [Admin API key](#admin-api-key-object) object. Requires `admin_api_key:manage`.--Fluxer leaves an omitted field unchanged, and the supplied fields take effect on the key's next authenticated request. The acting credential must already have every value in a supplied `acls`, unless it has `*`. A key with an expiry keeps it.--:::caution[Supplying acls replaces the whole stored set]-An update never rotates the credential, and no field on this route changes the expiry, so revoking the key is the only way to disable it.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| key_id | snowflake | The ID of the key |+Renames a key or replaces its ACLs and returns the updated [Admin API key](#admin-api-key-object) object. Fields you leave out stay unchanged. You can only set ACLs your credential has, unless it has `*`.### JSON body| Field | Type | Description || --- | --- | --- |-| name?<sup>1</sup> | string | The replacement name for the key (1-100 characters) |-| acls?<sup>2</sup> | array[string] | The complete replacement set of [ACLs](/admin-api/#acl-registry), each a registry value (at most 106) |--<sup>1</sup> A value that is empty after trimming is rejected--<sup>2</sup> An empty array leaves the key with no ACLs, so the key satisfies no operation. An empty request body is accepted and changes nothing+| name? | string | The new name of the key (1-100 characters) |+| acls? | array[string] | The complete replacement set of [ACLs](/admin-api/#acl-registry) |### Response| Status | Body | Condition || --- | --- | --- || 200 | [Admin API key](#admin-api-key-object) object | Key was updated |-| 400 | [error response](/admin-api/#error-response) | Body validation fails, including an `acls` value outside the [ACL registry](/admin-api/#acl-registry), returned as `INVALID_FORM_BODY` |-| 403<sup>1</sup> | [error response](/admin-api/#error-response) | Credential type is refused, `admin_api_key:manage` is absent, or `acls` names a value the acting credential does not have |-| 404 | [error response](/admin-api/#error-response) | `ADMIN_API_KEY_NOT_FOUND`, which also covers an expired key and a key created by another account |--<sup>1</sup> The ownership check runs before the ACL grant check, so a key belonging to another account returns 404, not 403--### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `update_admin_api_key`, target type `admin_api_key`, target ID equal to `key_id`, and metadata keys `fields` and `acls`. `fields` lists the supplied field names joined with commas, and is empty for an empty body. `acls` is the stored ACL set joined with commas, present only when the request supplied `acls`. The entry has no name.+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` when an `acls` value is not in the registry |+| 403 | [error response](/admin-api/#error-response) | `MISSING_ACL` when `acls` has a value you don't have |+| 404 | [error response](/admin-api/#error-response) | `ADMIN_API_KEY_NOT_FOUND` when the key is missing, expired or not yours |-### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Revoke Admin API key<RouteHeader method="DELETE" path="/v1/admin/api-keys/{key_id}" auditReason />-Revokes an Admin API key and returns HTTP 200 with a response body. Requires `admin_api_key:manage`.--The credential stops authenticating on its next use. A request already in flight runs to completion.--:::danger[Revocation is permanent]-Every later request presenting that credential fails authentication, and no operation recovers the key ID or reissues the raw value.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| key_id | snowflake | The ID of the key |+Revokes a key right away. You can't undo this.### Response body@@ -272,12 +151,6 @@ Every later request presenting that credential fails authentication, and no oper| Status | Body | Condition || --- | --- | --- || 200 | response body | Key was revoked |-| 404 | [error response](/admin-api/#error-response) | `ADMIN_API_KEY_NOT_FOUND`, which also covers an expired key and a key created by another account |--### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `revoke_admin_api_key`, target type `admin_api_key`, target ID equal to `key_id`, and no metadata.--### Rate limit+| 404 | [error response](/admin-api/#error-response) | `ADMIN_API_KEY_NOT_FOUND` when the key is missing, expired or not yours |-100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/applications.mdx b/fluxer_docs/src/content/docs/admin-api/applications.mdxindex f441d69fd..5448129eb 100644--- a/fluxer_docs/src/content/docs/admin-api/applications.mdx+++ b/fluxer_docs/src/content/docs/admin-api/applications.mdx@@ -1,22 +1,16 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Admin applications-description: Application inspection, the owner and guild selectors, and ownership transfer.+description: Look up OAuth2 applications and their bots, and transfer ownership.---import RouteHeader from '@/components/RouteHeader.astro';-An application is an OAuth2 client that can own one bot account. These routes inspect applications and [transfer their ownership](#transfer-application-ownership).--These records are the same ones the public [Applications](/http-api/applications/) resource serves. Creation, deletion, renaming, bot creation, redirect URI editing, and credential rotation are available only through that resource.--:::note[Admin operations report credential metadata only]-The Admin application object reports whether a client secret or bot token hash is stored, when it was created, and the non-secret bot token preview.-:::+An application is an OAuth2 client that can have one bot account. These routes look up any application and transfer its ownership. To manage your own applications, use the public [Applications](/http-api/applications/) resource.## Admin application object-The Admin view of one application. An application and its bot account share one identifier, so an application that has a bot reports the same [snowflake](/snowflakes/) in `id` and `bot_user_id`.+Admin routes return applications in this structure. When the application has a bot, `bot_user_id` is the same as `id`. The object never has the client secret or bot token, only whether each one is set.### Structure@@ -26,31 +20,25 @@ The Admin view of one application. An application and its bot account share one| name | string | The display name (1-256 characters) || owner_user_id | snowflake | The ID of the owning account || owner_username<sup>1</sup> | ?string | The username of the owner |-| owner_global_name<sup>1</sup> | ?string | The display name of the owner, or null when unset |-| owner_discriminator<sup>1</sup> | ?string | The discriminator of the owner, as four decimal digits with leading zeroes |-| bot_user_id | ?snowflake | The ID of the bot account, or null when the application has no bot |+| owner_global_name<sup>1</sup> | ?string | The display name of the owner |+| owner_discriminator<sup>1</sup> | ?string | The discriminator of the owner, as four digits |+| bot_user_id | ?snowflake | The ID of the bot account, or null when there is no bot || bot_username<sup>2</sup> | ?string | The username of the bot |-| bot_global_name<sup>2</sup> | ?string | The display name of the bot, or null when unset |-| bot_discriminator<sup>2</sup> | ?string | The discriminator of the bot, as four decimal digits with leading zeroes |+| bot_global_name<sup>2</sup> | ?string | The display name of the bot |+| bot_discriminator<sup>2</sup> | ?string | The discriminator of the bot, as four digits || bot_is_public | boolean | Whether an account other than the owner can add the bot |-| bot_require_code_grant | boolean | Whether adding the bot requires a completed authorisation code grant |-| oauth2_redirect_uris<sup>3</sup> | array[string] | The registered OAuth2 redirect URIs (at most 10 entries) |-| has_client_secret | boolean | Whether a client secret hash is stored |-| has_bot_token | boolean | Whether a bot token hash is stored |-| bot_token_preview | ?string | The non-secret trailing preview of the bot token, or null when none is stored |-| bot_token_created_at | ?ISO8601 timestamp | When the bot token was created, or null when none is stored |-| client_secret_created_at<sup>4</sup> | ?ISO8601 timestamp | When the client secret was created |-| version<sup>5</sup> | integer | The optimistic locking version of the stored record (0-2147483647) |--<sup>1</sup> Null when no account with `owner_user_id` exists--<sup>2</sup> Null when the application has no bot, and also null when no account with `bot_user_id` exists+| bot_require_code_grant | boolean | Whether adding the bot needs a completed authorization code grant |+| oauth2_redirect_uris | array[string] | The registered OAuth2 redirect URIs (at most 10) |+| has_client_secret | boolean | Whether the application has a client secret |+| has_bot_token | boolean | Whether the application has a bot token |+| bot_token_preview | ?string | The first 8 characters of the bot token's secret part |+| bot_token_created_at | ?ISO8601 timestamp | When the bot token was created |+| client_secret_created_at | ?ISO8601 timestamp | When the client secret was created |+| version | integer | The version of the application, which goes up on each change (0-2147483647) |-<sup>3</sup> The stored set arrives in no guaranteed order+<sup>1</sup> These are null when the owner account doesn't exist.-<sup>4</sup> Null when no client secret is stored, and null for the [built-in Admin application](#the-built-in-admin-application)--<sup>5</sup> Incremented by every stored change, including one made through the public [Applications](/http-api/applications/) resource+<sup>2</sup> These are null when there is no bot or the bot account doesn't exist.### Example@@ -71,7 +59,7 @@ The Admin view of one application. An application and its bot account share one"oauth2_redirect_uris": ["https://example.com/oauth2/callback"],"has_client_secret": true,"has_bot_token": true,- "bot_token_preview": "kQ9x",+ "bot_token_preview": "kQ9xT2mA","bot_token_created_at": "2026-02-11T09:14:02.117Z","client_secret_created_at": "2026-02-11T09:13:58.004Z","version": 7@@ -80,142 +68,86 @@ The Admin view of one application. An application and its bot account share one## The built-in Admin application-Fluxer serves one synthetic application for its own Admin OAuth2 client. The application has no bot, so every `bot_` field is null or false and `has_bot_token` is false. It also reports these values:--- `id` is the fixed constant `1234567890123456789`.-- `name` is `Fluxer Admin`, and `owner_user_id` is the system account `0`.-- `oauth2_redirect_uris` has one entry, the configured Admin endpoint followed by `/oauth2_callback`.-- `has_client_secret` is true in every response that returns this application, and `client_secret_created_at` is null.-- `version` is always 1.--:::caution[The built-in application is read-only]-[Get application](#get-application) returns it only while an Admin client secret is configured for the deployment, and returns a null `application` otherwise. [List applications](#list-applications) never returns it. [Transfer application ownership](#transfer-application-ownership) answers 403 `FORBIDDEN`.-:::+The API has one built-in application for the Admin panel's OAuth2 client, with ID `1234567890123456789` and owner `0`. Its name is the instance name followed by ` Admin`. It exists only while the Admin client secret is set. [List applications](#list-applications) never returns it, and [transferring](#transfer-application-ownership) it fails with 403 `FORBIDDEN`.## List applications<RouteHeader method="GET" path="/v1/admin/applications" auditReason />-Returns the [Admin application](#admin-application-object) objects selected by exactly one of `owner_id` and `guild_id`. Requires `application:lookup` or `application:list:by_owner`.--The route returns the complete selection in one response. There is no cursor, no limit, and no name search.+Returns the applications an account owns, or the applications whose bot is a member of a guild. Send exactly one of the query parameters. `owner_id` needs `application:list:by_owner` and `guild_id` needs `application:lookup`.### Query parameters| Field | Type | Description || --- | --- | --- |-| owner_id?<sup>1</sup> <sup>2</sup> | snowflake | Select the applications owned by this account |-| guild_id?<sup>1</sup> <sup>3</sup> | snowflake | Select the applications whose bot account is a member of this guild |--<sup>1</sup> Supplying both fails with 400 `INVALID_FORM_BODY` reported against `guild_id`, and supplying neither fails against `owner_id`--<sup>2</sup> An `owner_id` naming no account fails with 404 `UNKNOWN_USER`--<sup>3</sup> A `guild_id` naming no guild fails with 404 `UNKNOWN_GUILD`--`owner_id` returns every application the account owns, with or without a bot. `guild_id` returns an application only while its own bot account is a member of that guild.+| owner_id? | snowflake | Select the applications this account owns |+| guild_id? | snowflake | Select the applications whose bot is a member of this guild |### Response body| Field | Type | Description || --- | --- | --- |-| applications<sup>1</sup> | array[[Admin application](#admin-application-object) object] | The selected applications |--<sup>1</sup> No order is guaranteed, and the array is empty when the account owns no application or the guild has no bot member+| applications | array[[Admin application](#admin-application-object) object] | The selected applications |### Response| Status | Body | Condition || --- | --- | --- || 200 | response body | The selected applications were returned |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER` when `owner_id` names no account, or `UNKNOWN_GUILD` when `guild_id` names no guild |--### Side effects+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER` or `UNKNOWN_GUILD` when the ID doesn't exist |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with a metadata key `application_count`. An `owner_id` request records action `list_user_applications`, target type `user`, and the owner as target ID. A `guild_id` request records action `list_guild_applications`, target type `guild`, and the guild as target ID. A failed request records nothing.+The Admin audit entry has the action `list_user_applications` or `list_guild_applications` and the metadata key `application_count`.-### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Get application<RouteHeader method="GET" path="/v1/admin/applications/{application_id}" auditReason />-Returns one [Admin application](#admin-application-object) object wrapped in a single-member object. Requires `application:lookup`.--Fluxer answers 200 with `application` set to null when the ID names no application.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| application_id | snowflake | The ID of the application |+Returns one application, or null when no application has this ID. You need `application:lookup`.### Response body| Field | Type | Description || --- | --- | --- |-| application<sup>1</sup> | ?[Admin application](#admin-application-object) object | The resolved application, or null when no application has this ID |--<sup>1</sup> Also null for the [built-in Admin application](#the-built-in-admin-application) on a deployment with no configured Admin client secret+| application | ?[Admin application](#admin-application-object) object | The application |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The lookup completed, whether or not it resolved an application |--### Side effects+| 200 | response body | The lookup completed |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `get_application`, target type `application`, the path `application_id` as target ID, and a metadata key `found`. `found` is `true` when `application` is an object and `false` when it is null. A returned application adds `owner_user_id`, and `bot_user_id` when the application has a bot.+The Admin audit entry has the action `get_application` and the metadata key `found`, plus `owner_user_id` and `bot_user_id` when the application has them.-### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Transfer application ownership<RouteHeader method="PATCH" path="/v1/admin/applications/{application_id}" auditReason />-Moves the application to another account and returns the stored [Admin application](#admin-application-object) object. Requires `application:transfer_ownership`.--Ownership is the only field this operation writes. The new owner can be any existing account, and Fluxer does not notify the previous owner.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| application_id | snowflake | The ID of the application |+Moves the application to another account and returns the updated [Admin application](#admin-application-object) object. You need `application:transfer_ownership`.### JSON body| Field | Type | Description || --- | --- | --- |-| new_owner_id<sup>1</sup> | snowflake | The account to transfer the application to |--<sup>1</sup> An unknown application fails with 404 `UNKNOWN_APPLICATION`, and an unknown replacement owner fails with 404 `UNKNOWN_USER`. Fluxer looks up the application first, so a request where both are unknown fails with `UNKNOWN_APPLICATION`+| new_owner_id | snowflake | The account to transfer the application to |### Response body| Field | Type | Description || --- | --- | --- |-| application | [Admin application](#admin-application-object) object | The application as stored after the transfer |+| application | [Admin application](#admin-application-object) object | The application after the transfer |### Response| Status | Body | Condition || --- | --- | --- || 200 | response body | Ownership was transferred |-| 403 | [error response](/admin-api/#error-response) | `FORBIDDEN` because the target is the [built-in Admin application](#the-built-in-admin-application) |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_APPLICATION` for the application, or `UNKNOWN_USER` for the replacement owner |--### Side effects--The transfer changes `owner_user_id`, increments `version`, and updates the results of [List applications](#list-applications) and [List user applications](/admin-api/users/#list-user-applications). It emits no Gateway Dispatch.--Fluxer records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with the target type `application`, the target ID equal to the application ID, and the action `transfer_ownership`. Its metadata is `old_owner_id` and `new_owner_id`. Neither owner is resolved into `related_users`.+| 403 | [error response](/admin-api/#error-response) | `FORBIDDEN` for the [built-in Admin application](#the-built-in-admin-application) |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_APPLICATION` or `UNKNOWN_USER` for the new owner |-### Rate limit+The Admin audit entry has the action `transfer_ownership` and the metadata keys `old_owner_id` and `new_owner_id`.-100 requests per minute for each authenticated user, on the `admin:guild:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:guild:modify` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/archives.mdx b/fluxer_docs/src/content/docs/admin-api/archives.mdxindex 307afb4ce..7cf3d9a43 100644--- a/fluxer_docs/src/content/docs/admin-api/archives.mdx+++ b/fluxer_docs/src/content/docs/admin-api/archives.mdx@@ -1,55 +1,37 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Archives-description: Administrative user and guild archive state, listing filters, and download grants.+description: Reading user and guild archives and getting download links for them.---import RouteHeader from '@/components/RouteHeader.astro';-An archive is a snapshot of one user account or one guild, built in the background and downloaded as a file. [Create user archive](/admin-api/users/#create-user-archive) and [Create guild archive](/admin-api/guilds/#create-guild-archive) request one. The operations here read archive state and issue time-limited download URLs.+An archive is a snapshot of one user account or one guild, built in the background. [Create user archive](/admin-api/users/#create-user-archive) and [Create guild archive](/admin-api/guilds/#create-guild-archive) start one, and the routes below look it up and give you a download link.-While Fluxer builds an archive, it leaves out any stored file that is missing from storage. Any other read or write failure fails that build attempt and sets `failed_at`.--Every operation needs an [ACL](/admin-api/#acl-evaluation) covering the subject type it touches.--- A user archive needs `archive:view_all` or `archive:trigger:user`.-- A guild archive needs `archive:view_all` or `archive:trigger:guild`.-- Reading both types at once needs `archive:view_all`, or `archive:trigger:user` and `archive:trigger:guild` together.--:::note[An expired archive stops being readable]-An archive becomes unavailable through these routes at `expires_at`, 365 days after it was requested. Its lifetime is never extended.-:::+The Admin API routes on this page need `archive:view_all`, or `archive:trigger:user` for user archives and `archive:trigger:guild` for guild archives. See [ACL evaluation](/admin-api/#acl-evaluation).## Archive object-An archive is in one of these lifecycle states. It is building while `completed_at` and `failed_at` are both null, complete once `completed_at` is set, and failed once `failed_at` is set. When Fluxer starts a new attempt at a failed archive, it clears `failed_at` and `error_message`, so the archive reads as building again while that attempt runs.+An archive is building while `completed_at` and `failed_at` are both null. It is complete once `completed_at` is set and failed once `failed_at` is set. A retry clears `failed_at` and `error_message`, so a failed archive can read as building again. An archive is deleted at `expires_at`, 365 days after it was requested.### Structure| Field | Type | Description || --- | --- | --- |-| archive_id | snowflake | The ID of the archive, used with its subject to address the record |-| subject_type | string | The [archive subject type](#archive-subject-types) the record is stored under |+| archive_id | snowflake | The ID of the archive |+| subject_type | string | The [archive subject type](#archive-subject-types) || subject_id | snowflake | The user or guild the archive was taken of |-| requested_by | snowflake | The Admin account that requested the archive |-| requested_at | ISO8601 timestamp | The time the archive record was created |-| started_at | ?ISO8601 timestamp | The time construction began, or null while the task has not started |-| completed_at | ?ISO8601 timestamp | The time construction completed, or null when it has not completed |-| failed_at | ?ISO8601 timestamp | The time construction failed, or null when it has not failed |-| file_size<sup>1</sup> | ?string | The size of the stored archive object in bytes, or null before completion |-| progress_percent<sup>2</sup> | number | The construction progress from 0 to 100 |-| progress_step<sup>2</sup> | ?string | The step the construction task last reported |-| error_message | ?string | The failure text the construction task reported, or null when it has not failed |-| download_url_expires_at<sup>3</sup> | ?ISO8601 timestamp | The cache expiry stamped on the stored archive object at completion, or null before completion |-| expires_at<sup>4</sup> | ?ISO8601 timestamp | The time the archive stops being readable |--<sup>1</sup> The size is a decimal string--<sup>2</sup> A new archive starts at 0 with the step `Queued`, and completion sets 100 and `Completed`. Failure leaves `progress_percent` where it was and sets the step to `Failed`--<sup>3</sup> Written at completion using the archive's fixed `expires_at`. [Create archive download](#create-archive-download) returns a URL with its own expiry--<sup>4</sup> The value is 365 days after `requested_at`+| requested_by | snowflake | The admin account that requested the archive |+| requested_at | ISO8601 timestamp | The time the archive was requested |+| started_at | ?ISO8601 timestamp | The time construction began |+| completed_at | ?ISO8601 timestamp | The time construction completed |+| failed_at | ?ISO8601 timestamp | The time construction failed |+| file_size | ?string | The size of the archive in bytes, as a decimal string |+| progress_percent | number | The construction progress from 0 to 100 |+| progress_step | ?string | The step the build last reported |+| error_message | ?string | The failure text, if the build failed |+| download_url_expires_at | ?ISO8601 timestamp | Set when the build completes, to the same time as `expires_at` |+| expires_at | ?ISO8601 timestamp | The time the archive is deleted |### Example@@ -77,18 +59,14 @@ An archive is in one of these lifecycle states. It is building while `completed_## Archive download object-This object uses camelCase field names, unlike every other Admin response body.+This object uses camelCase field names.### Structure| Field | Type | Description || --- | --- | --- |-| downloadUrl<sup>1</sup> | string | The time-limited URL the archive file is fetched from |-| expiresAt<sup>2</sup> | ISO8601 timestamp | The time this URL stops working |--<sup>1</sup> A presigned object storage link, or a [signed download](#download-signed-file) link on the API while presigned harvest downloads are disabled. Neither carries an Admin credential, so possession of it grants access until it expires--<sup>2</sup> The value is seven days after the grant was issued, regardless of the archive's own `expires_at`+| downloadUrl | string | The time-limited URL the archive file is fetched from |+| expiresAt | ISO8601 timestamp | The time the URL stops working, seven days after it was issued |### Example@@ -103,155 +81,93 @@ This object uses camelCase field names, unlike every other Admin response body.<RouteHeader method="GET" path="/v1/admin/archives" auditReason />-Returns [archive](#archive-object) objects matching the supplied filters, newest first. Requires an ACL covering the requested `subject_type`.+Returns [archive](#archive-object) objects, newest first, with no pagination. Use a narrower filter to find older archives. Without `requested_by`, the API narrows `all` to the subject types your ACLs cover. With it, you get that account's archives of both subject types, whatever `subject_type` says.### Query parameters| Field | Type | Description || --- | --- | --- |-| subject_type?<sup>1</sup> | string | `user`, `guild`, or `all` (default `all`) |-| subject_id?<sup>2</sup> | snowflake | The exact subject whose archives are returned |-| requested_by?<sup>3</sup> | snowflake | The Admin account that requested the returned archives |-| limit?<sup>4</sup> | integer | The maximum number of archives to return (1-200, default 50) |-| include_expired?<sup>5</sup> | boolean | Whether to include archives past their `expires_at` (default false) |--<sup>1</sup> `all` returns the newest `limit` archives across both subject types, so a busy subject type can crowd out the other--<sup>2</sup> `subject_type` also has to name `user` or `guild`--<sup>3</sup> Ignored when `subject_id` is supplied. When `requested_by` applies, Fluxer ignores `subject_type` and returns that account's archives of both subject types--<sup>4</sup> The listing is not paginated and returns no cursor. Only a narrower filter reaches older records--<sup>5</sup> The value counts as true only for `true`, `True`, or `1`. Excluding expired archives can leave fewer than `limit` results--:::note[The default filter narrows to the account's ACLs]-`all` is the default, and Fluxer resolves it to the subject types the account's ACLs cover. An account holding only `archive:trigger:user` reads user archives, one holding only `archive:trigger:guild` reads guild archives, and one holding `archive:view_all` reads both. An account holding none of the three is refused with 403 `MISSING_ACL`.-:::+| subject_type? | string | `user`, `guild` or `all` (default `all`) |+| subject_id? | snowflake | The subject whose archives are returned, with `subject_type` set to `user` or `guild` |+| requested_by? | snowflake | The admin account that requested the archives, ignored when `subject_id` is set |+| limit? | integer | The maximum number of archives to return (1-200, default 50) |+| include_expired? | boolean | Whether to include archives past their `expires_at` (default false) |### Response body| Field | Type | Description || --- | --- | --- |-| archives | array[[archive](#archive-object) object] | The archives matching the filters, newest first |+| archives | array[[archive](#archive-object) object] | The archives matching the filters |### Response| Status | Body | Condition || --- | --- | --- || 200 | response body | The archives were returned |-| 400 | [error response](/admin-api/#error-response) | `subject_id` is supplied while `subject_type` is `all`. `INVALID_FORM_BODY` has `INVALID_FORMAT` on `subject_type` |-| 403 | [error response](/admin-api/#error-response) | `MISSING_ACL` without an ACL covering the requested subject type |--### Side effects+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` when `subject_id` is set while `subject_type` is `all` |+| 403 | [error response](/admin-api/#error-response) | `MISSING_ACL` when you don't have an ACL for this subject type |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_archives`, target type `archive`, target ID `0`, and metadata keys `subject_type`, `limit`, `include_expired`, and `result_count`. `subject_type` is the value after Fluxer narrows `all` to the account's ACLs. The entry also has `subject_user_id` or `subject_guild_id` when `subject_id` is supplied, and `requested_by_user_id` when `requested_by` is supplied.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Get archive<RouteHeader method="GET" path="/v1/admin/archives/{subject_type}/{subject_id}/{archive_id}" auditReason />-Returns one [archive](#archive-object) object. Requires an ACL covering the subject type.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| subject_type | string | The [archive subject type](#archive-subject-types), either `user` or `guild` |-| subject_id | snowflake | The user or guild the archive was taken of |-| archive_id | snowflake | The ID of the archive |+Returns one [archive](#archive-object) object, or null `archive` when nothing matches or the archive has expired.### Response body| Field | Type | Description || --- | --- | --- |-| archive<sup>1</sup> | ?[archive](#archive-object) object | The archive, or null when the subject and identifier resolve to nothing |--<sup>1</sup> A missing archive answers 200 with a null archive, which is also the answer when the identifier belongs to a different subject and when the archive has passed `expires_at`+| archive | ?[archive](#archive-object) object | The archive, or null when it was not found |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | A lookup was done, whether or not it resolved |-| 403 | [error response](/admin-api/#error-response) | `MISSING_ACL` without an ACL covering the subject type |--### Side effects--The read issues no download grant.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `get_archive`, target type equal to `subject_type`, target ID equal to `subject_id`, and metadata keys `archive_id` and `found`. `found` is `false` when the response has a null archive.--### Rate limit+| 200 | response body | The lookup ran, whether or not it found the archive |+| 403 | [error response](/admin-api/#error-response) | `MISSING_ACL` when you don't have an ACL for this subject type |-200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.-## Create archive download+## Get archive download link<RouteHeader method="GET" path="/v1/admin/archives/{subject_type}/{subject_id}/{archive_id}/download" auditReason />-Issues a temporary download URL for a completed archive. Returns an [archive download](#archive-download-object) object on success. Requires an ACL covering the subject type.+Returns an [archive download](#archive-download-object) object for a completed archive. The URL points to [Download signed file](#download-signed-file) unless the instance uses presigned storage links.-:::caution[The grant is an unauthenticated bearer URL]-The URL has its own signature and works for seven days for anyone who holds it. It is bound to no Admin account, and no operation revokes it. Each repeat of the operation issues a further independent grant.+:::caution[The link needs no credentials]+Anyone with the URL can download the archive for seven days, and nothing revokes it.:::### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [archive download](#archive-download-object) object | The grant was issued |-| 400<sup>1</sup> | [error response](/admin-api/#error-response) | The archive is not downloadable, returned as `HARVEST_NOT_READY`, `HARVEST_FAILED`, or `HARVEST_EXPIRED` |-| 403 | [error response](/admin-api/#error-response) | `MISSING_ACL` without an ACL covering the subject type |-| 404<sup>2</sup> | [error response](/admin-api/#error-response) | The subject and identifier resolve to nothing, returned as `UNKNOWN_HARVEST` |--<sup>1</sup> `HARVEST_FAILED` while `failed_at` is set, `HARVEST_NOT_READY` while the archive has no completion time or no stored object, and `HARVEST_EXPIRED` once `expires_at` has passed, tested in that order--<sup>2</sup> The archive record stops being readable at `expires_at`, so an archive past its expiry answers `UNKNOWN_HARVEST`, not `HARVEST_EXPIRED`--### Side effects--The operation creates a download URL valid for seven days and changes no field of the archive, including `download_url_expires_at`. While presigned harvest downloads are disabled, which is the self-hosted default, the URL points at [Download signed file](#download-signed-file) on the public API endpoint instead of object storage.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `get_archive_download_url`, target type equal to `subject_type`, target ID equal to `subject_id`, and metadata key `archive_id`. The entry has no URL. A request that returns 400 or 404 records no entry.--### Rate limit+| 200 | [archive download](#archive-download-object) object | The link was issued |+| 400 | [error response](/admin-api/#error-response) | `HARVEST_NOT_READY`, `HARVEST_FAILED` or `HARVEST_EXPIRED` when the archive is not downloadable |+| 403 | [error response](/admin-api/#error-response) | `MISSING_ACL` when you don't have an ACL for this subject type |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_HARVEST` when nothing matches or the archive has expired |-200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Download signed file<RouteHeader method="GET" path="/v1/signed-downloads/{filename}" unauthenticated />-Streams an archive or a file kept with a report, from a link the Admin API issued in place of a presigned object storage link.--[Create archive download](#create-archive-download), and the attachment and profile image URLs of a [report](/admin-api/reports/), use this route while presigned harvest downloads are disabled. The `token` query parameter names the stored file and its expiry, and is signed by the instance. Use the complete issued URL and keep it secret.--:::note[Every rejection looks identical]-A missing, malformed, forged, or expired token and an object that no longer exists all return 404 with the plain text body `Not Found`. So does every request while the instance issues presigned URLs.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| filename | string | File name the download is saved as (1-512 characters) |+Streams an archive or a [report](/admin-api/reports/) file from a link the Admin API gave out. The `token` expires after seven days for an archive and five minutes for a report file. On an instance that uses presigned storage links, this route always returns 404.### Query parameters| Field | Type | Description || --- | --- | --- |-| token | string | Signed download token issued with the link (1-2,048 characters) |+| token | string | Signed download token from the link (1-2,048 characters) |### Request headers| Field | Type | Description || --- | --- | --- |-| Range? | string | Standard byte range, answered with 206 and a `Content-Range` header |+| Range? | string | A byte range to fetch part of the file |### Response@@ -259,17 +175,7 @@ A missing, malformed, forged, or expired token and an object that no longer exis| --- | --- | --- || 200 | file bytes | The complete file was streamed || 206 | file bytes | The requested byte range was streamed |-| 404 | `Not Found` | The token is missing, invalid, or expired, the file is gone, or the instance issues presigned URLs instead |-| 416 | `Range Not Satisfiable` | The requested range lies outside the file |--### Response headers--The 200 has the stored `Content-Type`, `Content-Disposition: attachment` with the file name from the path, `Content-Length`, `Accept-Ranges: bytes`, `Cache-Control: private, no-store`, `X-Content-Type-Options: nosniff`, and a sandboxing `Content-Security-Policy`. The 206 adds `Content-Range`.--### Side effects--The file is read and streamed. The token is not consumed, so it stays usable until its own expiry, which is seven days for an archive and five minutes for a report file.--### Rate limit+| 404 | `Not Found` | The token is missing, invalid or expired, or the file is gone |+| 416 | `Range Not Satisfiable` | The range lies outside the file |-60 requests per minute for each client IP address, or for the authenticated account when the request has a resolvable credential, on the `user:harvest:download_file` bucket.+The rate limit is 60 requests per minute, on the `user:harvest:download_file` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/blocklists.mdx b/fluxer_docs/src/content/docs/admin-api/blocklists.mdxindex 749b8347e..b95322708 100644--- a/fluxer_docs/src/content/docs/admin-api/blocklists.mdx+++ b/fluxer_docs/src/content/docs/admin-api/blocklists.mdx@@ -6,84 +6,46 @@ description: The safety blocklists, their value forms, and the operations that mimport RouteHeader from '@/components/RouteHeader.astro';-Fluxer has eight blocklists for account access and user content. Each defines its accepted values, matching rules and metadata. Fluxer normalises a value when it adds the value and again when it checks the value.--Each list has its own [Admin ACLs](/admin-api/#acl-registry). A read needs the selected list's `check` permission, an addition or an update needs its `add` permission, and a removal needs its `remove` permission. An account holding `ban:ip:add` writes to the `ip` list and to no other. Every operation records the audit reason on the [Admin audit entries](/admin-api/#admin-audit-entry-object) it produces, and each read produces one entry. An entry about one list has a target type built from the list name with each hyphen written as an underscore, so `url-domain` entries use `url_domain`.--Fluxer builds each permission name from `ban:`, the list name with each hyphen written as an underscore, and the verb, so the `url-domain` list uses `ban:url_domain:check`, `ban:url_domain:add`, and `ban:url_domain:remove`.+Fluxer has eight blocklists, and each one blocks one kind of value, such as an IP address, a link or a file hash. Each list has three [Admin ACLs](/admin-api/#acl-registry) in the form `ban:<list>:<verb>`, with hyphens in the list name written as underscores. For example, `url-domain` uses `ban:url_domain:check`. You need `check` to read a list, `add` to add or update entries and `remove` to remove them.## Blocklist types-`ip` and `email` gate account access and registration. `phrase`, `url`, `url-domain`, `file-sha`, `avatar-hash`, and `profile-substring` gate what an account may post, link, upload, or display. `email` stores nothing but the value. An `ip` row also stores a ban kind, a reason, an expiry, its creation time, and the enforcement decision it belongs to, if any. An `ip` row with an expiry stops applying when it expires, and Fluxer then deletes it.--## Network blocks from decisions--A permanent suspension or a closure for a broken rule can block networks the account used in the last 30 days, through `block_networks` on [Suspend user](/admin-api/users/#suspend-user) and [Schedule user deletion](/admin-api/users/#schedule-user-deletion). Each such `ip` row belongs to that [enforcement decision](/admin-api/enforcement/) and expires after 90 days unless the request set another length. These rows are only ever created by a decision:--- Adding or removing the address through this resource returns 409 `IP_BAN_LINKED_TO_DECISION` with the `decision_id`.-- A plain write, including a temporary block from Fluxer's own abuse defences, never replaces a decision's row.-- A plain row with an expiry becomes the decision's row and keeps the later of the two expiries. A permanent plain row or another decision's row is left as it is, and the request reports the address in `skipped_ips` as `already_blocked`.-- Ending the decision removes its rows. So does executing the account's deletion, for the rows of every decision on that account.--Ending a decision removes its rows even if a plain block existed before the decision took the row over. Add the plain block again if it is still wanted.+Fluxer normalizes each value when you add or check it and stores the normalized form. The `url`, `url-domain`, `file-sha` and `avatar-hash` lists are content blocklists, and each of their entries has a category and a severity.| Value | Description || --- | --- |-| ip<sup>1</sup> | IPv4 addresses, IPv6 addresses, and CIDR ranges denied service |-| email<sup>2</sup> | Exact email addresses blocked from registration and from being set on an account |-| phrase<sup>3</sup> | Phrases blocked from content |-| url<sup>4</sup> | Absolute `http` and `https` URLs blocked from being posted |-| url-domain<sup>5</sup> | Domains blocked from being linked |-| file-sha<sup>6</sup> | SHA-256 hashes blocked from being uploaded |-| avatar-hash<sup>7</sup> | Avatar hashes blocked from being set |-| profile-substring<sup>3</sup> <sup>8</sup> | Substrings blocked from one named profile field |--<sup>1</sup> Fluxer refuses an address with 400 `IP_BAN_DECLINED` when it is on the instance exemption list, and records the refusal in the Admin audit log--<sup>2</sup> Stored lowercased, so a mixed-case value does not create a second row+| ip | IPv4 addresses, IPv6 addresses and CIDR ranges denied service |+| email | Email addresses, or `@example.com` for a domain and its subdomains, that can't be used to sign up or be set on an account |+| phrase<sup>1</sup> | Phrases blocked from content |+| url | Absolute `http` and `https` URLs blocked from being posted |+| url-domain | Domains or [domain patterns](#domain-patterns) blocked from being linked |+| file-sha | SHA-256 hashes of files blocked from upload |+| avatar-hash | 8-character avatar hashes blocked from being set, with any `a_` prefix stripped |+| profile-substring<sup>1</sup> | Substrings blocked from one [profile field](#profile-substring-scopes) |-<sup>3</sup> Canonicalised by NFKC normalisation, removal of control, format and variation-selector characters, lowercasing, and trimming. When Fluxer matches a value, it also normalises inserted whitespace, punctuation, and compatibility characters+<sup>1</sup> Matching ignores case, Unicode look-alike forms, and whitespace, punctuation or invisible characters placed between letters-<sup>4</sup> Canonicalised before storage. A value Fluxer cannot canonicalise returns 400 `INVALID_FORM_BODY` naming `url`--<sup>5</sup> Stored lowercased, in ASCII form, and without a trailing dot. A row matches that hostname, and with `match_subdomains` true it also matches every subdomain. A value whose leftmost label has `*` is a [domain pattern](#domain-patterns)--<sup>6</sup> Stored as lowercase hexadecimal+## Network blocks from decisions-<sup>7</sup> Stored as the 8-character hash with any `a_` animation prefix stripped and the rest lowercased, so the animated and static forms of one avatar are the same row+A permanent suspension or an account deletion for a rule violation can block the addresses the account used in the last 30 days, through `block_networks` on [Suspend user](/admin-api/users/#suspend-user) and [Schedule user deletion](/admin-api/users/#schedule-user-deletion). Those `ip` entries belong to the [enforcement decision](/admin-api/enforcement/) and expire after 90 days unless the request sets another length.-<sup>8</sup> The only scoped list. Scope and substring together identify a row, so the same substring can be stored once per [scope](#profile-substring-scopes)+A decision takes over a plain entry that has an expiry and keeps the later of the two expiries, so ending the decision also removes that block. Add it again if you still want it. A permanent plain entry or another decision's entry is left as it is, and the request lists the address in `skipped_ips` as `already_blocked`.-The fields and the operations a list accepts differ from list to list. Read the `fields` array and the `supports_` flags of a [blocklist object](#blocklist-object) before writing to a list.+Ending the decision or executing the account's deletion removes its entries.## Domain patterns-A `url-domain` value whose leftmost label has `*` is a pattern. Each `*` stands for any run of characters inside that one label, so `*shop*.example.com` matches `shop.example.com` and `my-shop-2.example.com`. The rest of the value is a literal domain, called the suffix.+A `url-domain` value whose leftmost label has `*` is a pattern. Each `*` matches any run of characters in that one label. For example `*shop*.example.com` matches `shop.example.com` and `my-shop-2.example.com` but not `example.com`. With `match_subdomains` true, a pattern or plain domain also matches every subdomain.-A pattern only matches the label directly left of its suffix. It never matches the suffix itself, so `*shop*.example.com` does not block `example.com`. With `match_subdomains` true, the pattern also matches every subdomain of a matching host, such as `www.shop.example.com`. Blocking a whole suffix takes a plain domain row.--Fluxer refuses a pattern with 400 `INVALID_FORM_BODY` naming `domain` when:--- `*` appears outside the leftmost label-- the leftmost label has characters other than `a-z`, `0-9`, `-`, and `*`-- the leftmost label has more than 3 `*` or fewer than 3 other characters-- the suffix is not a valid domain or is a public suffix such as `com` or `co.uk`--A domain under a shared hosting suffix, such as `onrender.com` or `github.io`, is a valid suffix. Fluxer folds a run of `*` into one before it stores the pattern.--Fluxer matches a pattern against the ASCII form of a hostname. An internationalised label is compared in its punycode form, so a pattern with a leading or trailing literal can miss it, while `*shop*` still matches it.--## Link matching--Fluxer checks every link in user content against the `url` and `url-domain` lists. This covers bare links, autolinks in angle brackets, the target of a masked link, and the link URLs of rich embeds. Fluxer reads the hostname of each link the way a browser does. It ignores user information and the port, lowercases the hostname, converts it to ASCII, decodes percent escapes, and drops trailing dots.+Fluxer refuses a pattern with 400 `INVALID_FORM_BODY` when `*` is outside the leftmost label, when that label has characters other than `a-z`, `0-9`, `-` and `*`, or when it has more than 3 `*` or fewer than 3 other characters. It also refuses a pattern when the part after the leftmost label isn't a valid domain or is a public suffix such as `com` or `co.uk`.## Content blocklist categories-Every `url`, `url-domain`, `file-sha`, and `avatar-hash` row has a category naming where it came from. A row created through this resource without an explicit category is stored as `manual`.+A category says where an entry came from. The values below are the ones Fluxer uses, but `category` accepts any string.| Value | Description || --- | --- |-| manual | Added by an Admin through this resource |+| manual | Added by an Admin || urlhaus | Imported from URLhaus || phishtank | Imported from PhishTank || google_safe_browsing | Imported from Google Safe Browsing |@@ -92,118 +54,67 @@ Every `url`, `url-domain`, `file-sha`, and `avatar-hash` row has a category nami| gifct | Imported from a GIFCT hash set || stop_ncii | Imported from a StopNCII hash set |-With blocklist feeds off, Fluxer ignores and removes every `file-sha` row in the `malware_bazaar` category that no Admin added.--The request field is a free string of 1 through 64 characters, so a value outside this registry is accepted and stored verbatim. Tolerate a stored category outside the registry.-## Content blocklist severities-Every `url`, `url-domain`, `file-sha`, and `avatar-hash` row has a severity. A row created without an explicit severity is stored as `2`.--The severity is a stored label for moderators. Fluxer refuses the content of every matching row whatever its severity, so a row stored as `0` or `1` blocks exactly like one stored as `2`. Delete a row to stop it blocking.+Severity is only a label for moderators, and Fluxer blocks every matching entry, even one with severity 0.| Value | Name | Description || --- | --- | --- |-| 0 | ALLOW | Labelled as content to allow |-| 1 | WARN | Labelled as content to warn about |-| 2 | BLOCK | Labelled as content to refuse |-| 3 | BLOCK_AND_REPORT | Labelled as content to refuse and report |+| 0 | ALLOW | Content to allow |+| 1 | WARN | Content to warn about |+| 2 | BLOCK | Content to refuse |+| 3 | BLOCK_AND_REPORT | Content to refuse and report |## Profile substring scopes| Value | Description || --- | --- |-| username | Match the substring against the account username |-| global_name | Match the substring against the account display name |-| nickname | Match the substring against a guild nickname |-| bio | Match the substring against the profile biography |-| pronouns | Match the substring against the profile pronouns |+| username | The account username |+| global_name | The account display name |+| nickname | A guild nickname |+| bio | The profile bio |+| pronouns | The profile pronouns |## Blocklist object-One entry of the blocklist catalogue returned by [List blocklists](#list-blocklists). The catalogue is fixed in each release and reports no counts.+Describes one blocklist and the fields it accepts, and [List blocklists](#list-blocklists) returns one for each list. Check `fields` and the `supports_` flags before you write to a list.### Structure| Field | Type | Description || --- | --- | --- |-| list_type | string | The [blocklist type](#blocklist-types) this entry describes |-| description | string | The human-readable summary of what the blocklist matches and how |-| value_field<sup>1</sup> | string | The request body field that has the value when adding |-| fields<sup>2</sup> | array[string] | The field names rows of this blocklist accept beyond the value (at most 8) |-| scoped<sup>3</sup> | boolean | Whether rows are scoped to a profile field and every operation has a scope |-| supports_bulk_create<sup>4</sup> | boolean | Whether [Bulk add blocklist entries](#bulk-add-blocklist-entries) is accepted |-| supports_bulk_delete<sup>5</sup> | boolean | Whether [Bulk remove blocklist entries](#bulk-remove-blocklist-entries) is accepted |-| supports_update<sup>6</sup> | boolean | Whether [Update blocklist entry](#update-blocklist-entry) is accepted |--<sup>1</sup> `ip` names `ip`, `email` names `email`, `url-domain` names `domain`, `phrase` names `phrase`, `url` names `url`, `file-sha` names `sha256_hex`, `avatar-hash` names `hashes`, and `profile-substring` names `substrings`--<sup>2</sup> `ip` names `duration_hours`. Empty for `email` and `phrase`. `url` names `category`, `severity`, `source_url`, and `notes`. `url-domain` adds `match_subdomains`, `file-sha` adds `content_type`, and `avatar-hash` adds `reason`. `profile-substring` names `scope`, `reason`, and `notes`--<sup>3</sup> True only for `profile-substring`--<sup>4</sup> True only for `file-sha`--<sup>5</sup> True only for `avatar-hash` and `profile-substring`--<sup>6</sup> True for `url`, `url-domain`, `file-sha`, `avatar-hash`, and `profile-substring`--### Example--```json-{- "list_type": "url-domain",- "description": "Domains blocked from being linked, optionally covering every subdomain rooted at the domain. A value whose leftmost label contains * is a pattern that matches that one label under a registrable domain.",- "value_field": "domain",- "fields": ["match_subdomains", "category", "severity", "source_url", "notes"],- "scoped": false,- "supports_bulk_create": false,- "supports_bulk_delete": false,- "supports_update": true-}-```+| list_type | string | The [blocklist type](#blocklist-types) |+| description | string | A summary of what the list matches |+| value_field | string | The body field that has the value when adding |+| fields | array[string] | The other body fields the list accepts |+| scoped | boolean | Whether every operation needs a `scope`, which is true only for `profile-substring` |+| supports_bulk_create | boolean | Whether [Bulk add blocklist entries](#bulk-add-blocklist-entries) works on the list |+| supports_bulk_delete | boolean | Whether [Bulk remove blocklist entries](#bulk-remove-blocklist-entries) works on the list |+| supports_update | boolean | Whether [Update blocklist entry](#update-blocklist-entry) works on the list |## Blocklist entry object-One stored row of one blocklist. Every field is present on every entry, and a field the row's blocklist does not store is null.+An entry stored in a blocklist. Every field is present, and a field the list doesn't use is null.### Structure| Field | Type | Description || --- | --- | --- |-| list_type | string | The [blocklist type](#blocklist-types) the row belongs to |-| value<sup>1</sup> | string | The canonical stored value (1-2048 characters) |-| scope<sup>2</sup> | ?string | The [profile substring scope](#profile-substring-scopes) the row is stored under |-| category<sup>3</sup> | ?string | The [content blocklist category](#content-blocklist-categories) the row was recorded under |-| severity<sup>3</sup> | ?integer | The [content blocklist severity](#content-blocklist-severities) label stored on the row |-| source_url<sup>3</sup> | ?string | The feed or evidence URL the row was recorded from |-| notes<sup>4</sup> | ?string | The internal note stored alongside the row |-| content_type<sup>5</sup> | ?string | The media type hint recorded alongside a `file-sha` row |-| match_subdomains<sup>6</sup> | ?boolean | Whether a `url-domain` row also covers subdomains |-| reason<sup>7</sup> | ?string | The reason stored on the row |-| expires_at<sup>7</sup> | ?ISO8601 timestamp | When the row expires |-| created_at<sup>8</sup> | ?ISO8601 timestamp | When the row was added |-| created_by_user_id<sup>8</sup> | ?snowflake | The Admin account that added the row, or null when unknown |--<sup>1</sup> The exact string the single-entry operations and the `after` cursor accept for that row--<sup>2</sup> Non-null only on `profile-substring`--<sup>3</sup> Non-null only on `url`, `url-domain`, `file-sha`, and `avatar-hash`, where `category` and `severity` are always set--<sup>4</sup> Non-null only on `url`, `url-domain`, `file-sha`, `avatar-hash`, and `profile-substring`--<sup>5</sup> Non-null only on `file-sha`--<sup>6</sup> Non-null only on `url-domain`--<sup>7</sup> Non-null only on `ip`. An address added through [Add blocklist entry](#add-blocklist-entry) reads back with the reason `platform_admin_enforcement`. Its `expires_at` is null unless it was added with a positive `duration_hours`. A row a decision created reads back with the reason `enforcement_decision` and always has an `expires_at`. A row past its `expires_at` is not listed--<sup>8</sup> Both null on `email` and `phrase`, which store nothing but the value. `created_by_user_id` is also null on `ip`--:::note[The audit entry records the accepted reason]-An `avatar-hash` or `profile-substring` write accepts `reason`, and both lists then report `reason` as null in this object.-:::+| list_type | string | The [blocklist type](#blocklist-types) |+| value | string | The normalized value, to send as `entry_value` or `after` (1-2048 characters) |+| scope | ?string | The [profile substring scope](#profile-substring-scopes) |+| category | ?string | The [content blocklist category](#content-blocklist-categories) |+| severity | ?integer | The [content blocklist severity](#content-blocklist-severities) |+| source_url | ?string | The feed or evidence URL |+| notes | ?string | The internal note |+| content_type | ?string | The media type hint of a `file-sha` entry |+| match_subdomains | ?boolean | Whether a `url-domain` entry also covers subdomains |+| reason<sup>1</sup> | ?string | The reason stored on an `ip` entry |+| expires_at | ?ISO8601 timestamp | When an `ip` entry expires |+| created_at | ?ISO8601 timestamp | When the entry was added |+| created_by_user_id | ?snowflake | The Admin who added the entry |++<sup>1</sup> `platform_admin_enforcement` for an entry added through these routes, or `enforcement_decision` for one an enforcement decision added### Example@@ -227,511 +138,273 @@ An `avatar-hash` or `profile-substring` write accepts `reason`, and both lists t## Blocklist check object-The decision [Check blocklist entry](#check-blocklist-entry) returns for one value.+What [Check blocklist entry](#check-blocklist-entry) returns for one value.### Structure| Field | Type | Description || --- | --- | --- |-| banned<sup>1</sup> | boolean | Whether the value is currently blocked by the named blocklist |-| expires_at<sup>2</sup> | ?ISO8601 timestamp | When the matching ban expires |-| decision_id<sup>3</sup> | ?snowflake | The [enforcement decision](/admin-api/enforcement/) the matching block belongs to |--<sup>1</sup> Reports the decision the enforcement path would make for this value--<sup>2</sup> Non-null only on `ip` when the matching ban has an expiry. Null when the ban is permanent, when nothing matches, and on every other blocklist--<sup>3</sup> Non-null only on `ip` when the matching block belongs to a decision. Read from the same cache the enforcement path uses, so a block written in the last few moments on another node can read as null--:::note[A block and a row are different things]-A value can be blocked with no row of its own, as a single address covered by a stored CIDR range is. A row can exist while the value reads as not blocked, as an exempt address or an exempt email domain does.-:::+| banned | boolean | Whether the list blocks the value |+| expires_at | ?ISO8601 timestamp | When the matching `ip` block expires, or null when it is permanent |+| decision_id | ?snowflake | The [enforcement decision](/admin-api/enforcement/) the matching `ip` block belongs to |## Blocklist entry creation object-The body of [Add blocklist entry](#add-blocklist-entry) has one shape per blocklist, and the `list_type` path segment selects the shape. The field that has the value differs per blocklist, and two of the nine take an array, so one request can add up to 1000 avatar hashes or profile substrings.+The body of [Add blocklist entry](#add-blocklist-entry) has the value field for its `list_type` and any additional fields that list accepts.### Value field| Blocklist | Field | Accepted value || --- | --- | --- |-| ip | ip | IPv4 address, IPv6 address, or CIDR range of 1 through 45 characters |-| email | email | Email address of 1 through 254 characters |-| phrase | phrase | Phrase of 1 through 500 characters |-| url | url | Absolute `http` or `https` URL of 1 through 2048 characters |-| url-domain | domain | Domain or [domain pattern](#domain-patterns) of 1 through 253 characters |+| ip | ip | IPv4 address, IPv6 address or CIDR range (1-45 characters) |+| email | email | Email address or `@domain` (1-254 characters) |+| phrase | phrase | Phrase (1-500 characters) |+| url | url | Absolute `http` or `https` URL (1-2048 characters) |+| url-domain | domain | Domain or [domain pattern](#domain-patterns) (1-253 characters) || file-sha | sha256_hex | Exactly 64 hexadecimal characters |-| avatar-hash<sup>1</sup> | hashes | 1 through 1000 hashes, each 8 through 10 characters matching `^(a_)?[0-9a-fA-F]{8}$` |-| profile-substring<sup>1</sup> <sup>2</sup> | substrings | 1 through 1000 substrings, each 1 through 500 characters |--<sup>1</sup> Each value is canonicalised and written as its own row with its own Admin audit entry--<sup>2</sup> `scope` is required in the same body--Each field is a string, except `hashes` and `substrings`, which are `array[string]`.--`avatar-hash` deduplicates the array after canonicalisation. `profile-substring` does not, so a substring repeated in one request is written once and audited once per occurrence. A `profile-substring` value that canonicalises to an empty string is skipped.+| avatar-hash | hashes | Array of hashes matching `^(a_)?[0-9a-fA-F]{8}$` (1-1000 items) |+| profile-substring | substrings | Array of substrings (1-1000 items of 1-500 characters) |### Additional fields| Field | Type | Description || --- | --- | --- |-| scope?<sup>3</sup> | string | The [profile substring scope](#profile-substring-scopes) to store the rows under |-| category?<sup>4</sup> | string | The [content blocklist category](#content-blocklist-categories) (1-64 characters, default `manual`) |-| severity?<sup>4</sup> | integer | The [content blocklist severity](#content-blocklist-severities) (0-3, default 2) |-| match_subdomains?<sup>5</sup> | boolean | Whether the row also covers subdomains (default true) |-| content_type?<sup>6</sup> | string | The media type hint (1-128 characters) |-| source_url?<sup>4</sup> | string | The feed or evidence URL (1-2048 characters) |-| reason?<sup>7</sup> | string | The reason (1-1024 characters) |-| notes?<sup>8</sup> | string | The internal note (1-1024 characters) |-| duration_hours?<sup>9</sup> | integer | Hours until the row expires (0-8760, default 0) |--<sup>3</sup> Required by `profile-substring`. Every other blocklist strips `scope`--<sup>4</sup> Accepted only by `url`, `url-domain`, `file-sha`, and `avatar-hash`--<sup>5</sup> Accepted only by `url-domain`--<sup>6</sup> Accepted only by `file-sha`--<sup>7</sup> Accepted only by `avatar-hash` and `profile-substring`, and recorded in the audit entry metadata+| scope?<sup>1</sup> | string | The [profile substring scope](#profile-substring-scopes) |+| category?<sup>2</sup> | string | The [content blocklist category](#content-blocklist-categories) (1-64 characters, default `manual`) |+| severity?<sup>2</sup> | integer | The [content blocklist severity](#content-blocklist-severities) (0-3, default 2) |+| match_subdomains? | boolean | Whether a `url-domain` entry also covers subdomains (default true) |+| content_type? | string | The media type hint of a `file-sha` entry (1-128 characters) |+| source_url?<sup>2</sup> | string | The feed or evidence URL (1-2048 characters) |+| reason? | string | The reason for `avatar-hash` and `profile-substring`, kept in the audit entry (1-1024 characters) |+| notes? | string | The internal note, for every list but `ip`, `email` and `phrase` (1-1024 characters) |+| duration_hours? | integer | Hours until an `ip` entry expires, with `0` for permanent (0-8760, default 0) |-<sup>8</sup> Accepted only by `url`, `url-domain`, `file-sha`, `avatar-hash`, and `profile-substring`+<sup>1</sup> Required for `profile-substring`-<sup>9</sup> Accepted only by `ip`. `0` writes a permanent row. A positive value writes a row that stops applying after that many hours, and Fluxer then deletes it. Adding an address again replaces its expiry, so a permanent row can become temporary and a temporary row can become permanent+<sup>2</sup> Only for content blocklists## List blocklists<RouteHeader method="GET" path="/v1/admin/blocklists" auditReason />-Returns one [blocklist](#blocklist-object) object for every blocklist this instance keeps. Requires any one of the `check` permissions.--The response is identical for every Admin.+Returns a [blocklist object](#blocklist-object) for each blocklist. You need the `check` permission for at least one list.### Response body| Field | Type | Description || --- | --- | --- |-| items<sup>1</sup> | array[[blocklist](#blocklist-object) object] | Every blocklist exposed by this instance |--<sup>1</sup> Always the complete catalogue in one response. There is no cursor, no `has_more`, and no `next_after`+| items | array[[blocklist](#blocklist-object) object] | All eight blocklists |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Catalogue was returned |--### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_blocklists`, target type `blocklist`, target ID `0`, and metadata key `result_count`.--### Rate limit+| 200 | response body | The catalog was returned |-60 requests per minute for each authenticated user, on the `admin:ban:operation` bucket.+The rate limit is 60 requests per minute, on the `admin:ban:operation` bucket.## List blocklist entries<RouteHeader method="GET" path="/v1/admin/blocklists/{list_type}/entries" auditReason />-Returns a value-ordered cursor page of [blocklist entry](#blocklist-entry-object) objects. Requires the selected list's `check` permission.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| list_type | string | The [blocklist type](#blocklist-types) |+Returns a page of [blocklist entry objects](#blocklist-entry-object) ordered by value. You need the list's `check` permission.### Query parameters| Field | Type | Description || --- | --- | --- || limit? | integer | Maximum entries to return (1-200, default 50) |-| after?<sup>1</sup> | string | Return entries ordered strictly after this value (1-2048 characters) |-| scope?<sup>2</sup> | string | The [profile substring scope](#profile-substring-scopes) to list |--<sup>1</sup> Compared as a string against the canonical stored value. Fluxer does not validate it against the selected blocklist, so an impossible cursor returns no entries+| after? | string | Return entries after this value (1-2048 characters) |+| scope?<sup>1</sup> | string | The [profile substring scope](#profile-substring-scopes) to list |-<sup>2</sup> Required by `profile-substring` and rejected by every other blocklist+<sup>1</sup> Required for `profile-substring` and refused with 400 `INVALID_FORM_BODY` on every other list### Response body| Field | Type | Description || --- | --- | --- |-| items | array[[blocklist entry](#blocklist-entry-object) object] | Entries in this page, ordered by value ascending |-| has_more | boolean | Whether another page can be fetched with `next_after` |-| next_after<sup>3</sup> | ?string | The stored entry value to send as `after`, or null on the last page |--<sup>3</sup> A value cursor, so it is sent back verbatim as `after`+| items | array[[blocklist entry](#blocklist-entry-object) object] | The entries in this page |+| has_more | boolean | Whether another page exists |+| next_after | ?string | The value to send as `after` for the next page, or null on the last page |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Entry page was returned |-| 400 | [error response](/admin-api/#error-response) | `scope` is supplied on an unscoped blocklist or omitted on `profile-substring`, and the request returns `INVALID_FORM_BODY` |--The cost of a page does not fall as the cursor advances, so walk a large list with the largest `limit` the operation accepts.--### Side effects+| 200 | response body | The page was returned |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_blocklist_entries`, the target type of the selected list, target ID `0`, and metadata keys `list_type`, `limit`, `result_count` for the entries in this page, and `has_more`. `profile-substring` adds `scope`, and a supplied `after` adds `has_after`. The cursor value and the entry values are not recorded. A 400 records nothing.--### Rate limit--60 requests per minute for each authenticated user, on the `admin:ban:operation` bucket.+The rate limit is 60 requests per minute, on the `admin:ban:operation` bucket.## Add blocklist entry<RouteHeader method="POST" path="/v1/admin/blocklists/{list_type}/entries" auditReason />-Canonicalises the submitted value or values and writes them to the selected blocklist. Returns 204 with an empty body. Requires the selected list's `add` permission.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| list_type | string | The [blocklist type](#blocklist-types) |+Adds a value to the list, or up to 1000 values for `avatar-hash` and `profile-substring`. You need the list's `add` permission.### JSON body-The body is one [blocklist entry creation object](#blocklist-entry-creation-object). `list_type` selects the shape, so a body valid for one blocklist fails validation on another.+The body is one [blocklist entry creation object](#blocklist-entry-creation-object).-:::caution[Adding a row overwrites the existing row]-Every write is an upsert on the canonical value. An omitted optional field is written as its default, so re-adding a `url` without a `category` resets that row to `manual`. The previous values are not recoverable.+:::caution[Adding an entry overwrites the existing entry]+Adding a value that is already stored replaces its entry, and every optional field you leave out goes back to its default.:::### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Values were written |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` because the value is not valid for the list, or a field the blocklist does not accept was supplied |-| 409 | [error response](/admin-api/#error-response) | `IP_BAN_LINKED_TO_DECISION` with `decision_id`, because the address is blocked by an enforcement decision |--A body field the selected blocklist does not accept is stripped and never produces that 400. A `url` Fluxer cannot canonicalise returns 400 `INVALID_FORM_BODY` naming `url` in the `errors` array. A `url-domain` value that is not a valid domain or [domain pattern](#domain-patterns) returns the same 400 naming `domain`.--Fluxer refuses to add an `ip` with 400 `IP_BAN_DECLINED` when the address is on the instance exemption list.--The response has no body, so it does not report the canonical form that was stored. Read it back with [List blocklist entries](#list-blocklist-entries).--### Side effects--Fluxer checks later requests against the written rows. For every list except `email`, other nodes see the rows after a short propagation delay. No Gateway Dispatch is emitted.--Fluxer records one [Admin audit entry](/admin-api/#admin-audit-entry-object) per written value, with that value in its metadata. An `ip` added with a positive `duration_hours` adds the metadata keys `duration_hours` and `expires_at`. A `url-domain` entry also records `match_subdomains` and `pattern`, which is `true` for a [domain pattern](#domain-patterns). Fluxer records an entry for a refused `ip` too, under the action `ban_ip_skipped_exempt`, before it returns the 400.--### Rate limit+| 204 | empty | The values were written |+| 400 | [error response](/admin-api/#error-response) | `IP_BAN_DECLINED` when the address is on the instance exemption list |+| 409 | [error response](/admin-api/#error-response) | `IP_BAN_LINKED_TO_DECISION` with `decision_id` when the address belongs to an enforcement decision |-60 requests per minute for each authenticated user, on the `admin:ban:operation` bucket.+The rate limit is 60 requests per minute, on the `admin:ban:operation` bucket.## Bulk add blocklist entries<RouteHeader method="PUT" path="/v1/admin/blocklists/{list_type}/entries" auditReason />-Queues a background job that adds up to 10000 SHA-256 hashes to the `file-sha` blocklist and returns the job ID immediately. Requires `ban:file_sha:add`.--Only `file-sha` accepts this operation, reported as `supports_bulk_create` by [List blocklists](#list-blocklists). Every other list type returns 400 `INVALID_FORM_BODY`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| list_type | string | The [blocklist type](#blocklist-types), which is `file-sha` here |+Starts a background job that adds up to 10000 hashes to the `file-sha` list with category `manual` and severity 2, and returns its ID for [Get job](/admin-api/jobs/#get-job). You need `ban:file_sha:add`. Every other list returns 400 `INVALID_FORM_BODY`.### JSON body| Field | Type | Description || --- | --- | --- |-| sha256_list<sup>1</sup> | array[string] | The SHA-256 hashes to add (1-10000 items of exactly 64 characters) |--<sup>1</sup> The body enforces the length of each item. The job checks the alphabet and records a non-hexadecimal item as an `invalid_sha256` failure+| sha256_list | array[string] | The SHA-256 hashes to add (1-10000 items of exactly 64 characters) |### Response body| Field | Type | Description || --- | --- | --- |-| job_id | snowflake | The background job applying the hashes |+| job_id | snowflake | The ID of the job |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Job was queued |-| 400 | [error response](/admin-api/#error-response) | The list type is not `file-sha` and the request returns `INVALID_FORM_BODY` |--The operation returns before any hash is written. Read progress and the final counts from [Get job](/admin-api/jobs/#get-job), and stop the job with [Cancel job](/admin-api/jobs/#cancel-job). The job reports progress every 50 hashes and finishes with a summary naming how many were written and how many failed.--Every hash is written with the category `manual`, the severity `2`, and a null content type, source URL, and note. The bulk path accepts no metadata, so a hash that needs any of those goes through [Add blocklist entry](#add-blocklist-entry) or a later [Update blocklist entry](#update-blocklist-entry).--### Side effects--Each hash is lowercased and replaces any existing entry. Changes become visible across the instance when the job stops, whether it ran to the end or was cancelled, so a cancelled job still enforces the hashes it already wrote. No Gateway Dispatch is emitted.--The request records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `queue_bulk_job`, target type `bulk_job`, the job ID as target ID, and metadata keys `task` and `entity_count`. `task` is `ban_file_shas`, and `entity_count` is the number of submitted hashes.--The job records one [Admin audit entry](/admin-api/#admin-audit-entry-object) per written hash under the action `ban_file_sha`, with that hash in its metadata, exactly as [Add blocklist entry](#add-blocklist-entry) does. It then records one aggregate entry under the action `bulk_ban_file_shas`, with the submitted, processed, successful, and failed counts. A cancelled job records the entries for the hashes it wrote and an aggregate entry marked `cancelled`.+| 200 | response body | The job was queued |-### Rate limit--60 requests per minute for each authenticated user, on the `admin:ban:operation` bucket.+The rate limit is 60 requests per minute, on the `admin:ban:operation` bucket.## Bulk remove blocklist entries<RouteHeader method="DELETE" path="/v1/admin/blocklists/{list_type}/entries" auditReason />-Canonicalises up to 1000 values and removes their rows from the selected blocklist. Returns 204 with an empty body. Requires the selected list's `remove` permission.--Only `avatar-hash` and `profile-substring` accept this operation, reported as `supports_bulk_delete` by [List blocklists](#list-blocklists). Every other list type returns 400 `INVALID_FORM_BODY`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| list_type | string | The [blocklist type](#blocklist-types), which is `avatar-hash` or `profile-substring` here |+Removes up to 1000 values from the `avatar-hash` or `profile-substring` list. You need the list's `remove` permission. Every other list returns 400 `INVALID_FORM_BODY`.### JSON body-The body is selected by `list_type`.-| Field | Type | Description || --- | --- | --- |-| hashes?<sup>1</sup> | array[string] | Avatar hashes to remove (1-1000 items of 8 through 10 characters matching `^(a_)?[0-9a-fA-F]{8}$`) |-| scope?<sup>2</sup> | string | The [profile substring scope](#profile-substring-scopes) the substrings are stored under |-| substrings?<sup>2</sup> | array[string] | Substrings to remove (1-1000 items of 1 through 500 characters) |-| reason?<sup>3</sup> | string | Accepted and ignored |-| notes?<sup>3</sup> | string | Accepted and ignored |--<sup>1</sup> `avatar-hash` only, where it is required and is the whole body+| hashes?<sup>1</sup> | array[string] | Avatar hashes to remove (1-1000 items matching `^(a_)?[0-9a-fA-F]{8}$`) |+| scope?<sup>2</sup> | string | The [profile substring scope](#profile-substring-scopes) |+| substrings?<sup>2</sup> | array[string] | Substrings to remove (1-1000 items of 1-500 characters) |+| reason? | string | Ignored |+| notes? | string | Ignored |-<sup>2</sup> `profile-substring` only, where both are required+<sup>1</sup> Required for `avatar-hash`-<sup>3</sup> `profile-substring` only. Fluxer records neither in the audit entry+<sup>2</sup> Required for `profile-substring`### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Values were processed |-| 400 | [error response](/admin-api/#error-response) | The list accepts no bulk removal, or the body fails validation, and the request returns `INVALID_FORM_BODY` |--The operation is idempotent and reports no counts. A value with no stored row still returns 204. Read the list before and after to tell a removal from a no-op.--`avatar-hash` deduplicates the array after canonicalisation. `profile-substring` does not, so a substring repeated in one request is removed once and audited once per occurrence. A `profile-substring` value that canonicalises to an empty string is skipped.--### Side effects+| 204 | empty | The values were removed, or had no entry |-After the removal reaches every node, Fluxer no longer checks later requests against the removed entries. A value can remain blocked by another matching entry. No Gateway Dispatch is emitted.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) per canonical value processed.--### Rate limit--60 requests per minute for each authenticated user, on the `admin:ban:operation` bucket.+The rate limit is 60 requests per minute, on the `admin:ban:operation` bucket.## Check blocklist entry<RouteHeader method="GET" path="/v1/admin/blocklists/{list_type}/entries/{entry_value}" auditReason />-Reports whether one value is currently blocked by the selected blocklist and returns a [blocklist check](#blocklist-check-object) object. Requires the selected list's `check` permission.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| list_type | string | The [blocklist type](#blocklist-types) |-| entry_value<sup>1</sup> | string | The percent-encoded value to check (1-2048 characters) |+Returns a [blocklist check object](#blocklist-check-object) saying whether the list blocks a value. You need the list's `check` permission. Percent-encode `entry_value`.-<sup>1</sup> Percent encoding is required because a canonical value can contain a slash. Fluxer checks the value for length alone, so a value in the wrong form returns 200 with `banned` false+A value can be blocked without an entry of its own when an `ip` address is inside a stored CIDR range or a `url-domain` hostname or URL matches a parent domain or a pattern. The `url` check doesn't look at the `url-domain` list.### Query parameters| Field | Type | Description || --- | --- | --- |-| scope?<sup>2</sup> | string | The [profile substring scope](#profile-substring-scopes) to check the value against |--<sup>2</sup> Required by `profile-substring` and rejected by every other blocklist--### Matching rule by blocklist--| Blocklist | Rule |-| --- | --- |-| ip<sup>3</sup> <sup>4</sup> | The address itself, any stored CIDR range containing it, and any stored address the instance treats as the same origin |-| email | Exact match on the lowercased address |-| phrase | Normalised phrase matching, so a disguised form of a stored phrase still reads as blocked |-| url<sup>5</sup> | Exact match on the canonicalised URL |-| url-domain<sup>6</sup> | The hostname, each parent domain stored with `match_subdomains` true, and each [domain pattern](#domain-patterns) covering the hostname |-| file-sha | Exact match on the lowercased hexadecimal digest |-| avatar-hash | Exact match after the `a_` prefix is stripped and the hash is lowercased |-| profile-substring | Normalised substring matching within the named scope |+| scope?<sup>1</sup> | string | The [profile substring scope](#profile-substring-scopes) to check |-<sup>3</sup> Any value that is not a single address, including a CIDR range, always reads as not blocked. An address on the instance exemption list reads as not blocked even while a row exists--<sup>4</sup> Two addresses are the same origin when they share a decision key, which is the exact address for IPv4 and the `/64` prefix for IPv6--<sup>5</sup> This check does not read the `url-domain` list, so a URL that a stored domain blocks reads as not blocked. Check the hostname separately--<sup>6</sup> The value can be a hostname or an absolute `http` or `https` URL. Fluxer normalises the hostname as it does for [link matching](#link-matching)+<sup>1</sup> Required for `profile-substring` and refused with 400 `INVALID_FORM_BODY` on every other list### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [blocklist check](#blocklist-check-object) object | Value was checked |-| 400 | [error response](/admin-api/#error-response) | `scope` is supplied on an unscoped blocklist or omitted on `profile-substring`, and the request returns `INVALID_FORM_BODY` |--A value with no row and no covering match returns 200 with `banned` false, so this operation never reports whether a specific row exists. Use [List blocklist entries](#list-blocklist-entries) for that.--For every list except `email`, a row written on another node becomes visible here after a short propagation delay.--### Side effects+| 200 | [blocklist check](#blocklist-check-object) object | The value was checked |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `check_blocklist_entry`, the target type of the selected list, target ID `0`, and metadata keys `list_type` and `banned`. `profile-substring` adds `scope`. The checked value is not recorded. A 400 records nothing.--### Rate limit--60 requests per minute for each authenticated user, on the `admin:ban:operation` bucket.+The rate limit is 60 requests per minute, on the `admin:ban:operation` bucket.## Update blocklist entry<RouteHeader method="PATCH" path="/v1/admin/blocklists/{list_type}/entries/{entry_value}" auditReason />-Rewrites the stored fields of one row without removing and re-adding it. Returns 204 with an empty body. Requires the selected list's `add` permission.--Only `url`, `url-domain`, `file-sha`, `avatar-hash`, and `profile-substring` accept this operation, reported as `supports_update` by [List blocklists](#list-blocklists). A list with no stored fields has nothing to update and returns 400 `INVALID_FORM_BODY`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| list_type | string | The [blocklist type](#blocklist-types) |-| entry_value | string | The percent-encoded canonical value of the row to write (1-2048 characters) |+Rewrites the fields of one entry, or creates it when it doesn't exist. You need the list's `add` permission. The `ip`, `email` and `phrase` lists return 400 `INVALID_FORM_BODY`.### JSON body-The body is the creation shape of the selected blocklist with the value field removed, so the same field list and the same bounds apply.-| Field | Type | Description || --- | --- | --- |-| scope?<sup>1</sup> | string | The [profile substring scope](#profile-substring-scopes) to write the row under |-| category?<sup>2</sup> | string | The [content blocklist category](#content-blocklist-categories) (1-64 characters, default `manual`) |-| severity?<sup>2</sup> | integer | The [content blocklist severity](#content-blocklist-severities) (0-3, default 2) |-| match_subdomains?<sup>3</sup> | boolean | Whether the row also covers subdomains (default true) |-| content_type?<sup>4</sup> | string | The media type hint (1-128 characters) |-| source_url?<sup>2</sup> | string | The feed or evidence URL (1-2048 characters) |-| reason?<sup>5</sup> | string | The reason (1-1024 characters) |-| notes?<sup>6</sup> | string | The internal note (1-1024 characters) |--<sup>1</sup> Required by `profile-substring`. This operation takes no query parameters, so the scope goes in the body, and every other blocklist ignores it there--<sup>2</sup> Accepted only by `url`, `url-domain`, `file-sha`, and `avatar-hash`--<sup>3</sup> Accepted only by `url-domain`--<sup>4</sup> Accepted only by `file-sha`--<sup>5</sup> Accepted only by `avatar-hash` and `profile-substring`, and recorded in the audit entry metadata+| scope?<sup>1</sup> | string | The [profile substring scope](#profile-substring-scopes) |+| category? | string | The [content blocklist category](#content-blocklist-categories) (1-64 characters, default `manual`) |+| severity? | integer | The [content blocklist severity](#content-blocklist-severities) (0-3, default 2) |+| match_subdomains? | boolean | Whether a `url-domain` entry also covers subdomains (default true) |+| content_type? | string | The media type hint of a `file-sha` entry (1-128 characters) |+| source_url? | string | The feed or evidence URL (1-2048 characters) |+| reason? | string | The reason, kept in the audit entry (1-1024 characters) |+| notes? | string | The internal note (1-1024 characters) |-<sup>6</sup> Accepted only by `url`, `url-domain`, `file-sha`, `avatar-hash`, and `profile-substring`+<sup>1</sup> Required for `profile-substring`:::caution[An omitted field is written as its default]-Sending `{"severity": 3}` on a `url` row also resets its category to `manual` and clears its source URL and notes. Resend every field the row is meant to keep.+Sending `{"severity": 3}` on a `url` entry also resets its category to `manual` and clears its source URL and notes. Send every field the entry should keep.:::### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Row was written |-| 400 | [error response](/admin-api/#error-response) | The list accepts no update, or the body fails validation, and the request returns `INVALID_FORM_BODY` |+| 204 | empty | The entry was written |-On the `url` blocklist, an `entry_value` Fluxer cannot canonicalise returns 400 `INVALID_FORM_BODY` naming `url` in the `errors` array. On the `url-domain` blocklist, an `entry_value` that is not a valid domain or [domain pattern](#domain-patterns) returns the same 400 naming `domain`.--The write is an upsert on the canonical value, so a value with no existing row is created. This operation never returns 404. A `url` blocked only by a stored `url-domain` row has no row of its own, and updating it through the URL silently creates a new exact-URL row.--Changing the `scope` of a `profile-substring` row writes a second row under the new scope and leaves the original in place. Removing the original takes [Remove blocklist entry](#remove-blocklist-entry).--### Side effects--After the change reaches every node, later matches use the updated fields. No Gateway Dispatch is emitted.--The write records one [Admin audit entry](/admin-api/#admin-audit-entry-object) under the same action an add records, with the canonical value but no previous values of the changed fields.--### Rate limit--60 requests per minute for each authenticated user, on the `admin:ban:operation` bucket.+The rate limit is 60 requests per minute, on the `admin:ban:operation` bucket.## Remove blocklist entry<RouteHeader method="DELETE" path="/v1/admin/blocklists/{list_type}/entries/{entry_value}" auditReason />-Removes one row from the selected blocklist. Returns 204 with an empty body. Requires the selected list's `remove` permission.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| list_type | string | The [blocklist type](#blocklist-types) |-| entry_value<sup>1</sup> | string | The percent-encoded canonical value of the row to remove (1-2048 characters) |--<sup>1</sup> Canonicalised the same way it was on the add path and matched exactly, so a `url` blocked only by a broader `url-domain` row cannot be removed through the URL. A `url-domain` value that fails validation is lowercased and removed as written+Removes one entry. You need the list's `remove` permission. Percent-encode `entry_value` and send the value as the entry stores it. An address inside a stored CIDR range has no entry of its own, and you unblock it by removing the range.### Query parameters| Field | Type | Description || --- | --- | --- |-| scope?<sup>2</sup> | string | The [profile substring scope](#profile-substring-scopes) the row is stored under |+| scope?<sup>1</sup> | string | The [profile substring scope](#profile-substring-scopes) of the entry |-<sup>2</sup> Required by `profile-substring` and rejected by every other blocklist+<sup>1</sup> Required for `profile-substring` and refused with 400 `INVALID_FORM_BODY` on every other list### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Value was processed |-| 400 | [error response](/admin-api/#error-response) | `scope` is supplied on an unscoped blocklist or omitted on `profile-substring`, and the request returns `INVALID_FORM_BODY` |-| 409 | [error response](/admin-api/#error-response) | `IP_BAN_LINKED_TO_DECISION` with `decision_id`, because an enforcement decision owns the `ip` row |--On the `url` blocklist, an `entry_value` Fluxer cannot canonicalise returns 400 `INVALID_FORM_BODY` naming `url` in the `errors` array.--Removal is idempotent. A value with no stored row returns 204 and still records an Admin audit entry, so this operation never returns 404 and never reports whether anything was removed.--### Side effects--The removed row stops affecting subsequent blocklist decisions. For every list except `email`, other nodes stop applying it after a short propagation delay. A value can remain blocked by another matching row, such as a single address covered by a stored CIDR range. No Gateway Dispatch is emitted.+| 204 | empty | The entry was removed, or there was none |+| 409 | [error response](/admin-api/#error-response) | `IP_BAN_LINKED_TO_DECISION` with `decision_id` when the address belongs to an enforcement decision |-The removal records one [Admin audit entry](/admin-api/#admin-audit-entry-object), with the canonical value in its metadata.--### Rate limit--60 requests per minute for each authenticated user, on the `admin:ban:operation` bucket.+The rate limit is 60 requests per minute, on the `admin:ban:operation` bucket.## Block a user's current avatar<RouteHeader method="POST" path="/v1/admin/users/{user_id}/avatar-block" auditReason />-Adds the account's current avatar hash to the `avatar-hash` blocklist and returns the stored hash. Requires `ban:avatar_hash:add`.--This is a shortcut over [Add blocklist entry](#add-blocklist-entry) for blocking an avatar an Admin is looking at. The operation reads the current avatar hash and strips any `a_` animation prefix, so the stored value is the 8-character form. It writes the same row an add writes, with the category `manual`, the severity `2`, and a null source URL. It does not ban, suspend, or otherwise act on the account.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The account whose current avatar is blocked |+Adds the user's current avatar hash to the `avatar-hash` list and returns it. You need `ban:avatar_hash:add`. The user keeps the avatar until you clear it with [Clear user profile fields](/admin-api/users/#clear-user-profile-fields). No user can set that image again while the hash is on the list.### JSON body-Both fields are optional, so an empty body and `{}` are both valid requests.-| Field | Type | Description || --- | --- | --- |-| reason?<sup>1</sup> | string | The reason (1-1024 characters) |-| notes?<sup>2</sup> | string | The internal note (1-1024 characters) |--<sup>1</sup> Recorded in the metadata of the Admin audit entry, so no read of the row returns it--<sup>2</sup> Stored on the row. Omitting it stores the generated note `banned via user shortcut user_id=<user_id>`+| reason? | string | The reason, kept in the audit entry (1-1024 characters) |+| notes? | string | The internal note, which defaults to a note with the user ID (1-1024 characters) |### Response body@@ -743,19 +416,7 @@ Both fields are optional, so an empty body and `{}` are both valid requests.| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Avatar hash was written |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER` when the account does not exist, or `NOT_FOUND` when the account has no avatar |--The account keeps the blocked avatar until it next sets one. Clearing it is a separate request naming `avatar` in the `fields` array of [Clear user profile fields](/admin-api/users/#clear-user-profile-fields).--The avatar hash is the first 8 characters of the MD5 digest of the image, so every account using that image has the same avatar hash, so blocking the hash blocks the image for every account.--### Side effects--The hash blocks subsequent avatar uploads after the change propagates across the instance. No Gateway Dispatch is emitted.--Fluxer records one [Admin audit entry](/admin-api/#admin-audit-entry-object) under the action `ban_avatar_hash`, with the stored hash and the supplied reason.--### Rate limit+| 200 | response body | The hash was added |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER` when the account doesn't exist, or `NOT_FOUND` when it has no avatar |-60 requests per minute for each authenticated user, on the `admin:ban:operation` bucket.+The rate limit is 60 requests per minute, on the `admin:ban:operation` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/bulk-jobs.mdx b/fluxer_docs/src/content/docs/admin-api/bulk-jobs.mdxindex 6d1006725..d8138fe3c 100644--- a/fluxer_docs/src/content/docs/admin-api/bulk-jobs.mdx+++ b/fluxer_docs/src/content/docs/admin-api/bulk-jobs.mdx@@ -1,16 +1,12 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Bulk jobs-description: Administrative bulk mutations over an explicit user or guild set.+description: Queue one operation for an explicit list of users or guilds.---import RouteHeader from '@/components/RouteHeader.astro';-A bulk job applies one operation to an explicit set of users or guilds. The `task` field selects the request body and required [Admin ACL](/admin-api/#acl-registry).--Every target is a list of IDs. There is no search, role, tag, email, or IP selector, so the caller resolves its own target set first with [List users](/admin-api/users/#list-users) or [List guilds](/admin-api/guilds/#list-guilds).--[Queue bulk job](#queue-bulk-job) returns a job identifier immediately and applies nothing synchronously. The caller reads progress, terminal state, and failure text through [Get job](/admin-api/jobs/#get-job). [Cancel job](/admin-api/jobs/#cancel-job) stops a run.+A bulk job applies one operation to a list of user or guild IDs. Queueing one returns a job ID right away. Follow its progress with [Get job](/admin-api/jobs/#get-job) and stop it with [Cancel job](/admin-api/jobs/#cancel-job).## Bulk job creation object@@ -18,58 +14,35 @@ Every target is a list of IDs. There is no search, role, tag, email, or IP selec| Field | Type | Description || --- | --- | --- |-| job_id<sup>1</sup> | snowflake | The job that applies the requested operation, readable through [Get job](/admin-api/jobs/#get-job) |--<sup>1</sup> The job is readable as soon as this response arrives--### Example--```json-{- "job_id": "1501314428688998182"-}-```+| job_id | snowflake | The queued [job](/admin-api/jobs/#get-job) |## Bulk task types-Each value is the exact `task` discriminator.--### `update_user_flags`--ACL `bulk:update:user_flags`. Adds and removes account flags on every targeted user. Runs as `bulkUpdateUserFlags`.--### `update_guild_features`--ACL `bulk:update:guild_features`. Adds and removes features on every targeted guild. Runs as `bulkUpdateGuildFeatures`.--### `add_guild_members`--ACL `bulk:add:guild_members`. Adds every targeted user to one guild. Runs as `bulkAddGuildMembers`.--### `schedule_user_deletion`--ACL `bulk:delete:users`. Closes every targeted account and schedules its deletion. Runs as `bulkScheduleUserDeletion`. A job queued in the shape used before enforcement decisions, with `reason_code` and no `basis`, fails when the worker runs it instead of inventing a decision.--### `delete_user_messages`--ACL `bulk:delete:user_messages`. Deletes every message each targeted account wrote. Runs as `bulkDeleteMessagesForUsers`. A job queued without a `basis` fails when the worker runs it.+The `task` field selects the body and the [Admin ACL](/admin-api/#acl-registry) you need.-Each worker task is recorded as `task_type` on the job and listed under [background job task types](/admin-api/jobs/#background-job-task-types). Every bulk task runs in the `lifecycle` [processing lane](/admin-api/jobs/#processing-lanes).+| Task | ACL | Description |+| --- | --- | --- |+| update_user_flags | `bulk:update:user_flags` | Adds and removes account flags on each user |+| update_guild_features | `bulk:update:guild_features` | Adds and removes features on each guild |+| add_guild_members | `bulk:add:guild_members` | Adds each user to one guild |+| schedule_user_deletion | `bulk:delete:users` | Closes each account and schedules its deletion |+| delete_user_messages | `bulk:delete:user_messages` | Deletes every message each user wrote |++[Get job](/admin-api/jobs/#get-job) reports each task under its job task type in `task_type`.++| Task | Job task type |+| --- | --- |+| update_user_flags | `bulkUpdateUserFlags` |+| update_guild_features | `bulkUpdateGuildFeatures` |+| add_guild_members | `bulkAddGuildMembers` |+| schedule_user_deletion | `bulkScheduleUserDeletion` |+| delete_user_messages | `bulkDeleteMessagesForUsers` |## Queue bulk job<RouteHeader method="POST" path="/v1/admin/bulk-jobs" auditReason />-Queues one bulk operation. Returns a [bulk job creation](#bulk-job-creation-object) object on success.--### Limitations--- The body matches exactly one `task` variant.-- The caller needs at least one of the [bulk ACLs](#bulk-task-types) and then the exact ACL that `task` selects.--:::caution[Authorisation depends on the validated body]-Body validation runs ahead of authentication and ACL evaluation, so a malformed body answers 400 even when the request has no credential.-:::+Queues one bulk operation and returns a [bulk job creation](#bulk-job-creation-object) object. You need the [ACL for the `task`](#bulk-task-types) you send.### JSON body@@ -77,86 +50,68 @@ Body validation runs ahead of authentication and ACL evaluation, so a malformed| Field | Type | Description || --- | --- | --- |-| task | string | The discriminator selecting this variant, `update_user_flags` |-| user_ids | array[snowflake] | The users to update (max 1000 entries) |-| add_flags?<sup>1</sup> | array[string] | [Account flag](/admin-api/users/#account-flags) values to add (max 64, default empty) |-| remove_flags?<sup>1</sup> | array[string] | [Account flag](/admin-api/users/#account-flags) values to remove (max 64, default empty) |--<sup>1</sup> Each entry is one 64-bit flag value written as an unsigned decimal string, such as `1024`. Body validation rejects a symbolic name. Additions are applied before removals, so a value named in both arrays ends up cleared+| task | string | Always `update_user_flags` |+| user_ids | array[snowflake] | The users to update (up to 1000) |+| add_flags? | array[string] | [Account flag](/admin-api/users/#account-flags) values to add, as unsigned decimal strings (up to 64, default empty) |+| remove_flags? | array[string] | [Account flag](/admin-api/users/#account-flags) values to remove, as unsigned decimal strings (up to 64, default empty) |#### Update guild features structure| Field | Type | Description || --- | --- | --- |-| task | string | The discriminator selecting this variant, `update_guild_features` |-| guild_ids | array[snowflake] | The guilds to update (max 1000 entries) |-| add_features?<sup>1</sup> | array[string] | [Guild features](/http-api/guilds/#guild-features) to add (max 100, default empty) |-| remove_features?<sup>1</sup> | array[string] | [Guild features](/http-api/guilds/#guild-features) to remove (max 100, default empty) |--<sup>1</sup> Body validation accepts any string, so a name outside the registry is written to the guild's feature set. Additions are applied before removals+| task | string | Always `update_guild_features` |+| guild_ids | array[snowflake] | The guilds to update (up to 1000) |+| add_features? | array[string] | [Guild features](/http-api/guilds/#guild-features) to add (up to 100, default empty) |+| remove_features? | array[string] | [Guild features](/http-api/guilds/#guild-features) to remove (up to 100, default empty) |#### Add guild members structure| Field | Type | Description || --- | --- | --- |-| task | string | The discriminator selecting this variant, `add_guild_members` |+| task | string | Always `add_guild_members` || guild_id | snowflake | The guild that receives the users |-| user_ids | array[snowflake] | The users to add as members (max 1000 entries) |+| user_ids | array[snowflake] | The users to add as members (up to 1000) |#### Schedule user deletion structure| Field | Type | Description || --- | --- | --- |-| task | string | The discriminator selecting this variant, `schedule_user_deletion` |-| user_ids | array[snowflake] | The users to schedule for deletion (max 1000 entries) |-| days_until_deletion<sup>1</sup> | integer | The delay before deletion in whole days (1-365) |-| basis<sup>2</sup> | [basis](/admin-api/enforcement/#basis) object | Why the accounts are closed |--<sup>1</sup> Fluxer raises the value to 14 days, the minimum of every basis--<sup>2</sup> The `enforcement` basis takes a bulk decision with `reason_code`, `source` (always `own_review`), `automation` and a required `statement`. Reports, evidence messages and any other field are refused, because per-account facts cannot be given in bulk. The `X-Audit-Log-Reason` header is required with this basis, or the request fails with `ENFORCEMENT_INTERNAL_NOTE_REQUIRED`, and becomes the first note on every decision+| task | string | Always `schedule_user_deletion` |+| user_ids | array[snowflake] | The users to schedule for deletion (up to 1000) |+| days_until_deletion | integer | Days until each account is deleted (1-365, raised to 14 if lower) |+| basis<sup>1</sup> | [basis](/admin-api/enforcement/#basis) object | Why the accounts are closed |#### Delete user messages structure| Field | Type | Description || --- | --- | --- |-| task | string | The discriminator selecting this variant, `delete_user_messages` |-| user_ids | array[snowflake] | The users whose messages are deleted (max 1000 entries) |+| task | string | Always `delete_user_messages` |+| user_ids | array[snowflake] | The users whose messages are deleted (up to 1000) || basis<sup>1</sup> | [basis](/admin-api/enforcement/#basis) object | Why the messages are deleted |-<sup>1</sup> Takes the same bulk decision and `X-Audit-Log-Reason` rule as the schedule user deletion structure. A reason with restricted handling is refused for each account, because it needs evidence messages+<sup>1</sup> With `type` set to `enforcement`, `decision` takes `reason_code`, `source` (always `own_review`), `automation` and a required `statement`, and it can't link reports or evidence messages.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [bulk job creation](#bulk-job-creation-object) object | The bulk job was queued |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY`, including for a restriction flag or a missing internal note |-| 403 | [error response](/admin-api/#error-response) | `MISSING_ACL` without the ACL selected by `task` |-| 500<sup>1</sup> | [error response](/admin-api/#error-response) | The job could not be queued |--<sup>1</sup> A full queue rejects the job and the request returns `INTERNAL_SERVER_ERROR`+| 200 | [bulk job creation](#bulk-job-creation-object) object | The job was queued |+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY`, also when `add_flags` has a restriction flag |+| 400 | [error response](/admin-api/#error-response) | `ENFORCEMENT_INTERNAL_NOTE_REQUIRED` when an `enforcement` basis has no `X-Audit-Log-Reason` |+| 403 | [error response](/admin-api/#error-response) | `MISSING_ACL` without the ACL that `task` selects |### Side effects-The [job](/admin-api/jobs/) records the acting Admin and audit reason. Queueing records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `queue_bulk_job`, target type `bulk_job`, target ID equal to the job identifier, and metadata keys `task` and `entity_count`. `entity_count` is the length of `guild_ids` for `update_guild_features` and of `user_ids` for every other task. An `add_guild_members` entry also has `guild_id`. Failure to create the job returns 500 `INTERNAL_SERVER_ERROR` without starting the operation or recording an entry.--Entities are processed in the submitted order. [Cancel job](/admin-api/jobs/#cancel-job) stops the run between entities and sets its status to `cancelled`. Completed changes remain in place. A failed or unknown entity counts as failed without stopping the remaining work.--Every task updates its progress before work starts and at completion. Every task except `schedule_user_deletion` also updates its progress after every 25 entities, and `schedule_user_deletion` updates its progress after every 10 accounts. The final `progress_message` has the successful and failed counts.--Every task writes one summary Admin audit entry when it finishes, with the action `bulk_update_user_flags`, `bulk_update_guild_features`, `bulk_add_guild_members`, `bulk_schedule_deletion`, `bulk_ban_file_shas`, or `bulk_delete_user_messages`. The summary has the audit reason, the entity count, the operation-specific parameters, the job identifier, and the processed, successful, and failed counts. Its `target_type` is `bulk_job` and its `target_id` is the job identifier, except for `add_guild_members`, which targets the guild. A failed job writes no summary entry. A cancelled job writes one, marked `cancelled`, covering the entities it processed before it stopped.--`update_user_flags` refuses the same restriction flag changes as [Update user flags](/admin-api/users/#update-user-flags). Adding one fails the request with `FLAG_REQUIRES_ENFORCEMENT_ROUTE`, and a removal an account refuses counts that account as failed. It writes one `update_flags` entry for each account and dispatches [User Update](/gateway/events/#user-update) to the account's sessions. A change to a publicly visible flag also dispatches [Guild Member Update](/gateway/events/#guild-member-update) to every guild the account is in.--`update_guild_features` writes one `update_features` entry for each guild, dispatches [Guild Update](/gateway/events/#guild-update), and reindexes the guild for search. Fluxer reconciles a guild that already has a discovery application record against the new feature set, so gaining `DISCOVERABLE` approves the record and losing it marks the record removed. A guild with no discovery record is left alone.--`add_guild_members` bypasses the ban check that a normal join runs. The task suppresses the join system message, records the join source as an Admin force add, and dispatches [Guild Member Add](/gateway/events/#guild-member-add) to the guild and [Guild Create](/gateway/events/#guild-create) to the added account's sessions. The task still enforces the per-account guild cap and the guild member cap, so an account at either ceiling is counted as failed. An account that is already a member is left unchanged and counted as successful, with no second membership and no Dispatch. Adding a bot account also records a `BOT_ADD` guild audit log entry attributed to the acting Admin.+Fluxer works through the IDs in order. A failed ID doesn't stop the job, and the final `progress_message` gives the successful and failed counts. Cancelling stops the job between IDs and keeps the changes already made.-`delete_user_messages` runs the same steps as [Delete all user messages](/admin-api/users/#delete-all-user-messages) for each account, with the job's basis. With the `enforcement` basis each account that wrote any message gets its own content removal decision and notice. Each account writes one `delete_all_user_messages` entry with the audit reason, the basis and the message count, and the summary entry records `basis`, plus `reason_code` for the `enforcement` basis. Progress is reported after every account.+Queueing writes a `queue_bulk_job` audit entry, and each job writes one summary entry when it ends.-`schedule_user_deletion` runs the same steps as [Schedule user deletion](/admin-api/users/#schedule-user-deletion) for each account, with the job's basis. With the `enforcement` basis each account gets its own decision and notice, its email is blocked when the rule bars new accounts, and the pending reports against it are resolved for the reasons that resolve reports, leaving the `child_safety`, `underage_user`, and `self_harm` categories pending. Each account writes one `schedule_deletion` entry with the audit reason, and the summary entry records `basis`, plus `reason_code` for the `enforcement` basis. A failed email is logged and does not fail the entity. An account that already has a pending deletion, or that a decision owns for a holder request or housekeeping deletion, counts as failed.+Each task works like its single-target route and sends the same Gateway events.-### Rate limit+- `update_user_flags` works like [Update user flags](/admin-api/users/#update-user-flags).+- `update_guild_features` works like [Update guild](/admin-api/guilds/#update-guild) and sends [Guild Update](/gateway/events/#guild-update).+- `add_guild_members` works like [Add guild member](/admin-api/guilds/#add-guild-member) but posts no join message, and users who are already members count as successful.+- `schedule_user_deletion` works like [Schedule user deletion](/admin-api/users/#schedule-user-deletion).+- `delete_user_messages` works like [Delete all user messages](/admin-api/users/#delete-all-user-messages).-20 requests per minute for each authenticated user, on the `admin:bulk:operation` bucket.+The rate limit is 20 requests per minute, on the `admin:bulk:operation` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/discovery.mdx b/fluxer_docs/src/content/docs/admin-api/discovery.mdxindex 5b7c9aa20..847711f62 100644--- a/fluxer_docs/src/content/docs/admin-api/discovery.mdx+++ b/fluxer_docs/src/content/docs/admin-api/discovery.mdx@@ -1,60 +1,36 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Admin discovery-description: Discovery application review, listing reads, category moves, and removal.+description: Review discovery applications, edit and move listings, and remove guilds from the directory.---import RouteHeader from '@/components/RouteHeader.astro';-Admin discovery is the review side of the public guild directory. An Admin decides the application a guild manager submits, reads and edits the approved listing, moves it between categories, and removes the guild from the directory. A guild has at most one application, and the public [Discovery](/http-api/discovery/) resource drives the same lifecycle from the guild's side. People see this feature as "Explore" in the Fluxer apps. The API calls it discovery.--Every operation except [Remove discovery listing](#remove-discovery-listing) requires `discovery:review`, which covers the reads, [Review discovery application](#review-discovery-application), [Move discovery listings to a category](#move-discovery-listings-to-a-category), and [Update discovery listing](#update-discovery-listing). [Remove discovery listing](#remove-discovery-listing) requires `discovery:remove` instead. Neither implies the other.--Every operation here records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with the audit reason from `X-Audit-Log-Reason` when it succeeds. An operation that stores a reason on the application takes it in its request body, and that reason is not recorded in the entry.--:::note[Review runs regardless of the discovery setting]-An operator can disable discovery for the whole instance. Only the public [Discovery](/http-api/discovery/) routes read that state, and they return 400 `DISCOVERY_DISABLED` while it is off, so an application can be reviewed into a directory no account can see.-:::+Admins review the guild applications that guild managers submit through the public [Discovery](/http-api/discovery/) resource. Every endpoint here needs `discovery:review` except [Remove discovery listing](#remove-discovery-listing), which needs `discovery:remove`. Each one records an [Admin audit entry](/admin-api/#admin-audit-entry-object).## Admin pending application object-A guild's submitted application, together with the guild details Fluxer resolves at request time.+A pending application and details about its guild.### Structure| Field | Type | Description || --- | --- | --- |-| guild_id | snowflake | Guild that applied to discovery |-| guild_name<sup>1</sup> | string | Current guild name |-| guild_icon<sup>1</sup> | ?string | Current guild icon hash, or null when the guild has none |-| guild_owner_id<sup>1</sup> | snowflake | Current guild owner |-| guild_owner_username<sup>2</sup> | ?string | Username of the owner |-| guild_owner_global_name<sup>2</sup> | ?string | Display name of the owner, or null when unset |-| guild_owner_discriminator<sup>2</sup> <sup>3</sup> | ?string | Discriminator of the owner |-| guild_member_count<sup>1</sup> <sup>4</sup> | integer | The member count on the guild record |-| guild_nsfw_level<sup>1</sup> | ?integer | Current [NSFW level](/http-api/guilds/#nsfw-levels) of the guild |-| guild_features<sup>1</sup> <sup>5</sup> | array[string] | Current [guild features](/http-api/guilds/#guild-features) |-| description | string | Listing description of 10 through 300 characters |-| category_type<sup>6</sup> | integer | [Discovery category](/http-api/discovery/#discovery-categories) the listing is filed under |-| primary_language<sup>7</sup> | ?string | [Supported primary language](/http-api/discovery/#supported-primary-languages) code |-| custom_tags<sup>6</sup> <sup>8</sup> | array[string] | Normalised [custom tags](/http-api/discovery/#custom-tags) of the listing |-| applied_at | ISO8601 timestamp | Time at which the guild applied |--<sup>1</sup> Resolved from the guild at request time. A guild Fluxer fails to load yields the literal name `(unknown guild)`, a null icon, the owner ID `0`, a member count of 0, a null NSFW level, an empty feature array, and null for all owner name fields--<sup>2</sup> Read from the owner account, so it is null when the guild resolved but the owner account did not--<sup>3</sup> Rendered as four digits with leading zeroes--<sup>4</sup> The count stored on the guild record, so it is approximate--<sup>5</sup> An approved application has the discoverable feature here--<sup>6</sup> A stored null reads as `0` for the category and as an empty array for the tags--<sup>7</sup> A stored null reads as `en-US`, so this read does not produce null--<sup>8</sup> Stored already trimmed, lowercased, and whitespace collapsed, so a tag does not round-trip in the casing it was submitted with+| guild_id | snowflake | The ID of the guild that applied |+| guild_name | string | The name of the guild |+| guild_icon | ?string | The icon hash of the guild |+| guild_owner_id | snowflake | The ID of the guild owner |+| guild_owner_username | ?string | The username of the owner |+| guild_owner_global_name | ?string | The display name of the owner |+| guild_owner_discriminator | ?string | The discriminator of the owner |+| guild_member_count | integer | The approximate member count |+| guild_nsfw_level | ?integer | The [NSFW level](/http-api/guilds/#nsfw-levels) of the guild |+| guild_features | array[string] | The [guild features](/http-api/guilds/#guild-features) |+| description | string | The listing description (10-300 characters) |+| category_type | integer | The [discovery category](/http-api/discovery/#discovery-categories) of the listing |+| primary_language | ?string | The [primary language](/http-api/discovery/#supported-primary-languages) code |+| custom_tags | array[string] | The [custom tags](/http-api/discovery/#custom-tags) of the listing |+| applied_at | ISO8601 timestamp | When the guild applied |### Example@@ -80,78 +56,19 @@ A guild's submitted application, together with the guild details Fluxer resolves## Admin discovery listing object-An approved listing. It has every field of the [Admin pending application object](#admin-pending-application-object) with the same meaning, plus the field below.+An approved listing has every field of the [Admin pending application object](#admin-pending-application-object) plus `approved_at`.### Structure| Field | Type | Description || --- | --- | --- |-| approved_at<sup>1</sup> | ?ISO8601 timestamp | Time at which the application was approved |--<sup>1</sup> The review time of the application, so a guild approved automatically on submission has its submission time here--## Discovery application object--This is the [discovery application object](/http-api/discovery/#discovery-application-object) of the public Discovery resource. Every write on this page answers with it, so a client that needs the guild name, icon, owner, member count, NSFW level, or features re-reads the listing after a write. No response on this page exposes the Admin that approved, rejected, or removed the application.--### Structure--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | Guild the application belongs to |-| guild_nsfw_level?<sup>1</sup> | ?integer | [NSFW level](/http-api/guilds/#nsfw-levels) of the guild |-| status | string | [Discovery application status](/http-api/discovery/#discovery-application-statuses) |-| description | string | The description shown on the listing |-| category_type | integer | [Discovery category](/http-api/discovery/#discovery-categories) the listing is filed under |-| primary_language | ?string | [Supported primary language](/http-api/discovery/#supported-primary-languages) code |-| custom_tags | array[string] | Normalised [custom tags](/http-api/discovery/#custom-tags) of the listing |-| applied_at | ISO8601 timestamp | Time at which the guild applied |-| reviewed_at<sup>2</sup> | ?ISO8601 timestamp | Time at which the application was approved or rejected, or null while it is pending |-| review_reason<sup>3</sup> | ?string | Reason recorded with the approval or rejection, or null |-| removed_at<sup>4</sup> | ?ISO8601 timestamp | Time at which an approved listing was removed, or null |-| removal_reason<sup>4</sup> | ?string | Reason recorded with the removal, or null |--<sup>1</sup> No route on this page populates it. Read the level from the [Admin pending application object](#admin-pending-application-object) or the [guild object](/http-api/guilds/#guild-object) instead--<sup>2</sup> An application approved automatically on submission has its submission time here--<sup>3</sup> Null for an approval that supplied no reason and for an automatic approval. A rejection always has one--<sup>4</sup> Both fields are set only by [Remove discovery listing](#remove-discovery-listing)--### Example--```json-{- "guild_id": "1478812292088791040",- "status": "approved",- "description": "A place to talk about building things.",- "category_type": 3,- "primary_language": "en-US",- "custom_tags": ["makers", "diy"],- "applied_at": "2026-08-19T14:03:55.000Z",- "reviewed_at": "2026-08-20T09:11:02.000Z",- "review_reason": null,- "removed_at": null,- "removal_reason": null-}-```--## Discovery categories--Each release ships a fixed category set, and no Admin operation changes it. See [discovery categories](/http-api/discovery/#discovery-categories) for the set.--Every `category_type` and `category_id` here is an integer of 0 through 8. A value outside that range fails path, query, or body validation.+| approved_at | ?ISO8601 timestamp | When the application was approved |## List discovery applications<RouteHeader method="GET" path="/v1/admin/discovery/applications" auditReason />-Returns every pending application as an array of [Admin pending application](#admin-pending-application-object) objects. Requires `discovery:review`.--The response is a bare array with no guaranteed order, cursor or limit. Sort it locally if a stable order is required.--A guild approved automatically on submission never appears here. An application whose stored record can no longer be read is dropped from the array. The request still succeeds.+Returns every pending application as an array of [Admin pending application](#admin-pending-application-object) objects.### Response@@ -159,72 +76,36 @@ A guild approved automatically on submission never appears here. An application| --- | --- | --- || 200 | array[[Admin pending application](#admin-pending-application-object) object] | Pending applications were returned |-### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_discovery_applications`, target type `guild`, target ID `0`, and metadata key `result_count`.--### Rate limit--30 requests per 10 seconds for each authenticated user, on the `discovery:admin:list` bucket.+The rate limit is 30 requests per 10 seconds, on the `discovery:admin:list` bucket.## Review discovery application<RouteHeader method="PATCH" path="/v1/admin/discovery/applications/{guild_id}" auditReason />-Approves or rejects a pending application and returns the updated [discovery application](#discovery-application-object) object. Requires `discovery:review`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | Guild that applied to discovery |+Approves or rejects a pending application and returns the [discovery application](/http-api/discovery/#discovery-application-object). An approval adds the `DISCOVERABLE` and `VISITS_ENABLED` [guild features](/http-api/guilds/#guild-features) and sends [Guild Update](/gateway/events/#guild-update).### JSON body| Field | Type | Description || --- | --- | --- |-| status<sup>1</sup> | approved \| rejected | Decision to apply |-| reason?<sup>2</sup> <sup>3</sup> | string | Reason stored on the application as `review_reason` (at most 500 characters) |--<sup>1</sup> A value outside the two listed fails body validation. Neither `removed` nor `pending` is accepted--<sup>2</sup> Optional when `status` is `approved`, and omitting it stores null. An empty string fails body validation with 400 `INVALID_FORM_BODY`--<sup>3</sup> Required and at least one character when `status` is `rejected`, so a rejection without a reason fails body validation--:::caution[Review is a one-way transition]-An application that is already approved, rejected, or removed fails with 409 `DISCOVERY_APPLICATION_ALREADY_REVIEWED`, and nothing returns a reviewed application to pending. Listing a removed or rejected guild again requires a new application.-:::+| status | approved \| rejected | The decision |+| reason? | string | The review reason, at most 500 characters. Required for `rejected`, where it must be at least 1 character |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [discovery application](#discovery-application-object) object | Decision was applied |-| 404 | [error response](/admin-api/#error-response) | The guild holds no application, returned as `DISCOVERY_APPLICATION_NOT_FOUND` |-| 409 | [error response](/admin-api/#error-response) | The application is not pending, returned as `DISCOVERY_APPLICATION_ALREADY_REVIEWED` |--### Side effects--An approval moves the application to `approved` and records the review time, the reviewing Admin, and the supplied reason. It adds the discoverable feature to the guild and indexes the listing, so the guild appears in [Search discovery guilds](/http-api/discovery/#search-discovery-guilds). [Guild Update](/gateway/events/#guild-update) fires to every session that can observe the guild. Indexing is skipped on an instance with no search backend configured, and the approval still succeeds.--A rejection moves the application to `rejected` and records the review time, the reviewing Admin, and the required reason. It leaves every guild field as it is and emits no Gateway Dispatch.+| 200 | [discovery application](/http-api/discovery/#discovery-application-object) object | The decision was applied |+| 404 | [error response](/admin-api/#error-response) | `DISCOVERY_APPLICATION_NOT_FOUND` when the guild has no application |+| 409 | [error response](/admin-api/#error-response) | `DISCOVERY_APPLICATION_ALREADY_REVIEWED` when the application is not pending |-An approval whose guild can no longer be resolved still succeeds. Fluxer skips the feature grant and the Dispatch.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `approve_discovery_application` or `reject_discovery_application`, target type `guild`, the guild ID as target ID, and metadata key `status`.--### Rate limit--20 requests per 10 seconds for each authenticated user, on the `discovery:admin:action` bucket.+The rate limit is 20 requests per 10 seconds, on the `discovery:admin:action` bucket.## List discovery categories<RouteHeader method="GET" path="/v1/admin/discovery/categories" auditReason />-Returns the fixed [discovery category](/http-api/discovery/#discovery-categories) set as an array of [discovery category](/http-api/discovery/#discovery-category-object) objects, in ascending ID order. Requires `discovery:review`.--It reports the same set on every instance running the same release and has no listing counts. Names are the release's display names and are not localised.+Returns the [discovery categories](/http-api/discovery/#discovery-categories) as an array of [discovery category](/http-api/discovery/#discovery-category-object) objects.### Response@@ -232,36 +113,20 @@ It reports the same set on every instance running the same release and has no li| --- | --- | --- || 200 | array[[discovery category](/http-api/discovery/#discovery-category-object) object] | Categories were returned |-### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_discovery_categories`, target type `discovery_category`, target ID `0`, and metadata key `result_count`.--### Rate limit--30 requests per 10 seconds for each authenticated user, on the `discovery:admin:list` bucket.+The rate limit is 30 requests per 10 seconds, on the `discovery:admin:list` bucket.## List guilds in a discovery category<RouteHeader method="GET" path="/v1/admin/discovery/categories/{category_id}/listings" auditReason />-Returns an offset page of the approved listings filed under one category, most members first, as an array of [Admin discovery listing](#admin-discovery-listing-object) objects. Requires `discovery:review`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| category_id | integer | [Discovery category](/http-api/discovery/#discovery-categories) of 0 through 8 |+Returns approved listings in a category as an array of [Admin discovery listing](#admin-discovery-listing-object) objects, most members first. `category_id` is an integer from 0 to 8.### Query parameters| Field | Type | Description || --- | --- | --- |-| limit? | integer | Listings to return (1-100, default 50) |-| offset?<sup>1</sup> | integer | Listings to skip (0-10000, default 0) |--<sup>1</sup> Applied after the category filter and the member sort, so raise it to page a category--A rebuild of the discovery search index does not change what this operation answers. It reports no total, so a page shorter than `limit` is the only end-of-category signal. A listing whose guild could not be resolved sorts as if it had no members and lands at the end.+| limit? | integer | The number of listings to return (1-100, default 50) |+| offset? | integer | The number of listings to skip (0-10000, default 0) |### Response@@ -269,21 +134,13 @@ A rebuild of the discovery search index does not change what this operation answ| --- | --- | --- || 200 | array[[Admin discovery listing](#admin-discovery-listing-object) object] | The page was returned |-### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_discovery_category_listings`, target type `discovery_category`, target ID `0`, and metadata keys `category_id`, `limit`, `offset`, `result_count` for the listings in this page, and `total` for every approved listing in the category.--### Rate limit--30 requests per 10 seconds for each authenticated user, on the `discovery:admin:list` bucket.+The rate limit is 30 requests per 10 seconds, on the `discovery:admin:list` bucket.## List discovery listings<RouteHeader method="GET" path="/v1/admin/discovery/listings" auditReason />-Returns every approved listing as an array of [Admin discovery listing](#admin-discovery-listing-object) objects. Requires `discovery:review`.--The response is a bare array with no guaranteed order, cursor or limit. Pending, rejected and removed applications are excluded.+Returns every approved listing as an array of [Admin discovery listing](#admin-discovery-listing-object) objects.### Response@@ -291,152 +148,80 @@ The response is a bare array with no guaranteed order, cursor or limit. Pending,| --- | --- | --- || 200 | array[[Admin discovery listing](#admin-discovery-listing-object) object] | Approved listings were returned |-### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_discovery_listings`, target type `guild`, target ID `0`, and metadata key `result_count`.--### Rate limit--30 requests per 10 seconds for each authenticated user, on the `discovery:admin:list` bucket.+The rate limit is 30 requests per 10 seconds, on the `discovery:admin:list` bucket.## Move discovery listings to a category<RouteHeader method="PATCH" path="/v1/admin/discovery/listings" auditReason />-Files every named guild under one [discovery category](/http-api/discovery/#discovery-categories) and reports how many moved. Requires `discovery:review`.+Moves the guilds in `guild_ids` to one [discovery category](/http-api/discovery/#discovery-categories). The request returns 200 even when some guilds don't move, and `failed_guild_ids` lists them.### JSON body| Field | Type | Description || --- | --- | --- |-| guild_ids<sup>1</sup> | array[snowflake] | Guilds to move, 1 through 100 entries |-| category_type | integer | [Discovery category](/http-api/discovery/#discovery-categories) of 0 through 8 to file every named guild under |--<sup>1</sup> Duplicate entries are collapsed before the move, so a guild named twice is attempted once and counted once+| guild_ids | array[snowflake] | The guilds to move (1-100) |+| category_type | integer | The category to move them to (0-8) |### Response body| Field | Type | Description || --- | --- | --- |-| updated | integer | Number of distinct guilds that were moved |-| failed_guild_ids<sup>1</sup> | array[snowflake] | Distinct guilds that were not moved |--<sup>1</sup> A guild lands here when it holds no application, when its application is rejected or removed, or when the write failed. The response does not say which. Retry the guild through [Update discovery listing](#update-discovery-listing) to read the error+| updated | integer | The number of guilds that moved |+| failed_guild_ids | array[snowflake] | The guilds that did not move |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The batch ran, whether or not every guild moved |--:::caution[Some named guilds can fail inside a 200]-Fluxer attempts the guilds one at a time and in order, and a failure does not stop the ones after it. Read `failed_guild_ids` for the guilds that did not move. The operation never returns 404.-:::--Repeating the request is safe. The operation moves a pending application the same way it moves an approved one, so this operation can refile a guild that is still awaiting review.--### Side effects--A move replaces the application's `category_type` and preserves its description, language, tags, status, and timestamps. A moved listing that is already approved appears under the new category in the next public search. No guild field changes and no Gateway Dispatch is emitted.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `update_discovery_categories`, target type `guild`, target ID `0`, and metadata keys `category_type`, `guild_count`, `updated`, and `failed`. It records the entry when every guild fails as well. The guild IDs are not recorded.+| 200 | response body | The batch ran |-### Rate limit--20 requests per 10 seconds for each authenticated user, on the `discovery:admin:action` bucket.+The rate limit is 20 requests per 10 seconds, on the `discovery:admin:action` bucket.## Update discovery listing<RouteHeader method="PATCH" path="/v1/admin/discovery/listings/{guild_id}" auditReason />-Updates the stored listing of one guild and returns the updated [discovery application](#discovery-application-object) object. Requires `discovery:review`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id<sup>1</sup> | snowflake | Guild whose application is edited |--<sup>1</sup> Despite the route path, a pending application is accepted as well as an approved listing, which lets an Admin correct the wording before approving it+Updates the listing of an approved or pending application and returns the [discovery application](/http-api/discovery/#discovery-application-object). An approved listing stays approved.### JSON body| Field | Type | Description || --- | --- | --- |-| description?<sup>1</sup> | string | Listing description of 10 through 300 characters |-| category_type? | integer | [Discovery category](/http-api/discovery/#discovery-categories) of 0 through 8 |-| primary_language?<sup>2</sup> | string | [Supported primary language](/http-api/discovery/#supported-primary-languages) code |-| custom_tags?<sup>3</sup> <sup>4</sup> | array[string] | Up to 10 [custom tags](/http-api/discovery/#custom-tags) |--<sup>1</sup> A supplied value is scanned against the instance content blocklists before the stored application is read, so a match returns 403 `CONTENT_BLOCKED` even when the guild holds no application. The scan covers banned phrases and banned URLs and domains found in the text--<sup>2</sup> A code outside the supported set fails body validation. A language is always stored, so the listing cannot be returned to having none--<sup>3</sup> A supplied array replaces the stored tags outright, so an empty array clears every tag--<sup>4</sup> Each entry is 2 through 30 characters both as submitted and after normalisation. An entry that fails that bound or the character rule fails body validation against its own index, and duplicate normalised values collapse to the first occurrence+| description? | string | The listing description (10-300 characters) |+| category_type? | integer | The category (0-8) |+| primary_language? | string | A [primary language](/http-api/discovery/#supported-primary-languages) code |+| custom_tags? | array[string] | Up to 10 [custom tags](/http-api/discovery/#custom-tags) that replace the current ones |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [discovery application](#discovery-application-object) object | Listing was updated, or the submitted values already matched the stored ones |-| 403 | [error response](/admin-api/#error-response) | The description matches a content blocklist, returned as `CONTENT_BLOCKED` |-| 404 | [error response](/admin-api/#error-response) | The guild holds no application, returned as `DISCOVERY_APPLICATION_NOT_FOUND` |-| 409 | [error response](/admin-api/#error-response) | The stored application is rejected or removed, returned as `DISCOVERY_APPLICATION_ALREADY_REVIEWED` |--### Side effects--The supplied members update the application while preserving its status, submission time, review time, review reason, and removal fields. Editing an approved listing does not return it to review. The new description, category, language, and tags appear in the next public search. Editing a pending application changes nothing a public reader can see.--No guild field changes, so no [Guild Update](/gateway/events/#guild-update) fires.+| 200 | [discovery application](/http-api/discovery/#discovery-application-object) object | The listing was updated |+| 403 | [error response](/admin-api/#error-response) | `CONTENT_BLOCKED` when the description matches a content blocklist |+| 404 | [error response](/admin-api/#error-response) | `DISCOVERY_APPLICATION_NOT_FOUND` when the guild has no application |+| 409 | [error response](/admin-api/#error-response) | `DISCOVERY_APPLICATION_ALREADY_REVIEWED` when the application is rejected or removed |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `update_discovery_listing`, target type `guild`, the guild ID as target ID, and metadata key `status` with the stored [application status](/http-api/discovery/#discovery-application-statuses). `fields` names the supplied members joined by commas and is absent for an empty body. A supplied `category_type` or `primary_language` adds a key of the same name with its value. The description and tags are not recorded.--### Rate limit--20 requests per 10 seconds for each authenticated user, on the `discovery:admin:action` bucket.+The rate limit is 20 requests per 10 seconds, on the `discovery:admin:action` bucket.## Remove discovery listing<RouteHeader method="DELETE" path="/v1/admin/discovery/listings/{guild_id}" auditReason />-Removes an approved listing from discovery, strips the guild's discoverable feature, and returns the updated [discovery application](#discovery-application-object) object. Requires `discovery:remove`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The guild whose listing is removed |+Removes an approved listing and returns the [discovery application](/http-api/discovery/#discovery-application-object). Fluxer removes the `DISCOVERABLE` feature from the guild, keeps `VISITS_ENABLED` and sends [Guild Update](/gateway/events/#guild-update). The guild has to apply again to be listed.### JSON body| Field | Type | Description || --- | --- | --- |-| reason | string | Reason stored on the application as `removal_reason`, 1 through 500 characters |--:::caution[Removal is terminal for this application]-The application moves to `removed`, and the guild can be listed again only through a new application submitted to the public [Discovery](/http-api/discovery/) resource. That submission replaces the removed record and its removal reason entirely.-:::+| reason | string | The removal reason (1-500 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [discovery application](#discovery-application-object) object | Listing was removed |-| 400<sup>1</sup> | [error response](/admin-api/#error-response) | The application is not approved, returned as `DISCOVERY_NOT_DISCOVERABLE` |-| 404 | [error response](/admin-api/#error-response) | The guild holds no application, returned as `DISCOVERY_APPLICATION_NOT_FOUND` |--<sup>1</sup> A pending application is refused this way, so rejecting it through [Review discovery application](#review-discovery-application) is the only way to close it--### Side effects--The application moves to `removed` and records the removal time, the removing Admin, and the required reason. The discoverable feature is removed from the guild, the guild stops appearing in [Search discovery guilds](/http-api/discovery/#search-discovery-guilds), and [Guild Update](/gateway/events/#guild-update) fires to every session that can observe the guild.--A removal whose guild can no longer be resolved still succeeds. Fluxer skips the feature strip and the Dispatch.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `remove_discovery_listing`, target type `guild`, the guild ID as target ID, and no metadata.--### Rate limit+| 200 | [discovery application](/http-api/discovery/#discovery-application-object) object | The listing was removed |+| 400 | [error response](/admin-api/#error-response) | `DISCOVERY_NOT_DISCOVERABLE` when the application is not approved |+| 404 | [error response](/admin-api/#error-response) | `DISCOVERY_APPLICATION_NOT_FOUND` when the guild has no application |-20 requests per 10 seconds for each authenticated user, on the `discovery:admin:action` bucket.+The rate limit is 20 requests per 10 seconds, on the `discovery:admin:action` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/enforcement.mdx b/fluxer_docs/src/content/docs/admin-api/enforcement.mdxindex 148c965e7..119bc8097 100644--- a/fluxer_docs/src/content/docs/admin-api/enforcement.mdx+++ b/fluxer_docs/src/content/docs/admin-api/enforcement.mdx@@ -6,61 +6,54 @@ description: The record behind every restriction staff apply, the notice it sendimport RouteHeader from '@/components/RouteHeader.astro';-An enforcement decision records why staff restricted an account. The route that applies the restriction records it in the same request, so a restriction never exists without its statement of reasons. [Suspend user](/admin-api/users/#suspend-user), [Warn user](/admin-api/users/#warn-user), [Limit user features](/admin-api/users/#limit-user-features) and [Schedule user deletion](/admin-api/users/#schedule-user-deletion) with a broken rule as its basis record decisions today, and so does Fluxer itself when a payment fraud signal arrives.+An enforcement decision records why staff restricted an account or community. The route that applies the restriction records the decision in the same request, and the decision sends a notice to the holder. Every route that suspends, warns, limits, closes or removes something takes a [`decision`](#enforcement-decision-input) or a [`basis`](#basis).-The decision holds the explanation. The restriction itself stays where it always was, so a suspension is still `temp_banned_until` and the `DISABLED` flag on the account, a closure is still `pending_deletion_at` and the `DELETED` flag, and a feature limit is still its account flag. The account's `enforcement_decision_id` names the suspension or closure decision behind the current state.--Every decision sends its notice to the person it is about. There is no switch to withhold it.+The restriction itself is still stored on the account, as `temp_banned_until` and the `DISABLED` flag for a suspension or `pending_deletion_at` and the `DELETED` flag for a closure. The account's `enforcement_decision_id` is the suspension or closure decision behind its current state.## Concepts| Term | Meaning || --- | --- |-| kind | What the decision did: `warning`, `suspension`, `closure`, `feature_limit`, `content_removal`, `profile_reset`, or `community_removal` |-| reason code | One of the enforcement [deletion reasons](/admin-api/users/#deletion-reasons). `USER_REQUESTED`, `OTHER` and `INACTIVITY` are refused |-| rule | The policy section the reason code points to. The notice links it |-| handling | `standard`, `protected` or `restricted`, fixed by the reason code. It decides how much detail the notice gives |-| evidence | A snapshot of the subject's own messages, or for a community the messages posted in it, taken when the decision is made |-| notes | Internal staff notes. The `X-Audit-Log-Reason` header of the request that made the decision is the first note |-| notice | The statement of reasons the holder receives by email, system DM, or at sign-in |+| subject | The account, bot or community the decision is about |+| holder | The person who gets the notice, which is the account itself, a bot's owner or a community's owner |+| kind | `warning`, `suspension`, `closure`, `feature_limit`, `content_removal`, `profile_reset` or `community_removal` |+| reason code | An enforcement [deletion reason](/admin-api/users/#deletion-reasons). Codes 1, 2, 19, 32 and 33 are refused |+| handling | `standard`, `protected` or `restricted`, set by the reason code. It decides how much detail the notice gives |+| evidence | A snapshot of the subject's messages, or for a community the messages posted in it, taken when the decision is made |+| notes | Internal staff notes. The `X-Audit-Log-Reason` header of the request is the first note |+| notice | The statement of reasons the holder gets by email, system DM or at sign-in |### Handling| Handling | Reason codes | Notice detail || --- | --- | --- |-| standard | every code not listed below | The rule, where and when it happened, and the note to the user |-| protected | 7, 10, 11, 15, 23 | The same, except that messages in direct and group conversations show the month only |-| restricted | 9, 13, 24 | The rule only. No locations and no note to the user |+| standard | Every other code | The rule, where and when it happened, and the note to the user |+| protected | 7, 10, 11, 15, 23 | The same, but messages in direct and group conversations show the month only |+| restricted | 9, 13, 24 | The rule only, with no locations and no note to the user |-A restricted reason allows only a permanent suspension and content removal, needs at least one evidence message and both confirmations, and refuses a note to the user. Its evidence keeps the message ID, channel ID, time and attachment count only.+A restricted reason allows only a permanent suspension or a content removal, and its evidence keeps only the message ID, channel ID, time and attachment count.### Lifecycle-A decision is `active` until staff end it as `lifted` or `reversed`. A temporary suspension that runs out is ended by Fluxer as `expired`, with the system user (ID 0) as `ended_by` and its end as `ended_at`. That happens when the holder next signs in or in a scheduled task that runs every six hours, whichever comes first, and sends no notice. A suspension that ended as `expired` can still be ended as `reversed`, which sends the ended notice.+A decision is `active` until staff end it as `lifted` or `reversed`. Fluxer ends a temporary suspension that ran out as `expired` when the holder next signs in, or in a task that runs every six hours. The system user (ID 0) is `ended_by`, no notice is sent, and staff can still end the decision as `reversed`.-Two states are derived when it is read and never stored:+The API computes two more states each time it returns a decision, and never stores them.- `expired`: an active suspension or feature limit whose `ends_at` has passed, before Fluxer ends it-- `replaced`: an active suspension or closure that the account's `enforcement_decision_id` no longer names, because a later decision replaced it+- `replaced`: an active suspension or closure that a later decision replaced-A replacing suspension or closure sends its own notice and no ended email for the one it replaces. A closure replaces a suspension and lifts it in the same write.+A closure replaces an active suspension and lifts it. A replaced decision gets no ended email.### Basis-Routes whose action is not always enforcement take a `basis` instead of a `decision`. Only the `enforcement` basis records a decision and sends its notice.+Routes whose action is not always enforcement take a `basis` in place of a `decision`. Only the `enforcement` basis records a decision and sends a notice.| Field | Type | Description || --- | --- | --- |-| type | string | `enforcement`, `holder_request` or `housekeeping` |+| type | string | `enforcement` (a rule was broken), `holder_request` (the holder asked) or `housekeeping` (no conduct involved) || decision?<sup>1</sup> | [enforcement decision input](#enforcement-decision-input) object | Why the subject is restricted |-<sup>1</sup> Required for the `enforcement` type and refused for the others. A bulk job takes a narrower decision, which [Bulk jobs](/admin-api/bulk-jobs/) describes--- `enforcement`: a rule was broken-- `holder_request`: the account holder or community owner asked-- `housekeeping`: nobody's conduct is involved, such as inactivity or cleanup--Each route accepts these bases:+<sup>1</sup> Required for `enforcement` and refused for the others. A bulk job takes a [narrower decision](/admin-api/bulk-jobs/)| Route | Bases || --- | --- |@@ -73,107 +66,105 @@ Each route accepts these bases:### Feature limits-Each feature limit decision limits one feature, so ending or expiring one never touches another.+Each feature limit decision limits one feature, and ending one never touches another.-- `direct_messages` sets `SPAMMER` and is allowed for reason codes 3, 6, 8, 18 and 21. It has no end.-- `reports` sets `REPORT_BANNED` and is allowed for reason code 29. It ends after 90 days by default and after at most 365.-- `purchases` sets `PURCHASE_DISABLED` and is allowed for reason codes 12 and 14. It has no end.+| Limit | Flag | Reason codes |+| --- | --- | --- |+| `direct_messages` | `SPAMMER` | 3, 6, 8, 18, 21 |+| `reports` | `REPORT_BANNED` | 29 |+| `purchases` | `PURCHASE_DISABLED` | 12, 14 |-A reports limit expires on its own. The next report from the account after `ends_at` clears `REPORT_BANNED` and is accepted. A reporter under a reports limit is still told the outcome of reports filed before the limit started.+Only a `reports` limit ends, after 90 days by default and at most 365. The next report from the account after a reports limit's `ends_at` clears `REPORT_BANNED` and is accepted.### Removals-- Content removal: [Shred user messages](/admin-api/users/#shred-user-messages) snapshots the first 50 entries as the evidence, and every entry for restricted reasons, before it queues the shred job. The entries are the evidence, so `evidence` is refused there. [Delete all user messages](/admin-api/users/#delete-all-user-messages) cannot snapshot an unbounded set first, so it refuses restricted reasons. To remove a single message for a rule, shred it.-- Profile reset: the old values of the cleared fields are saved as the evidence's `profile_values`. The cleared fields are the facts, so neither evidence nor a statement is needed.-- Community removal: the subject is the community and the owner receives the notice. Evidence must be posted in that community, and linked reports must name it. Restricted reasons are refused, because the removal deletes the content.+[Shred user messages](/admin-api/users/#shred-user-messages) snapshots the first 50 messages as evidence, or every message for a restricted reason, before it queues the job, and it refuses `evidence`. [Delete all user messages](/admin-api/users/#delete-all-user-messages) refuses restricted reasons.++A profile reset saves the old values of the cleared fields as `profile_values` and needs no evidence or statement.++A community removal has the community as its subject and sends the notice to its owner. Evidence must be posted in that community, linked reports must be about it, and restricted reasons are refused.-Removed content cannot be restored, so these decisions end only as `reversed`.+Removed content cannot be restored, and these decisions end only as `reversed`.### Reporter outcomes-A decision that resolves linked reports tells each reporter what happened to the item. `removed` covers a reported message the decision removed, a profile report met by a profile reset, and a community removal. `restricted` covers a suspension, closure or feature limit. `warned` covers a warning and is stored as such, but the reporter is told the same as for `action_taken`: that Fluxer acted on what they reported, without naming the action or saying the account was restricted. A content removal or profile reset that leaves the reported item in place leaves the report pending. A manual resolution through [Update report](/admin-api/reports/#update-report) names the outcome itself, and a duplicate takes the outcome stored on the report it repeats.+A decision that resolves linked reports tells each reporter what happened to the item.++| Outcome | Decisions |+| --- | --- |+| `removed` | A removed message, a profile reset or a community removal |+| `restricted` | A suspension, closure or feature limit |+| `warned` | A warning, and the reporter is told only that action was taken |++A content removal or profile reset that leaves the reported item in place leaves the report pending. [Update report](/admin-api/reports/#update-report) sets the outcome for a manual resolution.### Network blocks-A permanent suspension or a closure for a broken rule can also block networks the account used in the last 30 days, through `block_networks` on [Suspend user](/admin-api/users/#suspend-user) and [Schedule user deletion](/admin-api/users/#schedule-user-deletion). [List network block candidates](/admin-api/users/#list-network-block-candidates) shows which addresses qualify. The blocks last 90 days unless the request sets another length, belong to the decision, and are removed when it ends or the account's deletion runs. [Blocklists](/admin-api/blocklists/#network-blocks-from-decisions) explains how these rows relate to plain IP blocks.+A permanent suspension, or a closure for a broken rule, can block the networks the account used in the last 30 days. Set `block_networks` on [Suspend user](/admin-api/users/#suspend-user) or [Schedule user deletion](/admin-api/users/#schedule-user-deletion), and use [List network block candidates](/admin-api/users/#list-network-block-candidates) to see which addresses qualify. The blocks last 90 days unless the request sets another length, and they are removed when the decision ends. These are separate from [plain IP blocks](/admin-api/blocklists/#network-blocks-from-decisions).-Fluxer never blocks an exempt address or a special-purpose range, such as a private, shared carrier, loopback, link-local or documentation range, and lists those in `skipped_ips`. It refuses an address on which another account that is not itself suspended or closed was last active, matching IPv6 addresses by their /64, so a block never shuts out people who share a network with the account.+Fluxer never blocks an exempt address or a special-purpose range, such as a private, loopback or link-local range, and leaves an address that is already blocked as it is. It lists all of these in `skipped_ips`. It refuses an address where another account that is not suspended or closed was last active, matching IPv6 addresses by their /64.-The notice says the account's networks were blocked and until when, and never names an address. The block screen shows the rule only for rules that read safely to a bystander on the same network: spam, service abuse, disruptive automation, raids, impersonation, adult content outside 18+ spaces, graphic violence, misuse of reporting and copyright. Every other block looks exactly like a plain one.+The notice says the networks were blocked and until when, and never shows an address.-### Automated decisions and the review queue+### Review queue-A Stripe early fraud warning records a `purchases` limit with reason code 12, `automation` `automated`, `payment_at` set to the time of the payment, and the system user (ID 0) as `decided_by`. Fluxer never suspends or closes an account, or blocks its email, because of a payment signal alone. The decision is placed in the review queue until a person ends it or records a warning, suspension or closure on the same account. A won dispute ends the decision as `reversed`, with the system user as `ended_by`.+A decision with `automation` set to `automated` waits in the review queue until a person ends it or records a warning, suspension or closure on the same account. Its `decided_by` is the system user (ID 0).## Enforcement decision input-The `decision` object every restricting route takes.+Every route that records a decision takes this object as `decision`.| Field | Type | Description || --- | --- | --- || reason_code | integer | An enforcement [deletion reason](/admin-api/users/#deletion-reasons) |-| source | string | `report` when staff reviewed this after a report, `own_review` otherwise |-| automation | string | `flagged` when automated tools flagged it before staff decided, `none` otherwise |+| source | string | `report` after a report, `own_review` otherwise |+| automation | string | `flagged` when automated tools flagged it first, `none` otherwise || report_ids?<sup>1</sup> | array[snowflake] | Reports about the subject that the decision resolves (at most 20) || evidence?<sup>2</sup> | array[object] | `channel_id` and `message_id` of messages the decision relies on (at most 50) || statement?<sup>3</sup> | string | Note to the user, shown in the notice (1-500 characters) || rights_holder?<sup>4</sup> | string | The rights holder or the right concerned (1-200 characters) || confirmations?<sup>5</sup> | array[string] | `evidence_preserved` and `reports_filed_or_not_required` |-<sup>1</sup> Required when `source` is `report`. Each report must name the subject, the reported account or the reported community. Messages in a report's snapshot that the subject wrote, or that were posted in the community, become evidence too, and other messages are dropped. Pending reports are resolved as actioned and their reporters are told the [outcome](#reporter-outcomes)+<sup>1</sup> Required when `source` is `report`. Each report must be about the subject. Pending reports are resolved and their reporters told the [outcome](#reporter-outcomes). The subject's messages in each report's snapshot, or for a community the messages posted in it, become evidence too-<sup>2</sup> Every message must exist and be the subject's own, or for a community be posted in it. A message in a direct or group conversation is accepted only when a linked report covers that conversation. Attachments are kept as file name, size and type, never as files+<sup>2</sup> Every message must exist and be the subject's own, or for a community be posted in it. A message in a direct or group conversation needs a linked report that covers it-<sup>3</sup> The decision needs at least one evidence message or a statement, except for a profile reset. Restricted reasons refuse it+<sup>3</sup> The decision needs an evidence message or a statement, except for a profile reset. Restricted reasons refuse it<sup>4</sup> Required for code 31 (`COPYRIGHT`) and refused for every other code-<sup>5</sup> Both are required for restricted reasons. They are added to the first note+<sup>5</sup> Both are required for restricted reasons-The `X-Audit-Log-Reason` header is required on every route that takes a decision and becomes its first note.+The `X-Audit-Log-Reason` header is required on every route that takes a decision.### Validation-Fluxer checks ACLs before it looks anything up, so a caller without the ACL learns nothing about the messages or reports it names. Evidence needs `message:lookup`, reports need `report:view` and `report:resolve`, and `block_networks` needs `ban:ip:add` and `user:view:ip`. Each other failure is a 400 `INVALID_FORM_BODY` whose error has one of these codes.--- `ENFORCEMENT_INTERNAL_NOTE_REQUIRED`: the `X-Audit-Log-Reason` header is missing-- `ENFORCEMENT_KIND_NOT_ALLOWED`: the reason code does not allow this kind, a bot is given anything other than a suspension or closure, a restricted reason is used to delete all of an account's messages, or a self-hosted instance is given reason code 34-- `ENFORCEMENT_LIMIT_NOT_ALLOWED`: the reason code does not allow this feature limit-- `ENFORCEMENT_LIMIT_END_INVALID`: a reports limit ends in the past or more than 365 days from now, or another limit is given an end-- `ENFORCEMENT_REPORT_REQUIRED`: `source` is `report` and no report is linked-- `ENFORCEMENT_REPORT_MISMATCH`: a linked report does not exist or is about someone else-- `ENFORCEMENT_EVIDENCE_NOT_ALLOWED`: a shred is given evidence messages, because its entries are the evidence-- `ENFORCEMENT_EVIDENCE_NOT_FOUND`: an evidence message does not exist-- `ENFORCEMENT_EVIDENCE_NOT_SUBJECT`: an evidence message is not the subject's own, or not posted in the community-- `ENFORCEMENT_EVIDENCE_DM_UNREPORTED`: an evidence message is in a conversation no linked report covers-- `ENFORCEMENT_FACTS_REQUIRED`: there is no evidence message and no statement-- `ENFORCEMENT_EVIDENCE_REQUIRED`: a restricted reason has no evidence, or `remove_evidence` has nothing to remove-- `ENFORCEMENT_STATEMENT_NOT_ALLOWED`: a restricted reason has a statement-- `ENFORCEMENT_PERMANENT_REQUIRED`: a restricted reason is given a temporary suspension-- `ENFORCEMENT_CONFIRMATIONS_REQUIRED`: a restricted reason is missing a confirmation-- `ENFORCEMENT_RIGHTS_HOLDER_REQUIRED`: code 31 has no `rights_holder`-- `ENFORCEMENT_RIGHTS_HOLDER_NOT_ALLOWED`: another code has a `rights_holder`-- `ENFORCEMENT_NETWORK_BLOCK_NOT_ALLOWED`: `block_networks` is given with a temporary suspension or a closure that is not for a broken rule-- `ENFORCEMENT_NETWORK_UNKNOWN`: the account did not use an address in `block_networks` in the last 30 days-- `ENFORCEMENT_NETWORK_SHARED`: another account that is not suspended or closed was last active on an address in `block_networks`--### Order of effects--1. Fluxer validates the input and snapshots the evidence.-2. It stores the decision with `notice_status` `pending`, together with its evidence and first note.-3. It applies the restriction. A suspension writes `enforcement_decision_id` in the same account write as `temp_banned_until`, and a closure in the same write as `pending_deletion_at`. A content removal queues its shred job only now, after the evidence is stored. When this step fails, the decision is deleted and nothing is sent.-4. It resolves the linked reports.-5. It sends the notice and stores what it sent.--A failure after step 3 leaves the restriction and its decision in place with `notice_status` `pending`.+Fluxer checks ACLs before it looks anything up. Evidence needs `message:lookup`, `remove_evidence` needs `message:shred`, reports need `report:view` and `report:resolve`, and `block_networks` needs `ban:ip:add` and `user:view:ip`. Every other failure is a 400 `INVALID_FORM_BODY` with one of these codes.++- `ENFORCEMENT_INTERNAL_NOTE_REQUIRED` when the `X-Audit-Log-Reason` header is missing+- `ENFORCEMENT_KIND_NOT_ALLOWED` when the reason code does not allow this kind or action, or a bot is given anything other than a suspension or closure+- `ENFORCEMENT_LIMIT_NOT_ALLOWED` when the reason code does not allow this feature limit+- `ENFORCEMENT_LIMIT_END_INVALID` when a reports limit ends in the past or after 365 days, or another limit has an end+- `ENFORCEMENT_REPORT_REQUIRED` when `source` is `report` and no report is linked+- `ENFORCEMENT_REPORT_MISMATCH` when a linked report does not exist or is about someone else+- `ENFORCEMENT_EVIDENCE_NOT_ALLOWED` when a shred has evidence messages+- `ENFORCEMENT_EVIDENCE_NOT_FOUND` when an evidence message does not exist+- `ENFORCEMENT_EVIDENCE_NOT_SUBJECT` when an evidence message is not the subject's, or not posted in the community+- `ENFORCEMENT_EVIDENCE_DM_UNREPORTED` when an evidence message is in a conversation no linked report covers+- `ENFORCEMENT_FACTS_REQUIRED` when there is no evidence message and no statement+- `ENFORCEMENT_EVIDENCE_REQUIRED` when a restricted reason has no evidence, or `remove_evidence` has nothing to remove+- `ENFORCEMENT_STATEMENT_NOT_ALLOWED` when a restricted reason has a statement+- `ENFORCEMENT_PERMANENT_REQUIRED` when a restricted reason has a temporary suspension+- `ENFORCEMENT_CONFIRMATIONS_REQUIRED` when a restricted reason is missing a confirmation+- `ENFORCEMENT_RIGHTS_HOLDER_REQUIRED` when code 31 has no `rights_holder`+- `ENFORCEMENT_RIGHTS_HOLDER_NOT_ALLOWED` when another code has a `rights_holder`+- `ENFORCEMENT_NETWORK_BLOCK_NOT_ALLOWED` when `block_networks` is given with a temporary suspension or a closure not for a broken rule+- `ENFORCEMENT_NETWORK_UNKNOWN` when the account did not use an address in `block_networks` in the last 30 days+- `ENFORCEMENT_NETWORK_SHARED` when another unrestricted account was last active on an address in `block_networks`### Notice delivery-Suspensions and closures are sent by email only. Every other kind is also sent as a system DM. The decision records `undelivered` when no channel reaches the holder, because the account has no email address or the instance has email turned off and the kind sends no system DM. A suspension or closure that was not sent is delivered when the holder next signs in. The sign-in records `sent` with the channel `sign_in`, the request locale, the text and the time, and the appeal deadline counts from then. A bot's notice goes to its owner, and a community's to its owner.--The email subject names the kind of decision, except for a restricted reason, where it is neutral. The system DM leaves out the greeting and sign-off and shows links as Markdown links.--On a self-hosted instance the notice has no appeal section and no out-of-court redress lines, and it uses the instance's own name.+A person's suspension or closure notice is sent by email only. Every other notice, including any notice about a bot, is also sent as a system DM to the holder. `notice_status` is `undelivered` when no channel can deliver the notice. A suspension or closure notice that was not sent is delivered at the holder's next sign-in. The notice uses the instance's own name.## Enforcement decision object@@ -181,13 +172,13 @@ On a self-hosted instance the notice has no appeal section and no out-of-court r| Field | Type | Description || --- | --- | --- |-| decision_id | snowflake | The ID of the decision, which the holder quotes in an appeal |+| decision_id | snowflake | The ID of the decision || subject_type | string | `user` or `guild` || subject_id | snowflake | The ID of the account, bot or community || subject_name | ?string | The bot username or community name when the decision was made, null for a person's own account |-| recipient_user_id | ?snowflake | Who receives the notice, or null when nobody can |-| kind | string | What the decision did |-| reason_code | integer | [Deletion reason](/admin-api/users/#deletion-reasons) |+| recipient_user_id | ?snowflake | The holder, or null when there is none |+| kind | string | The [kind](#concepts) of decision |+| reason_code | integer | The [deletion reason](/admin-api/users/#deletion-reasons) || source | string | `report` or `own_review` || automation | string | `none`, `flagged` or `automated` || statement | ?string | Note to the user |@@ -211,7 +202,7 @@ On a self-hosted instance the notice has no appeal section and no out-of-court r| notice_channels | array[string] | `email`, `system_dm` and `sign_in` || notice_locale | ?string | The locale the notice was written in || notice_text | ?string | The plain text that was sent |-| notice_sent_at | ?ISO8601 timestamp | When the holder received the notice. The 60-day appeal window counts from here |+| notice_sent_at | ?ISO8601 timestamp | When the holder got the notice || expired | boolean | See [Lifecycle](#lifecycle) || replaced | boolean | See [Lifecycle](#lifecycle) |@@ -224,10 +215,10 @@ On a self-hosted instance the notice has no appeal section and no out-of-court r| notes | array[object] | Internal notes in order, each with `note_id`, `author_id`, `body` and `created_at` || evidence<sup>1</sup> | array[object] | Snapshot messages, each with `message_id`, `channel_id`, `timestamp`, `content`, `attachments` and `attachment_count` || profile_values<sup>1</sup> | ?object | Profile values before a reset |-| network_blocks<sup>2</sup> | array[object] | The decision's [network blocks](#network-blocks) that have not expired, each with `ip` and `expires_at` |-| notice | object | The notice as the holder sees it now, in English |+| network_blocks<sup>2</sup> | array[object] | The decision's unexpired [network blocks](#network-blocks), each with `ip` and `expires_at` |+| notice | object | The notice as the holder sees it, in English |-<sup>1</sup> Message content, attachment details and profile values are null without `message:lookup`. Evidence and notes are deleted a year after the decision, and the decision itself is kept+<sup>1</sup> Message content, attachment details and profile values are null without `message:lookup`. Evidence is deleted a year after the decision, and each note a year after it was written<sup>2</sup> Each `ip` is masked to its /24 or /64 without `user:view:ip`@@ -235,13 +226,13 @@ On a self-hosted instance the notice has no appeal section and no out-of-court r<RouteHeader method="GET" path="/v1/admin/enforcement-decisions" />-Lists the decisions about one account or community, newest first, without notes or evidence, or the [review queue](#automated-decisions-and-the-review-queue). Requires `enforcement:view`.+Lists the decisions about one account or community, newest first, or the [review queue](#review-queue). You need `enforcement:view`.### Query parameters| Field | Type | Description || --- | --- | --- |-| review_queue?<sup>1</sup> | boolean | List the automated decisions waiting for a person instead of one subject |+| review_queue?<sup>1</sup> | boolean | List the automated decisions waiting for a person || subject_type? | string | `user` or `guild` || subject_id? | snowflake | The ID of the account or community || limit? | integer | Maximum number of decisions (1-100, default 50) |@@ -253,7 +244,7 @@ Lists the decisions about one account or community, newest first, without notes| Field | Type | Description || --- | --- | --- |-| decisions | array[[enforcement decision](#enforcement-decision-object) object] | The decisions, without the fields only the single read returns |+| decisions | array[[enforcement decision](#enforcement-decision-object) object] | The decisions, without the fields [Get enforcement decision](#get-enforcement-decision) adds |### Response@@ -261,52 +252,28 @@ Lists the decisions about one account or community, newest first, without notes| --- | --- | --- || 200 | response body | The decisions were listed |-### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_enforcement_decisions` and the metadata keys `list` and `result_count`. A subject list has the subject as its target and `list` `subject`. The review queue has target type `enforcement_decision`, target ID 0 and `list` `review_queue`.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Get enforcement decision<RouteHeader method="GET" path="/v1/admin/enforcement-decisions/{decision_id}" />-Returns one decision with its notes, its evidence and the notice the holder sees now. Requires `enforcement:view`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| decision_id | snowflake | The ID of the decision |+Returns one decision with its notes, evidence and notice. You need `enforcement:view`.### Response| Status | Body | Condition || --- | --- | --- || 200 | [enforcement decision](#enforcement-decision-object) object | The decision was found |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_ENFORCEMENT_DECISION`, because no decision has this ID |--### Side effects+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_ENFORCEMENT_DECISION` when no decision has this ID |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `view_enforcement_decision`, target type `enforcement_decision`, and the metadata keys `decision_id` and `kind`.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Add a note to an enforcement decision<RouteHeader method="POST" path="/v1/admin/enforcement-decisions/{decision_id}/notes" auditReason />-Appends an internal note. Requires `enforcement:annotate`. Notes are staff only and never change.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| decision_id | snowflake | The ID of the decision |+Appends an internal note that staff can see and nobody can change. You need `enforcement:annotate`.### JSON body@@ -328,27 +295,33 @@ Appends an internal note. Requires `enforcement:annotate`. Notes are staff only| Status | Body | Condition || --- | --- | --- || 200 | response body | The note was added |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_ENFORCEMENT_DECISION`, because no decision has this ID |--### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `annotate_enforcement_decision`, target type `enforcement_decision`, and the metadata keys `decision_id` and `note_id`.+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_ENFORCEMENT_DECISION` when no decision has this ID |-### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## End an enforcement decision<RouteHeader method="POST" path="/v1/admin/enforcement-decisions/{decision_id}/end" auditReason />-Ends an active decision, or reverses a suspension that ended as `expired`, undoes what can be undone and emails the holder. Requires `enforcement:view` and the ACL of the route that made the decision, `user:temp_ban` for a suspension, `user:delete` for a closure, and `user:update:flags` for a warning or a feature limit, plus `ban:ip:remove` when the decision has network blocks. Returns the ended decision.+Ends an active decision, or reverses a suspension that ended as `expired`, and emails the holder. You need `enforcement:view` and the ACL of the route that made the decision, plus `ban:ip:remove` when the decision has network blocks.-### Path parameters+| Kind | ACL |+| --- | --- |+| `suspension` | `user:temp_ban` |+| `closure` | `user:delete` |+| `warning`, `feature_limit` | `user:update:flags` |+| `profile_reset` | `user:update:profile` |+| `community_removal` | `guild:delete` |-| Field | Type | Description |-| --- | --- | --- |-| decision_id | snowflake | The ID of the decision |+A `content_removal` needs `message:shred`, or `message:delete_all` when every message was removed.++| Kind | What ending it does |+| --- | --- |+| `suspension` | Clears `temp_banned_until`, `enforcement_decision_id` and `DISABLED` |+| `closure` | Cancels the deletion and clears `DELETED`, `deletion_reason_code` and `enforcement_decision_id` |+| `feature_limit` | Removes its flag unless another active decision has the same limit |++Ending any other kind changes nothing on the account. Ending a closure also unblocks the email address if the closure blocked it, and ending a suspension or closure removes its network blocks.### JSON body@@ -357,27 +330,19 @@ Ends an active decision, or reverses a suspension that ended as `expired`, undoe| outcome<sup>1</sup> | string | `lifted` or `reversed` || statement? | string | Note to the user, sent in the email (1-500 characters) |-<sup>1</sup> `lifted` ends a restriction that was correct. `reversed` says the decision was wrong. Only suspensions, closures and feature limits can be lifted. Every other kind can only be reversed, because there is nothing to lift. A suspension that ended as `expired` can only be reversed+<sup>1</sup> `lifted` ends a restriction that was correct and `reversed` says the decision was wrong. Only suspensions, closures and feature limits can be lifted, and a suspension that ended as `expired` or a suspension or closure no longer on the account can only be reversed### Response| Status | Body | Condition || --- | --- | --- || 200 | [enforcement decision](#enforcement-decision-object) object | The decision ended |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` with `ENFORCEMENT_OUTCOME_NOT_ALLOWED`, because a warning was given `lifted` |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_ENFORCEMENT_DECISION`, because no decision has this ID |-| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_DECISION_ENDED`, because the decision already ended, or ended as `expired` and was given `lifted` |-| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_DECISION_REPLACED`, because a later suspension or closure replaced this one |-| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_DELETION_STARTED`, because the deletion of a closed account has started |--### Side effects--Ending a suspension clears `temp_banned_until`, `enforcement_decision_id` and the `DISABLED` flag, and lifts the new conversation limit, as [Lift a suspension without a decision](/admin-api/users/#lift-a-suspension-without-a-decision) does for older suspensions. Ending a closure cancels the deletion, clears `DELETED`, `deletion_reason_code` and `enforcement_decision_id`, and unblocks the account's email address when the closure blocked it. Ending either removes the decision's network blocks. Ending a feature limit removes its flag unless another active decision holds the same limit, and takes the decision out of the review queue. Ending a warning changes nothing on the account.--The holder is emailed that the restriction ended or was reversed, with the statement when one is given. The ended notice of every kind except a suspension or closure is also sent as a system DM.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `end_enforcement_decision`, target type `enforcement_decision`, and the metadata keys `decision_id`, `kind`, `outcome` and `subject_id`.+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` with `ENFORCEMENT_OUTCOME_NOT_ALLOWED` when the decision cannot be lifted |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_ENFORCEMENT_DECISION` when no decision has this ID |+| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_DECISION_ENDED` when the decision already ended, or ended as `expired` and was given `lifted` |+| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_DECISION_REPLACED` when `lifted` is given for a suspension or closure that a later one replaced |+| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_DELETION_STARTED` when the deletion of a closed account has started |-### Rate limit+The holder is emailed that the restriction ended or was reversed, with the statement when one is given. Every kind except a person's suspension or closure also gets a system DM.-100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/gateway.mdx b/fluxer_docs/src/content/docs/admin-api/gateway.mdxindex 81c267f01..95e8b95c5 100644--- a/fluxer_docs/src/content/docs/admin-api/gateway.mdx+++ b/fluxer_docs/src/content/docs/admin-api/gateway.mdx@@ -1,49 +1,37 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Gateway control-description: Node statistics, per-guild memory, voice state counts, and guild reloads.+description: Read live statistics from the main Gateway cluster and reload guilds.---import RouteHeader from '@/components/RouteHeader.astro';-Gateway control is the Admin view of the running [main Gateway](/gateway/overview/) cluster. It reads live node state and submits guild reload requests, and it exposes no session, presence, or call payload.--An unanswered Gateway request returns 504 `GATEWAY_TIMEOUT`. An overloaded or unavailable cluster returns 503 `SERVICE_UNAVAILABLE`. An invalid Gateway response returns 502 `BAD_GATEWAY`.--:::note[Every value is live state]-The Gateway cluster answers each read at request time. Two consecutive reads can differ without any Admin action, and a node that is restarting can be absent from one response and present in the next.-:::+Gateway control shows live state from the running [main Gateway](/gateway/overview/) cluster and reloads guilds. When the API gets no answer from the Gateway in time, it returns 504 `GATEWAY_TIMEOUT`. It returns 503 `SERVICE_UNAVAILABLE` when the cluster is overloaded or unreachable and 502 `BAD_GATEWAY` when the answer is invalid.## Node statistics object-One snapshot of the Gateway cluster, taken across the nodes the request polled. Every top-level counter except `uptime_seconds`, `node_count`, and `status` is a plain sum over those nodes, including each member of `memory`. The `nodes` array reports each polled node on its own.+A snapshot of the whole cluster. Each count and each `memory` value is a sum over the polled nodes, and `nodes` has the same values for each node.### Structure| Field | Type | Description || --- | --- | --- || status<sup>1</sup> | string | The aggregate health of the cluster |-| sessions | integer | The connected client Gateway sessions, summed across nodes |-| session_resumes_total | integer | The total number of session resumes, summed across nodes |-| websocket_dispatches_total | integer | The total number of WebSocket dispatches, summed across nodes |-| websocket_dispatch_drops_total | integer | The total number of WebSocket dispatches dropped, summed across nodes |-| guilds | integer | The live guild processes, summed across nodes |-| presences | integer | The tracked presences, summed across nodes |-| calls | integer | The live calls, summed across nodes |-| memory | [node memory](#node-memory-object) object | The memory accounting, summed across nodes |-| process_count | integer | The Erlang processes in use, summed across nodes |-| process_limit | integer | The Erlang process ceiling, summed across nodes |-| uptime_seconds<sup>2</sup> | integer | The lowest uptime any polled node reported, in seconds |-| node_count<sup>3</sup> | integer | The number of nodes the request polled |-| nodes<sup>4</sup> | array[[gateway node](#gateway-node-object) object] | The per-node breakdown (max 1000 entries) |--<sup>1</sup> `healthy` when every polled node reported `healthy` and `degraded` when at least one did not--<sup>2</sup> The value tracks the most recently started node and drops back whenever any node restarts--<sup>3</sup> Includes nodes that did not answer--<sup>4</sup> Entries are ordered by `node_id` ascending. The node that served the request is always polled, so the array is never empty+| sessions | integer | The number of connected Gateway sessions |+| session_resumes_total | integer | The total number of session resumes |+| websocket_dispatches_total | integer | The total number of WebSocket dispatches |+| websocket_dispatch_drops_total | integer | The total number of WebSocket dispatches dropped |+| guilds | integer | The number of live guild processes |+| presences | integer | The number of tracked presences |+| calls | integer | The number of live calls |+| memory | [node memory](#node-memory-object) object | The memory accounting |+| process_count | integer | The number of Erlang processes running |+| process_limit | integer | The maximum number of Erlang processes |+| uptime_seconds | integer | The lowest uptime any polled node reported, in seconds |+| node_count | integer | The number of nodes polled, including nodes that did not answer |+| nodes | array[[gateway node](#gateway-node-object) object] | The per-node breakdown (max 1000 entries) |++<sup>1</sup> `healthy` when every polled node reported `healthy`, otherwise `degraded`.### Example@@ -61,56 +49,70 @@ One snapshot of the Gateway cluster, taken across the nodes the request polled."process_count": 92114,"process_limit": 2097152,"uptime_seconds": 84213,- "node_count": 2,- "nodes": []+ "node_count": 1,+ "nodes": [+ {+ "node_id": "fluxer-gateway-0",+ "status": "healthy",+ "sessions": 4820,+ "session_resumes_total": 1234,+ "websocket_dispatches_total": 1234567,+ "websocket_dispatch_drops_total": 123,+ "guilds": 1913,+ "presences": 4611,+ "calls": 12,+ "memory": {"total": "3221225472", "processes": "1610612736", "system": "1610612736"},+ "process_count": 92114,+ "process_limit": 2097152,+ "uptime_seconds": 84213,+ "cluster_metrics": {+ "gateway_cluster_member_count": 1,+ "gateway_cluster_discovery_resolve_failures_total": 0,+ "gateway_cluster_membership_transitions_total": {"up": 1, "down": 0},+ "gateway_node_router_owner_resolutions_total": {"self": 5120, "peer": 0}+ }+ }+ ]}```## Gateway node object-One entry for each node the request polled, including nodes that did not answer within the 10 second per-node deadline.+One node's statistics. A node that does not answer within 10 seconds is listed with status `unavailable`.### Structure| Field | Type | Description || --- | --- | --- |-| node_id<sup>1</sup> | string | The name the node reports for itself |-| status<sup>2</sup> | string | The health this node reported |-| sessions | integer | The connected client Gateway sessions on this node |-| session_resumes_total | integer | The total number of session resumes on this node |-| websocket_dispatches_total | integer | The total number of WebSocket dispatches on this node |-| websocket_dispatch_drops_total | integer | The total number of WebSocket dispatches dropped on this node |-| guilds | integer | The live guild processes on this node |-| presences | integer | The tracked presences on this node |-| calls | integer | The live calls on this node |-| memory | [node memory](#node-memory-object) object | The memory accounting for this node |-| process_count | integer | The Erlang processes in use on this node |-| process_limit | integer | The Erlang process ceiling on this node |+| node_id | string | The name the node reports for itself |+| status<sup>1</sup> | string | The health this node reported |+| sessions | integer | The number of connected Gateway sessions |+| session_resumes_total | ?integer | The total number of session resumes |+| websocket_dispatches_total | ?integer | The total number of WebSocket dispatches |+| websocket_dispatch_drops_total | ?integer | The total number of WebSocket dispatches dropped |+| guilds | integer | The number of live guild processes |+| presences | integer | The number of tracked presences |+| calls | integer | The number of live calls |+| memory | [node memory](#node-memory-object) object | The memory accounting |+| process_count | integer | The number of Erlang processes running |+| process_limit | integer | The maximum number of Erlang processes || uptime_seconds | integer | The seconds since this node started |-| cluster_metrics?<sup>3</sup> | [gateway cluster metrics](#gateway-cluster-metrics-object) object | The clustering counters of this node |--<sup>1</sup> A node reports its `HOSTNAME` environment value when that value is a non-blank string, and its Erlang node name otherwise--<sup>2</sup> `healthy` for a node that answered and `unavailable` for one that did not. A node that did not answer reports null for every counter here and contributes zero to every cluster total--<sup>3</sup> Absent for a node that did not answer+| cluster_metrics? | [gateway cluster metrics](#gateway-cluster-metrics-object) object | How this node sees the cluster, absent when the node did not answer |-A node entry can have further diagnostic members. A client treats a member it does not recognise as absent.+<sup>1</sup> `healthy` or `unavailable`. An `unavailable` node has no `cluster_metrics` and null counters.## Gateway cluster metrics object-How one node sees the Gateway cluster. Every total counts from the moment the node started, so a restart resets it to zero.+The cluster as one node sees it. Each `_total` count starts at zero when the node starts.### Structure| Field | Type | Description || --- | --- | --- |-| gateway_cluster_member_count | integer | The cluster members this node currently counts as alive |-| gateway_cluster_discovery_resolve_failures_total | integer | The times this node failed to resolve its cluster peers |-| gateway_cluster_membership_transitions_total | [membership transition counts](#membership-transition-counts-object) object | The members this node saw join and leave |-| gateway_node_router_owner_resolutions_total | [owner resolution counts](#owner-resolution-counts-object) object | Where this node routed the work it had to place |--The object can have further diagnostic members. A client treats a member it does not recognise as absent.+| gateway_cluster_member_count | integer | The number of cluster members this node sees as up |+| gateway_cluster_discovery_resolve_failures_total | integer | The number of times this node failed to resolve its peers |+| gateway_cluster_membership_transitions_total | [membership transition counts](#membership-transition-counts-object) object | The number of times this node saw a member join or leave |+| gateway_node_router_owner_resolutions_total | [owner resolution counts](#owner-resolution-counts-object) object | The number of owner lookups this node resolved to itself and to other nodes |### Membership transition counts object@@ -118,8 +120,8 @@ The object can have further diagnostic members. A client treats a member it does| Field | Type | Description || --- | --- | --- |-| up | integer | Members that joined the alive set |-| down | integer | Members that left the alive set |+| up | integer | The number of times a member joined the cluster |+| down | integer | The number of times a member left the cluster |### Owner resolution counts object@@ -127,12 +129,12 @@ The object can have further diagnostic members. A client treats a member it does| Field | Type | Description || --- | --- | --- |-| self | integer | Owner lookups that resolved to this node |-| peer | integer | Owner lookups that resolved to another node |+| self | integer | The number of owner lookups that resolved to this node |+| peer | integer | The number of owner lookups that resolved to another node |## Node memory object-Byte counts for one node, or for every polled node summed together. Each count is a decimal string because a JSON number cannot preserve a 64-bit byte count.+Byte counts for one node, or summed over all polled nodes. Each count is a decimal string.### Structure@@ -151,36 +153,28 @@ Memory and activity for one live guild.| Field | Type | Description || --- | --- | --- || node_id | string | The node that owns the guild process |-| guild_id | ?snowflake | The ID of the guild the process serves, or null when the process state has no guild ID |-| guild_name<sup>1</sup> | string | The guild name the process holds in memory |-| guild_icon | ?string | The icon hash the guild process holds in memory, or null when it has none |-| nsfw_level<sup>2</sup> | ?integer | The [NSFW level](/http-api/guilds/#nsfw-levels) resolved from stored guild data, or null when the guild could not be resolved |-| memory<sup>3</sup> | string | The bytes the guild process uses, as a decimal string |+| guild_id | ?snowflake | The ID of the guild |+| guild_name | string | The guild name in memory, or `Unknown` |+| guild_icon | ?string | The icon hash in memory |+| nsfw_level | ?integer | The [NSFW level](/http-api/guilds/#nsfw-levels), or null when the guild could not be loaded |+| memory | string | The bytes the guild process uses, as a decimal string || member_count | integer | The number of members the guild process holds || session_count | integer | The number of sessions subscribed to the guild process || presence_count | integer | The number of presences the guild process tracks |-<sup>1</sup> A process whose cached guild data has no name reports `Unknown`--<sup>2</sup> Null for a live process whose guild row could not be loaded and for a process that reports no `guild_id`--<sup>3</sup> The Erlang process memory of the guild process. Entries are ordered by it descending across the whole cluster, with ties broken by `guild_id` ascending-## Voice state count object-Cluster voice state totals, with one grouping by voice region and one by voice server.+Cluster voice state totals, grouped by voice region and by voice server.### Structure| Field | Type | Description || --- | --- | --- |-| total_voice_states<sup>1</sup> | integer | The voice states across the whole cluster |-| regions<sup>2</sup> | array[[region voice state count](#region-voice-state-count-object) object] | The counts grouped by [voice region](/admin-api/voice/#admin-voice-region-object) (max 1000 entries) |-| servers<sup>2</sup> | array[[server voice state count](#server-voice-state-count-object) object] | The counts grouped by [voice server](/admin-api/voice/#admin-voice-server-object) (max 5000 entries) |--<sup>1</sup> The sum of the totals each node reported, so it can differ from the sum of the entries in `regions` or `servers`+| total_voice_states<sup>1</sup> | integer | The number of voice states across the whole cluster |+| regions | array[[region voice state count](#region-voice-state-count-object) object] | The counts by [voice region](/admin-api/voice/#admin-voice-region-object) (max 1000 entries) |+| servers | array[[server voice state count](#server-voice-state-count-object) object] | The counts by [voice server](/admin-api/voice/#admin-voice-server-object) (max 5000 entries) |-<sup>2</sup> Entries are ordered by `voice_state_count` descending, with ties broken by identifier ascending. An identifier with no voice states is absent from the array, so every entry has a count of at least 1+<sup>1</sup> Includes voice states with no region or server, which `regions` and `servers` leave out.### Example@@ -194,33 +188,27 @@ Cluster voice state totals, with one grouping by voice region and one by voice s## Region voice state count object-One entry for each voice region that holds at least one voice state.-### Structure| Field | Type | Description || --- | --- | --- |-| region_id | string | The ID of the region the count belongs to |-| voice_state_count | integer | The voice states attributed to the region |+| region_id | string | The ID of the region |+| voice_state_count | integer | The number of voice states in the region |## Server voice state count object-One entry for each voice server that holds at least one voice state.-### Structure| Field | Type | Description || --- | --- | --- |-| server_id<sup>1</sup> | string | The ID of the server the count belongs to |-| voice_state_count | integer | The voice states attributed to the server |--<sup>1</sup> The identifier is unique only inside its region+| server_id | string | The ID of the server, unique only inside its region |+| voice_state_count | integer | The number of voice states on the server |## Get Gateway node statistics<RouteHeader method="GET" path="/v1/admin/gateway/stats" auditReason />-Returns the [node statistics](#node-statistics-object) object for the whole Gateway cluster. Requires `gateway:memory_stats`.+Returns the [node statistics](#node-statistics-object) object. Needs `gateway:memory_stats`.### Response@@ -228,27 +216,21 @@ Returns the [node statistics](#node-statistics-object) object for the whole Gate| --- | --- | --- || 200 | [node statistics](#node-statistics-object) object | Cluster state was returned |-### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `get_gateway_stats`, target type `gateway`, target ID `0`, and metadata key `node_count`.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Get guild memory statistics<RouteHeader method="GET" path="/v1/admin/gateway/memory-stats" auditReason />-Returns the heaviest live guild processes as [guild memory statistics](#guild-memory-statistics-object) objects. Requires `gateway:memory_stats`.+Returns the live guild processes that use the most memory, largest first. Needs `gateway:memory_stats`. A node that does not answer within 5 seconds adds no entries.### Query parameters| Field | Type | Description || --- | --- | --- |-| limit?<sup>1</sup> | integer | The maximum guild processes to return (100-1000, default 100) |+| limit?<sup>1</sup> | integer | The maximum number of guild processes to return (100-1000, default 100) |-<sup>1</sup> The Gateway clamps the value it acts on to 500, and each node contributes at most 100 of its own guild processes. A `limit` of 1000 returns at most 500 entries+<sup>1</sup> The Gateway returns at most 500 entries, and at most 100 from each node.### Response body@@ -262,21 +244,13 @@ Returns the heaviest live guild processes as [guild memory statistics](#guild-me| --- | --- | --- || 200 | response body | The guild processes were returned |-### Side effects--A node that does not answer within 5 seconds contributes no entries, and the request still returns 200.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_guild_memory_stats`, target type `guild`, target ID `0`, and metadata keys `limit` and `result_count` for the entries in this response.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Get voice state counts<RouteHeader method="GET" path="/v1/admin/gateway/voice-state-counts" auditReason />-Returns the [voice state count](#voice-state-count-object) object. Requires `gateway:memory_stats`.+Returns the [voice state count](#voice-state-count-object) object for every voice state in guild channels and calls. Needs `gateway:memory_stats`. A node that does not answer within 10 seconds counts as zero.### Response@@ -284,60 +258,36 @@ Returns the [voice state count](#voice-state-count-object) object. Requires `gat| --- | --- | --- || 200 | [voice state count](#voice-state-count-object) object | Counts were returned |-### Side effects--The counts cover voice states in guild channels and in calls. A node that does not answer within 10 seconds contributes zero, and the request still returns 200.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `get_voice_state_counts`, target type `gateway`, target ID `0`, and metadata keys `total_voice_states`, `region_count`, and `server_count`.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Reload Gateway guilds<RouteHeader method="POST" path="/v1/admin/gateway/reloads" auditReason />-Fetches the guild data for the supplied guilds from the database again and sends it to each live guild process and returns how many live guild processes were selected. Requires `gateway:reload_all`.+Reloads each given guild's live process from the database. Needs `gateway:reload_all`. Each reloaded guild sends [Guild Update](/gateway/events/#guild-update) to its subscribed sessions.### JSON body| Field | Type | Description || --- | --- | --- |-| guild_ids<sup>1</sup> | array[snowflake] | The guilds to reload (max 1000 entries) |--<sup>1</sup> The field is required. An empty array selects every live guild process on every active node+| guild_ids | array[snowflake] | The guilds to reload (max 1000 entries) |:::danger[An empty array reloads the whole cluster]-Sending `{"guild_ids": []}` dispatches a reload to every live guild process on every active node. Send an explicit list unless a cluster-wide reload is intended.-:::--:::note[A reload fires Guild Update]-Every reloaded guild process fires one [Guild Update](/gateway/events/#guild-update) Dispatch to each session subscribed to it. The payload is the rebuilt guild. Each process also reloads the thread state of its guild, and sessions receive [Thread List Sync](/gateway/threads/#thread-list-sync) in the cases that entry lists.+`{"guild_ids": []}` reloads every live guild process on every active node.:::### Response body| Field | Type | Description || --- | --- | --- |-| count<sup>1</sup> <sup>2</sup> | integer | The number of live guild processes selected for reload |--<sup>1</sup> A supplied guild with no live process is skipped, so the value can be lower than the number of IDs sent. An owner node that fails or does not answer within 15 seconds contributes zero+| count<sup>1</sup> | integer | The number of live guild processes selected for reload |-<sup>2</sup> Taken when the processes are selected. A selected process whose guild data cannot be fetched is still counted, so the value is an upper bound on the reloads that succeeded+<sup>1</sup> Guilds with no live process are skipped and not counted. An owner node that fails or does not answer within 15 seconds adds 0, even though its reloads can still be running.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Fluxer started a reload for every selected guild process |--### Side effects--A guild whose owner node cannot be resolved is not counted. Reloads can still be in progress when the response arrives. No guild data is changed.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `reload_guilds`, target type `guild`, target ID `0`, and metadata keys `guild_count` for the requested guilds and `reloaded` for the returned `count`.--### Rate limit+| 200 | response body | The reloads started |-5 requests per minute for each authenticated user, on the `admin:gateway:reload` bucket.+The rate limit is 5 requests per minute, on the `admin:gateway:reload` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/gift-codes.mdx b/fluxer_docs/src/content/docs/admin-api/gift-codes.mdxindex 063e1fc20..82312f652 100644--- a/fluxer_docs/src/content/docs/admin-api/gift-codes.mdx+++ b/fluxer_docs/src/content/docs/admin-api/gift-codes.mdx@@ -1,75 +1,56 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Gift codes-description: Administrative generation of one-use premium gift codes.+description: Generate one-use premium gift codes.---import RouteHeader from '@/components/RouteHeader.astro';-Admin gift code generation issues [premium](/http-api/premium/) codes in bulk, each one redeemable once and each granting a fixed span of entitlement. [Gifts](/http-api/gifts/) defines the public record of a code and its single redemption.--This resource has that one operation. No Admin operation lists, revokes, or redeems a code, or reports who redeemed one.--:::caution[A self-hosted instance needs the `mirror` premium mode]-A self-hosted instance whose [premium mode](/admin-api/instance/#premium-modes) is `everyone` answers 403 `FEATURE_NOT_AVAILABLE_SELF_HOSTED`. Body validation runs first, so it answers a body that fails validation with 400 `INVALID_FORM_BODY`. Generated codes need no payment provider.-:::+Each gift code gives [premium](/http-api/premium/) to the first account that redeems it. People redeem them through [Gifts](/http-api/gifts/).## Gift duration units-The unit and the quantity together define the span a redeemed code grants. At redemption, Fluxer adds the span to the entitlement anchor, which is the latest of the current time, the end of the redeemer's premium, and the end of any earlier gift extension. A `lifetime` code grants premium that never ends instead.+[Gifts](/http-api/gifts/#gift-object) explains how a redeemed code extends premium.| Value | Description || --- | --- |-| days | The quantity counts days added to the entitlement anchor |-| weeks | The quantity counts weeks added to the entitlement anchor |-| months<sup>1</sup> | The quantity counts calendar months added to the entitlement anchor |-| years<sup>1</sup> | The quantity counts calendar years, applied as twelve calendar months each |-| lifetime<sup>2</sup> | The code grants lifetime premium, and the quantity is ignored |--<sup>1</sup> A calendar month is added in UTC and clamped to the last day of the target month, so an anchor of 31 January extended by one month lands on 28 or 29 February--<sup>2</sup> Accepted only when generating codes. The stored code reports `duration_type` `months` with `duration_quantity` `0`, the shape every lifetime gift has, and a redeemer who already has lifetime premium cannot redeem it. Redeeming one takes no lifetime sequence number, so the redeemer's `premium_lifetime_sequence` stays null+| days | Days |+| weeks | Weeks |+| months | Calendar months |+| years | Calendar years |+| lifetime | Premium that never ends, and `duration_quantity` is ignored |## Create gift codes<RouteHeader method="POST" path="/v1/admin/gift-codes" auditReason />-Generates the requested number of unredeemed gift codes. Requires `gift_codes:generate`. Returns the complete redemption links on success.+Generates gift codes and returns their redemption links. You need `gift_codes:generate`, and the instance's [premium mode](/admin-api/instance/#premium-modes) must be `mirror`.### JSON body| Field | Type | Description || --- | --- | --- || count | integer | The number of codes to generate (1-100) |-| duration_type | string | The [gift duration unit](#gift-duration-units) the quantity is counted in |-| duration_quantity | integer | The quantity of the selected unit (1-3650), ignored for `lifetime` |+| duration_type | string | The [gift duration unit](#gift-duration-units) |+| duration_quantity | integer | The number of units (1-3650), still required but ignored for `lifetime` |### Response body| Field | Type | Description || --- | --- | --- |-| codes<sup>1</sup> | array[string] | The complete redemption links, one for each generated code, in generation order |--<sup>1</sup> Each link uses the instance's configured gift endpoint followed by `/` and the code--```json-{- "codes": [- "https://example.com/gift/aB3dEfGhIjKlMnOpQrStUvWxYz012345",- "https://example.com/gift/Zy9XwVuTsRqPoNmLkJiHgFeDcBa543210"- ]-}-```+| codes | array[string] | The redemption links, each in the form `{gift URL}/{code}` |### Response| Status | Body | Condition || --- | --- | --- || 200 | response body | The codes were generated |-| 403<sup>1</sup> | [error response](/admin-api/#error-response) | The account lacks `admin:authenticate` or `gift_codes:generate`, or the instance is self-hosted in the `everyone` premium mode |+| 403 | [error response](/admin-api/#error-response) | `FEATURE_NOT_AVAILABLE_SELF_HOSTED` when the premium mode is `everyone` |++The request records a `generate_gift_codes` [audit entry](/admin-api/#admin-audit-entry-object) without the codes.-<sup>1</sup> Returned as `MISSING_PERMISSIONS` without `admin:authenticate`, as `MISSING_ACL` with that but without `gift_codes:generate`, and as `FEATURE_NOT_AVAILABLE_SELF_HOSTED` on a self-hosted instance in the `everyone` premium mode+The rate limit is 30 requests per minute, on the `admin:code:generation` bucket.:::caution[The codes are returned once]-Reading a code back requires presenting it to [Get gift](/http-api/gifts/#get-gift), so a lost response cannot be recovered.+Save the response. No Admin API route lists or revokes the codes later. If a request fails partway, codes generated before the failure stay redeemable but aren't returned, so a retry creates additional codes.:::diff --git a/fluxer_docs/src/content/docs/admin-api/guilds.mdx b/fluxer_docs/src/content/docs/admin-api/guilds.mdxindex 04632db71..42a97b1cb 100644--- a/fluxer_docs/src/content/docs/admin-api/guilds.mdx+++ b/fluxer_docs/src/content/docs/admin-api/guilds.mdx@@ -1,24 +1,16 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Admin guilds-description: Guild search, detail, mutation, deletion, membership, expressions, and Gateway lifecycle.+description: Admin routes for finding, changing, moderating and deleting guilds.---import RouteHeader from '@/components/RouteHeader.astro';-Admin guild operations read and change the guilds the public [Guilds](/http-api/guilds/) resource exposes. None of them need membership in the guild or any guild permission.--[Archives](/admin-api/archives/) owns the archive lifecycle and the downloads.--Reads use the `admin:lookup` bucket, which permits 200 requests per minute for each authenticated user. Writes use the `admin:guild:modify` bucket, which permits 100 requests per minute for each authenticated user. [Create guild archive](#create-guild-archive) is the one write served from the read bucket.--:::danger[Guild deletion is immediate]-[Delete guild](#delete-guild) destroys the guild at once. There is no scheduled deletion, no recovery window, and no restore operation.-:::+These routes look up and change any guild without membership or guild permissions. Routes that call the Gateway return 502, 503 or 504 when the Gateway fails, is overloaded or doesn't answer.## Admin guild object-The compact guild representation returned by [List guilds](#list-guilds) and by [List user guilds](/admin-api/users/#list-user-guilds), with no channel or role state.+The short form of a guild, returned by [List guilds](#list-guilds) and [List user guilds](/admin-api/users/#list-user-guilds).### Structure@@ -26,26 +18,24 @@ The compact guild representation returned by [List guilds](#list-guilds) and by| --- | --- | --- || id | snowflake | The ID of the guild || name | string | The name of the guild |-| features | array[string] | The complete [guild feature](/http-api/guilds/#guild-features) set (at most 100) |+| features | array[string] | The [guild features](/http-api/guilds/#guild-features) (at most 100) || owner_id | snowflake | The ID of the owner || owner_username<sup>1</sup> | ?string | The username of the owner || owner_global_name<sup>1</sup> | ?string | The display name of the owner || owner_discriminator<sup>1</sup> | ?string | The owner discriminator, zero-padded to four digits |-| icon | ?string | The icon hash, or null when unset |-| banner | ?string | The banner hash, or null when unset |-| member_count<sup>2</sup> | integer | The recorded member count |+| icon | ?string | The icon hash |+| banner | ?string | The banner hash |+| member_count | integer | The number of members || nsfw_level? | integer | The [NSFW level](/http-api/guilds/#nsfw-levels) |-| nsfw | boolean | Whether the guild is flagged as adult content |+| nsfw | boolean | Whether the guild is age restricted || content_warning_level | integer | The [guild content warning level](/http-api/guilds/#guild-content-warning-levels) |-| content_warning_text | ?string | The custom content warning text, or null when unset |-| approximate_member_count?<sup>3</sup> | integer | The member count the main Gateway reports |-| approximate_presence_count?<sup>3</sup> | integer | The connected member count the main Gateway reports |+| content_warning_text | ?string | The custom content warning text |+| approximate_member_count?<sup>2</sup> | integer | The member count the Gateway reports |+| approximate_presence_count?<sup>2</sup> | integer | The number of connected members the Gateway reports |-<sup>1</sup> All are null whenever the owner account is not resolved. [List guilds](#list-guilds) never resolves it, so all are always null there+<sup>1</sup> Always null on [List guilds](#list-guilds), and null elsewhere when the owner account is missing-<sup>2</sup> A member connecting or disconnecting does not change it--<sup>3</sup> Present only on [List user guilds](/admin-api/users/#list-user-guilds) when the request sets `with_counts` to true+<sup>2</sup> Only on [List user guilds](/admin-api/users/#list-user-guilds) when `with_counts` is true### Example@@ -70,7 +60,9 @@ The compact guild representation returned by [List guilds](#list-guilds) and by## Admin guild detail object-The full guild representation returned by [Get guild](#get-guild). It embeds every channel and every role of the guild. [List guild threads](/admin-api/threads/#list-guild-threads) returns the threads.+The full guild with every channel and role, returned by [Get guild](#get-guild). Use [List guild threads](/admin-api/threads/#list-guild-threads) for threads.++The owner fields are null when the owner account doesn't exist.### Structure@@ -78,36 +70,34 @@ The full guild representation returned by [Get guild](#get-guild). It embeds eve| --- | --- | --- || id | snowflake | The ID of the guild || owner_id | snowflake | The ID of the owner |-| owner_username<sup>1</sup> | ?string | The username of the owner |-| owner_global_name<sup>1</sup> | ?string | The display name of the owner |-| owner_discriminator<sup>1</sup> | ?string | The owner discriminator, zero-padded to four digits |+| owner_username | ?string | The username of the owner |+| owner_global_name | ?string | The display name of the owner |+| owner_discriminator | ?string | The owner discriminator, zero-padded to four digits || name | string | The name of the guild (1-100 characters) |-| vanity_url_code | ?string | The custom invite code, or null when the guild owns none |-| icon | ?string | The icon hash, or null when unset |-| banner | ?string | The banner hash, or null when unset |-| splash | ?string | The invite splash hash, or null when unset |-| embed_splash | ?string | The embedded invite splash hash, or null when unset |-| features | array[string] | The complete [guild feature](/http-api/guilds/#guild-features) set (at most 100) |+| vanity_url_code | ?string | The custom invite code |+| icon | ?string | The icon hash |+| banner | ?string | The banner hash |+| splash | ?string | The invite splash hash |+| embed_splash | ?string | The embedded invite splash hash |+| features | array[string] | The [guild features](/http-api/guilds/#guild-features) (at most 100) || verification_level | integer | The [verification level](/http-api/guilds/#verification-levels) |-| mfa_level | integer | The [MFA level](/http-api/guilds/#mfa-levels) required of moderators |+| mfa_level | integer | The [MFA level](/http-api/guilds/#mfa-levels) moderators need || nsfw_level | integer | The [NSFW level](/http-api/guilds/#nsfw-levels) |-| nsfw | boolean | Whether the guild is flagged as adult content |+| nsfw | boolean | Whether the guild is age restricted || content_warning_level | integer | The [guild content warning level](/http-api/guilds/#guild-content-warning-levels) |-| content_warning_text | ?string | The custom content warning text, or null when unset |+| content_warning_text | ?string | The custom content warning text || explicit_content_filter | integer | The [explicit content filter level](/http-api/guilds/#guild-explicit-content-filter-levels) || default_message_notifications | integer | The [default message notification level](/http-api/guilds/#default-message-notification-levels) |-| afk_channel_id | ?snowflake | The voice channel idle members are moved to, or null when unset |+| afk_channel_id | ?snowflake | The voice channel idle members are moved to || afk_timeout | integer | The idle time before a member is moved, in seconds |-| system_channel_id | ?snowflake | The channel system messages are sent to, or null when they are disabled |+| system_channel_id | ?snowflake | The channel system messages are sent to || system_channel_flags | integer | The [system channel flags](/http-api/guilds/#system-channel-flags) |-| rules_channel_id | ?snowflake | The channel holding the guild rules, or null when unset |+| rules_channel_id | ?snowflake | The rules channel || disabled_operations | integer | The [disabled guild operations](/http-api/guilds/#disabled-guild-operations) bitfield |-| member_count | integer | The recorded member count |-| channels | array[[Admin guild channel](#admin-guild-channel-object) object] | Every channel in the guild except its threads |+| member_count | integer | The number of members |+| channels | array[[Admin guild channel](#admin-guild-channel-object) object] | Every channel in the guild except threads || roles | array[[Admin guild role](#admin-guild-role-object) object] | Every role in the guild |-<sup>1</sup> All are null when the owner account cannot be resolved-### Admin guild channel object#### Structure@@ -117,15 +107,13 @@ The full guild representation returned by [Get guild](#get-guild). It embeds eve| id | snowflake | The ID of the channel || name | ?string | The channel name (1-100 characters) || type | integer | The [channel type](/http-api/channels/#channel-types) |-| position | integer | The sort position within the guild |-| parent_id | ?snowflake | The parent category ID, or null when the channel is top-level |-| nsfw | ?boolean | Whether the channel is marked age restricted |-| nsfw_override | ?boolean | The age restriction set on the channel itself, or null when the channel sets none |+| position | integer | The sort position in the guild |+| parent_id | ?snowflake | The parent category ID |+| nsfw | ?boolean | Whether the channel itself is age restricted, false when it inherits |+| nsfw_override | ?boolean | The channel's own age restriction, or null when it inherits from its category or guild || content_warning_level | integer | The [content warning level](/http-api/guilds/#guild-content-warning-levels) set on the channel |-| content_warning_text | ?string | The content warning text set on the channel, or null when unset |-| url<sup>2</sup> | ?string | The external channel URL (1-2048 characters) |--<sup>2</sup> Null for every channel type that is not an external link channel+| content_warning_text | ?string | The content warning text set on the channel |+| url | ?string | The URL of a link channel (1-2048 characters), or null for other types |### Admin guild role object@@ -135,15 +123,15 @@ The full guild representation returned by [Get guild](#get-guild). It embeds eve| --- | --- | --- || id | snowflake | The ID of the role || name | string | The role name (1-100 characters) |-| color | integer | The packed RGB colour |-| position | integer | The sort position within the guild |-| permissions | string | The [permission](/http-api/permissions/) bitfield as an unsigned 64-bit decimal string |-| hoist | boolean | Whether the role is displayed separately in the member list |-| mentionable | boolean | Whether the role can be mentioned by anyone |+| color | integer | The RGB color |+| position | integer | The sort position in the guild |+| permissions | string | The [permission](/http-api/permissions/) bitfield as a decimal string |+| hoist | boolean | Whether the role shows separately in the member list |+| mentionable | boolean | Whether anyone can mention the role |## Admin guild update object-The guild state [Update guild](#update-guild) reads back after applying the request, with no channel, role, or owner identity state.+The guild after [Update guild](#update-guild) applies a change.### Structure@@ -151,28 +139,26 @@ The guild state [Update guild](#update-guild) reads back after applying the requ| --- | --- | --- || id | snowflake | The ID of the guild || name | string | The name of the guild (1-100 characters) |-| features | array[string] | The complete [guild feature](/http-api/guilds/#guild-features) set after the update (at most 100) |-| owner_id | snowflake | The ID of the owner after the update |-| icon | ?string | The icon hash, or null when unset or cleared |-| banner | ?string | The banner hash, or null when unset or cleared |-| member_count | integer | The recorded member count |+| features | array[string] | The [guild features](/http-api/guilds/#guild-features) (at most 100) |+| owner_id | snowflake | The ID of the owner |+| icon | ?string | The icon hash |+| banner | ?string | The banner hash |+| member_count | integer | The number of members || nsfw_level | integer | The [NSFW level](/http-api/guilds/#nsfw-levels) |## Admin guild expression object-A custom emoji or a sticker of a guild, with a resolvable media URL. The listings return the same shape.+A custom emoji or sticker of a guild.### Structure| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the emoji or sticker |-| name | string | The expression name (1-100 characters) |-| animated | boolean | Whether the stored image is animated |-| creator_id | snowflake | The account that uploaded the expression |-| media_url<sup>1</sup> | string | The [Media Proxy](/media-proxy/routes/) URL the expression is served from (1-2048 characters) |--<sup>1</sup> Always the WebP representation, at size 160 for an emoji and size 320 for a sticker, and the URL has the `animated=true` query parameter only when `animated` is true+| name | string | The name (1-100 characters) |+| animated | boolean | Whether the image is animated |+| creator_id | snowflake | The user who uploaded it |+| media_url | string | The WebP [Media Proxy](/media-proxy/routes/) URL of the image |### Example@@ -188,238 +174,167 @@ A custom emoji or a sticker of a guild, with a resolvable media URL. The listing## Admin guild asset purge result object-One entry of the `processed` array returned by [Purge guild assets](#purge-guild-assets).+An entry in the `processed` array of [Purge guild assets](#purge-guild-assets).### Structure| Field | Type | Description || --- | --- | --- |-| id | snowflake | The asset that was purged |-| asset_type | string | The [asset type](#asset-types) the ID resolved to |-| found_in_db<sup>1</sup> | boolean | Whether the ID matched an emoji or sticker record |-| guild_id<sup>2</sup> | ?snowflake | The guild the purged record belonged to |-| guild_nsfw_level<sup>2</sup> | ?integer | The [NSFW level](/http-api/guilds/#nsfw-levels) of that guild |--<sup>1</sup> False exactly when `asset_type` is `unknown`, in which case only the stored media was queued for removal--<sup>2</sup> Both null when `asset_type` is `unknown`, and `guild_nsfw_level` is also null when the owning guild can no longer be resolved+| id | snowflake | The ID that was purged |+| asset_type | string | The [asset type](#asset-types) |+| found_in_db | boolean | Whether the ID matched an emoji or sticker, which is false for `unknown` |+| guild_id | ?snowflake | The guild the emoji or sticker belonged to, or null for `unknown` |+| guild_nsfw_level | ?integer | The [NSFW level](/http-api/guilds/#nsfw-levels) of that guild, or null for `unknown` |## Admin guild asset purge error object-One entry of the `errors` array returned by [Purge guild assets](#purge-guild-assets).+An entry in the `errors` array of [Purge guild assets](#purge-guild-assets).### Structure| Field | Type | Description || --- | --- | --- |-| id | string | The asset that could not be purged, as supplied |-| error<sup>1</sup> | string | The reason the asset could not be purged (1-4000 characters) |--<sup>1</sup> The operation produces `Invalid numeric ID`, `Asset belongs to another guild`, and `Failed to purge asset`. Any other value is the message of the error Fluxer hit while purging that ID+| id | string | The ID as you sent it |+| error | string | Why it failed, such as `Asset belongs to another guild` |## Asset types| Value | Description || --- | --- |-| emoji | The ID resolved to a custom emoji owned by the requested guild |-| sticker | The ID resolved to a sticker owned by the requested guild |-| unknown | The ID matched no emoji or sticker, and Fluxer queued removal of any emoji and sticker media stored under that ID |--An ID owned by a different guild appears in `errors` with no asset type.+| emoji | A custom emoji of the guild |+| sticker | A sticker of the guild |+| unknown | No emoji or sticker has the ID, and Fluxer still deletes any stored image with that ID |## List guilds<RouteHeader method="GET" path="/v1/admin/guilds" auditReason />-Searches guilds through the guild search index and returns [Admin guild](#admin-guild-object) objects. Requires `guild:lookup`.--The index matches `q` against the guild name, the discovery tags, the custom invite code, and the discovery description, in that order of weight. Hits are ordered by guild creation time ascending, so the oldest matching guild is first. An empty or omitted `q` matches every indexed guild.+Searches guilds by name, discovery tags, custom invite code and discovery description, oldest first. You need `guild:lookup`.### Query parameters| Field | Type | Description || --- | --- | --- |-| q?<sup>1</sup> | string | Free-text query (1-1024 characters) |+| q?<sup>1</sup> | string | The search text (1-1024 characters). Leave it out to match every guild || limit? | integer | Maximum guilds to return (1-200, default 50) |-| offset? | integer | Guilds to skip before returning results (0-10000, default 0) |+| offset? | integer | Guilds to skip (0-10000, default 0) |-<sup>1</sup> A `q` of all decimal digits also resolves that value as an exact guild ID, but only while `offset` is 0. When the index did not return the guild with that ID, Fluxer prepends it to `guilds` and adds one to `total`+<sup>1</sup> When `q` is all digits and `offset` is 0, the guild with that ID is also returned### Response body| Field | Type | Description || --- | --- | --- || guilds | array[[Admin guild](#admin-guild-object) object] | Guilds in this page |-| total<sup>2</sup> | integer | The number of guilds the index reported for the query |--<sup>2</sup> The value can exceed the number of entries in `guilds`. Pagination advances with `offset`, and the operation returns no cursor+| total | integer | The number of matching guilds |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Guild page was returned |-| 403 | [error response](/admin-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED`, because the instance has no search backend configured |--### Side effects+| 200 | response body | The page was returned |+| 403 | [error response](/admin-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED` when the instance has no search backend |-One [Admin audit entry](/admin-api/#admin-audit-entry-object) is recorded with the action `search_guilds`, the target type `guild`, and the target ID `0`. Its metadata keys are `limit`, `offset`, `result_count` for the guilds in this page, and `total`. `has_query` is added as `true` when `q` is supplied, and the query text is not recorded. A 403 records nothing.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Get guild<RouteHeader method="GET" path="/v1/admin/guilds/{guild_id}" auditReason />-Returns one guild with its channels and roles. Requires `guild:lookup`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns a guild with its channels and roles. You need `guild:lookup`.### Response body| Field | Type | Description || --- | --- | --- |-| guild<sup>1</sup> | ?[Admin guild detail](#admin-guild-detail-object) object | The guild, or null when the ID resolves to nothing |--<sup>1</sup> A guild that does not exist answers 200 with a null guild+| guild | ?[Admin guild detail](#admin-guild-detail-object) object | The guild, or null when it doesn't exist |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | A lookup was done, whether or not it resolved |--### Side effects--One [Admin audit entry](/admin-api/#admin-audit-entry-object) is recorded with the action `get_guild`, the target type `guild`, and the requested guild ID as the target. Its metadata key `found` is `true` when the guild resolved and `false` when `guild` is null.+| 200 | response body | Always, with `guild` null when the guild doesn't exist |-### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Update guild<RouteHeader method="PATCH" path="/v1/admin/guilds/{guild_id}" auditReason />-Applies one or more field groups to a guild and returns the [Admin guild update](#admin-guild-update-object) object read back afterwards. Omitted fields are left unchanged.--This is the only way to change the owner of a guild without acting as its current owner. The public [Transfer guild ownership](/http-api/guild-members/#transfer-guild-ownership) operation requires the caller to be the owner.--Fluxer evaluates authorisation in two stages and reads the body between them. The account first needs at least one of `guild:update:name`, `guild:update:settings`, `guild:update:features`, `guild:update:vanity`, and `guild:transfer_ownership`. The validated body then selects a set of ACLs and every one of them is required, so a body with `name` and `nsfw` needs both `guild:update:name` and `guild:update:settings`. The wildcard satisfies both stages.+Changes a guild, including its owner, and returns the [Admin guild update](#admin-guild-update-object) object. You need the ACL for every group of fields you send.-- `name` selects `guild:update:name`.-- `fields`, `verification_level`, `mfa_level`, `nsfw_level`, `nsfw`, `content_warning_level`, `content_warning_text`, `explicit_content_filter`, `default_message_notifications`, and `disabled_operations` select `guild:update:settings`.-- `add_features` and `remove_features` select `guild:update:features`.-- `vanity_url_code` selects `guild:update:vanity`.-- `new_owner_id` selects `guild:transfer_ownership`.--A body with no field at all selects nothing, so an empty patch applies no change and records one `update_guild` entry.--### Path parameters+| ACL | Needed for |+| --- | --- |+| `guild:update:name` | Renaming the guild (`name`) |+| `guild:update:settings` | Clearing images and changing settings (`fields` and every field from `verification_level` to `disabled_operations`) |+| `guild:update:features` | Adding and removing features (`add_features`, `remove_features`) |+| `guild:update:vanity` | Changing the custom invite code (`vanity_url_code`) |+| `guild:transfer_ownership` | Transferring ownership (`new_owner_id`) |-| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+To change `afk_channel_id`, `system_channel_id` or `afk_timeout`, use [Modify guild](/http-api/guilds/#modify-guild).### JSON body| Field | Type | Description || --- | --- | --- |-| name? | string | The replacement name (1-100 characters) |-| vanity_url_code?<sup>1</sup> | ?string | The replacement custom invite code, or null to release the current one |-| new_owner_id?<sup>2</sup> | snowflake | The replacement owner |+| name? | string | The new name (1-100 characters) |+| vanity_url_code?<sup>1</sup> | ?string | The new custom invite code, or null to remove it |+| new_owner_id?<sup>2</sup> | snowflake | The new owner || add_features?<sup>3</sup> | array[string] | [Guild features](/http-api/guilds/#guild-features) to add (at most 100) || remove_features?<sup>3</sup> | array[string] | [Guild features](/http-api/guilds/#guild-features) to remove (at most 100) |-| fields?<sup>4</sup> | array[string] | Image fields to clear, each `icon`, `banner`, `splash`, or `embed_splash` (at most 10) |-| verification_level? | integer | The replacement [verification level](/http-api/guilds/#verification-levels) |-| mfa_level? | integer | The replacement [MFA level](/http-api/guilds/#mfa-levels) |-| nsfw_level? | integer | The replacement [NSFW level](/http-api/guilds/#nsfw-levels) |-| nsfw? | boolean | Whether the guild is flagged as adult content |-| content_warning_level? | integer | The replacement [guild content warning level](/http-api/guilds/#guild-content-warning-levels) |-| content_warning_text? | ?string | The replacement custom content warning text (at most 200 characters), or null to clear it |-| explicit_content_filter? | integer | The replacement [explicit content filter level](/http-api/guilds/#guild-explicit-content-filter-levels) |-| default_message_notifications? | integer | The replacement [default message notification level](/http-api/guilds/#default-message-notification-levels) |-| disabled_operations?<sup>5</sup> | integer | The replacement [disabled guild operations](/http-api/guilds/#disabled-guild-operations) bitfield |+| fields? | array[string] | Images to clear, each `icon`, `banner`, `splash` or `embed_splash` (at most 10) |+| verification_level? | integer | The new [verification level](/http-api/guilds/#verification-levels) |+| mfa_level? | integer | The new [MFA level](/http-api/guilds/#mfa-levels) |+| nsfw_level? | integer | The new [NSFW level](/http-api/guilds/#nsfw-levels) |+| nsfw? | boolean | Whether the guild is age restricted |+| content_warning_level? | integer | The new [guild content warning level](/http-api/guilds/#guild-content-warning-levels) |+| content_warning_text? | ?string | The new content warning text (at most 200 characters), or null to clear it |+| explicit_content_filter? | integer | The new [explicit content filter level](/http-api/guilds/#guild-explicit-content-filter-levels) |+| default_message_notifications? | integer | The new [default message notification level](/http-api/guilds/#default-message-notification-levels) |+| disabled_operations? | integer | The new [disabled guild operations](/http-api/guilds/#disabled-guild-operations) bitfield |-<sup>1</sup> Normalised to lowercase with whitespace folded to hyphens and consecutive hyphens collapsed. The normalised result is 2 to 32 characters, and a shorter or longer one is rejected with 400+<sup>1</sup> Fluxer lowercases the code and turns spaces into hyphens. The result must be 2-32 lowercase letters, digits and hyphens, and it can't start or end with a hyphen-<sup>2</sup> The operation does not confirm that the replacement account exists, and an unresolvable owner makes every `owner_` field null on later reads+<sup>2</sup> Fluxer doesn't check that the user exists-<sup>3</sup> Additions are applied before removals, so a feature named in both is removed. Any string is accepted--<sup>4</sup> The array only clears an image, and no Admin operation uploads one--<sup>5</sup> Any integer from 0 to 2147483647, stored as supplied, including bits outside the documented registry--A code already claimed by any invite is rejected with 400 `INVALID_FORM_BODY` and the validation code `THIS_VANITY_URL_IS_ALREADY_TAKEN` against `vanity_url_code`.--`afk_channel_id`, `system_channel_id`, `afk_timeout`, and `message_history_cutoff` of a guild are not Admin-writable. They change through the public [Modify guild](/http-api/guilds/#modify-guild) operation.+<sup>3</sup> A feature in both lists ends up removed. Adding `DISCOVERABLE` approves the guild's [discovery](/admin-api/discovery/) application, and removing it takes the guild out of discovery### Response body| Field | Type | Description || --- | --- | --- |-| guild | [Admin guild update](#admin-guild-update-object) object | The guild state read back after the request was applied |+| guild | [Admin guild update](#admin-guild-update-object) object | The guild after the change |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Every selected field group was applied |-| 400 | [error response](/admin-api/#error-response) | The custom invite code is malformed or already claimed |-| 403 | [error response](/admin-api/#error-response) | `MISSING_ACL`, because the account holds none of the update ACLs, or lacks an ACL a supplied field selects |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD`, because the guild does not exist |--:::caution[Field groups apply one at a time]-The groups run in a fixed order: image clears, settings, features, name, custom invite code, ownership. Each is a separate write with its own [Guild Update](/gateway/events/#guild-update) Dispatch and its own Admin audit entry. A failure part way through leaves the earlier groups applied.-:::--### Side effects--Clearing an image schedules its deletion. Replacing or clearing the custom invite code invalidates the previous invite link.--Supplying `add_features` or `remove_features` reconciles an existing discovery application. The application is approved when [DISCOVERABLE](/http-api/guilds/#guild-features) becomes present and it is not already approved, and it is marked removed when `DISCOVERABLE` becomes absent and it was approved. A guild that has never applied for [discovery](/admin-api/discovery/) gains no application.--Every applied group refreshes the guild's entry in the guild search index and fires one [Guild Update](/gateway/events/#guild-update) Dispatch to every session that can see the guild, including when the write changes no value.--Each applied group records one Admin audit entry with the target type `guild` and the guild ID as the target. A body that applies no group records one entry with action `update_guild` and no metadata instead.--- `clear_fields` records the cleared field names.-- `update_settings` records each applied setting.-- `update_features` records the added, removed, and resulting feature sets.-- `update_name` records the old and new names.-- `update_vanity` records the old and new codes.-- `transfer_ownership` records the old and new owner IDs.+| 200 | response body | The changes were applied |+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` when the custom invite code is invalid or `THIS_VANITY_URL_IS_ALREADY_TAKEN` |+| 403 | [error response](/admin-api/#error-response) | `MISSING_ACL` when you lack an ACL a field needs |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD` when the guild doesn't exist |-### Rate limit+Fluxer saves image clears, settings, features, name, custom invite code and owner one at a time in that order, and each sends a [Guild Update](/gateway/events/#guild-update) event. If one fails, the ones before it stay saved.-100 requests per minute for each authenticated user, on the `admin:guild:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:guild:modify` bucket.## Delete guild<RouteHeader method="DELETE" path="/v1/admin/guilds/{guild_id}" auditReason />-Permanently deletes a guild and every record it owns. Requires `guild:delete`. The guild becomes unavailable to every member at once, and a `guildProcessDeletion` job on the `lifecycle` lane removes its records.+Deletes a guild with its channels, messages, attachments, invites and webhooks. You need `guild:delete`. Members get [Guild Delete](/gateway/events/#guild-delete).-### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+:::danger+Deletion is immediate and can't be undone. [Create a guild archive](#create-guild-archive) first if you need the content.+:::### JSON body| Field | Type | Description || --- | --- | --- |-| basis<sup>1</sup> | [basis](/admin-api/enforcement/#basis) object | `enforcement` when a rule was broken, `holder_request` when the owner asked. `housekeeping` fails body validation |+| basis<sup>1</sup> | [basis](/admin-api/enforcement/#basis) object | `enforcement` when a rule was broken, or `holder_request` when the owner asked |-<sup>1</sup> The `enforcement` basis records a community removal [decision](/admin-api/enforcement/) before the guild is deleted and sends its notice to the owner by email and system DM. Its evidence must be posted in the guild, and its linked reports must name it. Restricted reasons are refused with `ENFORCEMENT_KIND_NOT_ALLOWED`, because the deletion destroys the content+<sup>1</sup> `enforcement` records a removal [decision](/admin-api/enforcement/) and sends the owner a notice### Response body@@ -431,89 +346,48 @@ Permanently deletes a guild and every record it owns. Requires `guild:delete`. T| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Guild was deleted |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY`, because the basis or the [decision](/admin-api/enforcement/#validation) is invalid |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD`, because the guild does not exist |--:::danger[Archive content before deleting the guild]-The guild, its channels, roles, memberships, messages, and attachments are destroyed as soon as the request is accepted. Take a [guild archive](#create-guild-archive) first when the content has to be retained.-:::+| 200 | response body | The guild was deleted |+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` when the basis or the [decision](/admin-api/enforcement/#validation) isn't valid |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD` when the guild doesn't exist |-### Side effects--Members receive [Guild Delete](/gateway/events/#guild-delete). The guild disappears from their [settings and folders](/http-api/users/settings/) and from search. Its invites, webhooks, messages, attachments and discovery application are also deleted.--One Admin audit entry is recorded with the action `delete_guild`, the target type `guild`, the guild ID in both the target and the metadata, and the `basis` metadata key. The `enforcement` basis adds `decision_id`, `reason_code`, `kind` and `notice_status`.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:guild:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:guild:modify` bucket.## List guild members<RouteHeader method="GET" path="/v1/admin/guilds/{guild_id}/members" auditReason />-Returns one page of [guild member](/http-api/guild-members/#guild-member-object) objects read from the main Gateway, without requiring membership. Requires `guild:list:members`.--:::note[Members come from the main Gateway]-A guild the main Gateway cannot load answers 404 `UNKNOWN_GUILD`.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns a page of [guild member](/http-api/guild-members/#guild-member-object) objects from the Gateway. You need `guild:list:members`.### Query parameters| Field | Type | Description || --- | --- | --- || limit? | integer | Maximum members to return (1-200, default 50) |-| offset? | integer | Members to skip before returning results (0-2147483647, default 0) |+| offset? | integer | Members to skip (0-2147483647, default 0) |### Response body| Field | Type | Description || --- | --- | --- || members | array[[guild member](/http-api/guild-members/#guild-member-object) object] | Members in this page |-| total | integer | The total member count the main Gateway reported |-| limit<sup>1</sup> | integer | The limit the operation applied |-| offset<sup>1</sup> | integer | The offset the operation applied |--<sup>1</sup> Both are echoed from the resolved query, so a request that omitted them reads back the defaults. A client advances the page by adding `limit` to `offset`+| total | integer | The number of members |+| limit | integer | The limit that was used |+| offset | integer | The offset that was used |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Member page was returned |-| 500 | [error response](/admin-api/#error-response) | The API loses its connection to the main Gateway during the call |+| 200 | response body | The page was returned |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD` when the guild doesn't exist |-A member query the main Gateway reports as failed returns 502 `BAD_GATEWAY`, an unanswered call returns 504 `GATEWAY_TIMEOUT`, and an overloaded cluster returns 503 `SERVICE_UNAVAILABLE`.--### Side effects--One [Admin audit entry](/admin-api/#admin-audit-entry-object) is recorded with the action `list_guild_members`, the target type `guild`, and the guild ID as the target. Its metadata keys are `limit` and `offset` as applied, `result_count` for the members in this page, and `total`. An error response records nothing.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Add guild member<RouteHeader method="PUT" path="/v1/admin/guilds/{guild_id}/members/{user_id}" auditReason />-Adds a user to a guild without an invite. Requires `guild:force_add_member`. The operation takes no request body.--Fluxer checks only the Admin ACL. The acting account needs no membership and no permission in the guild.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |-| user_id | snowflake | The user to add |+Adds a user to a guild without an invite, even when they're banned from it. You need `guild:force_add_member`. Adding a user who is already a member does nothing.### Response body@@ -525,291 +399,151 @@ Fluxer checks only the Admin ACL. The acting account needs no membership and no| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Member was added, or the user was already a member |-| 400 | [error response](/admin-api/#error-response) | `MAX_GUILDS` because the user is at their guild limit, or `MAX_GUILD_MEMBERS` because the guild is at its member limit |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER` because the user does not exist, or `UNKNOWN_GUILD` because the guild does not exist |--### Side effects--Fluxer creates the membership with the Admin force-add join source and restores a communication timeout still in force from a previous membership. The guild ban list is not checked, so a banned user can be admitted. The per-user guild limit and the guild member limit are still enforced.--[Guild Member Add](/gateway/events/#guild-member-add) fires to the guild, and the user's sessions are joined to the guild on the main Gateway. When the guild's members are already indexed for search, Fluxer adds the new member to guild member search. The ordinary join system message is created, and with it a [Message Create](/gateway/events/#message-create) Dispatch, unless the guild sets `SUPPRESS_JOIN_NOTIFICATIONS` or has no `system_channel_id`, or its `system_channel_id` names a channel that no longer exists. A bot target also records a `BOT_ADD` entry in the guild's own [audit log](/http-api/guild-audit-logs/#audit-actions).+| 200 | response body | The user is a member |+| 400 | [error response](/admin-api/#error-response) | `MAX_GUILDS` or `MAX_GUILD_MEMBERS` when the user or the guild is at its limit |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER` or `UNKNOWN_GUILD` when the user or the guild doesn't exist |-A user who is already a member keeps their existing membership. No membership is created, `member_count` does not change, and no Dispatch is emitted. The Admin audit entry is still written.+The guild gets [Guild Member Add](/gateway/events/#guild-member-add), and the guild's system channel shows a join message.-One Admin audit entry is recorded with the action `force_add_to_guild`, the target type `user`, the added user as the target, and the guild ID in the metadata.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:guild:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:guild:modify` bucket.## Remove guild member<RouteHeader method="DELETE" path="/v1/admin/guilds/{guild_id}/members/{user_id}" auditReason />-Removes a member from a guild without banning them and returns 204 with an empty body. Requires `guild:kick_member`.--Fluxer checks only the Admin ACL. The acting account needs no membership, no permission and no role position in the guild. Fluxer removes the member as the Fluxer system user, whose ID is `0`, and the guild owner cannot be removed.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |-| user_id | snowflake | The member to remove |+Removes a member from a guild without banning them. You need `guild:kick_member`. The guild's [audit log](/http-api/guild-audit-logs/#audit-actions) shows the Fluxer system user (ID `0`) as the moderator.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Member was removed |-| 403 | [error response](/admin-api/#error-response) | `MISSING_PERMISSIONS` because the target is the guild owner |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD` because the guild does not exist, or `UNKNOWN_MEMBER` because the target is not a member |--### Side effects--The user loses membership and disappears from guild member search. Removal from the guild removes every membership in its threads. Fluxer emits a [Thread Members Update](/gateway/threads/#thread-members-update) for each of them, as [Thread member flags](/http-api/thread-members/#thread-member-flags) states. A later rejoin restores a communication timeout that is still in force. The rejoined member starts with no nickname and no roles.--[Guild Member Remove](/gateway/events/#guild-member-remove) fires to the guild. A `MEMBER_KICK` entry is written to the guild's own [audit log](/http-api/guild-audit-logs/#audit-actions). The entry gives the Fluxer system user as the actor and has no reason, so the `X-Audit-Log-Reason` header and the acting Admin account never appear in the guild. The write fires [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create) to sessions holding [VIEW_AUDIT_LOG](/http-api/permissions/).--The removal creates no ban record, so the user can rejoin.+| 204 | empty | The member was removed |+| 403 | [error response](/admin-api/#error-response) | `MISSING_PERMISSIONS` when the user owns the guild |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD` when the guild doesn't exist, or `UNKNOWN_MEMBER` when the user isn't a member |-One Admin audit entry is recorded with the action `kick_member`, the target type `guild_member` and the removed user as the target. It names the acting Admin account and has the audit reason. Its metadata has the guild ID, the user ID and `acl` set to `guild:kick_member`.+The guild gets [Guild Member Remove](/gateway/events/#guild-member-remove).-### Rate limit--100 requests per minute for each authenticated user, on the `admin:guild:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:guild:modify` bucket.## Ban guild member<RouteHeader method="PUT" path="/v1/admin/guilds/{guild_id}/bans/{user_id}" auditReason />-Bans a user from a guild, optionally removes their recent messages, and returns 204 with an empty body. The target need not be a member. Requires `guild:ban_member`.--Fluxer checks only the Admin ACL. The acting account needs no membership, no permission and no role position in the guild. Fluxer bans the user as the Fluxer system user, whose ID is `0`, and the guild owner cannot be banned.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |-| user_id | snowflake | The user to ban |+Bans a user from a guild, whether or not they're a member, and can delete their recent messages. You need `guild:ban_member`. The guild's [audit log](/http-api/guild-audit-logs/#audit-actions) shows the Fluxer system user (ID `0`) as the moderator.### JSON body| Field | Type | Description || --- | --- | --- |-| delete_message_seconds?<sup>1</sup> | integer | The window of recent messages to delete, in seconds (0-604800) |-| delete_message_days?<sup>1</sup> | integer | The window of recent messages to delete, in days (0-7, default 0) |-| reason? | ?string | The guild ban reason (at most 512 characters). Omitting it stores no reason |-| ban_duration_seconds?<sup>2</sup> | integer | The ban duration in seconds, either exactly 0 or between 60 and 63072000 |--<sup>1</sup> `delete_message_seconds` wins when both are supplied, and `delete_message_days` is otherwise multiplied by 86400. A resolved window of 0 deletes no message+| delete_message_seconds?<sup>1</sup> | integer | How far back to delete messages, in seconds (0-604800) |+| delete_message_days?<sup>1</sup> | integer | How far back to delete messages, in days (0-7, default 0) |+| reason? | ?string | The ban reason (at most 512 characters) |+| ban_duration_seconds? | integer | How long the ban lasts, in seconds (60-63072000, or 0 for permanent, default 0) |-<sup>2</sup> Omitting the field and sending 0 both produce a permanent ban. There is no field that sets an absolute expiry timestamp+<sup>1</sup> `delete_message_seconds` wins when you send both### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | User was banned |-| 400 | [error response](/admin-api/#error-response) | Duration, reason, or message window validation fails |-| 403 | [error response](/admin-api/#error-response) | `MISSING_PERMISSIONS` because the target is the guild owner |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD` for a missing guild, `UNKNOWN_MEMBER` for the system user, or `UNKNOWN_USER` for a missing user |--:::caution[The ban can also delete messages]-A ban removes current membership and blocks later joins until its expiry or explicit removal. Messages inside the resolved deletion window are permanently deleted and are not restored when the ban ends.-:::--### Side effects--The ban record gives the Fluxer system user as `moderator_id`. It has the expiry, the reason, the target's lowercased email address, and the target's last known IP address unless that address is on the ban exemption list. While the ban exists the guild also blocks that address and that email, as described by [Guild moderation](/http-api/guild-moderation/#guild-ban-object), and removing the ban releases both.--A positive deletion window queues a background job that deletes the target's matching messages after the response, which fires [Message Delete Bulk](/gateway/events/#message-delete-bulk) as deletion progresses.+| 204 | empty | The user was banned |+| 403 | [error response](/admin-api/#error-response) | `MISSING_PERMISSIONS` when the user owns the guild |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD` or `UNKNOWN_USER` when the guild or the user doesn't exist, or `UNKNOWN_MEMBER` for the system user |-[Guild Ban Add](/gateway/events/#guild-ban-add) fires to the guild. If the target was a member, they lose access, disappear from member search, and trigger [Guild Member Remove](/gateway/events/#guild-member-remove). Removal from the guild removes every membership in its threads. Fluxer emits a [Thread Members Update](/gateway/threads/#thread-members-update) for each of them, as [Thread member flags](/http-api/thread-members/#thread-member-flags) states. A communication timeout in force at the ban is not restored on a later rejoin.+Like any [guild ban](/http-api/guild-moderation/#guild-ban-object), it also blocks the user's email address and last IP address. The guild gets [Guild Ban Add](/gateway/events/#guild-ban-add). If the user is a member, they're removed and the guild gets [Guild Member Remove](/gateway/events/#guild-member-remove).-A `MEMBER_BAN_ADD` entry is written to the guild's own [audit log](/http-api/guild-audit-logs/#audit-actions). The entry gives the Fluxer system user as the actor and has the body `reason` when one is supplied. The `X-Audit-Log-Reason` header and the acting Admin account never appear in the guild. The write fires [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create) to sessions holding [VIEW_AUDIT_LOG](/http-api/permissions/).--One Admin audit entry is recorded with the action `ban_member`, the target type `guild_member` and the banned user as the target. It names the acting Admin account and has the audit reason. Its metadata has the guild ID, the user ID, the `delete_message_days` value, `acl` set to `guild:ban_member`, and any supplied reason and duration.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:guild:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:guild:modify` bucket.## Unban guild member<RouteHeader method="DELETE" path="/v1/admin/guilds/{guild_id}/bans/{user_id}" auditReason />-Removes a guild ban and returns 204 with an empty body. Requires `guild:ban_member`. The operation takes no request body.--Fluxer checks only the Admin ACL. The acting account needs no membership and no permission in the guild. Fluxer removes the ban as the Fluxer system user, whose ID is `0`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |-| user_id | snowflake | The banned user |+Removes a guild ban and sends [Guild Ban Remove](/gateway/events/#guild-ban-remove) to the guild. You need `guild:ban_member`.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Ban was removed |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` with `USER_IS_NOT_BANNED` against `user_id`, because the user has no ban |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD` because the guild does not exist |--### Side effects--The user can join the guild again, and the guild stops blocking the email address and IP address stored on the ban. [Guild Ban Remove](/gateway/events/#guild-ban-remove) fires to the guild.--A `MEMBER_BAN_REMOVE` entry is written to the guild's own [audit log](/http-api/guild-audit-logs/#audit-actions). The entry gives the Fluxer system user as the actor and has no reason, so the `X-Audit-Log-Reason` header and the acting Admin account never appear in the guild. The write fires [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create) to sessions holding [VIEW_AUDIT_LOG](/http-api/permissions/).+| 204 | empty | The ban was removed |+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` with `USER_IS_NOT_BANNED` when the user isn't banned |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD` when the guild doesn't exist |-One Admin audit entry is recorded with the action `unban_member`, the target type `guild_member` and the unbanned user as the target. It names the acting Admin account and has the audit reason. Its metadata has the guild ID, the user ID and `acl` set to `guild:ban_member`.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:guild:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:guild:modify` bucket.## List guild emojis<RouteHeader method="GET" path="/v1/admin/guilds/{guild_id}/emojis" auditReason />-Returns every custom emoji of a guild as [Admin guild expression](#admin-guild-expression-object) objects. Requires `asset:purge`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns every custom emoji of a guild. You need `asset:purge`.### Response body| Field | Type | Description || --- | --- | --- |-| guild_id | snowflake | The guild the listing covers, echoed from the path |-| emojis<sup>1</sup> | array[[Admin guild expression](#admin-guild-expression-object) object] | Every custom emoji of the guild |--<sup>1</sup> The listing is not paginated and takes no query parameters+| guild_id | snowflake | The ID of the guild |+| emojis | array[[Admin guild expression](#admin-guild-expression-object) object] | Every custom emoji of the guild |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Emojis were returned, or the guild owns none |--The operation does not verify that the guild exists, so an unknown guild ID returns an empty listing.--### Side effects--One [Admin audit entry](/admin-api/#admin-audit-entry-object) is recorded with the action `list_guild_emojis`, the target type `guild`, and the guild ID as the target. Its metadata key `result_count` is the number of emojis returned.--### Rate limit+| 200 | response body | The emojis were returned, and the list is empty for an unknown guild |-200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## List guild stickers<RouteHeader method="GET" path="/v1/admin/guilds/{guild_id}/stickers" auditReason />-Returns every sticker of a guild as [Admin guild expression](#admin-guild-expression-object) objects. Requires `asset:purge`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns every sticker of a guild. You need `asset:purge`.### Response body| Field | Type | Description || --- | --- | --- |-| guild_id | snowflake | The guild the listing covers, echoed from the path |-| stickers<sup>1</sup> | array[[Admin guild expression](#admin-guild-expression-object) object] | Every sticker of the guild |--<sup>1</sup> The listing is not paginated and takes no query parameters+| guild_id | snowflake | The ID of the guild |+| stickers | array[[Admin guild expression](#admin-guild-expression-object) object] | Every sticker of the guild |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Stickers were returned, or the guild owns none |--The operation does not verify that the guild exists, so an unknown guild ID returns an empty listing.--### Side effects+| 200 | response body | The stickers were returned, and the list is empty for an unknown guild |-One [Admin audit entry](/admin-api/#admin-audit-entry-object) is recorded with the action `list_guild_stickers`, the target type `guild`, and the guild ID as the target. Its metadata key `result_count` is the number of stickers returned.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Purge guild assets<RouteHeader method="DELETE" path="/v1/admin/guilds/{guild_id}/assets" auditReason />-Deletes emoji and sticker records owned by a guild and queues their stored media for removal, reporting the outcome of every ID separately. Requires `asset:purge`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Deletes emojis and stickers of a guild with their images and returns a result for each ID. You need `asset:purge`. This can't be undone, and the guild gets [Guild Emojis Update](/gateway/events/#guild-emojis-update) or [Guild Stickers Update](/gateway/events/#guild-stickers-update) for each deletion.### JSON body| Field | Type | Description || --- | --- | --- |-| ids<sup>1</sup> | array[string] | Emoji and sticker IDs to delete with their media, each 1 to 64 characters (at most 100) |--<sup>1</sup> Each entry is trimmed, and Fluxer skips one that is then empty and any repeat of an entry already seen, so neither appears in `processed` or `errors`. An empty array is accepted and purges nothing+| ids | array[string] | Emoji and sticker IDs, each 1-64 characters (at most 100) |### Response body| Field | Type | Description || --- | --- | --- |-| processed | array[[Admin guild asset purge result](#admin-guild-asset-purge-result-object) object] | Assets that were purged |-| errors | array[[Admin guild asset purge error](#admin-guild-asset-purge-error-object) object] | Assets that could not be purged |+| processed | array[[Admin guild asset purge result](#admin-guild-asset-purge-result-object) object] | IDs that were purged |+| errors | array[[Admin guild asset purge error](#admin-guild-asset-purge-error-object) object] | IDs that failed |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The purge attempt completed, whether or not every ID succeeded |--The operation does not verify that the guild exists. Under an unknown guild ID, an ID that matches another guild's record lands in `errors` and every other ID is reported as `unknown`.+| 200 | response body | The purge finished, even when some IDs failed |-:::danger[Successful asset purges cannot be undone]-Every ID in `processed` loses its record and its stored media permanently. The operation still returns 200 when other IDs fail.-:::--### Side effects--A record owned by the guild in the path is deleted, and its stored media is queued for removal. The guild then receives one [Guild Emojis Update](/gateway/events/#guild-emojis-update) or [Guild Stickers Update](/gateway/events/#guild-stickers-update) Dispatch with its complete remaining expression set. A request that purges several records emits one such Dispatch per record.--A record owned by a different guild is left untouched and reported in `errors`. An ID with no record queues emoji and sticker media removal for that ID and is reported with the `unknown` asset type, so the operation also removes stored media that has no emoji or sticker record.--Every entry in `processed` records its own Admin audit entry, with the numeric ID as the target. A purged emoji records `purge_guild_emoji_asset` with the target type `guild_emoji`, a purged sticker records `purge_guild_sticker_asset` with `guild_sticker`, and an `unknown` ID records `purge_asset` with `asset`. Entries in `errors` record nothing.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:guild:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:guild:modify` bucket.## List guild audit logs<RouteHeader method="GET" path="/v1/admin/guilds/{guild_id}/audit-logs" auditReason />-Returns one page of the guild's own in-app audit log, without requiring guild membership or [VIEW_AUDIT_LOG](/http-api/permissions/). Requires `guild:audit_log:view`.--The query parameters behave the same way as in the public [List guild audit logs](/http-api/guild-audit-logs/#list-guild-audit-logs) operation, including its message deletion consolidation, except for the thread action values in `action_type`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns a page of the guild's own audit log, the same as the public [List guild audit logs](/http-api/guild-audit-logs/#list-guild-audit-logs). You need `guild:audit_log:view`.### Query parameters@@ -818,55 +552,36 @@ The query parameters behave the same way as in the public [List guild audit logs| limit? | integer | Maximum entries to return (1-100, default 50) || before?<sup>1</sup> | snowflake | Return entries older than this entry ID || after?<sup>1</sup> | snowflake | Return entries newer than this entry ID |-| user_id?<sup>2</sup> | snowflake | Return only entries recorded for this actor |-| action_type?<sup>2</sup><sup>3</sup> | integer | Return only entries with this [audit action](/http-api/guild-audit-logs/#audit-actions) value |+| user_id? | snowflake | Return only entries by this user |+| action_type?<sup>2</sup> | integer | Return only entries with this [audit action](/http-api/guild-audit-logs/#audit-actions) |-<sup>1</sup> The cursors are mutually exclusive. Supplying both fails with 400 `INVALID_FORM_BODY` and the validation code `CANNOT_SPECIFY_BOTH_BEFORE_AND_AFTER` against `before`+<sup>1</sup> Sending both fails with `INVALID_FORM_BODY` and `CANNOT_SPECIFY_BOTH_BEFORE_AND_AFTER`-<sup>2</sup> Supplying either filter disables the consolidation of consecutive message deletion entries--<sup>3</sup> The values 110, 111, and 112 return 400 `INVALID_FORM_BODY`+<sup>2</sup> The thread actions 110, 111 and 112 fail with `INVALID_FORM_BODY`### Response body| Field | Type | Description || --- | --- | --- |-| audit_log_entries | array[[guild audit log entry](/http-api/guild-audit-logs/#guild-audit-log-entry-object) object] | The returned page of audit entries |-| users | array[[partial user](/http-api/users/#partial-user-object) object] | Users referenced by the returned entries |-| webhooks | array[[audit log webhook](/http-api/guild-audit-logs/#audit-log-webhook-object) object] | Webhooks referenced by the returned entries |+| audit_log_entries | array[[guild audit log entry](/http-api/guild-audit-logs/#guild-audit-log-entry-object) object] | The entries in this page |+| users | array[[partial user](/http-api/users/#partial-user-object) object] | Users the entries mention |+| webhooks | array[[audit log webhook](/http-api/guild-audit-logs/#audit-log-webhook-object) object] | Webhooks the entries mention |-The schema also declares `threads`. This operation never returns it.+The schema also declares `threads`, which this route never returns.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Audit page was returned, or the guild has no matching entry |-| 400 | [error response](/admin-api/#error-response) | `before` and `after` were supplied together |--The operation does not verify that the guild exists, so an unknown guild ID returns an empty page.--### Side effects--The read appends no ordinary entry to the guild's own audit log. It still changes that log. Runs of consecutive message deletion entries are replaced with one bulk entry, and that replacement emits [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create), exactly as the public operation does.--One [Admin audit entry](/admin-api/#admin-audit-entry-object) is recorded with the action `list_guild_audit_logs`, the target type `guild`, and the guild ID as the target. Its metadata key `result_count` is the number of entries returned. The supplied query parameters add `limit`, `before`, `after`, `filter_user_id` for `user_id`, and `action_type`. A 400 records nothing.--### Rate limit+| 200 | response body | The page was returned, and it's empty for an unknown guild |-200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Reload guild<RouteHeader method="POST" path="/v1/admin/guilds/{guild_id}/reloads" auditReason />-Reloads a guild's state on the main Gateway. Requires `guild:reload`. The operation takes no request body.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Loads a guild again from storage on the Gateway, which also starts a stopped guild. You need `guild:reload`. Connected sessions get [Guild Update](/gateway/events/#guild-update).### Response body@@ -878,33 +593,16 @@ Reloads a guild's state on the main Gateway. Requires `guild:reload`. The operat| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Reload command completed |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD`, because the guild does not exist |-| 500 | [error response](/admin-api/#error-response) | The API loses its connection to the main Gateway during the call |--A reload the main Gateway reports as failed returns 502 `BAD_GATEWAY`, an unanswered call returns 504 `GATEWAY_TIMEOUT`, and an overloaded cluster returns 503 `SERVICE_UNAVAILABLE`.+| 200 | response body | The guild was reloaded |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD` when the guild doesn't exist |-### Side effects--The main Gateway reloads the guild's current state from storage and fires one [Guild Update](/gateway/events/#guild-update) Dispatch to every session subscribed to the guild. The reload also reloads the thread state of the guild. Sessions then receive [Thread List Sync](/gateway/threads/#thread-list-sync) in the cases that entry lists. The operation changes no guild data.--One Admin audit entry is recorded with the action `reload_guild`, the target type `guild`, and the guild ID in both the target and the metadata.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:guild:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:guild:modify` bucket.## Shut down guild<RouteHeader method="POST" path="/v1/admin/guilds/{guild_id}/shutdowns" auditReason />-Unloads a guild from the main Gateway without deleting stored data. Requires `guild:shutdown`. The operation takes no request body.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Stops a guild on the Gateway without touching stored data. You need `guild:shutdown`. Connected sessions get [Guild Delete](/gateway/events/#guild-delete) with `unavailable` true, and the Gateway reconnects them to the guild on its own, which starts it again.### Response body@@ -916,58 +614,28 @@ Unloads a guild from the main Gateway without deleting stored data. Requires `gu| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Shutdown command completed |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD`, because the guild does not exist |-| 500 | [error response](/admin-api/#error-response) | The API loses its connection to the main Gateway during the call |--A shutdown the main Gateway reports as failed returns 502 `BAD_GATEWAY`, an unanswered call returns 504 `GATEWAY_TIMEOUT`, and an overloaded cluster returns 503 `SERVICE_UNAVAILABLE`.--### Side effects--The main Gateway stops the guild process. Every session subscribed to the guild receives a [Guild Delete](/gateway/events/#guild-delete) Dispatch with `unavailable` true. One second later the main Gateway reconnects each of those sessions to the guild, which starts the guild again from stored data. Stored guild data is untouched, and [Reload guild](#reload-guild) also starts a stopped guild.--One Admin audit entry is recorded with the action `shutdown_guild`, the target type `guild`, and the guild ID in both the target and the metadata.+| 200 | response body | The guild was stopped |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD` when the guild doesn't exist |-### Rate limit--100 requests per minute for each authenticated user, on the `admin:guild:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:guild:modify` bucket.## Create guild archive<RouteHeader method="POST" path="/v1/admin/guilds/{guild_id}/archives" auditReason />-Queues an asynchronous archive of the guild's channels, threads, messages, members, roles, and settings, and returns the created [archive](/admin-api/archives/#archive-object) object. Requires `archive:trigger:guild`.--Archive status and downloads are read through [Archives](/admin-api/archives/).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Starts building an archive of a guild's channels, messages, members, roles and settings. You need `archive:trigger:guild`. Check progress and download it through [Archives](/admin-api/archives/).### JSON body| Field | Type | Description || --- | --- | --- |-| include_attachments? | boolean | Whether uploaded files are included in the archive (default false) |+| include_attachments? | boolean | Whether to include uploaded files (default false) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [archive](/admin-api/archives/#archive-object) object | Archive was created and queued |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD`, because the guild does not exist |-| 500 | [error response](/admin-api/#error-response) | Archive creation or queueing fails |--### Side effects--The archive record is created with the acting Admin account as `requested_by`, a `progress_percent` of 0, a `progress_step` of `Queued`, and an `expires_at` that is never extended. The archive is built after the response is returned. A client reads progress through [Get archive](/admin-api/archives/#get-archive).--The operation emits no Gateway Dispatch.--One [Admin audit entry](/admin-api/#admin-audit-entry-object) is recorded with the action `trigger_guild_archive`, the target type `guild`, and the guild ID as the target. Its metadata keys are `archive_id` for the new archive and `include_attachments`, which is `true` or `false`.--### Rate limit+| 200 | [archive](/admin-api/archives/#archive-object) object | The archive was queued |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_GUILD` when the guild doesn't exist |-200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/index.mdx b/fluxer_docs/src/content/docs/admin-api/index.mdxindex 41052da84..de9a8cbca 100644--- a/fluxer_docs/src/content/docs/admin-api/index.mdx+++ b/fluxer_docs/src/content/docs/admin-api/index.mdx@@ -1,126 +1,181 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Admin API overview-description: Admin credentials, ACL evaluation, audit entries, and the shared error contract.+description: Admin credentials, ACLs, the Admin audit log and the shared error format.---import RouteHeader from '@/components/RouteHeader.astro';-The Admin API is the privileged surface for administering an instance: its accounts, guilds, messages, and configuration. Every route sits below `/v1/admin` and shares the JSON framing and error envelope of the [HTTP API](/http-api/). It applies its own credential policy, [ACL evaluation](#acl-evaluation), and rate limit buckets.+The Admin API lets you manage accounts, guilds, messages and configuration on your instance. Every route is under `/v1/admin` and uses the same JSON format and [error response](#error-response) as the [HTTP API](/http-api/). It has its own [credentials](#authentication), [ACLs](#acl-evaluation) and rate limits.## Authentication-Every Admin operation accepts a user session token as a bare `Authorization` value, an access token issued by Fluxer's built-in Admin OAuth2 application as `Bearer <token>`, or an Admin API key as `Admin <token>`. Fluxer resolves a value in the user session token form as a session token even under the `Bearer` prefix. [HTTP authentication](/authentication/) defines the credential syntax.+Send one of these credentials in the `Authorization` header. [Authentication](/authentication/) has the token formats.-Fluxer evaluates the credential in a fixed order.--1. A request that resolves no account is refused with 401 `UNAUTHORIZED`.-2. A credential presented with the `Bot` scheme is refused with 401 `UNAUTHORIZED`.-3. Any access token issued to an OAuth2 application other than the built-in Admin application is refused with 403 `ACCESS_DENIED`.-4. An account holding neither `admin:authenticate` nor the wildcard `*` is refused with 403 `MISSING_PERMISSIONS`.-5. An account that passes every check above but satisfies none of the [ACLs](#acl-evaluation) the operation names is refused with 403 `MISSING_ACL`.--:::caution[A denial names no requirement]-The `MISSING_ACL` body is a fixed sentence with no ACL name and no requirement list, so a denial never says which requirement failed.-:::--No Admin operation declares an OAuth2 scope, an MFA requirement, or a sudo requirement, so none consumes the `X-Fluxer-Sudo-Mode-JWT` header. An accepted credential together with the required ACLs is the complete authorisation boundary.+| Credential | Header value |+| --- | --- |+| User session token | The token with no prefix |+| Admin OAuth2 access token | `Bearer` and the token, issued by the built-in Admin OAuth2 application |+| Admin API key | `Admin` and the token |-An Admin API key authenticates as the account that created it, and Fluxer reads it only on a path below `/v1/admin`. A request presenting a key on any other path is treated as a request with no credential. Fluxer authorises a key-authenticated request twice. The key's own ACL set must satisfy the operation, and unless the owning account holds `*` that account must itself hold one of the ACLs the operation names. When an ACL is removed from a key, or from the account that owns the key, the key no longer passes a check for that ACL on its next request. The key does not need to be rotated.+The account needs `admin:authenticate` or `*`. The API refuses bot tokens and access tokens from any other OAuth2 application. No Admin route needs an OAuth2 scope, MFA or sudo mode.-Admin authorisation runs before request validation on every operation except [Queue bulk job](/admin-api/bulk-jobs/#queue-bulk-job), whose body is validated first because its ACL is selected from that body. An account lacking the required ACL is therefore refused with 403 even when its query string or body is also malformed.+An [Admin API key](/admin-api/api-keys/) acts as the account that created it and only works on paths under `/v1/admin`. A request made with a key needs one of the route's ACLs on the key and one on the account that owns it, unless that account has `*`. Removing an ACL from the key or its owner takes effect on the next request.## ACL evaluation-An operation names one or more ACLs and admits the request when the caller holds at least one of them. The wildcard `*` satisfies every requirement on its own.--Where an operation stacks several requirements, Fluxer evaluates each separately and the caller must satisfy all of them. [List users](/admin-api/users/#list-users) is one example and stacks `user:view:email` or `user:view:ip` on top of `user:lookup` when a request uses a selector that needs one.--The effective ACL set of a session or an Admin OAuth2 bearer credential is the set stored on the account. The effective set of an Admin API key is the set stored on the key, subject to the owner check above. [Set user ACLs](/admin-api/users/#set-user-acls) writes an account's set. Holding `admin:authenticate` or `*` is the whole definition of an account that can reach the Admin API.--The operations below derive their required ACLs from the validated request body.--[Update guild](/admin-api/guilds/#update-guild) maps each present body field to one ACL and requires every ACL in that set.+Each route needs one or more ACLs, and the caller needs at least one of them. The wildcard `*` satisfies every ACL, including ones added later. Some routes need extra ACLs depending on the request, such as `user:view:email` on [List users](/admin-api/users/#list-users) when you filter by email, and you need every one of those.-- `name` maps to `guild:update:name`.-- `vanity_url_code` maps to `guild:update:vanity`.-- `new_owner_id` maps to `guild:transfer_ownership`.-- `add_features` and `remove_features` map to `guild:update:features`.-- `fields` together with every remaining setting maps to `guild:update:settings`.+[Update guild](/admin-api/guilds/#update-guild) and [Queue bulk job](/admin-api/bulk-jobs/#queue-bulk-job) need a different ACL depending on what the request body changes.-A body with none of those fields resolves to no ACL at all and applies no change. The route also names those ACLs as an ordinary any-of requirement, evaluated before the body is read.+[Set user ACLs](/admin-api/users/#set-user-acls), [Create Admin API key](/admin-api/api-keys/#create-admin-api-key) and [Update Admin API key](/admin-api/api-keys/#update-admin-api-key) only accept values from the [ACL registry](#acl-registry). You can only grant ACLs you have yourself, and trying to grant any other ACL returns 403 `MISSING_ACL`. An account with `*` can grant any ACL.-[Queue bulk job](/admin-api/bulk-jobs/#queue-bulk-job) maps its `task` discriminator to one ACL and requires that one.--- `update_user_flags` maps to `bulk:update:user_flags`.-- `update_guild_features` maps to `bulk:update:guild_features`.-- `add_guild_members` maps to `bulk:add:guild_members`.-- `schedule_user_deletion` maps to `bulk:delete:users`.--Fluxer checks each ACL an Admin grants against the ACLs that Admin holds. [Set user ACLs](/admin-api/users/#set-user-acls) and [Create Admin API key](/admin-api/api-keys/#create-admin-api-key) both refuse to write an ACL the acting Admin does not itself hold, with 403 `MISSING_ACL`. A wildcard holder is exempt. Set user ACLs also refuses the acting Admin's own account with 403 `ACCESS_DENIED`, and it looks up the target account before it checks the granted ACLs, so an unknown ID fails first with 404 `UNKNOWN_USER`.+## ACL registry-[Set user ACLs](/admin-api/users/#set-user-acls), [Create Admin API key](/admin-api/api-keys/#create-admin-api-key), and [Update Admin API key](/admin-api/api-keys/#update-admin-api-key) each accept at most 106 ACLs and validate every entry against the registry, so a value outside it returns 400 `INVALID_FORM_BODY`.+[List ACLs](#list-acls) returns these values in this order. Expect values that aren't in this table.-:::caution[`*` satisfies every present and future ACL]-A key whose owning account holds `*` skips the owner check. An Admin holding `*` can grant any ACL.-:::+| Value | Description |+| --- | --- |+| * | Satisfies every Admin permission, including permissions introduced later |+| acl:set:user | Replaces the Admin ACL set held by an account |+| admin_api_key:manage | Creates, reads, renames and revokes [Admin API keys](/admin-api/api-keys/) |+| application:lookup | Reads [Admin application](/admin-api/applications/) resources and lists the applications whose bots are in a guild |+| application:list:by_owner | Lists the applications one account owns |+| application:transfer_ownership | Transfers OAuth2 application ownership |+| archive:trigger:guild | Creates and reads guild [archives](/admin-api/archives/) |+| archive:trigger:user | Creates and reads user archives |+| archive:view_all | Reads and downloads archives |+| asset:purge | Reads a guild's emojis and stickers, and purges guild media assets |+| audit_log:view | Reads the [Admin audit log](#admin-audit-entry-object) |+| admin:authenticate | Lets the account use the Admin API, and is enough for [List ACLs](#list-acls) and [Get current Admin user](/admin-api/users/#get-current-admin-user) |+| jobs:view | Reads background [job](/admin-api/jobs/) state |+| jobs:cancel | Requests background job cancellation |+| ban:email:add | Adds and updates `email` [blocklist](/admin-api/blocklists/) entries |+| ban:email:check | Reads the `email` blocklist |+| ban:email:remove | Removes `email` blocklist entries |+| ban:phrase:add | Adds and updates `phrase` blocklist entries |+| ban:phrase:check | Reads the `phrase` blocklist |+| ban:phrase:remove | Removes `phrase` blocklist entries |+| ban:ip:add | Adds and updates `ip` blocklist entries |+| ban:ip:check | Reads the `ip` blocklist |+| ban:ip:remove | Removes `ip` blocklist entries |+| ban:url:add | Adds and updates `url` blocklist entries |+| ban:url:check | Reads the `url` blocklist |+| ban:url:remove | Removes `url` blocklist entries |+| ban:url_domain:add | Adds and updates `url-domain` blocklist entries |+| ban:url_domain:check | Reads the `url-domain` blocklist |+| ban:url_domain:remove | Removes `url-domain` blocklist entries |+| ban:file_sha:add | Adds and updates `file-sha` blocklist entries |+| ban:file_sha:check | Reads the `file-sha` blocklist |+| ban:file_sha:remove | Removes `file-sha` blocklist entries |+| ban:avatar_hash:add | Adds and updates `avatar-hash` blocklist entries |+| ban:avatar_hash:check | Reads the `avatar-hash` blocklist |+| ban:avatar_hash:remove | Removes `avatar-hash` blocklist entries |+| ban:profile_substring:add | Adds and updates `profile-substring` blocklist entries |+| ban:profile_substring:check | Reads the `profile-substring` blocklist |+| ban:profile_substring:remove | Removes `profile-substring` blocklist entries |+| bulk:add:guild_members | Queues the bulk guild member addition task |+| bulk:delete:users | Queues the bulk account deletion task |+| bulk:delete:user_messages | Queues the bulk message deletion task |+| bulk:update:guild_features | Queues the bulk guild feature task |+| bulk:update:user_flags | Queues the bulk account flag task |+| discovery:remove | Removes a guild from [discovery](/admin-api/discovery/) |+| discovery:review | Reads, reviews and edits discovery applications, categories and listings |+| enforcement:annotate | Adds notes to [enforcement decisions](/admin-api/enforcement/) |+| enforcement:view | Reads [enforcement decisions](/admin-api/enforcement/). Ending one needs this ACL plus the ACL for its kind |+| gateway:memory_stats | Reads main [Gateway](/admin-api/gateway/) statistics, memory statistics and voice state counts |+| gateway:reload_all | Reloads guilds across the main Gateway |+| gift_codes:generate | Generates [gift codes](/admin-api/gift-codes/) |+| guild:audit_log:view | Reads a guild's ordinary audit log |+| guild:ban_member | Bans a guild member and removes a guild ban |+| guild:delete | Deletes a guild |+| guild:force_add_member | Adds an account to a guild |+| guild:kick_member | Removes a guild member |+| guild:list:members | Reads guild member resources |+| guild:lookup | Reads and searches Admin [guild](/admin-api/guilds/) resources, lists the [threads](/admin-api/threads/#list-guild-threads) of a guild, and queues and reads [search index](/admin-api/search-indexes/) rebuilds |+| guild:reload | Reloads one guild on the main Gateway |+| guild:shutdown | Stops one guild on the main Gateway |+| guild:transfer_ownership | Transfers guild ownership |+| guild:update:features | Adds and removes guild features |+| guild:update:name | Updates a guild name |+| guild:update:settings | Updates general guild settings and clears guild fields |+| guild:update:vanity | Updates a guild custom invite code |+| instance:config:update | Updates [instance](/admin-api/instance/) configuration and branding, tests SMTP, manages registration URLs and migrates SSO subjects |+| instance:config:view | Reads instance configuration |+| instance:limit_config:update | Replaces the instance-wide limit configuration |+| instance:limit_config:view | Reads the instance-wide limit configuration |+| message:delete_all | Queues deletion of every message one account sent, and deletes a [thread](/admin-api/threads/#delete-thread) |+| message:delete | Deletes one message |+| message:lookup | Reads, browses and searches [messages](/admin-api/messages/) through the Admin API |+| message:shred | Queues an explicit message shred job and reads its state |+| registration:review | Reads and decides [pending registrations](/admin-api/instance/#list-pending-registrations) |+| report:delete | Deletes a [report](/admin-api/reports/#delete-report) with its stored evidence |+| report:resolve | Updates and resolves [reports](/admin-api/reports/), adds notes to them and places legal holds on them |+| report:view | Reads and searches reports and their notes |+| report:view:reporter_pii | Unredacts the contact fields a reporter supplied |+| system_dm:send | Sends an official direct message from the instance to one or many accounts |+| user:cancel:bulk_message_deletion | Cancels the bulk message deletion an account scheduled for itself |+| user:create:password_reset_link | Creates a password reset link on an instance where members sign in with a username |+| user:delete:recovery_kit | Revokes a recovery kit on an instance where members sign in with a username |+| user:delete | Schedules or cancels account deletion |+| user:list:dm_channels | Reads a user's direct message and group direct message channels |+| user:list:guilds | Reads a user's guild memberships |+| user:list:relationships | Reads a user's relationships |+| user:list:sessions | Reads a user's login sessions |+| user:lookup | Reads and searches the base Admin [user](/admin-api/users/) resource |+| user:remove:relationship | Removes one relationship or every relationship in one category |+| user:view:contact_log | Reads a user's identity and contact change log |+| user:view:dob | Unredacts user dates of birth |+| user:view:email | Unredacts user email addresses and email verification state |+| user:view:ip | Unredacts the last active IP address and the location derived from it |+| user:temp_ban | Suspends accounts and lifts suspensions |+| user:update:bot_status | Updates bot and system account state |+| user:update:dob | Updates dates of birth |+| user:update:email | Updates the email address, verifies it, resends verification, sends a password reset and binds SSO subjects |+| user:update:flags | Updates account flags and premium flags, and ends every login session of an account |+| user:update:mfa | Reads and removes a user's WebAuthn credentials, and removes MFA state |+| user:update:profile | Clears profile fields |+| user:update:traits | Replaces account traits |+| user:update:username | Updates usernames and discriminators |+| voice:region:create | Creates [voice](/admin-api/voice/) regions |+| voice:region:delete | Deletes voice regions |+| voice:region:list | Reads voice regions |+| voice:region:update | Updates voice regions |+| voice:server:create | Registers a voice server in a region |+| voice:server:delete | Deletes a registered voice server |+| voice:server:list | Reads registered voice servers |+| voice:server:update | Updates a registered voice server |-The [ACL registry](#acl-registry) below lists every value the instance recognises.+An ACL that unredacts a field doesn't give access to any route by itself. It only adds that field to responses you can already get.## Admin audit entry object-An Admin audit entry records one Admin action against one target.--Every Admin operation records at least one entry, reads included. Five reads are the exception and record nothing. They are [Get current Admin user](/admin-api/users/#get-current-admin-user), [List jobs](/admin-api/jobs/#list-jobs), [List active jobs](/admin-api/jobs/#list-active-jobs), [Get job](/admin-api/jobs/#get-job), and [Get search index refresh](/admin-api/search-indexes/#get-search-index-refresh). Each Admin resource page states, per operation, what its entry stores, and names the requests that change nothing and so record nothing, such as a purge whose every ID fails.--A read records its entry after the data is loaded and before the response is sent. A read that returns 200 with no match still records one. A read entry stores identifiers, filter values from a fixed set, counts, and whether a free-text query was supplied. It never stores query text, email addresses, IP addresses, blocklist values, or other free-form input.+An Admin audit entry records one Admin action against one target. Almost every Admin route records an entry, reads included. A request refused by authentication, ACLs, rate limits or validation records nothing.-An entry is a read entry when its action is one of the [read actions](#read-actions), and a write entry otherwise. The `access` field reports which, and the `access` query parameter of [List audit log entries](#list-audit-log-entries) filters on it.--A request refused by authentication, ACL evaluation, rate limiting, or path, query, or body validation records nothing.--Fluxer can record more than one entry for one request. [Update guild](/admin-api/guilds/#update-guild) records one entry for each mapped field group it applies. A bulk job records a `queue_bulk_job` entry when it is queued and one summary entry when it finishes, both with the creating Admin and that request's audit reason. The `update_user_flags`, `update_guild_features`, and `schedule_user_deletion` tasks also record one ordinary entry for each account or guild the worker changes, with `audit_log_reason` null.--An entry stores an acting Admin, a target type, a target ID, an action name, an optional audit reason, and a string metadata map. Fluxer fills every other field of the entry when the entry is read.+Read entries store IDs, filters and counts, never query text, email addresses, IP addresses or other free-form input.### Structure| Field | Type | Description || --- | --- | --- || log_id | snowflake | The ID of the audit entry |-| admin_user_id | snowflake | The ID of the account that performed the action |-| admin_user<sup>1</sup> | ?[Admin user summary](#admin-user-summary-object) object | The resolved acting Admin, or null when the account no longer resolves |-| target_type | string | The [audit target type](#audit-target-types) the entry was recorded against (1-256 characters) |-| target_id<sup>2</sup> | string | The target ID in decimal, which is the literal `0` for a target that has no snowflake |-| target_user<sup>3</sup> | ?[Admin user summary](#admin-user-summary-object) object | The resolved target account, or null when the entry names no account target |-| target_guild<sup>4</sup> | ?[Admin guild summary](#admin-guild-summary-object) object | The resolved target guild, or null when the entry names no guild target |-| target_channel<sup>5</sup> | ?[Admin channel summary](#admin-channel-summary-object) object | The resolved target channel, or null when the entry names no channel target or the channel no longer exists |-| related_users<sup>6</sup> | map[snowflake, [Admin user summary](#admin-user-summary-object) object] | The accounts the entry references, keyed by ID |-| related_guilds<sup>6</sup> | map[snowflake, [Admin guild summary](#admin-guild-summary-object) object] | The guilds the entry references, keyed by ID |-| related_channels<sup>6</sup> | map[snowflake, [Admin channel summary](#admin-channel-summary-object) object] | The channels the entry references, keyed by ID |-| action | string | The [audit action](#audit-actions) the service recorded (1-256 characters) |-| access | string | `read` for an entry recorded by a read, `write` for any other entry |-| audit_log_reason | ?string | The normalised [audit reason](#audit-reasons) (1-4,000 characters), or null when the request supplied none |-| metadata<sup>7</sup> | map[string, string] | The additional values the operation recorded |-| created_at | ISO8601 timestamp | The time the entry was recorded |--<sup>1</sup> Resolved from `admin_user_id` at read time, so an account deleted after the entry was written reports null while `admin_user_id` still has the ID--<sup>2</sup> Serialised as a decimal string, like a [snowflake](/snowflakes/). A read that is not scoped to one account, guild, channel, or message, a blocklist entry, a voice region, and a voice server record `0` here, and any identity they have is in `metadata`--<sup>3</sup> Resolved only when `target_type` is `user`, `guild_member`, `message_deletion`, or `message_shred`--<sup>4</sup> Resolved only when `target_type` is `guild`--<sup>5</sup> Resolved when `target_type` is `channel`, and otherwise from a `channel_id` metadata key. The thread of a `delete_thread` entry no longer exists, and `target_channel` is null--<sup>6</sup> Resolved once for the whole page and then repeated identically on every entry in it--<sup>7</sup> Keys are 1 to 256 characters and values are 0 to 4,000 characters. The keys an operation records are stated by that operation. An entry recorded through an Admin API key also has `via` set to `api_key:` followed by the key ID. An entry recorded with rexctl on the server has `admin_user_id` `0`, `via` set to `rexctl`, and `host_user` set to the name of the person who ran it, when rexctl knows it--Fluxer sets the `related_` maps from the acting Admin, from the resolved target, and from the metadata. A metadata key contributes when its value is a decimal integer and its name is `user_id`, `guild_id`, `channel_id`, `target_user_id`, or `admin_user_id`, or ends in `_user_id`, `_guild_id`, or `_channel_id`. An identifier that no longer resolves is omitted from the map.--An entry has no request method, request path, status, duration, IP address, or field change list. Fluxer never redacts an entry on read, so a caller holding `audit_log:view` reads `audit_log_reason` and every metadata value in full.+| admin_user_id | snowflake | The ID of the acting account, or `0` for an action run with rexctl |+| admin_user | ?[Admin user summary](#admin-user-summary-object) object | The acting account, or null when it no longer exists |+| target_type | string | The [audit target type](#audit-target-types) (1-256 characters) |+| target_id | string | The target ID as a decimal string, or `0` when the target has no snowflake |+| target_user | ?[Admin user summary](#admin-user-summary-object) object | The target account, or null when the target is not an account |+| target_guild | ?[Admin guild summary](#admin-guild-summary-object) object | The target guild, or null when the target is not a guild |+| target_channel | ?[Admin channel summary](#admin-channel-summary-object) object | The target channel or the channel in `channel_id` metadata, or null |+| related_users | map[snowflake, [Admin user summary](#admin-user-summary-object) object] | The accounts the entry references, keyed by ID |+| related_guilds | map[snowflake, [Admin guild summary](#admin-guild-summary-object) object] | The guilds the entry references, keyed by ID |+| related_channels | map[snowflake, [Admin channel summary](#admin-channel-summary-object) object] | The channels the entry references, keyed by ID |+| action | string | The [audit action](#audit-actions) (1-256 characters) |+| access | string | `read` or `write` |+| audit_log_reason | ?string | The [audit reason](#audit-reasons), or null |+| metadata | map[string, string] | The extra values the route recorded |+| created_at | ISO8601 timestamp | When the entry was recorded |++When an Admin API key made the request, `metadata.via` is `api_key:` followed by the key ID. When rexctl made it, `metadata.via` is `rexctl`, and `metadata.host_user` is set when rexctl knows who ran it.### Example@@ -167,10 +222,8 @@ An entry has no request method, request path, status, duration, IP address, or f| --- | --- | --- || id | snowflake | The ID of the account || username | string | The username of the account |-| discriminator<sup>1</sup> | string | The four-digit discriminator of the account |-| global_name | ?string | The display name of the account, or null when none is set |--<sup>1</sup> Left-padded with zeroes to four digits, unlike the unpadded integer `discriminator` of the [Admin user object](/admin-api/users/#admin-user-object)+| discriminator | string | The discriminator, zero-padded to four digits |+| global_name | ?string | The display name of the account |### Admin guild summary object@@ -190,10 +243,12 @@ An entry has no request method, request path, status, duration, IP address, or f| id | snowflake | The ID of the channel || name | ?string | The name of the channel, or null for a direct message channel || type | integer | The [channel type](/http-api/channels/#channel-types) |-| guild_id | ?snowflake | The ID of the owning guild, or null for a direct message channel |+| guild_id | ?snowflake | The ID of the guild, or null for a direct message channel |### Audit target types+Expect values that aren't in this table.+| Value | Description || --- | --- || user | User account |@@ -202,54 +257,46 @@ An entry has no request method, request path, status, duration, IP address, or f| guild_emoji | Guild emoji asset || guild_sticker | Guild sticker asset || message | Message |-| message_deletion<sup>1</sup> | Bulk deletion of every message one account sent |-| message_shred<sup>1</sup> | Message shred job for one account |+| message_deletion | Deletion of every message one account sent |+| message_shred | Message shred job for one account || channel | Channel || asset | Stored media asset || application | OAuth2 application || report | User report || search_index | Search index || system_dm | System DM broadcast |-| gift_code<sup>2</sup> | Batch of generated gift codes |+| gift_code | Batch of generated gift codes || bulk_job | Background job || admin_api_key | Admin API key || audit_log | Admin audit entry || enforcement_decision | Enforcement decision |-| archive<sup>2</sup> | Archive list |-| admin_acl<sup>2</sup> | Admin ACL registry |-| blocklist<sup>2</sup> | Blocklist catalogue |-| discovery_category<sup>2</sup> | Discovery category |-| instance_config<sup>2</sup> | Instance configuration |-| limit_config<sup>2</sup> | Limit configuration |-| registration_url<sup>3</sup> | Admin-issued registration URL |-| gateway<sup>2</sup> | Gateway cluster |-| system<sup>2</sup> | API process that served the request |-| voice_region<sup>2</sup> | Voice region |-| voice_server<sup>2</sup> | Voice server registration |-| ip<sup>2</sup> | IP blocklist entry |-| email<sup>2</sup> | Exact email blocklist entry |-| phrase<sup>2</sup> | Phrase blocklist entry |-| url<sup>2</sup> | Exact URL blocklist entry |-| url_domain<sup>2</sup> | URL domain blocklist entry |-| file_sha<sup>2</sup> | File SHA-256 blocklist entry |-| avatar_hash<sup>2</sup> | Avatar hash blocklist entry |-| profile_substring<sup>2</sup> | Profile substring blocklist entry |--<sup>1</sup> The target ID is the account the job acts on, and the entry resolves that account into `target_user`. [Get message shred job](/admin-api/messages/#get-message-shred-job) is the exception and records `0`--<sup>2</sup> The target has no snowflake, so `target_id` is `0`, and any identity the entry has is in `metadata`--<sup>3</sup> The ID of a registration URL is its redeemable code, so `target_id` is `0` and the entry stores no ID--The field is a free-form string, so a client MUST accept a value outside this table.+| archive | Archive list |+| admin_acl | Admin ACL registry |+| blocklist | Blocklist catalog |+| discovery_category | Discovery category |+| instance_config | Instance configuration |+| limit_config | Limit configuration |+| registration_url | Admin-issued registration URL |+| gateway | Gateway cluster |+| system | API process that served the request |+| voice_region | Voice region |+| voice_server | Voice server registration |+| ip | IP blocklist entry |+| email | Exact email blocklist entry |+| phrase | Phrase blocklist entry |+| url | Exact URL blocklist entry |+| url_domain | URL domain blocklist entry |+| file_sha | File SHA-256 blocklist entry |+| avatar_hash | Avatar hash blocklist entry |+| profile_substring | Profile substring blocklist entry |### Audit actions-An operation records one of the following actions. The field is a free-form string of 1 to 256 characters, so a client MUST accept a value outside these tables.+Expect values that aren't in these tables.#### Read actions-An entry with one of these actions has `access` set to `read`.+These entries have `access` set to `read`.| Value | Description || --- | --- |@@ -275,7 +322,7 @@ An entry with one of these actions has `access` set to `read`.| list_archives | Archives were listed || list_audit_logs | A page of the Admin audit log was read || list_blocklist_entries | A page of blocklist entries was read |-| list_blocklists | The blocklist catalogue was read |+| list_blocklists | The blocklist catalog was read || list_channel_messages | The messages of a channel were listed || list_discovery_applications | Pending discovery applications were read || list_discovery_categories | The discovery categories were read |@@ -292,7 +339,7 @@ An entry with one of these actions has `access` set to `read`.| list_network_block_candidates | The networks an account used in the last 30 days were listed, with how many other accounts share each || list_pending_registrations | Pending registrations were read || list_report_notes | The internal notes on a report were listed |-| list_report_reasons | The report reason catalogue was listed |+| list_report_reasons | The report reason catalog was listed || list_user_applications | The applications an account owns were read || list_user_change_log | The contact change log of an account was read || list_user_dm_channels | The direct message channels of an account were read |@@ -313,7 +360,7 @@ An entry with one of these actions has `access` set to `read`.#### Write actions-An entry with any other action has `access` set to `write`.+These entries have `access` set to `write`.| Value | Description || --- | --- |@@ -326,7 +373,7 @@ An entry with any other action has `access` set to `write`.| ban_email | An address was added to the email blocklist || ban_file_sha | A file hash was added to the attachment blocklist || ban_ip | An address was added to the IP blocklist |-| ban_ip_skipped_exempt | An IP blocklist entry was declined by the instance exemption list |+| ban_ip_skipped_exempt | An IP blocklist entry was skipped because the address is exempt || ban_member | An account was banned from a guild || ban_phrase | A phrase was added to the message phrase blocklist || ban_profile_substring | A substring was added to the profile substring blocklist |@@ -338,13 +385,13 @@ An entry with any other action has `access` set to `write`.| bulk_schedule_deletion | A bulk account deletion schedule was queued or applied || bulk_update_guild_features | A bulk guild feature change was queued or applied || bulk_update_user_flags | A bulk account flag change was queued or applied |-| cancel_bulk_message_deletion | A bulk message deletion an account scheduled for itself was cancelled |-| cancel_deletion | A scheduled account deletion was cancelled |+| cancel_bulk_message_deletion | A bulk message deletion an account scheduled for itself was canceled |+| cancel_deletion | A scheduled account deletion was canceled || cancel_job | Cancellation of a job was requested || change_dob | A date of birth was changed || change_email | An email address was changed || change_username | A username or discriminator was changed |-| clear_fields<sup>1</sup> | Profile fields of an account, or fields of a guild, were cleared |+| clear_fields | Profile fields of an account, or fields of a guild, were cleared || clear_report_legal_hold | The legal hold on a report was cleared || create_admin_api_key | An Admin API key was created || create_password_reset_link | A password reset link was created for an account |@@ -354,7 +401,7 @@ An entry with any other action has `access` set to `write`.| create_voice_region | A voice region was created || create_voice_server | A voice server was registered || delete_all_user_messages | Deletion of every message an account sent was queued |-| delete_all_user_messages_dry_run | The same operation was run with `dry_run` set, so no message was deleted |+| delete_all_user_messages_dry_run | Deletion of every message an account sent was previewed with `dry_run`, and nothing was deleted || delete_guild | A guild was deleted || delete_message | One message was deleted || delete_report | A report was deleted with its stored evidence |@@ -367,7 +414,7 @@ An entry with any other action has `access` set to `write`.| force_add_to_guild | An account was added to a guild while bypassing the ban check || generate_gift_codes | Gift codes were generated || kick_member | A member was removed from a guild |-| limit_features | A feature limit decision was recorded for an account, by staff or by Fluxer after a payment fraud signal |+| limit_features | A feature limit decision was recorded for an account || link_sso_identity | A single sign-on subject was bound to an account by hand || migrate_sso_identities | Single sign-on subjects were moved from an earlier provider ID to the provider in use || purge_asset | A stored media asset was purged |@@ -402,7 +449,7 @@ An entry with any other action has `access` set to `write`.| temp_ban | An account was suspended for a time or permanently || terminate_sessions | Every login session of an account was revoked || test_smtp_connection | An SMTP connection test was run |-| transfer_ownership<sup>1</sup> | Guild ownership or OAuth2 application ownership was transferred |+| transfer_ownership | Ownership of a guild or an OAuth2 application was transferred || trigger_guild_archive | A guild archive was created || trigger_user_archive | A user archive was created || unban | A suspension without an enforcement decision was lifted |@@ -421,7 +468,7 @@ An entry with any other action has `access` set to `write`.| update_discovery_listing | A discovery listing was edited || update_features | Guild features were added or removed || update_flags | Account flags were changed |-| update_guild | A guild update with no field group was sent |+| update_guild | A guild update changed none of the fields that have their own action || update_instance_config | The instance configuration was updated || update_limit_config | The limit configuration was replaced || update_name | A guild name was changed |@@ -439,293 +486,101 @@ An entry with any other action has `access` set to `write`.## Audit reasons-Send `X-Audit-Log-Reason` on operations that support an audit reason. Values are not percent-decoded, so a URI-encoded reason remains encoded in the audit log.--Normalisation strips control and format characters and trims surrounding whitespace. An absent header, a blank value, and a value whose normalised length exceeds 512 characters all resolve to null. Fluxer never fails a request during this normalisation, so an over-long reason is dropped silently.--Fluxer writes the resolved value to `audit_log_reason` on every entry the request records. An operation that records no entry accepts the header and does nothing with it. An Admin resource page shows the Audit reason label in an operation's route header only where an entry stores the value.+Send `X-Audit-Log-Reason` on any route marked Audit reason, and the API stores it in `audit_log_reason` on each entry the request records. The API trims the value and strips control characters. A blank value or one longer than 512 characters is dropped without failing the request. Routes that require a reason, such as the [enforcement](/admin-api/enforcement/) routes, return 400 when the value is missing or dropped. Send the value as plain UTF-8, because the API doesn't percent-decode it.## Errors and rate limits### Error response-An Admin failure uses the same envelope as the [HTTP API error response](/http-api/#error-response). The HTTP status is in the status line, and the request identifier in the `X-Request-ID` response header.--#### Structure--| Field | Type | Description |-| --- | --- | --- |-| code | string | The stable machine-readable [API error code](/http-api/errors/#api-error-codes) |-| message<sup>1</sup> | string | The human-readable description of this failure |-| errors?<sup>2</sup> | array[[validation error](/http-api/#validation-error-object) object] | The request fields that failed validation |--<sup>1</sup> The wording varies by locale and is not a stable value for programmatic matching+An Admin error uses the same format as the [HTTP API error response](/http-api/#error-response).-<sup>2</sup> Present on an `INVALID_FORM_BODY` response, and on any other failure that has field detail--A failure with extra detail puts those extra members next to `code` and `message`, at the top level of the object. A client MUST treat a member it does not recognise as absent, and MUST NOT assume that two failures with the same `code` have the same extra members.--### Standard response statuses--Every Admin response follows the [shared response header contract](/http-api/#standard-response-headers). An HTTP 401 has no challenge header, as described under [failed authentication](/authentication/#failed-authentication). [Admin authentication](#authentication) lists the credential types each Admin operation accepts.+These errors can come from any Admin route.| Status | Body | Condition || --- | --- | --- |-| 400 | [error response](#error-response) | Path, query, or body validation fails |-| 401 | [error response](#error-response) | Admin credential is missing or unresolvable |-| 403 | [error response](#error-response) | Credential type or ACL evaluation denies the request |-| 404 | [error response](#error-response) | A referenced resource does not exist |-| 429 | [error response](#error-response) | Route or global rate limit denies the request |-| 500 | [error response](#error-response) | An unexpected server error occurs |-| 503 | [error response](#error-response) | The in-flight request ceiling of the instance is exceeded |--A 429 has `Retry-After`, `X-RateLimit-Scope`, and the route bucket headers described in [rate limit headers](/topics/rate-limits/#rate-limit-headers). A 503 has `Retry-After: 1`. Fluxer applies the concurrency ceiling before routing, so a 503 can answer any Admin path with `SERVICE_UNAVAILABLE` regardless of credentials.+| 400 | [error response](#error-response) | `INVALID_FORM_BODY` when the path, query or body is invalid |+| 401 | [error response](#error-response) | `UNAUTHORIZED` when the credential is missing, invalid or a bot token |+| 403 | [error response](#error-response) | `ACCESS_DENIED` for an access token from an OAuth2 application other than Admin |+| 403 | [error response](#error-response) | `MISSING_PERMISSIONS` when the account holds neither `admin:authenticate` nor `*` |+| 403 | [error response](#error-response) | `MISSING_ACL` when the caller holds none of the route's ACLs |+| 429 | [error response](#error-response) | `RATE_LIMITED` when a rate limit is hit |-An Admin route bucket is keyed by the authenticated account and the credential type together, and no Admin bucket name has a path parameter. Every operation naming one bucket shares one allowance for each account, and an Admin API key draws on a separate allowance from its owner's session.--Every Admin operation declares a route bucket, and each Admin resource page names the one its operations use.--The global user bucket permits 50 requests per second, rising to 1,200 for an account that has the `HIGH_GLOBAL_RATE_LIMIT` flag. An account with the `RATE_LIMIT_BYPASS` flag is evaluated against no bucket at all. Instance configuration can change route and global limits as described in [rate limits](/topics/rate-limits/).--A successful Admin request from an account that is not a bot has no informational rate limit headers.+Admin rate limits count each account and credential type separately, and an Admin API key never shares its owner's session limits. See [Rate limits](/topics/rate-limits/) for the headers and the global limit.## List ACLs<RouteHeader method="GET" path="/v1/admin/acls" auditReason />-Returns every Admin permission string the instance recognises, in [ACL registry](#acl-registry) order. Requires `admin:authenticate`.+Returns every value in the [ACL registry](#acl-registry). You need `admin:authenticate`.### Response body| Field | Type | Description || --- | --- | --- |-| acls<sup>1</sup> | array[string] | The permission strings the Admin API recognises (at most 106 entries) |--<sup>1</sup> The response is the registry itself and does not vary with the caller's own ACL set+| acls | array[string] | The ACL registry, the same for every caller |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | ACL registry was returned |-| 403 | [error response](#error-response) | Credential type is refused, or the account holds neither `admin:authenticate` nor `*` |--### Side effects--The operation records one [Admin audit entry](#admin-audit-entry-object) with action `list_admin_acls`, target type `admin_acl`, target ID `0`, and metadata key `acl_count`.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.--## ACL registry--The registry is returned in this order by [List ACLs](#list-acls). A value outside it authorises nothing.--| Value | Description |-| --- | --- |-| *<sup>1</sup> | Satisfies every Admin permission, including permissions introduced later |-| acl:set:user | Replaces the Admin ACL set held by an account |-| admin_api_key:manage | Creates, reads, renames, and revokes [Admin API keys](/admin-api/api-keys/) |-| application:lookup | Reads [Admin application](/admin-api/applications/) resources, including the applications owned by one account |-| application:list:by_owner<sup>2</sup> | Reads the application listings |-| application:transfer_ownership | Transfers OAuth2 application ownership |-| archive:trigger:guild | Creates guild [archives](/admin-api/archives/) |-| archive:trigger:user | Creates user archives |-| archive:view_all<sup>3</sup> | Reads and downloads archives |-| asset:purge | Reads a guild's emojis and stickers, and purges guild media assets |-| audit_log:view | Reads the [Admin audit log](#admin-audit-entry-object) |-| admin:authenticate | Permits the account to reach the Admin API at all, and admits [List ACLs](#list-acls) and [Get current Admin user](/admin-api/users/#get-current-admin-user) |-| jobs:view | Reads background [job](/admin-api/jobs/) state |-| jobs:cancel | Requests background job cancellation |-| ban:email:add | Adds and updates `email` [blocklist](/admin-api/blocklists/) entries |-| ban:email:check | Reads the `email` blocklist |-| ban:email:remove | Removes `email` blocklist entries |-| ban:phrase:add | Adds and updates `phrase` blocklist entries |-| ban:phrase:check | Reads the `phrase` blocklist |-| ban:phrase:remove | Removes `phrase` blocklist entries |-| ban:ip:add | Adds and updates `ip` blocklist entries |-| ban:ip:check | Reads the `ip` blocklist |-| ban:ip:remove | Removes `ip` blocklist entries |-| ban:url:add | Adds and updates `url` blocklist entries |-| ban:url:check | Reads the `url` blocklist |-| ban:url:remove | Removes `url` blocklist entries |-| ban:url_domain:add | Adds and updates `url-domain` blocklist entries |-| ban:url_domain:check | Reads the `url-domain` blocklist |-| ban:url_domain:remove | Removes `url-domain` blocklist entries |-| ban:file_sha:add | Adds and updates `file-sha` blocklist entries |-| ban:file_sha:check | Reads the `file-sha` blocklist |-| ban:file_sha:remove | Removes `file-sha` blocklist entries |-| ban:avatar_hash:add <sup>4</sup> | Adds and updates `avatar-hash` blocklist entries |-| ban:avatar_hash:check | Reads the `avatar-hash` blocklist |-| ban:avatar_hash:remove | Removes `avatar-hash` blocklist entries |-| ban:profile_substring:add | Adds and updates `profile-substring` blocklist entries |-| ban:profile_substring:check | Reads the `profile-substring` blocklist |-| ban:profile_substring:remove | Removes `profile-substring` blocklist entries |-| bulk:add:guild_members | Queues the bulk guild member addition task |-| bulk:delete:users | Queues the bulk account deletion task |-| bulk:delete:user_messages | Queues the bulk message deletion task |-| bulk:update:guild_features | Queues the bulk guild feature task |-| bulk:update:user_flags | Queues the bulk account flag task |-| discovery:remove | Removes a guild from [discovery](/admin-api/discovery/) |-| discovery:review | Reads, reviews, and edits discovery applications, categories, and listings |-| enforcement:annotate | Adds notes to [enforcement decisions](/admin-api/enforcement/) |-| enforcement:view | Reads [enforcement decisions](/admin-api/enforcement/), and is needed with the kind's own ACL to end one |-| gateway:memory_stats | Reads main [Gateway](/admin-api/gateway/) statistics, memory statistics, and voice state counts |-| gateway:reload_all | Reloads guilds across the main Gateway |-| gift_codes:generate | Generates [gift codes](/admin-api/gift-codes/) |-| guild:audit_log:view | Reads a guild's ordinary audit log |-| guild:ban_member | Bans a guild member and removes a guild ban |-| guild:delete | Deletes a guild |-| guild:force_add_member | Adds an account to a guild |-| guild:kick_member | Removes a guild member |-| guild:list:members | Reads guild member resources |-| guild:lookup | Reads and searches Admin [guild](/admin-api/guilds/) resources, lists the [threads](/admin-api/threads/#list-guild-threads) of a guild, and queues and reads [search index](/admin-api/search-indexes/) rebuilds |-| guild:reload | Reloads one guild on the main Gateway |-| guild:shutdown | Stops one guild on the main Gateway |-| guild:transfer_ownership<sup>5</sup> | Transfers guild ownership |-| guild:update:features<sup>5</sup> | Adds and removes guild features |-| guild:update:name<sup>5</sup> | Updates a guild name |-| guild:update:settings<sup>5</sup> | Updates general guild settings and clears guild fields |-| guild:update:vanity<sup>5</sup> | Updates a guild custom invite code |-| instance:config:update | Updates [instance](/admin-api/instance/) configuration, branding, SMTP tests, registration URLs, and the SSO provider of subjects |-| instance:config:view | Reads instance configuration |-| instance:limit_config:update | Replaces the instance-wide limit configuration |-| instance:limit_config:view | Reads the instance-wide limit configuration |-| message:delete_all | Queues deletion of every message one account sent, and deletes a [thread](/admin-api/threads/#delete-thread) |-| message:delete | Deletes one message |-| message:lookup | Reads, browses, and searches [messages](/admin-api/messages/) through the Admin API |-| message:shred | Queues an explicit message shred job and reads its state |-| registration:review | Reads and decides [pending registrations](/admin-api/instance/#list-pending-registrations) |-| report:delete | Deletes a [report](/admin-api/reports/#delete-report) with its stored evidence |-| report:resolve | Updates and resolves [reports](/admin-api/reports/), adds notes to them, and places legal holds on them |-| report:view | Reads and searches reports and their notes |-| report:view:reporter_pii<sup>6</sup> | Unredacts the contact fields a reporter supplied |-| system_dm:send | Sends an official direct message from the instance to one or many accounts |-| user:cancel:bulk_message_deletion | Cancels the bulk message deletion an account scheduled for itself |-| user:create:password_reset_link | Creates a password reset link on an instance where members sign in with a username |-| user:delete | Schedules or cancels account deletion |-| user:delete:recovery_kit | Revokes a recovery kit on an instance where members sign in with a username |-| user:list:dm_channels | Reads a user's direct message and group direct message channels |-| user:list:guilds | Reads a user's guild memberships |-| user:list:relationships | Reads a user's relationships |-| user:list:sessions | Reads a user's login sessions |-| user:lookup | Reads and searches the base Admin [user](/admin-api/users/) resource |-| user:remove:relationship | Removes one relationship or every relationship in one category |-| user:view:contact_log | Reads a user's identity and contact change log |-| user:view:dob<sup>6</sup> | Unredacts user dates of birth |-| user:view:email<sup>6</sup> | Unredacts user email addresses and email verification state |-| user:view:ip<sup>6</sup> | Unredacts the last active IP address and the location derived from it |-| user:temp_ban | Suspends accounts and lifts suspensions |-| user:update:bot_status | Updates bot and system account state |-| user:update:dob | Updates dates of birth |-| user:update:email | Updates the email address, verifies it, resends verification, sends a password reset, and binds SSO subjects |-| user:update:flags | Updates account flags and premium flags, and ends every login session of an account |-| user:update:mfa | Reads and removes a user's WebAuthn credentials, and removes MFA state |-| user:update:profile | Clears profile fields |-| user:update:traits | Replaces account traits |-| user:update:username | Updates usernames and discriminators |-| voice:region:create | Creates [voice](/admin-api/voice/) regions |-| voice:region:delete | Deletes voice regions |-| voice:region:list | Reads voice regions |-| voice:region:update | Updates voice regions |-| voice:server:create | Registers a voice server in a region |-| voice:server:delete | Deletes a registered voice server |-| voice:server:list | Reads registered voice servers |-| voice:server:update | Updates a registered voice server |--<sup>1</sup> The first entry of the registry. An ACL set can contain it alongside named permissions--<sup>2</sup> [List applications](/admin-api/applications/#list-applications) and [List user applications](/admin-api/users/#list-user-applications) accept it in place of `application:lookup`, and no other operation reads it--<sup>3</sup> The archive reads accept `archive:view_all`, `archive:trigger:user`, or `archive:trigger:guild`, so an Admin who can create archives can also read them+| 200 | response body | The registry was returned |-<sup>4</sup> [Block a user's current avatar](/admin-api/blocklists/#block-a-users-current-avatar) requires it as well+Records a `list_admin_acls` audit entry.-<sup>5</sup> [Update guild](/admin-api/guilds/#update-guild) names all of these as one any-of requirement and then requires every one that the submitted body maps to--<sup>6</sup> The permission admits no operation of its own. It only widens what an already admitted read returns--[List ACLs](#list-acls) returns these permission strings alone, with no description attached.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## List audit log entries<RouteHeader method="GET" path="/v1/admin/audit-logs" auditReason />-Returns a page of [Admin audit entry](#admin-audit-entry-object) objects with their resolved user, guild, and channel summaries. Requires `audit_log:view`.+Returns a page of [Admin audit entries](#admin-audit-entry-object), newest first by default. You need `audit_log:view`.### Query parameters| Field | Type | Description || --- | --- | --- |-| q?<sup>1</sup> | string | The free-text query (1-1,024 characters) |-| admin_user_id? | snowflake | Return only entries recorded for this acting Admin |-| target_type? | string | Return only entries recorded against this [audit target type](#audit-target-types) (1-64 characters) |-| target_id? | string | Return only entries recorded against this target ID |-| access? | string | `read` to return only read entries, `write` to return only write entries |-| sort_by?<sup>2</sup> | string | `createdAt` or `relevance` (default `createdAt`) |-| sort_order?<sup>2</sup> | string | `asc` or `desc` (default `desc`) |+| q? | string | Search `action`, `target_type`, `target_id` and `audit_log_reason` (1-1,024 characters) |+| admin_user_id? | snowflake | Only entries by this acting account |+| target_type? | string | Only entries with this [target type](#audit-target-types) (1-64 characters) |+| target_id? | string | Only entries with this target ID |+| access? | string | `read` or `write` |+| sort_by? | string | `createdAt` or `relevance`, used only with `q` (default `createdAt`) |+| sort_order? | string | `asc` or `desc`, used only with `q` (default `desc`) || limit? | integer | The maximum number of entries to return (1-200, default 50) |-| offset? | integer | The number of entries to skip (minimum 0, default 0) |--<sup>1</sup> Supplying it runs a full-text search over the indexed `action`, `target_type`, `target_id`, and `audit_log_reason` of each entry. Omitting it pages the log in order with the same filters applied--<sup>2</sup> Honoured only when `q` is supplied, and without `q` the listing is ordered newest first. `relevance` orders by search score and ignores `sort_order`+| offset? | integer | The number of entries to skip (default 0) |-:::caution[The listing degrades without the search index]-Without an index, `q` is ignored, and a filtered page holds only the matches among the first `limit` plus `offset` rows, so it can be far shorter than `limit` while more matches exist.-:::+Without a search index, the API ignores `q` and only filters the newest `limit` plus `offset` entries, so a page and `total` can come back short.### Response body| Field | Type | Description || --- | --- | --- || logs | array[[Admin audit entry](#admin-audit-entry-object) object] | The entries in this page |-| total<sup>1</sup> | integer | The number of entries the query matched |--<sup>1</sup> The index reports the full match count. Without the search index, the operation reports only the matches among the first `limit` plus `offset` entries+| total | integer | The number of entries that match |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Audit page was returned |-| 403 | [error response](#error-response) | Credential type is refused, or the account holds neither `audit_log:view` nor `*` |--### Side effects--The operation records one [Admin audit entry](#admin-audit-entry-object) with target type `audit_log` and target ID `0`. Its action is `search_audit_logs` when `q` is supplied and `list_audit_logs` otherwise. The metadata keys are `limit`, `offset`, `result_count` for the entries in this page, and `total`. The supplied filters add `filter_admin_user_id` and `access`, `filter_target_id` when `target_id` is a snowflake, and `filter_target_type` when `target_type` is lowercase letters and underscores. Any other `target_type` value adds `has_target_type_filter` instead. A search also records `sort_by` and `sort_order`. The query text is not recorded.--The entry is written after the page is built, so it is never part of the page that recorded it.+| 200 | response body | The page was returned |-### Rate limit+Records a `search_audit_logs` audit entry when `q` is set and `list_audit_logs` otherwise, without the query text.-100 requests per minute for each authenticated user, on the `admin:audit_log` bucket.+The rate limit is 100 requests per minute, on the `admin:audit_log` bucket.## Get audit log entry<RouteHeader method="GET" path="/v1/admin/audit-logs/{log_id}" auditReason />-Returns one [Admin audit entry](#admin-audit-entry-object) object with the same resolved summaries the listing returns. Requires `audit_log:view`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| log_id | snowflake | The ID of the audit entry |+Returns one [Admin audit entry](#admin-audit-entry-object). You need `audit_log:view`.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [Admin audit entry](#admin-audit-entry-object) object | Audit entry was returned |-| 403 | [error response](#error-response) | Credential type is refused, or the account holds neither `audit_log:view` nor `*` |-| 404 | [error response](#error-response) | No entry has that identifier and the request returns `NOT_FOUND` |--### Side effects--The operation records one [Admin audit entry](#admin-audit-entry-object) with action `get_audit_log`, target type `audit_log`, the read entry's ID as target ID, and no metadata. A 404 records nothing.+| 200 | [Admin audit entry](#admin-audit-entry-object) object | The entry was returned |+| 404 | [error response](#error-response) | `NOT_FOUND` when no entry has that ID |-### Rate limit+Records a `get_audit_log` audit entry.-100 requests per minute for each authenticated user, on the shared `admin:audit_log` bucket.+The rate limit is 100 requests per minute, on the `admin:audit_log` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/instance.mdx b/fluxer_docs/src/content/docs/admin-api/instance.mdxindex f0fcfe115..627c212d2 100644--- a/fluxer_docs/src/content/docs/admin-api/instance.mdx+++ b/fluxer_docs/src/content/docs/admin-api/instance.mdx@@ -1,26 +1,18 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Admin instance-description: Instance configuration, branding, registration control, limits, and diagnostics.+description: Instance configuration, branding, registration control, limits and diagnostics.---import RouteHeader from '@/components/RouteHeader.astro';-Instance configuration is everything an operator can change at runtime. It covers single sign-on, Gateway rollout, registration policy, branding and legal links, instance policy, third party integrations, premium billing, media retention, and the ordered limit configuration. The [Instance](/http-api/instance/) resource serves the subset published to unauthenticated clients.+Instance configuration is everything an instance admin can change at runtime, from sign-in and registration to branding, integrations, billing and limits. The [Instance](/http-api/instance/) resource publishes part of it to clients.-Every write is a merge over the stored configuration, and an omitted key leaves the stored value unchanged. The limit configuration write is the one exception and replaces the stored document.--Reading configuration requires the [Admin ACL](/admin-api/#acl-registry) `instance:config:view`, and writing it requires `instance:config:update`. The limit configuration has its own pair, `instance:limit_config:view` and `instance:limit_config:update`. Pending registrations are read and decided with `registration:review` alone.--:::caution[No read returns a stored secret]-A secret is reported by a companion boolean such as `client_secret_set`. Except for the single sign-on client secret, that boolean is true whether the value is stored here or supplied by deployment configuration.-:::+No read returns a stored secret, and a boolean such as `client_secret_set` says whether one is set.## Instance configuration object-The complete runtime configuration of the deployment. Every configuration operation here except the limit configuration returns it.--Missing settings use the defaults documented below. Invalid stored configuration causes an error rather than silently resetting a policy.+The full runtime configuration. A setting that was never saved uses the default in its table.### Structure@@ -28,88 +20,76 @@ Missing settings use the defaults documented below. Invalid stored configuration| --- | --- | --- || sso | [SSO configuration](#sso-configuration-object) object | Single sign-on settings || gateway_rollout | [Gateway rollout configuration](#gateway-rollout-configuration-object) object | Gateway admission and dispatch tuning |-| push_relay | [push relay configuration](#push-relay-configuration-object) object | Operator consent to the Fluxer-run push relay |+| push_relay | [push relay configuration](#push-relay-configuration-object) object | Consent to the Fluxer-run push relay || voice_p2p | [peer-to-peer voice configuration](#peer-to-peer-voice-configuration-object) object | Peer-to-peer voice rollout |-| captcha | [captcha configuration](#captcha-configuration-object) object | ALTCHA proof-of-work captcha settings |-| experiment_delivery | [experiment delivery configuration](#experiment-delivery-configuration-object) object | Cadence every client polls the experiments route on |+| captcha | [captcha configuration](#captcha-configuration-object) object | ALTCHA proof-of-work settings |+| experiment_delivery | [experiment delivery configuration](#experiment-delivery-configuration-object) object | How often clients poll for experiments || registration | [registration configuration](#registration-configuration-object) object | Registration policy and issued URLs |-| self_hosted | boolean | Whether the deployment runs in self-hosted mode |-| account_identity | [account identity configuration](#account-identity-configuration-object) object | How members sign in, and whether that can still change |-| app_public | [public application configuration](#public-application-configuration-object) object | Branding, legal, setup, and registration field policy |-| policy | [instance policy](#instance-policy-object) object | Community, direct message, premium, and gating policy |-| integrations | [instance integrations](#instance-integrations-object) object | Third party provider settings and their resolved availability |+| self_hosted | boolean | Whether the instance runs in self-hosted mode |+| account_identity | [account identity configuration](#account-identity-configuration-object) object | How people sign in |+| app_public | [public application configuration](#public-application-configuration-object) object | Branding, legal links, setup and registration fields |+| policy | [instance policy](#instance-policy-object) object | Community, direct message, premium and gating policy |+| integrations | [instance integrations](#instance-integrations-object) object | Third-party provider settings || media | [instance media](#instance-media-object) object | Attachment retention settings |-| billing | [instance billing](#instance-billing-object) object | Premium billing settings and the state resolved from them |+| billing | [instance billing](#instance-billing-object) object | Premium billing settings || auth | [auth configuration](#auth-configuration-object) object | Email-first sign-in and instant accounts || accounts | [accounts configuration](#accounts-configuration-object) object | Date of birth step, account tiers and cleanup |-| guild_visits | [guild visits configuration](#guild-visits-configuration-object) object | Rollout of visiting communities without joining |-| notice | ?[instance notice](/http-api/instance/#instance-notice-object) object | Notice shown to everyone, or null when there is none |+| guild_visits | [guild visits configuration](#guild-visits-configuration-object) object | Rollout of visiting communities before joining |+| notice | ?[instance notice](/http-api/instance/#instance-notice-object) object | Notice shown to everyone, or null |## Account identity configuration object-How members of the deployment sign in. It is read-only here. The setup wizard chooses it through [set the setup sign-in method](/http-api/instance/#set-the-setup-sign-in-method), and [Sign-in methods](/operator/sign-in/) explains the rules.+How people sign in. It is read-only here, and the setup wizard sets it through [set the setup sign-in method](/http-api/instance/#set-the-setup-sign-in-method). [Sign-in methods](/operator/sign-in/) explains the rules.### Structure| Field | Type | Description || --- | --- | --- |-| mode | string | The [account identity mode](/http-api/instance/#account-identity-modes) in effect, `email` or `username` |-| locked<sup>1</sup> | boolean | Whether the mode can no longer change |-| tag_style | string | How usernames are tagged, one of the [tag styles](/http-api/instance/#tag-styles) |-| lock_reason<sup>2</sup> | ?string | Why the mode can no longer change, one of the [account identity lock reasons](/http-api/instance/#account-identity-lock-reasons), or null |--<sup>1</sup> True once setup is complete or the first account exists--<sup>2</sup> Null while the mode can still change. When more than one reason applies, the value is the first one in the table of lock reasons+| mode | string | The [account identity mode](/http-api/instance/#account-identity-modes), `email` or `username` |+| locked | boolean | Whether the mode is fixed, with the reason in `lock_reason` |+| tag_style | string | One of the [tag styles](/http-api/instance/#tag-styles) |+| lock_reason | ?string | One of the [account identity lock reasons](/http-api/instance/#account-identity-lock-reasons), or null |## SSO configuration object-Single sign-on settings for the deployment's OpenID Connect provider.+Settings for the instance's OpenID Connect provider.### Structure| Field | Type | Description || --- | --- | --- || enabled | boolean | Whether single sign-on is offered |-| enforced<sup>1</sup> | boolean | Whether single sign-on is the only accepted login method |-| display_name | ?string | Provider name shown on the login screen |-| button_label<sup>4</sup> | ?string | Text on the single sign-on button of the login screen, or null for the app's default label |+| enforced | boolean | Whether single sign-on is the only way to sign in |+| display_name | ?string | Provider name shown on the sign-in screen |+| button_label | ?string | Text on the sign-in button, or null for the default (up to 64 characters) || issuer | ?string | OpenID Connect issuer |-| authorization_url | ?string | Authorisation endpoint |+| authorization_url | ?string | Authorization endpoint || token_url | ?string | Token endpoint || userinfo_url | ?string | Userinfo endpoint || jwks_url | ?string | JWKS endpoint |-| client_id | ?string | Registered client identifier |+| client_id | ?string | Registered client ID || client_secret_set | boolean | Whether a client secret is stored |-| scope | ?string | Space-separated scope string |-| allowed_domains<sup>2</sup> | array[string] | Email domains permitted to sign in (max 100 entries) |-| auto_provision | boolean | Whether a first-time sign-in creates an account |-| redirect_uri<sup>3</sup> | ?string | Redirect URI to register with the provider |-| groups_claim<sup>5</sup> | ?string | The claim that lists a member's groups, or null for `groups` (max 128 characters) |-| group_role_mappings<sup>6</sup> | array[[SSO group role mapping](#sso-group-role-mapping-object) object] | Groups whose members get a role in the single community (max 100 entries) |--<sup>1</sup> A deployment that has never stored the value reports the same value as `enabled`--<sup>2</sup> Each entry is stored lowercased and IDNA encoded, duplicates are collapsed, and an empty entry is dropped--<sup>3</sup> The configured web application endpoint followed by `/auth/sso/callback`. It is the only redirect URI the provider needs, mobile sign-in included. No operation can set it--<sup>4</sup> Trimmed on write, and an empty value is stored as null. A value longer than 64 UTF-16 code units fails validation against `sso.button_label` with `CONTENT_EXCEEDS_MAX_LENGTH`. A value with a control character, a line or paragraph separator, or a bidirectional embedding, override or isolate character fails validation against `button_label` with `INVALID_FORMAT`, and so does a value made only of invisible characters+| scope | ?string | Space-separated scopes |+| allowed_domains | array[string] | Email domains allowed to sign in (up to 100 entries) |+| auto_provision | boolean | Whether a first sign-in creates an account |+| redirect_uri<sup>1</sup> | ?string | Redirect URI to register with the provider |+| groups_claim | ?string | The claim that lists a person's groups, or null for `groups` (up to 128 characters) |+| group_role_mappings<sup>2</sup> | array[[SSO group role mapping](#sso-group-role-mapping-object) object] | Groups whose members get a role in the single community (up to 100 entries) |-<sup>5</sup> Fluxer looks for the claim in the ID token first and then in the user info response. A list of strings and a single string are both accepted+<sup>1</sup> The web app URL followed by `/auth/sso/callback`, which mobile sign-in also uses. It is read-only-<sup>6</sup> Applied only in single-community mode, at every single sign-on. When the provider sends the groups claim, every listed role is added if the member is in its group and removed if not, and roles that no mapping lists are never changed. When the provider sends no groups claim, the roles stay as they are. On write, the everyone role or a role that isn't in the single community fails validation against `sso.group_role_mappings`+<sup>2</sup> Used only in single-community mode. At each sign-in that has the groups claim, Fluxer adds or removes each mapped role to match the person's groups and leaves other roles alone## SSO group role mapping object-One group of the identity provider and the community role its members get.+One provider group and the community role its members get.### Structure| Field | Type | Description || --- | --- | --- |-| group | string | The group name exactly as the provider sends it, such as `staff` or `/engineering/devs` (1-256 characters) |-| role_id | snowflake | A role in the single community |+| group | string | The group name exactly as the provider sends it, such as `staff` (1-256 characters) |+| role_id | snowflake | A role in the single community, other than the everyone role |## Gateway rollout configuration object@@ -119,110 +99,88 @@ Admission and dispatch tuning for the Gateway cluster.| Field | Type | Description || --- | --- | --- |-| session_rollout_percentage | number | Percentage of sessions admitted to the new Gateway (0-100, default 100) |+| session_rollout_percentage | number | Percentage of sessions the Gateway admits, by account (0-100, default 100) || session_rollout_mode | string | `modulo` or `random` (default `modulo`) |-| guild_rollout_percentage | number | Percentage of guilds admitted to the new Gateway (0-100, default 100) |+| guild_rollout_percentage | number | Percentage of guilds the Gateway starts (0-100, default 100) || rpc_request_timeout_ms | integer | Deadline for one Gateway RPC (1000-60000, default 10000) || max_concurrent_session_starts | integer | Session starts admitted at once (1-10000, default 512) || max_concurrent_guild_starts | integer | Guild starts admitted at once (1-10000, default 256) || gateway_dispatch_relay_shards | integer | Dispatch relay shard count (1-10000, default 32) |-| gateway_dispatch_relay_max_queue | integer | Dispatch relay queue ceiling (0-1000000, default 50000) |+| gateway_dispatch_relay_max_queue | integer | Dispatch relay queue limit (0-1000000, default 50000) || voice_e2ee_scope | string | `guild_feature_only` or `platform_wide` (default `guild_feature_only`) |## Push relay configuration object-The operator's consent to the push relay supplemental privacy notice.+Your consent to the privacy notice of the Fluxer-run push relay, which sends notifications to the official mobile apps through Apple and Google. A UnifiedPush or ntfy distributor doesn't need it.### Structure| Field | Type | Description || --- | --- | --- |-| relay_consent_accepted | boolean | Whether the operator accepted the push relay supplemental privacy notice (default false) |-| relay_consent_accepted_at | ?string | ISO 8601 timestamp of that acceptance, or null when the notice stands unaccepted (default null) |-| relay_consent_accepted_by | ?snowflake | Account that accepted the notice, or null when the notice stands unaccepted (default null) |--Every field is present on read. An absent document or missing field uses the defaults above.--The notice covers only the Fluxer-run relay that reaches Apple and Google for the official mobile apps. A subscription whose endpoint points at another distributor, such as a self-hosted UnifiedPush server or ntfy, never reaches that relay and needs no acceptance.+| relay_consent_accepted | boolean | Whether an admin accepted the notice (default false) |+| relay_consent_accepted_at | ?string | ISO 8601 time of the acceptance, or null |+| relay_consent_accepted_by | ?snowflake | Account that accepted the notice, or null |## Peer-to-peer voice configuration object-The instance rollout that lets small voice calls connect their participants directly instead of through the voice servers. [Experiments](/http-api/experiments/#peer-to-peer-voice-assignment-object) defines what a client resolves from it.+The rollout that lets small calls connect people directly, without the voice servers. [Experiments](/http-api/experiments/#peer-to-peer-voice-assignment-object) describes what a client gets from it.### Structure| Field | Type | Description || --- | --- | --- || enabled | boolean | Whether the rollout runs at all (default false) |-| config_version | integer | Revision counter, raised by Fluxer and never accepted from a request |-| rollout_basis_points | integer | Share of accounts the rollout selects, in basis points (0-10000, default 0) |-| rollout_country_codes | array[string] | Countries the sampled share is limited to, as unique uppercase ISO 3166-1 alpha-2 codes, up to 250 (default empty) |+| config_version | integer | Revision counter that Fluxer raises on each change |+| rollout_basis_points | integer | Share of accounts selected, in basis points (0-10000, default 0) |+| rollout_country_codes | array[string] | ISO 3166-1 alpha-2 codes that limit the sampled share (up to 250 entries, default empty) || rollout_salt | string | Salt of the sampling hash (1-64 printable ASCII characters, default `voice-p2p-v1`) |-| included_user_ids | array[snowflake] | Accounts the rollout always selects, up to 1000 entries (default empty) |-| included_guild_ids | array[snowflake] | Guilds whose members the rollout always selects, up to 1000 entries (default empty) |-| include_premium_users | boolean | Whether the rollout always selects accounts with active premium (default false) |-| excluded_user_ids | array[snowflake] | Accounts the rollout never selects, up to 1000 entries (default empty) |-| max_participants | integer | Most participants a peer-to-peer call holds (2-4, default 2) |--Every field is present on read. An absent document or missing field uses the defaults above.--`excluded_user_ids` wins over every other rule. Otherwise the rollout selects an account in `included_user_ids`, a member of a guild in `included_guild_ids`, or a premium account while `include_premium_users` is true, whatever `rollout_basis_points` says.--While `rollout_country_codes` is empty, `rollout_basis_points` samples every account. Once it lists a country, the sampled share only selects an account whose request comes from a listed country, and a request with an unknown country is never sampled. The list does not affect `excluded_user_ids`, `included_user_ids`, `included_guild_ids`, or `include_premium_users`.+| included_user_ids | array[snowflake] | Accounts always selected (up to 1000 entries, default empty) |+| included_guild_ids | array[snowflake] | Guilds whose members are always selected (up to 1000 entries, default empty) |+| include_premium_users | boolean | Whether accounts with active premium are always selected (default false) |+| excluded_user_ids | array[snowflake] | Accounts never selected, which wins over every other rule (up to 1000 entries, default empty) |+| max_participants | integer | Most people in one peer-to-peer call (2-4, default 2) |-The rules above select who may start a peer-to-peer call. Joining a call that already runs peer-to-peer needs only `enabled`, so a partial rollout does not keep unselected accounts out of running calls.--`max_participants` applies to every account, selected or not. A join that would take a peer-to-peer call past it is refused as full, as [Peer-to-peer voice](/gateway/events/#peer-to-peer-voice) describes. Lowering it removes nobody from a running call.--:::caution[`enabled` is the kill switch]-Setting `enabled` to false makes every new call use the voice servers. A call that already runs peer-to-peer keeps running and refuses new joins until it ends or a participant switches it to the voice servers. Fluxer never moves a running call on its own.-:::+Selection decides who can start a peer-to-peer call, and anyone can join one while `enabled` is true. Setting `enabled` to false makes new calls use the voice servers, and a running peer-to-peer call keeps going until it ends.## Captcha configuration object-The ALTCHA proof-of-work check that the API issues and verifies itself on gated operations. [CAPTCHA handling](/topics/captcha/) defines the challenge exchange and lists the gated operations.+The ALTCHA proof-of-work check on gated operations. [CAPTCHA handling](/topics/captcha/) lists those operations.### Structure| Field | Type | Description || --- | --- | --- |-| provider | string | `altcha` or `none`, the [CAPTCHA provider](/http-api/instance/#captcha-providers) gated operations ask for (default `altcha`) |-| cost | integer | PBKDF2 iterations per solving attempt (1000-20000, default 5000) |-| max_counter | integer | Upper bound of the hidden counter a client searches for (100-20000, default 1000) |+| provider | string | `altcha` or `none`, the [CAPTCHA provider](/http-api/instance/#captcha-providers) (default `altcha`) |+| cost | integer | PBKDF2 iterations per attempt (1000-20000, default 5000) |+| max_counter | integer | Upper bound of the counter a client searches for (100-20000, default 1000) || enabled | boolean | Deprecated. True unless `provider` is `none` |-Every field is present on read. An absent document or missing field uses the defaults above, so the check is on until an administrator sets `provider` to `none`, which turns the check off for the whole instance. A stored document from before `provider` existed is read with `enabled` false as `none` and anything else as `altcha`.--Setting `provider` to `none` while instant accounts are on returns 400 `INVALID_FORM_BODY` with `CAPTCHA_REQUIRED_BY_INSTANT_ACCOUNTS` at `captcha.provider`.--Each challenge hides its counter between half of `max_counter` and `max_counter`, and a client tries counters from 0 upward. Solve time grows with `cost` times `max_counter`. Fluxer spends one attempt at `cost` to issue each challenge.+Setting `provider` to `none` turns the check off for the whole instance. Solve time grows with `cost` times `max_counter`.## Auth configuration object-How people sign in and whether they can start with only a display name.+How people start signing in and whether they can join with only a display name.### Structure| Field | Type | Description || --- | --- | --- |-| identifier_first<sup>1</sup> | string | `auto`, `on` or `off`, whether clients start sign-in with the email address and offer emailed codes |-| instant_accounts | [instant accounts](#instant-accounts-object) object | Accounts created with only a display name, with no email and no password |-| instant_account_availability<sup>2</sup> | string | Whether public sign-up can create an instant account right now, and why not. Read-only |+| identifier_first<sup>1</sup> | string | Whether sign-in starts with the email address and offers emailed codes, `auto`, `on` or `off` |+| instant_accounts | [instant accounts](#instant-accounts-object) object | Accounts created with only a display name |+| instant_account_availability | string | Read-only [instant account availability](/http-api/instance/#instant-account-availability) |-<sup>1</sup> `auto` turns it on while the account identity mode is `email` and the instance sends email. `on` turns it on in the `email` mode even when the instance can't send email, and then sign-in offers only a password or a passkey. `off` keeps sign-in starting with the full form. The result is reported as `identifier_first` in the [instance features](/http-api/instance/#instance-features-object), and `email_codes` reports whether codes work. Setting `on` on a `username` instance returns 400 `INVALID_FORM_BODY` with `IDENTIFIER_FIRST_REQUIRES_EMAIL_IDENTITY`. A stored boolean from before the modes existed is read as `on` for true. A stored false is read as `auto` unless the admin audit log shows that an admin saved the auth settings, in which case it is read as `off`. The next write stores the mode--<sup>2</sup> One of the [instant account availability](/http-api/instance/#instant-account-availability) values. It is `available` only while `instant_accounts.enabled` is true, the captcha provider is not `none` and the registration mode is `open`+<sup>1</sup> `auto` (the default) turns it on when the account identity mode is `email` and the instance sends email. `on` turns it on in the `email` mode even when the instance doesn't send email, and sign-in then offers only a password or a passkey#### Instant accounts object| Field | Type | Description || --- | --- | --- |-| enabled<sup>1</sup> | boolean | Whether [register an account](/http-api/authentication/#register-an-account) accepts a body with no email and no password |+| enabled | boolean | Whether [register an account](/http-api/authentication/#register-an-account) accepts a body with no email and no password (default false) || pow_escalation_per_hour | integer | Accounts per hour that double the CAPTCHA cost for the next one (10-1000000, default 2000) |## Accounts configuration object-What new and existing accounts have to do before they can reach other people, and which accounts are deleted.+What accounts have to do before they can interact with other people, and which accounts Fluxer deletes.### Structure@@ -230,25 +188,23 @@ What new and existing accounts have to do before they can reach other people, an| --- | --- | --- || date_of_birth<sup>1</sup> | string | `off`, `ask`, `require_new_accounts` or `require_all` || interaction_tier<sup>2</sup> | string | `legacy` or `enforced` |-| verification_basis<sup>3</sup> | string | `auto`, `confirmed_email` or `local_credential` |+| verification_basis<sup>3</sup> | string | `auto`, `confirmed_email` or `local_credential` (default `auto`) || guild_join_gate<sup>4</sup> | string | `off`, `visits_capable` or `always` (default `always`) || unclaimed_account_cleanup<sup>5</sup> | [unclaimed account cleanup](#unclaimed-account-cleanup-object) object | Deleting accounts nobody can sign in to again |-| dob_missing_cleanup<sup>6</sup> | [date of birth cleanup](#date-of-birth-cleanup-object) object | Deleting accounts that never entered a date of birth |-| inactivity_deletion<sup>7</sup> | [inactivity deletion](#inactivity-deletion-object) object | Deleting accounts nobody has used for a long time |--<sup>1</sup> `off` never asks for a date of birth. `ask` asks every account without one, but refuses nothing. `require_new_accounts` refuses most operations to an account created without one until it [sets one](/http-api/users/current-user/#set-date-of-birth), and `require_all` does the same for every account without one. Current clients ask for it after sign-up, never during it. A stored document from before this field existed is read from `app_public.registration.collect_date_of_birth` and the older `date_of_birth_enforcement`. Collection off gives `off`, and with collection on the enforcement `off`, `new_accounts` and `all` gives `ask`, `require_new_accounts` and `require_all`+| dob_missing_cleanup | [date of birth cleanup](#date-of-birth-cleanup-object) object | Deleting accounts created without a date of birth, while `date_of_birth` isn't `off` |+| inactivity_deletion<sup>6</sup> | [inactivity deletion](#inactivity-deletion-object) object | Deleting accounts nobody has used for a long time |-<sup>2</sup> How the [account tiers](/http-api/users/#account-tiers) apply. `legacy` keeps the older limits, and `enforced` lets an account that has not finished setting up do only what does not reach other people. An upgraded self-hosted instance starts in `legacy`, and a new self-hosted instance starts in `enforced`+<sup>1</sup> `ask` asks accounts without one and refuses nothing. `require_new_accounts` refuses most operations to new accounts until they [set one](/http-api/users/current-user/#set-date-of-birth), and `require_all` does the same for every account without one-<sup>3</sup> What an account needs to be verified. `confirmed_email` needs a confirmed email, and `local_credential` needs a password or a passkey. `auto` uses `confirmed_email` while the instance sends email and `local_credential` otherwise. A `username` instance always uses `local_credential`. Setting `confirmed_email` while the instance does not send email returns 400 `INVALID_FORM_BODY` with `VERIFICATION_BASIS_REQUIRES_EMAIL_DELIVERY`, and so does turning email off while it is set. If email stops working some other way, such as a missing setting, `local_credential` is used until it works again. The value in effect is reported as `verification_basis` in the [instance features](/http-api/instance/#instance-features-object)+<sup>2</sup> How the [account tiers](/http-api/users/#account-tiers) apply. `enforced` lets an account that hasn't finished setting up do only things that don't involve other people-<sup>4</sup> When joining a community needs a verified account. It applies only while `interaction_tier` is `enforced`, and only to people assigned [guild visits](#guild-visits-configuration-object), who can preview a community before joining it. `always` applies to them on every client. `visits_capable` applies only on clients that send `X-Fluxer-Capabilities: guild_visits`, so an older client that can't preview still joins. `off` never applies. The value can be saved while `interaction_tier` is `legacy`, and it has no effect until the tier changes. An unknown stored value is read as `always`+<sup>3</sup> `confirmed_email` needs a confirmed email and `local_credential` needs a password or a passkey. `auto` uses `confirmed_email` while the instance sends email, and a `username` instance always uses `local_credential`-<sup>5</sup> An account counts when it has no way to sign in again. On a `username` instance, a password, a passkey or a saved recovery kit is a way back in. On an `email` instance, a passkey, a password together with an email, or any email while the instance sends email is a way back in. Bot, system and single sign-on accounts are never deleted this way. With `mode` set to `after_inactivity`, the sweep schedules such an account for deletion after `inactive_days` without use. With `on_last_session_end` set to `after_grace`, signing out of its last session schedules it too, and so does the sweep once it has no session left at least a day after it was created. Each deletion is scheduled 24 hours out and is cancelled by signing in+<sup>4</sup> Whether joining a community needs a verified account. It applies to people assigned [guild visits](#guild-visits-configuration-object) while `interaction_tier` is `enforced`, and `visits_capable` checks only clients that send `X-Fluxer-Capabilities: guild_visits`-<sup>6</sup> Applies only to an account created without a date of birth, and only while `date_of_birth` is not `off`. With `mode` set to `after_inactivity`, the sweep schedules it for deletion after `inactive_days` without use, 24 hours out and cancelled by signing in.+<sup>5</sup> Bot, system and single sign-on accounts are never deleted this way. `on_last_session_end` set to `after_grace` also schedules the deletion when the account signs out of its last session. Each deletion is scheduled 24 hours ahead, and signing in cancels it-<sup>7</sup> With `mode` set to `after_inactivity`, an account unused for `inactive_days` is sent a warning email, and it is deleted `warning_lead_days` later unless it is used in the meantime. An account that never got the warning, including every account with no email and every account on an instance that does not send email, is never deleted this way.+<sup>6</sup> Fluxer emails a warning first and deletes the account `warning_lead_days` later unless it is used. An account that never got the warning, such as one with no email, is never deleted this way#### Unclaimed account cleanup object@@ -269,212 +225,157 @@ What new and existing accounts have to do before they can reach other people, an| Field | Type | Description || --- | --- | --- |-| mode | string | `off` or `after_inactivity` |-| inactive_days | integer | Days without use before the warning email is sent (1-3650) |-| warning_lead_days | integer | Days between the warning email and the deletion (1-365) |+| mode | string | `off` or `after_inactivity` (default `after_inactivity`) |+| inactive_days | integer | Days without use before the warning email is sent (1-3650, default 730) |+| warning_lead_days | integer | Days between the warning email and the deletion (1-365, default 30) |-A new self-hosted instance starts with `date_of_birth` set to `off`, `interaction_tier` set to `enforced`, `unclaimed_account_cleanup` after 90 days with `after_grace`, and `dob_missing_cleanup` after 7 days. An upgraded self-hosted instance starts like a new one, except that `interaction_tier` is `legacy`, both cleanup policies are off and `date_of_birth` is read from the older fields. Every instance starts with `verification_basis` set to `auto`, `guild_join_gate` set to `always`, and `inactivity_deletion` after 730 days with the warning 30 days before.--A stored `abandoned_account_cleanup` from before the two cleanup policies existed is read as both policies on with the new instance defaults when true, and both off when false. When `inactivity_deletion` was never stored, `inactive_days` is the larger of 730 and the deprecated `inactivity_deletion_threshold_days` setting.+A new self-hosted instance starts with `date_of_birth` set to `off` and `interaction_tier` set to `enforced`. It deletes unclaimed accounts after 90 days with `after_grace`, and accounts without a date of birth after 7 days. An upgraded instance starts in `legacy` with both cleanup policies off. Every instance starts with inactivity deletion on.## Guild visits configuration object-The rollout of [visiting](/http-api/guilds/#visiting-guilds) a community before joining it. Only assigned people can start, list, read, or join through a visit, and the [join gate](#accounts-configuration-object) applies only to them. With `enabled` false nobody is assigned, starting a visit answers as if the guild or invite did not exist, and no session receives a visited guild. Saving this object ends the open visits of everyone it no longer assigns, so their sessions receive [Guild Delete](/gateway/events/#guild-delete) for each visited guild. A visit that has not expired comes back on the next session once the person is assigned again.+The rollout of [visiting](/http-api/guilds/#visiting-guilds) a community before joining it. Only assigned people can visit, and [get experiment assignments](/http-api/experiments/#get-experiment-assignments) reports the assignment as `guild_visits`. Saving this object ends the visits of people it stops assigning, and their sessions get [Guild Delete](/gateway/events/#guild-delete) for each community they were visiting.### Structure| Field | Type | Description || --- | --- | --- |-| enabled | boolean | Kill switch (default false) |+| enabled | boolean | Whether the rollout runs at all (default false) || user_basis_points | integer | Share of people assigned, in basis points (0-10000, default 0) |-| user_salt | string | Salt for the assignment bucket (1-64 printable ASCII characters) |-| included_user_ids | array[snowflake] | People always assigned (max 1000 items) |-| excluded_user_ids | array[snowflake] | People never assigned, checked first (max 1000 items) |--The assignment is reported as `guild_visits` by [get experiment assignments](/http-api/experiments/#get-experiment-assignments).+| user_salt | string | Salt of the assignment hash (1-64 printable ASCII characters) |+| included_user_ids | array[snowflake] | People always assigned (up to 1000 entries) |+| excluded_user_ids | array[snowflake] | People never assigned, which wins over every other rule (up to 1000 entries) |## Experiment delivery configuration object-How often a client polls [Get experiment assignments](/http-api/experiments/#get-experiment-assignments), and how widely those polls are spread. The setting is instance-wide and applies to every experiment at once, so adding an experiment adds no second cadence to tune.+How often clients poll [get experiment assignments](/http-api/experiments/#get-experiment-assignments). It applies to every experiment.### Structure| Field | Type | Description || --- | --- | --- |-| poll_interval_seconds | integer | Seconds between client revalidations (60-86400, default 300) |-| poll_jitter_percent | integer | Maximum random change to each revalidation interval, as a percentage in either direction (0-50, default 15) |--Every field is present on read. An absent document or missing field uses the defaults above.--Both fields are served to every account, whether or not any experiment targets that account, and neither one is versioned by `config_version`. A client that has never received a response from the experiments route uses built-in defaults of 300 seconds and 15 per cent, which equal the defaults above. A client that cannot read the route never receives either field.+| poll_interval_seconds | integer | Seconds between polls (60-86400, default 300) |+| poll_jitter_percent | integer | Most random change to each interval, as a percentage either way (0-50, default 15) |## Registration configuration object-Registration policy in force, plus every issued registration URL. Accounts awaiting a decision are read through [List pending registrations](#list-pending-registrations).+The registration policy and every issued registration URL. [List pending registrations](#list-pending-registrations) returns the accounts waiting for a decision.### Structure| Field | Type | Description || --- | --- | --- || mode | string | [Registration mode](#registration-modes) |-| admin_registration_urls_enabled<sup>1</sup> | boolean | Whether Admin-issued registration URLs are accepted |-| allowed_email_domains | array[string] | Domains that sign-ups, claims and email changes must use, empty for any. Admin-issued registration URLs skip it |-| urls<sup>2</sup> | array[[registration URL](#registration-url-object) object] | Every issued registration URL, including revoked and exhausted records |--<sup>1</sup> While the value is false, registration refuses every supplied registration URL code, so an issued URL stops working without being revoked--<sup>2</sup> Ordered by creation time, newest first--The URLs are embedded in the configuration response. There is no separate listing operation and no pagination, so every configuration read returns every issued URL.+| admin_registration_urls_enabled | boolean | Whether issued registration URLs work |+| allowed_email_domains | array[string] | Email domains that new accounts and email changes must use, or empty for any. Registration URLs aren't checked |+| urls | array[[registration URL](#registration-url-object) object] | Every issued registration URL, newest first, including revoked and used-up ones |## Registration modes| Value | Description || --- | --- || open | Anyone can register |-| approval | Anyone can register, and an Admin decision is required before the account can be used |-| closed | Public registration is closed |+| approval | Anyone can register, and an admin has to approve the account before it can be used |+| closed | Only a [registration URL](#registration-url-object) can create an account |-A valid registration URL is accepted in every mode, including `closed`, and its own `approval_required` replaces the mode for the account it creates.+A valid registration URL works in every mode, and its `approval_required` replaces the mode for the account it creates.## Registration URL object-A registration URL is an invitation an Admin can issue while the registration mode is `closed` or `approval`. It has its own expiry, use budget, and approval requirement.--Fluxer accepts a URL while it has no revocation time, has not passed its expiry, and has a use count below `max_uses`. A URL failing any of those tests is still reported here.+An invitation to register that an admin can hand out. Fluxer accepts it until it is revoked, expires or has been used `max_uses` times.### Structure| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | string | Identifier of the registration URL (1-128 characters) |-| label | ?string | Admin note attached to the URL, or null when unset |-| created_by_user_id | snowflake | Admin account that issued the URL |-| created_at | ISO8601 timestamp | Time the URL was issued |-| expires_at | ?ISO8601 timestamp | Time the URL stops working, or null when it never expires |-| max_uses | ?integer | Maximum permitted uses, or null for unlimited use |-| use_count | integer | How many registrations have completed through the URL |-| revoked_at | ?ISO8601 timestamp | Time the URL was revoked, or null while it has not been revoked |-| approval_required<sup>2</sup> | boolean | Whether an account created through the URL still needs an Admin decision |-| last_used_at | ?ISO8601 timestamp | Time the URL was last used, or null when it never has been |-| last_used_by_user_id | ?snowflake | Most recent account created through the URL, or null when there is none |-| invite_code<sup>3</sup> | ?string | Code of the invite an account created through the URL accepts, or null for none |--<sup>1</sup> A randomly generated UUID that is also the bearer code authorising registration, so every reader of the configuration can redeem an unrevoked URL--<sup>2</sup> The value replaces the instance registration mode for an account created through this URL, in both directions. A URL with the value false lets an account skip approval on an instance in `approval` mode--<sup>3</sup> The account accepts the invite once it exists, or once it is approved when the URL needs approval. An invite code the person brings to sign-up wins over it, and the account does not join the communities in `FLUXER_AUTO_JOIN_INVITE_CODE` then--### Example--```json-{- "id": "3f2a91c4-6d1e-4a77-9f0b-2c5d8e114a20",- "label": "Design team",- "created_by_user_id": "1478812292088791040",- "created_at": "2026-08-20T10:00:00.000Z",- "expires_at": null,- "max_uses": 25,- "use_count": 3,- "revoked_at": null,- "approval_required": false,- "last_used_at": "2026-08-29T18:22:10.000Z",- "last_used_by_user_id": "1500901337221828608",- "invite_code": null-}-```+| id<sup>1</sup> | string | ID of the registration URL (1-128 characters) |+| label | ?string | Admin note on the URL, or null |+| created_by_user_id | snowflake | Admin who issued the URL |+| created_at | ISO8601 timestamp | When the URL was issued |+| expires_at | ?ISO8601 timestamp | When the URL stops working, or null for never |+| max_uses | ?integer | Most uses allowed, or null for no limit |+| use_count | integer | Registrations completed through the URL |+| revoked_at | ?ISO8601 timestamp | When the URL was revoked, or null |+| approval_required | boolean | Whether an account created through the URL needs approval, whatever the registration mode |+| last_used_at | ?ISO8601 timestamp | When the URL was last used, or null |+| last_used_by_user_id | ?snowflake | Most recent account created through the URL, or null |+| invite_code | ?string | Invite that an account created through the URL accepts, or null |++<sup>1</sup> The ID is also the code that lets someone register. Anyone with `instance:config:view` can see it and use a URL that still works## Pending registration object-One account that registered and is still waiting for an Admin decision.+An account waiting for an admin decision.### Structure| Field | Type | Description || --- | --- | --- |-| user_id | snowflake | Account awaiting a decision |+| user_id | snowflake | Account waiting for a decision || username | string | Username chosen at registration |-| discriminator | integer | Discriminator tag from 0 to 9999 |-| global_name | ?string | Display name of the account, or null when unset |-| email | ?string | Email address of the account, or null when none is stored |-| requested_at | ISO8601 timestamp | Time the account registered |-| registration_url_id | ?string | [Registration URL](#registration-url-object) the account signed up through (1-128 characters), or null when it registered directly |-| client_ip<sup>1</sup> | ?string | IP address the account registered from, or null when none was recorded |-| invite_code<sup>2</sup> | ?string | Invite the account joins on approval (0-256 characters), or null when it has none |--<sup>1</sup> Stored at registration time and never refreshed, so it can be stale by the time an Admin reads it--<sup>2</sup> The invite code sent with the registration, or the instance's configured auto-join invite when it sent none. An account that registered through SSO sends no invite code, so it stores the auto-join invite or null+| discriminator | integer | Discriminator (0-9999) |+| global_name | ?string | Display name, or null |+| email | ?string | Email address, or null |+| requested_at | ISO8601 timestamp | When the account registered |+| registration_url_id | ?string | [Registration URL](#registration-url-object) used (1-128 characters), or null |+| client_ip | ?string | IP address at registration, or null |+| invite_code | ?string | Invite the account joins on approval (0-256 characters), or null |## Pending registration list object-Every account still waiting for an Admin decision.+Every account waiting for an admin decision.### Structure| Field | Type | Description || --- | --- | --- |-| pending_registrations<sup>1</sup> | array[[pending registration](#pending-registration-object) object] | Accounts awaiting a decision |--<sup>1</sup> Ordered by request time, oldest first. There is no pagination+| pending_registrations | array[[pending registration](#pending-registration-object) object] | Accounts waiting for a decision, oldest first |## Public application configuration object-Branding, legal, setup and registration field policy, in the Admin form of what the [Instance](/http-api/instance/) resource publishes to clients.+The admin view of the branding, legal and setup settings that the [Instance](/http-api/instance/) resource publishes.### Structure| Field | Type | Description || --- | --- | --- |-| branding | [public branding](/http-api/instance/#public-branding-object) object | Product name, image URLs, and theme colour |-| setup<sup>1</sup> | object | Has the single boolean `configured` |-| legal | [public legal configuration](/http-api/instance/#public-legal-configuration-object) object | Terms, privacy, and community guidelines URLs |-| registration<sup>2</sup> | [public registration fields](/http-api/instance/#public-registration-fields-object) object | Registration field collection policy |--<sup>1</sup> The [Instance](/http-api/instance/) resource publishes `admin_url` in this object as well--<sup>2</sup> The object has the single boolean `collect_date_of_birth`+| branding | [public branding](/http-api/instance/#public-branding-object) object | Product name, image URLs and theme color |+| setup | object | Has the boolean `configured` |+| legal | [public legal configuration](/http-api/instance/#public-legal-configuration-object) object | Terms, privacy and community guidelines URLs |+| registration | [public registration fields](/http-api/instance/#public-registration-fields-object) object | Has the boolean `collect_date_of_birth` |## Instance policy object-Community, direct message, premium and gating policy for the whole deployment.+Community, direct message, premium and gating policy.### Structure| Field | Type | Description || --- | --- | --- |-| single_community_enabled | boolean | Whether the deployment presents one community |-| single_community_guild_id | ?string | Guild used as that community, or null before one has been created |-| direct_messages_disabled | boolean | Whether direct messages are disabled |-| direct_messages_locked<sup>1</sup> | boolean | Whether the direct message setting is locked against further change |-| friends_disabled<sup>4</sup> | boolean | Whether friend requests are disabled |-| guild_create_access | boolean | Whether every account can create communities, or only admins and holders of the `feature_guild_create` limit |+| single_community_enabled | boolean | Whether the instance presents one community |+| single_community_guild_id | ?string | Guild used as that community, or null |+| direct_messages_disabled | boolean | Whether direct messages are off |+| direct_messages_locked | boolean | Whether the direct message setting is locked |+| friends_disabled<sup>1</sup> | boolean | Whether friend requests are off |+| guild_create_access | boolean | Whether every account can create communities. If not, only admins and accounts with the `feature_guild_create` limit can || premium_mode | string | [Premium mode](#premium-modes) |-| services | object | Operator overrides for `gif_enabled`, `youtube_enabled`, and `bluesky_enabled`. Each is nullable, and null means no override |-| services_resolved<sup>2</sup> | object | The same keys as concrete booleans, resolved from the override and the provider's own availability |-| services_available<sup>3</sup> | object | Provider availability for `gif`, `youtube`, and `bluesky`, with no operator override applied |--<sup>1</sup> The lock is set each time direct messages are re-enabled. [Update instance configuration](#update-instance-configuration) clears it when the policy object has `direct_messages_locked` set to false--<sup>2</sup> Each key is the operator override when one is set, and otherwise the matching `services_available` value+| services | object | Nullable `gif_enabled`, `youtube_enabled` and `bluesky_enabled` overrides |+| services_resolved | object | The same keys as booleans, using the override when set and `services_available` otherwise |+| services_available | object | Whether `gif`, `youtube` and `bluesky` are set up, before overrides |-<sup>3</sup> `gif` and `youtube` report whether an API key resolves from the stored configuration or the deployment configuration. `bluesky` is the value of `integrations.bluesky.effective_enabled`--<sup>4</sup> A stored policy from before the setting existed reads it from `direct_messages_disabled`, so a deployment that had direct messages off keeps friend requests off. Sending and accepting friend requests fail with 400 `FRIENDS_DISABLED` while it is true, except a request sent by a staff account+<sup>1</sup> Sending and accepting friend requests fail with 400 `FRIENDS_DISABLED` while it is true## Premium modes| Value | Description || --- | --- |-| mirror | Resolve premium access from the account's own entitlement and premium flags |-| everyone | Grant premium access to every account on a self-hosted deployment |+| mirror | Premium follows each account's own subscription |+| everyone | Every account has premium |-A self-hosted deployment issues gift codes and sells premium only in `mirror`.+Billing and gift codes work only in `mirror`.## Instance integrations object-Every provider reports its stored settings, a `_set` boolean in place of each secret, and the availability resolved from the stored settings and the deployment configuration.+Each provider's saved settings, a `_set` boolean for each secret and whether it is available.### Structure@@ -482,124 +383,110 @@ Every provider reports its stored settings, a `_set` boolean in place of each se| --- | --- | --- || gif | object | `klipy_api_key_set` and `effective_available` || youtube | object | `api_key_set` and `effective_available` |-| email | [email integration](#email-integration-object) object | Outbound email settings |+| email | [email integration](#email-integration-object) object | Outgoing email settings || bluesky | [Bluesky integration](#bluesky-integration-object) object | Bluesky client settings |## Email integration object-Outbound email settings, and the provider resolved from them.+Outgoing email settings, where each `effective_` field gives the value in use after environment variables apply.### Structure| Field | Type | Description || --- | --- | --- |-| delivery<sup>3</sup> | ?string | Stored delivery mode, `smtp` or `off`, or null to use the deployment configuration |+| delivery | ?string | Saved delivery mode, `smtp` or `off`, or null to use the environment || effective_delivery | string | Delivery mode in use, `smtp` or `off` |-| delivery_state<sup>4</sup> | string | Whether the instance sends email, and why not |-| enabled | ?boolean | Deprecated. The stored override from before `delivery` existed, or null |-| effective_enabled | boolean | Whether outbound email is in force, the same as `delivery_state` being `on` |-| provider | ?string | Deprecated. The stored override of `smtp` or `none` from before `delivery` existed, or null |-| effective_provider | string | Deprecated. Provider in use, either `smtp` or `none` |-| from_email | ?string | Envelope sender address |-| from_name | ?string | Envelope sender name, or null when none is set and mail is sent under the instance product name |+| delivery_state | string | One of the [email delivery states](/http-api/instance/#email-delivery-states) |+| enabled | ?boolean | Deprecated, use `delivery` |+| effective_enabled | boolean | Whether the instance sends email, the same as `delivery_state` being `on` |+| provider | ?string | Deprecated, use `delivery` |+| effective_provider | string | Deprecated. `smtp` or `none` |+| from_email | ?string | Sender address |+| from_name | ?string | Sender name, or null to use the product name || smtp<sup>1</sup> | object | The SMTP server settings |-| disable_new_ip_authorization | boolean | Whether new-IP authorisation email is suppressed by the stored setting |-| effective_disable_new_ip_authorization<sup>2</sup> | boolean | Whether it is suppressed once outbound email state is taken into account |--<sup>1</sup> Holds `host`, `port`, `username`, `tls_mode`, `effective_tls_mode`, and `password_set`. `host` and `username` are nullable, `port` is a nullable integer from 1 to 65535, and `password_set` is a plain boolean. `tls_mode` is the saved [SMTP TLS mode](#smtp-tls-mode), or null when none is saved. `effective_tls_mode` is the mode outgoing email uses, or null while the provider is not `smtp`+| disable_new_ip_authorization | boolean | Saved switch that turns off new-IP authorization email |+| effective_disable_new_ip_authorization | boolean | Whether new-IP authorization email is off, true when the instance doesn't send email |-<sup>2</sup> True whenever the stored setting is true or outbound email is not in force+<sup>1</sup> Has nullable `host`, `port` (1-65535), `username`, `tls_mode` (the saved [SMTP TLS mode](#smtp-tls-mode)) and `effective_tls_mode`, plus the boolean `password_set`-<sup>3</sup> A stored override from before `delivery` existed is read as `off` when `enabled` is false or `provider` is `none`, and as `smtp` when `enabled` is true with `smtp`. Setting `smtp` on a `username` instance returns 400 `INVALID_FORM_BODY` with `EMAIL_DELIVERY_REQUIRES_EMAIL_IDENTITY`, and setting it while no SMTP host is saved or set in the environment returns `SMTP_HOST_REQUIRED`--<sup>4</sup> One of the [email delivery states](/http-api/instance/#email-delivery-states). It is `on` only while delivery is `smtp`, the SMTP settings and the sender address are complete and the account identity mode is `email`--On a deployment whose account identity mode is `username`, `delivery_state` is always `off_username_mode` and `effective_enabled` is always false, whatever the stored settings hold.+On a `username` instance, `delivery_state` is always `off_username_mode`.## Bluesky integration object-Client identity the deployment presents to Bluesky, and the number of signing keys in its effective configuration.+The client details the instance shows to Bluesky.### Structure| Field | Type | Description || --- | --- | --- |-| enabled | ?boolean | Operator override, or null for no override |-| effective_enabled | boolean | Whether the integration is enabled with at least one configured signing key |-| client_name | ?string | Client name presented to Bluesky |+| enabled | ?boolean | Override, or null for none |+| effective_enabled | boolean | Whether the integration is on and has at least one signing key |+| client_name | ?string | Client name || client_uri | ?string | Client URI || logo_uri | ?string | Client logo URI || tos_uri | ?string | Client terms URI || policy_uri | ?string | Client policy URI |-| key_count | integer | Number of configured signing keys |--Signing keys are write-only and must have unique identifiers.+| key_count | integer | Number of signing keys |## Instance billing object-Stripe billing for the premium tier. Each stored field is nullable, and null falls back to the deployment configuration.+Stripe billing for premium. Each `effective_` field gives the value in use.### Structure| Field | Type | Description || --- | --- | --- |-| enabled | ?boolean | Operator override of the billing switch, or null for no override |-| effective_enabled | boolean | Whether billing is switched on once the override and the deployment configuration are combined |-| stripe_secret_key_set | boolean | Whether a Stripe secret key is stored or supplied by deployment configuration |-| stripe_webhook_secret_set | boolean | Whether a Stripe webhook secret is stored or supplied by deployment configuration |-| stripe_secret_key_stored | boolean | Whether a Stripe secret key is stored, not counting deployment configuration |-| stripe_webhook_secret_stored | boolean | Whether a Stripe webhook secret is stored, not counting deployment configuration |-| automatic_tax<sup>4</sup> | ?boolean | Stored switch for Stripe automatic tax at checkout, or null for the default |-| tax_id_collection<sup>4</sup> | ?boolean | Stored switch for collecting a buyer tax ID at checkout, or null for the default |-| terms_consent_required<sup>4</sup> | ?boolean | Stored switch for requiring terms of service consent at checkout, or null for the default |+| enabled | ?boolean | Override of the billing switch, or null |+| effective_enabled | boolean | Whether billing is on |+| stripe_secret_key_set | boolean | Whether a Stripe secret key is saved or set in the environment |+| stripe_webhook_secret_set | boolean | Whether a Stripe webhook secret is saved or set in the environment |+| stripe_secret_key_stored | boolean | Whether a Stripe secret key is saved here |+| stripe_webhook_secret_stored | boolean | Whether a Stripe webhook secret is saved here |+| automatic_tax | ?boolean | Saved switch for Stripe automatic tax, or null for off |+| tax_id_collection | ?boolean | Saved switch for collecting a buyer tax ID, or null for off |+| terms_consent_required | ?boolean | Saved switch for requiring terms consent at checkout, or null for off || effective_automatic_tax | boolean | Whether checkout uses Stripe automatic tax || effective_tax_id_collection | boolean | Whether checkout collects a buyer tax ID |-| effective_terms_consent_required | boolean | Whether checkout requires terms of service consent |-| default_currency | ?string | Currency used when no country mapping applies, or null |-| prices<sup>1</sup> | ?map[string, [billing price set](#billing-price-set-object) object] | Stored price sets keyed by currency, or null to use the deployment configuration |-| country_currencies | ?object | Stored map of two-letter country codes to currencies, or null |-| legacy_prices<sup>2</sup> | ?object | Stored map of legacy price slots to arrays of Stripe price IDs, or null to use the deployment configuration |-| billing_active<sup>3</sup> | boolean | Whether premium purchases are available |-| stripe_serviceable<sup>5</sup> | boolean | Whether existing Stripe subscriptions can be managed, cancelled and billed |-| catalog_mode | string | `operator` while `prices` is stored, otherwise `env` |+| effective_terms_consent_required | boolean | Whether checkout requires terms consent |+| default_currency | ?string | Currency when no country mapping applies, or null |+| prices | ?map[string, [billing price set](#billing-price-set-object) object] | Saved price sets by currency, or null to use the environment |+| country_currencies | ?object | Saved map of two-letter country codes to currencies, or null |+| legacy_prices<sup>1</sup> | ?object | Saved map of older price slots to Stripe price ID arrays, or null |+| billing_active<sup>2</sup> | boolean | Whether people can buy premium |+| stripe_serviceable | boolean | Whether existing Stripe subscriptions can be managed and billed |+| catalog_mode | string | `operator` while `prices` is saved, otherwise `env` || webhook_url | string | The URL to register as the Stripe webhook endpoint |-<sup>1</sup> Stored prices replace the deployment catalogue entirely and take any three-letter currency code. A buyer gets the currency mapped to their country, then `default_currency`, then the first configured currency. Fluxer's country checks for localised currencies do not apply to them--<sup>2</sup> A slot is `monthly`, `yearly`, `gift_1_month`, or `gift_1_year`, an underscore, and a currency, such as `monthly_GBP`. Existing subscriptions on a listed price keep renewing+<sup>1</sup> A slot is `monthly`, `yearly`, `gift_1_month` or `gift_1_year` and a currency, such as `monthly_GBP`. Subscriptions on a listed price keep renewing-<sup>3</sup> True when billing is switched on, a Stripe secret key is set, at least one currency has both a monthly and a yearly price, and premium tiering is in force. Premium tiering is in force only in the `mirror` [premium mode](#premium-modes)--<sup>4</sup> All three default to off. Automatic tax needs Stripe Tax set up, and terms consent needs a terms of service URL in the Stripe public details--<sup>5</sup> True while a Stripe secret key is set and premium tiering is in force. Only the checkout routes follow `billing_active`+<sup>2</sup> True when billing is on, a Stripe secret key is set, the premium mode is `mirror` and at least one currency has a monthly and a yearly price## Billing price set object-The Stripe price IDs for one currency. Each is nullable.+The Stripe price IDs for one currency.### Structure| Field | Type | Description || --- | --- | --- |-| monthly | ?string | Price ID of the monthly recurring plan |-| yearly | ?string | Price ID of the yearly recurring plan |+| monthly | ?string | Price ID of the monthly plan |+| yearly | ?string | Price ID of the yearly plan || gift_1_month | ?string | Price ID of the one-month gift || gift_1_year | ?string | Price ID of the one-year gift |## Instance media object-Attachment retention overrides the operator has set, and the values in force.+Attachment retention overrides and the values in use.### Structure| Field | Type | Description || --- | --- | --- |-| attachment_decay<sup>1</sup> | object | Nullable operator overrides plus an `effective` object of the same keys with concrete values |+| attachment_decay<sup>1</sup> | object | Nullable overrides, plus an `effective` object with the values in use |-<sup>1</sup> The override keys are `enabled`, `min_size_mb`, `max_size_mb`, `max_eligible_size_mb`, `min_lifetime_days`, `max_lifetime_days`, `curve`, `renew_threshold_days`, and `renew_window_days`. Each is null when the deployment default applies, and `effective` reports the value in force. `enabled` is a boolean, `curve` is a number from 0 to 1, the `_mb` keys are positive numbers, and the `_days` keys are positive safe integers+<sup>1</sup> The keys are `enabled`, `min_size_mb`, `max_size_mb`, `max_eligible_size_mb`, `min_lifetime_days`, `max_lifetime_days`, `curve` (0-1), `renew_threshold_days` and `renew_window_days`. Null uses the default-Fluxer clears `max_size_mb` when it is not above `min_size_mb`, clears `max_eligible_size_mb` when it is below `max_size_mb`, and clears `max_lifetime_days` when it is below `min_lifetime_days`. A cleared key uses the deployment default. The effective size range must have a finite maximum above its minimum, and retention must produce a valid expiry date. Check the returned `effective` values after an update.+Fluxer drops an override that would make a maximum smaller than its minimum.## Branding asset kinds@@ -610,87 +497,64 @@ Fluxer clears `max_size_mb` when it is not above `min_size_mb`, clears `max_elig| logo | Writes `branding.logo_url` || wordmark | Writes `branding.wordmark_url` || favicon | Writes `branding.favicon_url` |-| favicon_dark | Writes `branding.favicon_dark_url`. Self-hosted deployments only |-| sign_in_backdrop | Writes `branding.sign_in_backdrop_url`. Self-hosted deployments only |+| favicon_dark | Writes `branding.favicon_dark_url` |+| sign_in_backdrop | Writes `branding.sign_in_backdrop_url` |## SMTP TLS mode| Value | Description || --- | --- |-| implicit | TLS from the first byte, usually on port 465 |+| implicit | TLS from the start, usually on port 465 || starttls | A plain connection that must upgrade with STARTTLS, usually on port 587 || opportunistic | A plain connection that upgrades with STARTTLS when the server offers it |-| none | No TLS, even when the server offers STARTTLS |+| none | No TLS |-With no mode saved, Fluxer follows `FLUXER_EMAIL_SMTP_TLS_MODE`, then the older `FLUXER_EMAIL_SMTP_SECURE`. With neither set it uses `implicit` on port 465 and `starttls` on every other port.+With no saved mode, Fluxer uses `FLUXER_EMAIL_SMTP_TLS_MODE`, or `implicit` on port 465 and `starttls` on other ports.## SMTP test result object-Whether one [Create SMTP test](#create-smtp-test) connection attempt succeeded, and the failure text when it did not.+The result of one [Create SMTP test](#create-smtp-test).### Structure| Field | Type | Description || --- | --- | --- |-| ok | boolean | Whether the server accepted the connection and credentials, and the test message when one was sent |-| error<sup>1</sup> | ?string | Failure text, or null when the test succeeded |-| server_response?<sup>2</sup> | ?string | What the server answered when it accepted the test message |--<sup>1</sup> The message reported by the SMTP client, so it can repeat text supplied by the remote server--<sup>2</sup> Present only when the request set `send_to` and the server accepted the message, such as `250 2.0.0 Ok: queued as 7F3A`--### Example--```json-{- "ok": false,- "error": "Invalid login: 535 5.7.8 Authentication credentials invalid"-}-```+| ok | boolean | Whether the server accepted the connection, the credentials and any test message |+| error | ?string | Error message, or null when the test passed |+| server_response? | ?string | The server's reply to the test message, when `send_to` was set and it was accepted |## Registration URL creation object-One issued registration URL together with the link an Admin hands out.+A new registration URL and the link to hand out.### Structure| Field | Type | Description || --- | --- | --- |-| registration_url | [registration URL](#registration-url-object) object | Record that was issued |-| code<sup>1</sup> | string | Bearer code that authorises registration (1-256 characters) |-| url<sup>2</sup> | string | Complete registration link built from the configured web application endpoint |--<sup>1</sup> Equal to `registration_url.id`, so it can be recovered from any later configuration read--<sup>2</sup> The configured web application endpoint followed by `/register?registration_url=` and the percent-encoded code+| registration_url | [registration URL](#registration-url-object) object | The new URL |+| code | string | Code that lets someone register, the same as `registration_url.id` |+| url | string | The web app URL followed by `/register?registration_url=` and the code |## Limit configuration response object-The effective limit configuration together with the deployment defaults and the metadata an editor needs.+The limit configuration in use, with the defaults and the metadata an editor needs.### Structure| Field | Type | Description || --- | --- | --- |-| limit_config | [limit configuration](#limit-configuration-object) object | Effective configuration on the serving node |-| limit_config_json | string | The same document rendered as JSON indented by two spaces, for an editor to display |-| self_hosted | boolean | Whether the deployment runs in self-hosted mode |-| defaults<sup>1</sup> | map[string, map[string, integer]] | Deployment default limits, keyed by rule identifier and then by limit key |+| limit_config | [limit configuration](#limit-configuration-object) object | Configuration in use on the API node that answered |+| limit_config_json | string | The same document as JSON indented by two spaces |+| self_hosted | boolean | Whether the instance runs in self-hosted mode |+| defaults | map[string, map[string, integer]] | Default limits, by rule ID and then by limit key || metadata | map[string, [limit key metadata](#limit-key-metadata-object) object] | Display metadata for each limit key |-| categories<sup>2</sup> | map[string, string] | Display label for each metadata category |-| limit_keys | array[string] | Every [limit key](/http-api/instance/#limit-keys) in registry order |-| bounds?<sup>3</sup> | map[string, object] | Optional `min` and `max` pair for each limit key |--<sup>1</sup> Built for the deployment and the premium mode currently loaded by the serving node. Self-hosted `mirror` mode includes the `premium` rule--<sup>2</sup> The keys are `messages`, `guilds`, `channels`, `expressions`, `files`, `social`, and `features`--<sup>3</sup> Absent from every response+| categories | map[string, string] | Display label for each metadata category |+| limit_keys | array[string] | Every [limit key](/http-api/instance/#limit-keys) |+| bounds? | map[string, object] | Reserved and never sent |## Limit configuration object-Trait definitions and the ordered rules that decide each [limit key](/http-api/instance/#limit-keys).+Trait definitions and the ordered rules that set each [limit key](/http-api/instance/#limit-keys). Its field names are camelCase.### Structure@@ -701,22 +565,20 @@ Trait definitions and the ordered rules that decide each [limit key](/http-api/i## Limit rule object-One rule in that ordered set, with the filters that scope it and the limits it sets.+One rule, the filters that scope it and the limits it sets.### Structure| Field | Type | Description || --- | --- | --- |-| id | string | Rule identifier (at least 1 character) |+| id | string | Rule ID (at least 1 character) || filters? | object | Optional `traits` and `guildFeatures` string arrays that scope the rule || limits | map[string, integer] | Non-negative value for each [limit key](/http-api/instance/#limit-keys) the rule sets |-| modifiedFields?<sup>1</sup> | array[string] | Limit keys whose value differs from the deployment default |--<sup>1</sup> Compared with the deployment default rule of the same identifier, or with the deployment's `default` rule for a custom identifier. A set key absent from that default counts as modified. A rule with no differing key omits the field. Computing this field changes no value in `limits`+| modifiedFields? | array[string] | Limit keys whose value differs from the built-in rule with the same ID, or from the `default` rule for a custom rule |## Limit key metadata object-Display metadata for one [limit key](/http-api/instance/#limit-keys), which an editor uses to render its control.+Display metadata for one [limit key](/http-api/instance/#limit-keys).### Structure@@ -724,251 +586,176 @@ Display metadata for one [limit key](/http-api/instance/#limit-keys), which an e| --- | --- | --- || key | string | The [limit key](/http-api/instance/#limit-keys) || label | string | Display label |-| description | string | Description of what the limit bounds |-| category | string | Category key, resolved against `categories` |-| scope | string | `user`, `guild`, or `both` |-| isToggle | boolean | Whether the key is a feature gate whose value is 0 or 1 |-| unit? | string | `bytes` or `count` |-| min? | number | Suggested minimum for an editor |-| max? | number | Suggested maximum for an editor |+| description | string | What the limit bounds |+| category | string | Category key from `categories` |+| scope | string | `user`, `guild` or `both` |+| isToggle | boolean | Whether the key is a feature switch whose value is 0 or 1 |+| unit? | string | `bytes`, `count` or `bps` |+| min? | number | Smallest value a rule can set |+| max? | number | Largest value a rule can set |## Get instance configuration<RouteHeader method="GET" path="/v1/admin/instance/config" auditReason />-Returns the [instance configuration](#instance-configuration-object) object. Requires `instance:config:view`.+Returns the [instance configuration](#instance-configuration-object). You need `instance:config:view`.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [instance configuration](#instance-configuration-object) object | Configuration was returned |--### Side effects+| 200 | [instance configuration](#instance-configuration-object) object | The configuration was returned |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `get_instance_config`, target type `instance_config`, target ID `0`, and metadata key `registration_url_count`.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Update instance configuration<RouteHeader method="PATCH" path="/v1/admin/instance/config" auditReason />-Applies a merge patch to the stored configuration and returns the resulting [instance configuration](#instance-configuration-object) object. Requires `instance:config:update`.--:::note[Every section is optional and merged independently]-The body has one optional object for each section. Fluxer leaves an absent section alone. Within a section, an absent key keeps its stored value, and a key sent as null clears the stored value where the schema permits null.-:::+Merges the body into the saved configuration and returns the [instance configuration](#instance-configuration-object). You need `instance:config:update`. Sections and keys you leave out keep their saved value, and null clears a nullable key.### JSON body| Field | Type | Description || --- | --- | --- |-| sso?<sup>1</sup> | object | Every [SSO configuration](#sso-configuration-object) field except `client_secret_set` and `redirect_uri`, plus `client_secret` |-| gateway_rollout? | object | Any subset of the [Gateway rollout configuration](#gateway-rollout-configuration-object) fields, each bound as documented there |+| sso?<sup>1</sup> | object | [SSO configuration](#sso-configuration-object) fields except `client_secret_set` and `redirect_uri`, plus `client_secret` |+| gateway_rollout? | object | Any [Gateway rollout configuration](#gateway-rollout-configuration-object) fields || push_relay? | object | `relay_consent_accepted` from the [push relay configuration](#push-relay-configuration-object) |-| voice_p2p? | object | Any subset of the [peer-to-peer voice](#peer-to-peer-voice-configuration-object) fields |-| captcha? | object | Any subset of the [captcha configuration](#captcha-configuration-object) fields |-| experiment_delivery? | object | Any subset of the [experiment delivery](#experiment-delivery-configuration-object) fields |+| voice_p2p? | object | Any [peer-to-peer voice](#peer-to-peer-voice-configuration-object) fields |+| captcha? | object | Any [captcha configuration](#captcha-configuration-object) fields |+| experiment_delivery? | object | Any [experiment delivery](#experiment-delivery-configuration-object) fields || registration? | object | `mode`, `admin_registration_urls_enabled` and `allowed_email_domains` |-| app_public?<sup>2</sup> | object | `branding`, `setup`, `legal`, and `registration` sub-objects, each merged field by field |-| integrations?<sup>3</sup> | object | `gif`, `youtube`, `email`, and `bluesky` sub-objects, the last of which also has the `keys` array |-| media? | object | `attachment_decay` overrides, each nullable to restore the deployment default |-| policy? | [instance policy update](#instance-policy-update-structure) object | Community, direct message, premium, and gating policy |-| billing?<sup>4</sup> | object | Stored [instance billing](#instance-billing-object) fields, with `stripe_secret_key` and `stripe_webhook_secret` for the secrets |-| auth? | object | `identifier_first` and any subset of `instant_accounts`, from the [auth configuration](#auth-configuration-object) |-| accounts? | object | Any subset of the [accounts configuration](#accounts-configuration-object) fields, with any subset of each cleanup policy |-| guild_visits? | object | Any subset of the [guild visits configuration](#guild-visits-configuration-object) fields |-| notice?<sup>5</sup> | object | `message`, with optional `url`, `starts_at` and `ends_at`, for the [instance notice](/http-api/instance/#instance-notice-object) |--<sup>1</sup> The supplied fields are merged over the stored configuration and the result is validated as a whole. Every supplied endpoint URL uses `https`, has no credentials and no fragment, and resolves to a publicly routable address, otherwise the request returns 400 `INVALID_FORM_BODY` with `URL_MUST_USE_HTTPS`, `INVALID_URL_FORMAT` or `URL_NOT_PUBLICLY_ROUTABLE`+| app_public?<sup>2</sup> | object | `branding`, `setup`, `legal` and `registration` objects, each merged field by field |+| integrations?<sup>3</sup> | object | `gif`, `youtube`, `email` and `bluesky` objects, and `bluesky.keys` |+| media? | object | `attachment_decay` overrides, null to restore a default |+| policy? | [instance policy update](#instance-policy-update-structure) object | Community, direct message, premium and gating policy |+| billing?<sup>4</sup> | object | [Instance billing](#instance-billing-object) fields, plus `stripe_secret_key` and `stripe_webhook_secret` |+| auth? | object | `identifier_first` and any `instant_accounts` fields from the [auth configuration](#auth-configuration-object) |+| accounts? | object | Any [accounts configuration](#accounts-configuration-object) fields |+| guild_visits? | object | Any [guild visits configuration](#guild-visits-configuration-object) fields |+| notice?<sup>5</sup> | object | `message`, `url`, `starts_at` and `ends_at` of the [instance notice](/http-api/instance/#instance-notice-object) |-<sup>2</sup> `branding.product_name` is 1 to 80 characters, every branding and legal URL is at most 2048 characters and nullable, `branding.theme_color` is a hex colour (`#rgb` or `#rrggbb`, the `#` is optional) and nullable, and `setup.configured` and `registration.collect_date_of_birth` are booleans. The theme colour is returned as lowercase `#rrggbb`, and pure black is treated as unset and returned as null. `branding.premium_product_name` is 1 to 40 characters, and null restores the default. `branding.premium_info_url` and `legal.guidelines_url` are absolute `http` or `https` URLs. `branding.custom_css` is at most 32,768 characters, and null or a blank string clears it. `branding.upload_limit_message` is at most 500 characters, and null or a blank string clears it. Every string is trimmed before it is stored, and null or an empty string clears a legal URL+<sup>1</sup> While `enabled` is true, endpoint URLs must use `https` and point at a public address unless `FLUXER_SSO_ALLOW_PRIVATE_ADDRESSES` is true. Turning on both `enabled` and `enforced` fails with `SSO_MISCONFIGURED` unless there is an `issuer`, or an authorization endpoint, a token endpoint, a client ID and `jwks_url` or `userinfo_url`-`push_relay` takes only `relay_consent_accepted`. Fluxer sets `relay_consent_accepted_at` and `relay_consent_accepted_by` itself on the request that changes that flag, and accepts neither from a request. Turning the flag on stamps the current time and the acting account, and turning it off clears both to null. A request that repeats the flag it already holds leaves the stamp alone.+<sup>2</sup> `branding.product_name` is 1-80 characters, `branding.premium_product_name` 1-40, `branding.custom_css` up to 32,768 and `branding.upload_limit_message` up to 500. URLs are up to 2048 characters and `branding.theme_color` is a hex color. Setting `setup.configured` to true finishes setup, and accounts that register after that don't get the wildcard Admin ACL-`voice_p2p` works the same way, over the [peer-to-peer voice configuration](#peer-to-peer-voice-configuration-object) fields and its own `config_version`, except that a request whose fields all match the stored ones writes nothing and leaves `config_version` alone.+<sup>3</sup> A secret such as `klipy_api_key`, `api_key` or the SMTP `password` is saved when sent and kept when left out. `email.smtp` takes `host`, `port`, `username`, `password` and `tls_mode`. `bluesky.keys` replaces the signing keys with up to 8 entries of `kid` and `private_key`-`captcha` takes any subset of the [captcha configuration](#captcha-configuration-object) fields, each bound as documented there. Fluxer merges the supplied fields over the stored ones. The section has no `config_version`.+<sup>4</sup> `prices`, `country_currencies` and `legacy_prices` replace the saved value, and an empty `prices` object goes back to the environment prices. Billing can't be on while the premium mode is `everyone`-`auth`, `accounts` and `guild_visits` are merged over the stored values field by field, and each has no `config_version`.+<sup>5</sup> `message` is up to 1000 characters, and null or an empty string removes the notice. A request replaces the whole notice-`experiment_delivery` takes both [experiment delivery configuration](#experiment-delivery-configuration-object) fields, each bound as documented there. It is a section of its own, so a write to it changes no `config_version` and changes no assignment, only the cadence on which clients ask for one.+Fluxer checks the merged settings before it writes anything, and refuses these combinations with 400 `INVALID_FORM_BODY`.-<sup>3</sup> A secret such as `klipy_api_key`, `api_key`, or the SMTP `password` is written when supplied and left alone when absent. `integrations.email.smtp` takes `host`, `port`, `username`, `password`, and `tls_mode`, an [SMTP TLS mode](#smtp-tls-mode), and null clears a saved value so the environment applies again. The older boolean `secure` is still read when `tls_mode` is absent. True means `implicit` on port 465, or when the body has no port, and `starttls` on any other port. False means `opportunistic`. Leave `username` and `password` both empty for a relay that accepts mail without signing in. Setting only one of them leaves email off. `integrations.bluesky.keys` is the only way to write the Bluesky signing keys counted as `bluesky.key_count`. It takes up to 8 entries of `kid` (1-255 characters) and nullable `private_key` (up to 10000 characters), and replaces the stored key set outright--<sup>4</sup> A Stripe secret, `enabled`, `automatic_tax`, `tax_id_collection` and `terms_consent_required` are written when supplied, cleared by null, and left alone when absent. A null `enabled` follows `FLUXER_STRIPE_ENABLED`. `prices`, `country_currencies`, and `legacy_prices` replace the stored value outright, a price slot left out is stored as null, and an empty `prices` object restores the deployment catalogue. A price ID is `price_` followed by letters and digits. A currency is three upper-case letters and a country code is two--<sup>5</sup> `message` is up to 1000 characters after trimming, and null or an empty string removes the notice and ignores the other fields. `url` is an absolute `http` or `https` URL of up to 2048 characters. `starts_at` and `ends_at` are ISO8601 timestamps, and `ends_at` must come after `starts_at`. Fields left out are stored as null, so a request replaces the whole notice--Older field names are still accepted as input and translated. `auth.identifier_first` takes true for `on` and false for `off`. `accounts.date_of_birth_enforcement` and `app_public.registration.collect_date_of_birth` set `date_of_birth` the way a stored document from before it is read. `accounts.abandoned_account_cleanup` turns both cleanup policies on or off. `captcha.enabled` takes false for `none` and true for `altcha`. `integrations.email.enabled` and `provider` set `delivery`.--:::note[The account settings are checked together]-Fluxer merges the body over the stored auth, captcha, accounts, email and account identity settings and checks the result before writing anything. It refuses instant accounts with the captcha provider `none`, `identifier_first` set to `on` or email delivery set to `smtp` on a `username` instance, and `verification_basis` set to `confirmed_email` while the instance does not send email. Each refusal is 400 `INVALID_FORM_BODY` with the code at the field the body changed.-:::--:::note[Single sign-on URL validation is conditional]-Fluxer skips URL validation while the merged configuration leaves single sign-on disabled. A configuration both enabled and enforced fails validation against `sso` with `SSO_MISCONFIGURED` unless it resolves an authorisation endpoint, a token endpoint, a client identifier, and a claims source, which is `jwks_url` or `userinfo_url`. A set `issuer` meets the endpoint and claims source requirements, because Fluxer can discover them from the issuer.-:::+- `INSTANT_ACCOUNTS_REQUIRE_CAPTCHA` when instant accounts are turned on while the captcha provider is `none`+- `CAPTCHA_REQUIRED_BY_INSTANT_ACCOUNTS` when the captcha provider is set to `none` while instant accounts are on+- `IDENTIFIER_FIRST_REQUIRES_EMAIL_IDENTITY` when `identifier_first` is set to `on` on a `username` instance+- `EMAIL_DELIVERY_REQUIRES_EMAIL_IDENTITY` when email delivery is set to `smtp` on a `username` instance+- `SMTP_HOST_REQUIRED` when email delivery is set to `smtp` with no SMTP host saved or in the environment+- `VERIFICATION_BASIS_REQUIRES_EMAIL_DELIVERY` when `verification_basis` is `confirmed_email` while the instance doesn't send email#### Instance policy update structure| Field | Type | Description || --- | --- | --- |-| single_community_enabled?<sup>1</sup> | boolean | Whether the deployment presents one community |-| single_community_name?<sup>1</sup> | string | Name used only when the community has to be created (1-100 characters) |-| single_community_guild_id?<sup>3</sup> | snowflake | Existing guild to use as the single community |-| single_community_add_members?<sup>4</sup> | boolean | Whether to add every existing account to the single community |-| direct_messages_disabled?<sup>2</sup> | boolean | Whether direct messages are disabled |-| direct_messages_locked?<sup>2</sup> | boolean | Whether the direct message setting stays locked |-| friends_disabled? | boolean | Whether friend requests are disabled |+| single_community_enabled?<sup>1</sup> | boolean | Whether the instance presents one community |+| single_community_name? | string | Name for the community when Fluxer has to create it (1-100 characters) |+| single_community_guild_id? | snowflake | Existing guild to use as the single community |+| single_community_add_members?<sup>2</sup> | boolean | Whether to add every existing account to the single community |+| direct_messages_disabled?<sup>3</sup> | boolean | Whether direct messages are off |+| direct_messages_locked? | boolean | Only false, to unlock the direct message setting |+| friends_disabled?<sup>4</sup> | boolean | Whether friend requests are off || guild_create_access? | boolean | Whether every account can create communities || premium_mode? | string | [Premium mode](#premium-modes) |-| services? | object | Nullable `gif_enabled`, `youtube_enabled`, and `bluesky_enabled` overrides |--<sup>1</sup> Setting `single_community_enabled` to true adopts the already designated guild when one still exists. When none is designated or the designated guild was deleted, it creates a community using `single_community_name` or the configured product name. When the stored guild ID is not a valid ID, or the guild lookup fails for a reason other than an unknown guild, the operation fails and Fluxer creates no community. On a deployment whose setup is already complete, enabling it while no guild is designated fails with 400 `INSTANCE_POLICY_TRANSITION_NOT_ALLOWED`, as does enabling it when the acting Admin account cannot be resolved. Setting it to false only clears the flag and leaves the guild in place+| services? | object | Nullable `gif_enabled`, `youtube_enabled` and `bluesky_enabled` overrides |-<sup>3</sup> The guild must exist, otherwise the request fails with 400 `INVALID_FORM_BODY` against `policy.single_community_guild_id`. Sent with `single_community_enabled` set to true, it turns the mode on with that guild at any time, also after setup. Sent while the mode is already on, it moves the mode to that guild. New accounts join the guild named here, and accounts already in the previous one stay there+<sup>1</sup> Turning it on uses the community set in `single_community_guild_id`, or creates one owned by you. After setup is complete, it fails with 400 `INSTANCE_POLICY_TRANSITION_NOT_ALLOWED` unless a community is already set or sent. Turning it off keeps the community-<sup>4</sup> Only true does anything. It queues a background job that adds every account that can sign in, is not a bot and is not waiting for registration approval to the single community, without join messages. The job works through accounts in pages of 100. A page that fails is retried, and a run that has made no progress for 10 minutes is picked up again at the first page it has not finished, so it always reaches the end. An account the community refuses, such as a banned one, is skipped, and so is an account that still fails on the page's last retry. Sending true again restarts from the first page and stops the older run. The request fails with 400 `INVALID_FORM_BODY` when the mode is off after the policy is applied+<sup>2</sup> True starts a background job that adds every account that can sign in, except bots and accounts waiting for approval. Sending it again restarts the job-<sup>2</sup> The setting can be changed only while `direct_messages_locked` is false, and a change attempted after the lock is set fails with 400 `INSTANCE_POLICY_TRANSITION_NOT_ALLOWED` unless the same request sets `direct_messages_locked` to false. Re-enabling direct messages sets the lock again+<sup>3</sup> Re-enabling direct messages locks the setting, and changing it while locked fails with `INSTANCE_POLICY_TRANSITION_NOT_ALLOWED` unless the same request sends `direct_messages_locked` as false-`direct_messages_locked` accepts only false, and a body that sets it to true fails with 400 `INVALID_FORM_BODY`.--On a self-hosted deployment, billing and the `everyone` premium mode exclude each other. A body that would leave billing switched on in `everyone` fails with 400 `INVALID_FORM_BODY` and writes nothing, whether it enables billing or switches the premium mode.+<sup>4</sup> Left out while `direct_messages_disabled` changes, it takes the same value### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [instance configuration](#instance-configuration-object) object | The patch was applied |-| 400 | [error response](/admin-api/#error-response) | A policy transition is refused, returned as `INSTANCE_POLICY_TRANSITION_NOT_ALLOWED` |--:::caution[Sections are applied one after another]-The order is `gateway_rollout`, `push_relay`, `voice_p2p`, `captcha`, `auth`, `accounts`, `guild_visits`, `experiment_delivery`, `sso`, `registration`, `app_public` branding, legal, and registration fields, `integrations`, `media`, `policy`, `billing`, `notice`, and finally `app_public.setup`. A failure part way through leaves the earlier sections written.-:::+| 200 | [instance configuration](#instance-configuration-object) object | The update was applied |+| 400 | [error response](/admin-api/#error-response) | `INSTANCE_POLICY_TRANSITION_NOT_ALLOWED` when a policy change isn't allowed |-### Side effects+Fluxer saves the sections one at a time, and a failure partway keeps the sections saved before it.-Fluxer publishes a `gateway_rollout` change to the Gateway cluster. A `push_relay` change reaches the push service without a restart. A `billing` change applies without a restart. Premium mode changes affect the limits in force without replacing the saved limit configuration. On self-hosted deployments, `everyone` hides premium-filtered rules. Switching back to `mirror` restores them unless an Admin has replaced the limit configuration in the meantime. Enabling single community mode creates the community when none is designated and no `single_community_guild_id` is sent, with the acting Admin as owner. A `notice` change reaches clients through the discovery document.--An update that sets `app_public.setup.configured` to true also marks the deployment as bootstrapped, so no later registration receives the wildcard Admin ACL.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `update_instance_config`, target type `instance_config`, and target ID `0`. The metadata key `sections` lists the names of the non-null top-level sections in the body, comma-separated in alphabetical order, and is absent when the body supplies none. No value from the body is recorded. A request that fails part way records no entry.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Create branding asset<RouteHeader method="POST" path="/v1/admin/instance/config/branding-assets" auditReason />-Uploads an image, stores its [Media Proxy](/media-proxy/overview/) URL in the selected branding slot, and returns the resulting [instance configuration](#instance-configuration-object) object. Requires `instance:config:update`.+Uploads an image to a branding slot and returns the [instance configuration](#instance-configuration-object). You need `instance:config:update`.### JSON body| Field | Type | Description || --- | --- | --- |-| kind | string | [Branding asset kind](#branding-asset-kinds) naming the slot to write |-| image?<sup>1</sup> <sup>2</sup> | ?string | Base64 image or data URI (max 16000000 characters) |--<sup>1</sup> Omitting the key and sending null both clear the slot+| kind | string | [Branding asset kind](#branding-asset-kinds) of the slot to write |+| image?<sup>1</sup> | ?string | Base64 image or data URI, or null to clear the slot (up to 16000000 characters) |-<sup>2</sup> The image decodes to no more than the resolved `avatar_max_size` limit, which defaults to 10485760 bytes, and is a PNG, JPEG, WebP, GIF, APNG, AVIF, HEIC, HEIF, JXL, or SVG. An animated AVIF is refused. The `sign_in_backdrop` kind is stricter. Its image decodes to no more than 4194304 bytes and is a still PNG, JPEG, WebP, or AVIF+<sup>1</sup> Up to the `avatar_max_size` limit, 10 MiB by default, as PNG, JPEG, WebP, GIF, APNG, still AVIF, HEIC, HEIF, JXL or SVG. A `sign_in_backdrop` is up to 4 MiB as a still PNG, JPEG, WebP or AVIF### Response| Status | Body | Condition || --- | --- | --- || 200 | [instance configuration](#instance-configuration-object) object | The slot was written or cleared |-| 400<sup>1</sup> | [error response](/admin-api/#error-response) | The image cannot be decoded, is too large, or is not an accepted format, or the kind is self-hosted only |--<sup>1</sup> Returned as 400 `INVALID_FORM_BODY` with `IMAGE_SIZE_EXCEEDS_LIMIT`, `INVALID_IMAGE_FORMAT`, or `FAILED_TO_UPLOAD_IMAGE` against `image`, or with a message against `kind`--### Side effects--The stored image is served through the Media Proxy. Non-JPEG images are re-encoded to strip metadata and JPEG images are re-encoded at quality 100. The previously referenced image is not deleted.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `upload_branding_asset`, target type `instance_config`, target ID `0`, and metadata keys `kind` and `cleared`. `cleared` is `true` when the request cleared the slot.+| 400 | [error response](/admin-api/#error-response) | `IMAGE_SIZE_EXCEEDS_LIMIT`, `INVALID_IMAGE_FORMAT` or `FAILED_TO_UPLOAD_IMAGE` for a bad image |-### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Create SMTP test<RouteHeader method="POST" path="/v1/admin/instance/config/smtp-tests" auditReason />-Opens a connection to an SMTP server, authenticates against it, optionally sends a short test message, and reports the outcome as an [SMTP test result](#smtp-test-result-object) object without storing anything. Requires `instance:config:update`.--:::note[A rejected credential is still a successful test]-A test that runs to completion answers 200 whether or not the server accepted the connection. The `ok` field is the verdict and `error` is the failure text.-:::+Connects and signs in to an SMTP server, sends a test message when `send_to` is set and returns an [SMTP test result](#smtp-test-result-object) without saving anything. You need `instance:config:update`.### JSON body| Field | Type | Description || --- | --- | --- |-| host? | ?string | SMTP host to connect to (1-255 characters after trimming) |-| port? | ?integer | SMTP port to connect to (1-65535) |-| username? | ?string | SMTP username to authenticate with (1-320 characters after trimming) |-| password? | ?string | SMTP password to authenticate with (1-4096 characters after trimming) |-| tls_mode?<sup>1</sup> | ?string | [SMTP TLS mode](#smtp-tls-mode) to connect with |-| from_email? | ?string | From address for the test message, in place of the saved one |-| from_name? | ?string | From name for the test message, in place of the saved one (1-120 characters after trimming) |-| send_to?<sup>2</sup> | ?string | Email address to send a test message to |--Every field left out or sent as null is filled from the saved configuration, the one outgoing email uses. The saved password is filled in only while `host` and `username` are left out or match the saved ones. A test that names another host or username without a `password` fails before any connection is made, unless it ends up with no username, which tests a relay that accepts mail without signing in.--An empty body tests exactly what a send would use. It fails without connecting while outgoing email is not in force, which covers email turned off, a provider other than `smtp`, a missing from address, a missing host, a username without a password or the reverse, and an instance that signs in with usernames. A test with fields in the body fails the same way when the host ends up empty or only one of the username and password is set. A username and password that are both empty connect without signing in.+| host? | ?string | SMTP host (1-255 characters) |+| port? | ?integer | SMTP port (1-65535) |+| username? | ?string | SMTP username (1-320 characters) |+| password? | ?string | SMTP password (1-4096 characters) |+| tls_mode? | ?string | [SMTP TLS mode](#smtp-tls-mode) |+| from_email? | ?string | Sender address for the test message |+| from_name? | ?string | Sender name for the test message (1-120 characters) |+| send_to? | ?string | Address to send a test message to |-<sup>1</sup> Left out, the saved mode applies. Sent as null, the mode follows `FLUXER_EMAIL_SMTP_TLS_MODE`, then the port--<sup>2</sup> Sent only after the connection check passes. The message comes from `from_email` and `from_name` when they are set, and otherwise from the saved from address and name, which is the saved name or the product name. Its subject names the product. A server that refuses it, for example because the from address does not belong to the account, makes `ok` false with the server's answer in `error`. A missing from address fails the test without sending+Fluxer fills each missing field from the saved settings, and an empty body tests what outgoing email uses. It reuses the saved password only for the saved host and username.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [SMTP test result](#smtp-test-result-object) object | The test ran to completion, including a rejected credential |--### Side effects--No configuration is written and the supplied credentials are discarded when the request completes. The connection, greeting, and socket each have a ten-second deadline.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `test_smtp_connection`, target type `instance_config`, target ID `0`, and metadata keys `port`, `tls_mode`, `ok`, and `sent_message`, which says whether the request set `send_to`. The host, username, password, recipient, and failure text are not recorded.+| 200 | [SMTP test result](#smtp-test-result-object) object | The test ran, and `ok` says whether it passed |-### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Create registration URL<RouteHeader method="POST" path="/v1/admin/instance/registration-urls" auditReason />-Issues a registration URL an Admin can hand out while the registration mode is `closed` or `approval`, and returns a [registration URL creation](#registration-url-creation-object) object. Requires `instance:config:update`.--:::caution[The code is the identifier]-The returned `code` is the same value as `registration_url.id`, and every [Get instance configuration](#get-instance-configuration) response has that identifier. Treat `instance:config:view` as a registration capability on a deployment in `closed` or `approval` mode.-:::+Issues a [registration URL](#registration-url-object) and returns a [registration URL creation](#registration-url-creation-object) object. You need `instance:config:update`.### JSON body| Field | Type | Description || --- | --- | --- |-| label?<sup>1</sup> | ?string | Admin note to attach to the URL (1-120 characters), or null for none |-| expires_at? | ?ISO8601 timestamp | Time the URL stops working, or null for a URL that never expires |-| max_uses? | ?integer | Maximum permitted uses (1-1000000), or null for unlimited use |-| approval_required? | boolean | Whether an account created through the URL still needs an Admin decision (default false) |-| invite_code?<sup>2</sup> | ?string | Code of an invite that an account created through the URL accepts (1-64 letters, digits and hyphens) |--<sup>1</sup> The label is trimmed before it is length checked, so a whitespace-only label fails body validation. Omit the key or send null for a URL with no label--<sup>2</sup> The invite must exist when the URL is issued, otherwise the request fails with 400 `INVALID_FORM_BODY` against `invite_code`. An invite that is deleted later is skipped when an account is created+| label? | ?string | Admin note (1-120 characters after trimming), or null |+| expires_at? | ?ISO8601 timestamp | When the URL stops working, or null for never |+| max_uses? | ?integer | Most uses allowed (1-1000000), or null for no limit |+| approval_required? | boolean | Whether an account created through the URL needs approval (default false) |+| invite_code? | ?string | An existing invite that new accounts accept (1-64 letters, digits and hyphens) |### Response@@ -976,92 +763,48 @@ The returned `code` is the same value as `registration_url.id`, and every [Get i| --- | --- | --- || 200 | [registration URL creation](#registration-url-creation-object) object | The URL was issued |-### Side effects--A newly issued URL has a use count of zero, no revocation time, and the acting Admin as its issuer. It is the first entry of `registration.urls` on the next configuration read. The operation changes no account.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `create_registration_url`, target type `registration_url`, target ID `0`, and metadata key `approval_required`, plus `max_uses` and `invite_code` when the body sets them. The label is not recorded. The entry has no registration URL identifier, because the identifier is the bearer code.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Revoke registration URL<RouteHeader method="DELETE" path="/v1/admin/instance/registration-urls/{registration_url_id}" auditReason />-Revokes one registration URL so it can no longer be redeemed and returns the resulting [instance configuration](#instance-configuration-object) object. Called again on a URL that is already revoked, it removes the URL from the list. Requires `instance:config:update`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| registration_url_id | string | Identifier of the registration URL to revoke (1-128 characters) |+Revokes a registration URL and returns the [instance configuration](#instance-configuration-object). You need `instance:config:update`. Revoking a URL a second time removes it from the list, and accounts that registered through it keep their access.### Response| Status | Body | Condition || --- | --- | --- |-| 200<sup>1</sup> | [instance configuration](#instance-configuration-object) object | The revocation was applied |--<sup>1</sup> An identifier naming no registration URL answers 200 with the configuration unchanged. A URL that is already revoked is removed instead, and its record is gone from later configuration reads--:::caution[Revocation stops only later registrations]-An account that registered through the URL keeps its access, membership, and decision. A revocation cannot be reversed.-:::--### Side effects--A URL that was active records its revocation time and stays in the configuration response afterwards. A URL that was already revoked is deleted. The operation changes no account, and a pending registration that names a removed URL keeps its `registration_url_id`.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `revoke_registration_url`, or `remove_registration_url` when the URL was removed, target type `registration_url`, target ID `0`, and no metadata, including for an identifier that names no registration URL. The entry has no registration URL identifier, because the identifier is the bearer code.+| 200 | [instance configuration](#instance-configuration-object) object | The URL was revoked or removed |-### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Rename registration URL<RouteHeader method="PATCH" path="/v1/admin/instance/registration-urls/{registration_url_id}" auditReason />-Changes the label of one registration URL and returns the resulting [instance configuration](#instance-configuration-object) object. Requires `instance:config:update`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| registration_url_id | string | Identifier of the registration URL to rename (1-128 characters) |+Changes the label of a registration URL and returns the [instance configuration](#instance-configuration-object). You need `instance:config:update`.### JSON body| Field | Type | Description || --- | --- | --- |-| label<sup>1</sup> | ?string | New label (up to 120 characters), or null to clear it |--<sup>1</sup> The label is trimmed, and an empty label clears it like null+| label | ?string | New label (up to 120 characters), or null or empty to clear it |### Response| Status | Body | Condition || --- | --- | --- || 200 | [instance configuration](#instance-configuration-object) object | The label was changed |-| 404 | [error response](/admin-api/#error-response) | No registration URL has the identifier, returned as `NOT_FOUND` |--### Side effects--The URL keeps its code, use count and revocation state. The operation changes no account.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `rename_registration_url`, target type `registration_url`, target ID `0`, and no metadata. The label is not recorded.+| 404 | [error response](/admin-api/#error-response) | `NOT_FOUND` when no registration URL has the ID |-### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## List pending registrations<RouteHeader method="GET" path="/v1/admin/instance/pending-registrations" auditReason />-Returns the [pending registration list](#pending-registration-list-object) object. Requires `registration:review`.+Returns the [pending registration list](#pending-registration-list-object). You need `registration:review`.### Response@@ -1069,61 +812,36 @@ Returns the [pending registration list](#pending-registration-list-object) objec| --- | --- | --- || 200 | [pending registration list](#pending-registration-list-object) object | Pending registrations were returned |-### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_pending_registrations`, target type `instance_config`, target ID `0`, and metadata key `pending_registration_count`.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Update pending registration<RouteHeader method="PATCH" path="/v1/admin/instance/pending-registrations/{user_id}" auditReason />-Approves or rejects one pending registration and returns the resulting [pending registration list](#pending-registration-list-object) object. Requires `registration:review`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | Account awaiting a decision |+Approves or rejects a pending registration and returns the [pending registration list](#pending-registration-list-object). You need `registration:review`.### JSON body| Field | Type | Description || --- | --- | --- |-| status | string | Either `approved` or `rejected` |+| status | string | `approved` or `rejected` |### Response| Status | Body | Condition || --- | --- | --- |-| 200<sup>1</sup> | [pending registration list](#pending-registration-list-object) object | The decision was applied |+| 200 | [pending registration list](#pending-registration-list-object) object | The decision was applied |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER` when the account isn't pending or rejected |-<sup>1</sup> An account that no longer exists still answers 200. The pending registration is removed and no trait is written+Approval adds the account to its invite's community and the single community, and emails the person when the account has an email address. Rejection adds the `registration_rejected` trait, which blocks new sign-ins but leaves existing sessions signed in. A later approval removes it.-:::caution[Decisions apply even without a pending entry]-Both decisions remove the pending registration, but the endpoint does not require the account to be in that list. Rejecting writes the `registration_rejected` trait. A later approval can clear it again. The trait can also be changed through [Set user traits](/admin-api/users/#set-user-traits).-:::--### Side effects--Approval removes both the `registration_pending_approval` trait and the `registration_rejected` trait. When the account still had the `registration_pending_approval` trait, approval then accepts the stored `invite_code` when there is one and joins the account to the single community when that mode is enabled and a guild is designated. A join that fails, such as one through an invite that was deleted, has expired or needs the account to be online, is logged and does not fail the request. Rejection removes the `registration_pending_approval` trait and adds the `registration_rejected` trait, which blocks login and every later session creation. A session issued before the decision stays valid. The pending registration is removed either way.--When the stored pending registration list fails validation, the request fails before Fluxer changes the account. A failure after Fluxer writes the account traits leaves those traits written and can leave the entry in the pending list. Check the account traits and the pending list before retrying.--One Admin audit entry with the action `approve_registration` or `reject_registration` targets the account and records the audit reason. It has no metadata, except for an account that no longer exists, whose entry has the metadata key `account_found` set to `false`.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Get limit configuration<RouteHeader method="GET" path="/v1/admin/limit-config" auditReason />-Returns the [limit configuration response](#limit-configuration-response-object) object. Requires `instance:limit_config:view`.+Returns the [limit configuration response](#limit-configuration-response-object). You need `instance:limit_config:view`.### Response@@ -1131,53 +849,27 @@ Returns the [limit configuration response](#limit-configuration-response-object)| --- | --- | --- || 200 | [limit configuration response](#limit-configuration-response-object) object | The configuration was returned |-### Side effects--The response reflects the configuration in force on the node that serves the request, so two nodes can report different values while a change propagates.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `get_limit_config`, target type `limit_config`, target ID `0`, and metadata key `rule_count`.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Replace limit configuration<RouteHeader method="PUT" path="/v1/admin/limit-config" auditReason />-Replaces the stored limit configuration with the supplied document and returns the resulting [limit configuration response](#limit-configuration-response-object) object. Requires `instance:limit_config:update`.--:::caution[An absent custom rule is removed]-A default rule that the body omits is restored from the deployment defaults. Fluxer re-merges the write with the current defaults immediately.-:::--:::note[The stored document can differ from the body]-The re-merge restores every default rule and back-fills every default limit key the submitted rule did not override. Read the response to see what was stored.-:::+Replaces the saved limit configuration and returns the [limit configuration response](#limit-configuration-response-object). You need `instance:limit_config:update`. Fluxer merges the body with the defaults. A default rule or limit key you leave out comes back, and a custom rule you leave out is deleted.### JSON body| Field | Type | Description || --- | --- | --- |-| limit_config<sup>1</sup> | [limit configuration](#limit-configuration-object) object | Complete replacement document |--<sup>1</sup> `traitDefinitions` can be omitted and is then stored as an empty array. Every key inside a rule's `limits` map is a known [limit key](/http-api/instance/#limit-keys) and every value is a non-negative safe integer, otherwise the body fails validation. `modifiedFields` is not accepted on input and is recomputed+| limit_config | [limit configuration](#limit-configuration-object) object | The full document, without `modifiedFields` |### Response| Status | Body | Condition || --- | --- | --- || 200 | [limit configuration response](#limit-configuration-response-object) object | The configuration was replaced |-| 400 | [error response](/admin-api/#error-response) | Body validation fails, including an unknown limit key, returned as `INVALID_FORM_BODY` |--### Side effects--On a self-hosted deployment whose premium mode is `everyone`, Fluxer drops the `premium` trait definition and every rule filtered on the `premium` trait before storing the document.--Each rule's `modifiedFields` is then recomputed and the merged document replaces the stored one. Every API node adopts the new configuration. Clients observe it through the published [limit configuration](/http-api/instance/#limit-configuration-object).--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `update_limit_config`, target type `limit_config`, target ID `0`, and metadata keys `rule_count`, `changed_rule_count`, and `trait_definition_count`, each taken from the stored document. `changed_rule_count` is the number of rule identifiers added, removed, or stored with different filters or limits, compared with the configuration the serving node held before the write.+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` for an unknown limit key, a negative value or a value outside the key's `min` and `max` |-### Rate limit+In the `everyone` premium mode, Fluxer ignores the `premium` trait and every rule filtered on it, and keeps the ones already saved for when the mode goes back to `mirror`.-100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/jobs.mdx b/fluxer_docs/src/content/docs/admin-api/jobs.mdxindex bb891c582..a9f09aa2b 100644--- a/fluxer_docs/src/content/docs/admin-api/jobs.mdx+++ b/fluxer_docs/src/content/docs/admin-api/jobs.mdx@@ -1,18 +1,12 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Jobs-description: Background job status, progress, task types, and cancellation.+description: List background jobs, follow their progress and request cancellation.---import RouteHeader from '@/components/RouteHeader.astro';-These routes list recorded background jobs and request cancellation. Create jobs through [Queue bulk job](/admin-api/bulk-jobs/#queue-bulk-job), [Create system DM broadcast](/admin-api/system-dms/#create-system-dm-broadcast), [Refresh search index](/admin-api/search-indexes/#refresh-search-index), or an [archive](/admin-api/archives/) request.--Reads require `jobs:view` and cancellation requires `jobs:cancel`. Every operation on this page shares the `admin:jobs:view` bucket. The three reads record no [Admin audit entry](/admin-api/#admin-audit-entry-object), and cancellation records one.--:::note[Job updates vary by task]-Mention processing, link previews, announcement delivery and copy updates, message delete audit log batching, payment reconciliation when a user connects, and every scheduled task except `syncUrlBlocklists` and `syncFileShaBlocklists` run with no job record and never appear here. Fluxer deletes a job record about 90 days after the job was queued. A job also runs with no record when Fluxer fails to write that record. When a later write of status, progress or attempts fails, Fluxer logs the failure and the job continues, so the stored values can be behind the real run. Use the [archive routes](/admin-api/archives/) to track archive progress and failures.-:::+Admin requests such as [Queue bulk job](/admin-api/bulk-jobs/#queue-bulk-job), [Bulk add blocklist entries](/admin-api/blocklists/#bulk-add-blocklist-entries), [Create system DM broadcast](/admin-api/system-dms/#create-system-dm-broadcast), [Refresh search index](/admin-api/search-indexes/#refresh-search-index) and [archive](/admin-api/archives/) requests return a job ID that you follow here. Fluxer deletes a job record about 90 days after the job was queued.## Admin job object@@ -21,28 +15,28 @@ Mention processing, link previews, announcement delivery and copy updates, messa| Field | Type | Description || --- | --- | --- || job_id | snowflake | The ID of the job |-| task_type | string | The [background job task type](#background-job-task-types) the job runs |+| task_type | string | The [task type](#background-job-task-types) the job runs || status | string | The latest recorded [job status](#job-statuses) |-| progress_current | ?integer | The units of work reported as complete, or null |-| progress_total | ?integer | The reported total units of work, or null |-| progress_message | ?string | The latest reported progress message, or null |-| error_message | ?string | The recorded failure reason, or null |+| progress_current | ?integer | The units of work completed |+| progress_total | ?integer | The total units of work |+| progress_message | ?string | The latest progress message |+| error_message | ?string | The failure reason || created_at | ISO8601 timestamp | The time the job was recorded |-| started_at | ?ISO8601 timestamp | The latest recorded start time, or null when no start was recorded |-| completed_at | ?ISO8601 timestamp | The recorded completion, cancellation or failure time, or null |-| requested_by_user_id | ?snowflake | The recorded requester, or null |-| audit_log_reason | ?string | The recorded audit log reason, or null |-| jet_stream_lane | ?string | The assigned [processing lane](#processing-lanes), or null |-| jet_stream_seq | ?string | The recorded queue sequence as a decimal string, or null |-| attempts | integer | The recorded retry count, not a total of all executions |-| max_attempts | integer | Attempt limit recorded at queue time. Retries stop at the lane's delivery limit, which can differ from this value |-| run_at | ?ISO8601 timestamp | The earliest permitted run time, or null for an immediate job |+| started_at | ?ISO8601 timestamp | The latest recorded start time |+| completed_at | ?ISO8601 timestamp | The completion, cancellation or failure time |+| requested_by_user_id | ?snowflake | The user who requested the job |+| audit_log_reason | ?string | The audit log reason |+| jet_stream_lane | ?string | The [processing lane](#processing-lanes) |+| jet_stream_seq | ?string | The queue sequence as a decimal string |+| attempts | integer | The number of attempts so far |+| max_attempts | integer | The attempt limit recorded at queue time. Retries stop at the lane's delivery limit, which can differ |+| run_at | ?ISO8601 timestamp | The earliest run time, or null for an immediate job || cancel_requested | boolean | Whether cancellation has been requested |-| context_link | ?string | An Admin console path related to the job, or null |-| payload | ?string | The JSON-encoded job input, or null |-| result | ?string | The JSON-encoded result, or null |+| context_link | ?string | An Admin console path related to the job |+| payload | ?string | The JSON-encoded job input |+| result | ?string | The JSON-encoded result |-Progress fields stay null until the task reports progress. A task can report progress with no total or no message, which sets `progress_total` or `progress_message` to null. The payload can contain identifiers and message content, including in list responses.+`payload` can include user IDs and message text. Status and progress can lag a few moments behind the running task. Use the [archive routes](/admin-api/archives/) to track archive progress and failures.### Example@@ -74,7 +68,7 @@ Progress fields stay null until the task reports progress. A task can report pro## Job cursor object-Pass all three fields from `next_cursor` back to [List jobs](#list-jobs) using the corresponding cursor query parameters.+To get the next page, pass all three `next_cursor` fields to [List jobs](#list-jobs) as the matching `cursor_*` query parameters.### Structure@@ -82,35 +76,23 @@ Pass all three fields from `next_cursor` back to [List jobs](#list-jobs) using t| --- | --- | --- || bucket_day | string | The cursor's UTC date as `YYYY-MM-DD` || created_at | ISO8601 timestamp | The cursor's creation time |-| job_id | snowflake | The cursor's job identifier |--### Example--```json-{- "bucket_day": "2026-08-30",- "created_at": "2026-08-30T22:41:07.512Z",- "job_id": "1500901337221828608"-}-```+| job_id | snowflake | The cursor's job ID |## Job statuses| Value | Description || --- | --- |-| queued | The job was recorded and no later status has been recorded |-| running | The job was recorded as started |-| succeeded | The job was recorded as completed successfully |-| cancelled | The task read the cancellation request and stopped |-| deadletter | The job was recorded as failed, including a failure to queue it |+| queued | The job was recorded and has not started |+| running | The job started |+| succeeded | The job completed |+| cancelled | The task stopped after a cancellation request |+| deadletter | The job failed, including a failure to queue it |-`queued` and `running` accept cancellation requests. The other statuses are terminal. A cancellation request does not guarantee that the task will stop.--The queue drops a job 7 days after it was queued. A job still recorded as `queued` or `running` after 8 days is set to `deadletter` with the error `Expired from the job queue`.+A job still `queued` or `running` after 8 days becomes `deadletter` with the error `Expired from the job queue`.## Processing lanes-`jet_stream_lane` identifies the job's processing group.+List jobs never returns `realtime` or `unfurl` work, because those tasks have no job record.| Value | Description || --- | --- |@@ -118,21 +100,38 @@ The queue drops a job 7 days after it was queued. A job still recorded as `queue| unfurl | Link previews || lifecycle | Account, guild, moderation, archive and bulk work || batch | Scheduled maintenance, index work and thread maintenance |-| crosspost | [Announcement channel](/topics/announcement-channels/) delivery, copy updates, and follower cleanup |+| crosspost | [Announcement channel](/topics/announcement-channels/) delivery, copy updates and follower cleanup |## Background job task types-Use the returned `task_type` value to filter [List jobs](#list-jobs).--The tasks queued by [Bulk jobs](/admin-api/bulk-jobs/) are `bulkUpdateUserFlags`, `bulkUpdateGuildFeatures`, `bulkAddGuildMembers`, and `bulkScheduleUserDeletion`. `harvestUserData` and `harvestGuildData` build [archives](/admin-api/archives/), `sendSystemDm` delivers a [system DM broadcast](/admin-api/system-dms/), `refreshSearchIndex` rebuilds a [search index](/admin-api/search-indexes/). `guildProcessDeletion` removes the records of a deleted guild after [Delete guild](/admin-api/guilds/#delete-guild) or the owner deletes it. `removeChannelFollowers` runs on the `crosspost` lane after an announcement channel is deleted or converted into a text channel, and removes the channel follower webhooks that follow it.+The table lists the task types that admin requests queue and the guild and thread work you are most likely to see. Other task types can also appear.-Thread work runs on the `batch` lane. `deleteChannelThreads` deletes the threads of a deleted parent channel, `removeThreadMembershipsForGuildMember` removes the thread memberships of a user who is no longer a guild member, and `syncThreadSearchDocument` and `backfillThreadSearch` keep the thread search index current. `archiveInactiveThreads` runs every minute with no job record and archives the threads whose auto archive time has passed. `repairThreadIndexes` rebuilds the thread list entries of the threads it names. `seedThreadPermissions` runs once for a guild. It clears the thread permission bits from every overwrite mask. It then adds `CREATE_PUBLIC_THREADS`, `CREATE_PRIVATE_THREADS`, and `SEND_MESSAGES_IN_THREADS` to each overwrite mask that has `SEND_MESSAGES`, and to the everyone role when that role has `SEND_MESSAGES`.+| Value | Description |+| --- | --- |+| bulkUpdateUserFlags | A [bulk job](/admin-api/bulk-jobs/) |+| bulkUpdateGuildFeatures | A [bulk job](/admin-api/bulk-jobs/) |+| bulkAddGuildMembers | A [bulk job](/admin-api/bulk-jobs/) |+| bulkScheduleUserDeletion | A [bulk job](/admin-api/bulk-jobs/) |+| bulkBanFileShas | Adds entries from [Bulk add blocklist entries](/admin-api/blocklists/#bulk-add-blocklist-entries) |+| harvestUserData | Builds a user [archive](/admin-api/archives/) |+| harvestGuildData | Builds a guild [archive](/admin-api/archives/) |+| sendSystemDm | Delivers a [system DM broadcast](/admin-api/system-dms/) |+| refreshSearchIndex | Rebuilds a [search index](/admin-api/search-indexes/) |+| guildProcessDeletion | Removes the records of a deleted guild |+| removeChannelFollowers | Removes the follower webhooks of a deleted or converted announcement channel |+| deleteChannelThreads | Deletes the threads of a deleted parent channel |+| syncThreadSearchDocument | Updates the thread search index |+| backfillThreadSearch | Backfills the thread search index |+| repairThreadIndexes | Rebuilds thread list entries |+| seedThreadPermissions | Adds thread permissions to a guild's channel overwrites and @everyone role where Send Messages is set |++`bulkDeleteMessagesForUsers` runs a [bulk job](/admin-api/bulk-jobs/) that deletes users' messages, and `removeThreadMembershipsForGuildMember` removes the thread memberships of a user who is no longer a guild member.## List jobs<RouteHeader method="GET" path="/v1/admin/jobs" />-Returns a page of [Admin job](#admin-job-object) objects, newest first, within the requested lookback window. Requires `jobs:view`.+Returns [Admin job](#admin-job-object) objects, newest first. You need `jobs:view`.### Query parameters@@ -141,20 +140,20 @@ Returns a page of [Admin job](#admin-job-object) objects, newest first, within t| limit? | integer | The maximum number of jobs to return (1-200, default 50) || cursor_bucket_day? | string | `next_cursor.bucket_day` as a `YYYY-MM-DD` UTC date || cursor_created_at? | string | `next_cursor.created_at` as an ISO 8601 timestamp (1-64 characters) |-| cursor_job_id? | snowflake | The job identifier from `next_cursor.job_id` |+| cursor_job_id? | snowflake | The job ID from `next_cursor.job_id` || max_lookback_days? | integer | The number of days before today to include (1-60, default 14) |-| status? | string | Filter by recorded [job status](#job-statuses) |+| status? | string | Filter by [job status](#job-statuses) || task_type? | string | Filter by [task type](#background-job-task-types) (1-128 characters) |-| requested_by_user_id? | snowflake | Filter by recorded requester |+| requested_by_user_id? | snowflake | Filter by requester |-Supply all three cursor parameters together or omit all three. An incomplete or malformed cursor returns 400 `INVALID_FORM_BODY`. An unknown task type returns an empty page. A full page always returns `next_cursor`, so the next request can return an empty page.+`next_cursor` is set whenever a page is full, and the next page can be empty. It is null when there are no more jobs in the lookback window.### Response body| Field | Type | Description || --- | --- | --- || jobs | array[[Admin job](#admin-job-object) object] | The jobs in this page |-| next_cursor | ?[job cursor](#job-cursor-object) object | The cursor for the next request, or null |+| next_cursor | ?[job cursor](#job-cursor-object) object | The cursor for the next request |### Response@@ -163,21 +162,13 @@ Supply all three cursor parameters together or omit all three. An incomplete or| 200 | response body | The job page was returned || 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` because a query parameter is invalid |-### Side effects--The operation records no [Admin audit entry](/admin-api/#admin-audit-entry-object).--### Rate limit--600 requests per minute for each authenticated user, on the `admin:jobs:view` bucket.+The rate limit is 600 requests per minute, on the `admin:jobs:view` bucket.## List active jobs<RouteHeader method="GET" path="/v1/admin/jobs/active" />-Returns recorded active jobs as [Admin job](#admin-job-object) objects. Requires `jobs:view`.--This operation has no filters or pagination. The stored status and progress can be behind the work the task has already done.+Returns the [Admin job](#admin-job-object) objects of queued and running jobs, with no filters or pagination. You need `jobs:view`.### Response body@@ -191,25 +182,13 @@ This operation has no filters or pagination. The stored status and progress can| --- | --- | --- || 200 | response body | The active jobs were returned |-### Side effects--The operation records no [Admin audit entry](/admin-api/#admin-audit-entry-object).--### Rate limit--600 requests per minute for each authenticated user, on the `admin:jobs:view` bucket.+The rate limit is 600 requests per minute, on the `admin:jobs:view` bucket.## Get job<RouteHeader method="GET" path="/v1/admin/jobs/{job_id}" />-Returns one [Admin job](#admin-job-object) object. Requires `jobs:view`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| job_id | snowflake | The ID of the job |+Returns one [Admin job](#admin-job-object) object. You need `jobs:view`.### Response body@@ -222,29 +201,15 @@ Returns one [Admin job](#admin-job-object) object. Requires `jobs:view`.| Status | Body | Condition || --- | --- | --- || 200 | response body | The job was returned |-| 404 | `{"error": "job_not_found"}` | No job record has this identifier |--A 404 response uses this single-field body rather than the standard error response. A missing or expired record does not mean the work never ran.--### Side effects+| 404 | `{"error": "job_not_found"}` | No job record has this ID |-The operation records no [Admin audit entry](/admin-api/#admin-audit-entry-object).--### Rate limit--600 requests per minute for each authenticated user, on the `admin:jobs:view` bucket.+The rate limit is 600 requests per minute, on the `admin:jobs:view` bucket.## Cancel job<RouteHeader method="PUT" path="/v1/admin/jobs/{job_id}/cancellation" auditReason />-Requests cooperative cancellation of a job and reports whether the request was recorded. Requires `jobs:cancel`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| job_id | snowflake | The ID of the job |+Requests cancellation of a queued or running job. You need `jobs:cancel`.### Response body@@ -256,14 +221,10 @@ Requests cooperative cancellation of a job and reports whether the request was r| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The request was evaluated, whether or not the flag changed |--### Side effects--Sets `cancel_requested` to true for a queued or running job. `sendSystemDm`, `bulkBanFileShas`, `bulkDeleteMessagesForUsers`, and the tasks queued by [Bulk jobs](/admin-api/bulk-jobs/) check for the request while they run and stop at the next check. Other tasks run to the end. Completed work is not undone. A status of `cancelled` means the task stopped because of the request.+| 200 | response body | `cancelled` is false when the job doesn't exist or has finished |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `cancel_job`, target type `bulk_job`, target ID equal to `job_id`, and metadata key `cancelled`. The entry uses target type `bulk_job` for every task type, and Fluxer records it when `cancelled` is false too.+Only `sendSystemDm`, `bulkBanFileShas` and the [bulk job](/admin-api/bulk-jobs/) tasks check for the request. They stop at their next check, set the status to `cancelled` and keep the work already done. Other tasks run to the end.-### Rate limit+Every request records an [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `cancel_job`, target type `bulk_job`, target ID `job_id` and metadata key `cancelled`, even when `cancelled` is false.-600 requests per minute for each authenticated user, on the `admin:jobs:view` bucket.+The rate limit is 600 requests per minute, on the `admin:jobs:view` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/messages.mdx b/fluxer_docs/src/content/docs/admin-api/messages.mdxindex 78eb44e1e..895c7cd5e 100644--- a/fluxer_docs/src/content/docs/admin-api/messages.mdx+++ b/fluxer_docs/src/content/docs/admin-api/messages.mdx@@ -1,22 +1,16 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Admin messages-description: Message browsing and search, permanent deletion, and shred jobs.+description: Browse, search and permanently delete the messages of a channel and check message shred jobs.---import RouteHeader from '@/components/RouteHeader.astro';-Admin message routes read, search, and permanently delete the messages of one channel. Another reports the progress of a shred job.--Shredding and bulk deletion for a whole account are under [Admin users](/admin-api/users/).+Admin message routes browse, search and permanently delete the messages of one channel, and report the progress of shred jobs. To shred or delete all of a user's messages, use [Shred user messages](/admin-api/users/#shred-user-messages).## Admin message object-A flattened moderation view of one message. It has the author identity, the content and timestamp, the attachments, and the NSFW context of the channel and guild.--Every operation that returns Admin message objects also returns the matching public message objects in a parallel `message_responses` array, so a client that needs the full wire shape joins on `id`.--A `message_responses` entry has no `thread` field, and a thread started from a message lists no `THREAD_STARTER_MESSAGE`. [Thread messages](/http-api/threads/#thread-messages) defines both.+One message with its author, content, attachments and the NSFW settings of its channel and guild. Every response that returns Admin message objects also returns the matching public [message](/http-api/messages/#message-object) objects in `message_responses`, in the same order.### Structure@@ -24,7 +18,7 @@ A `message_responses` entry has no `thread` field, and a thread started from a m| --- | --- | --- || id | snowflake | The ID of the message || channel_id | snowflake | The channel the message was sent in |-| channel_name<sup>1</sup> | ?string | The channel name, or null for a channel that has no name |+| channel_name<sup>1</sup> | ?string | The channel name, or null when it has none || channel_nsfw<sup>1</sup> | ?boolean | Whether the channel is marked NSFW || channel_content_warning_level?<sup>2</sup> | ?integer | The channel [content warning level](/http-api/channels/#content-warning-levels) || channel_content_warning_text?<sup>2</sup> | ?string | The channel content warning text (0-200 characters) |@@ -43,11 +37,9 @@ A `message_responses` entry has no `thread` field, and a thread started from a m| timestamp | ISO8601 timestamp | When the message was sent || attachments | array[[Admin message attachment](#admin-message-attachment-object) object] | The attachments of the message (at most 10) |-<sup>1</sup> Every object in one response has the same values, taken from the channel named in the request path or query. All are null when the channel no longer exists+<sup>1</sup> These come from the channel in the request and are the same on every object in one response. All are null when the channel no longer exists-<sup>2</sup> Always absent from the objects these operations return. The same member is set on the [report message context object](/admin-api/reports/#report-message-context-object)--For a thread, `channel_nsfw` is the value of its parent channel, as [Thread object](/http-api/threads/#thread-object) describes.+<sup>2</sup> Only the [report message context object](/admin-api/reports/#report-message-context-object) returns it. The routes on this page never do### Example@@ -73,8 +65,6 @@ For a thread, `channel_nsfw` is the value of its parent channel, as [Thread obje### Admin message attachment object-An attachment entry has the ordinary attachment metadata.-#### Structure| Field | Type | Description |@@ -84,55 +74,35 @@ An attachment entry has the ordinary attachment metadata.| url | string | The CDN URL of the attachment (1-2,048 characters) || nsfw | ?boolean | Whether the attachment is marked NSFW, or null when it has no marking || content_type | ?string | The recorded MIME type, or null when none was recorded |-| width | ?integer | The pixel width, or null when no dimensions were recorded |-| height | ?integer | The pixel height, or null when no dimensions were recorded |-| size?<sup>3</sup> | ?integer | The attachment size in bytes, or null when no size was recorded |--<sup>3</sup> Always emitted, so it is null and never absent when no size was recorded+| width | ?integer | The pixel width, or null when none was recorded |+| height | ?integer | The pixel height, or null when none was recorded |+| size? | ?integer | The size in bytes, or null when none was recorded |## Message shred status object-The state of one message shred job. The state expires one hour after it was last written, and an expired job is reported by `status` alone.+The state of one message shred job. A job expires one hour after its last update. A job that is unknown, expired or not yet started by a worker returns only `status`, set to `not_found`.### Structure| Field | Type | Description || --- | --- | --- || status | not_found \| in_progress \| completed \| failed | The job state |-| requested<sup>1</sup> | integer | The number of message references the job was queued with |-| total<sup>1</sup> | integer | The number of those references the job resolved as shreddable |-| processed<sup>1</sup> | integer | The number of messages the job has shredded so far |-| skipped<sup>1</sup> <sup>2</sup> | integer | The number of references the job did not shred |-| started_at?<sup>1</sup> <sup>3</sup> | ISO8601 timestamp | When the job started |-| completed_at?<sup>1</sup> | ISO8601 timestamp | When the job completed |-| failed_at?<sup>1</sup> | ISO8601 timestamp | When the job failed |-| error?<sup>1</sup> <sup>4</sup> | string | Why the job failed (1-4,000 characters) |--<sup>1</sup> Absent when `status` is `not_found`, a shape that has `status` alone--<sup>2</sup> Counts a reference that repeats an earlier entry, one whose IDs are not valid snowflakes, one whose message no longer exists, and one no longer authored by the target user--<sup>3</sup> Present whenever the counters are+| requested | integer | The number of message references the job was queued with |+| total | integer | The number of those references the job resolved as shreddable |+| processed | integer | The number of messages shredded so far |+| skipped | integer | The number of references the job did not shred |+| started_at? | ISO8601 timestamp | When the job started |+| completed_at? | ISO8601 timestamp | When the job completed |+| failed_at? | ISO8601 timestamp | When the job failed |+| error?<sup>1</sup> | string | Why the job failed (1-4,000 characters) |-<sup>4</sup> Present only when `status` is `failed`--:::note[An expired job reports `not_found`]-A job identifier that never existed reports `not_found` too, so the two are indistinguishable.-:::+<sup>1</sup> Present only when `status` is `failed`## List channel messages<RouteHeader method="GET" path="/v1/admin/channels/{channel_id}/messages" auditReason />-Returns one page of [Admin message](#admin-message-object) objects for one channel. Requires `message:lookup`.--The read ignores message history permissions, channel membership, and the age cutoff applied to ordinary members, so it returns every message the channel still holds.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel |+Returns one page of [Admin message](#admin-message-object) objects for a channel, including messages that channel permissions hide from members. Needs `message:lookup`. An unknown channel returns an empty page.### Query parameters@@ -140,25 +110,21 @@ The read ignores message history permissions, channel membership, and the age cu| --- | --- | --- || limit? | integer | Maximum messages to return (1-100, default 50) || before?<sup>1</sup> | snowflake | Return messages with a lower ID than this cursor |-| after?<sup>1</sup> <sup>2</sup> | snowflake | Return messages with a higher ID than this cursor |--<sup>1</sup> Supplying neither selects the newest messages in the channel. Supplying both selects the newest messages below `before` and discards any at or below `after`+| after?<sup>1</sup> | snowflake | Return messages with a higher ID than this cursor |-<sup>2</sup> Supplying `after` also flips the order of the returned array+<sup>1</sup> With neither, the page has the newest messages### Response body| Field | Type | Description || --- | --- | --- || messages<sup>1</sup> | array[[Admin message](#admin-message-object) object] | Messages in this page (at most 100) |-| message_responses?<sup>2</sup> | array[[message](/http-api/messages/#message-object) object] | The same messages in the public wire shape, same order (at most 100) |-| has_more<sup>3</sup> | boolean | Whether the page was filled to `limit` |+| message_responses? | array[[message](/http-api/messages/#message-object) object] | The same messages as public message objects (at most 100) |+| has_more<sup>2</sup> | boolean | Whether the page was filled to `limit` |-<sup>1</sup> Ordered oldest first, except when `after` was supplied, in which case it is ordered newest first+<sup>1</sup> Oldest first, or newest first when you sent `after`-<sup>2</sup> Written by every response this operation produces--<sup>3</sup> True when the page holds exactly `limit` entries, so a page that ends on the last message reports true and the next request returns an empty page+<sup>2</sup> The next page can still be empty### Response@@ -166,50 +132,29 @@ The read ignores message history permissions, channel membership, and the age cu| --- | --- | --- || 200 | response body | Message page was returned |-The response has no cursor member. Page further by sending the ID of the oldest returned message as `before`, or the ID of the newest returned message as `after`.--A channel that does not exist returns an empty `messages` array with `has_more` false, so this operation never answers 404.--### Side effects--One [Admin audit entry](/admin-api/#admin-audit-entry-object) is recorded with the action `list_channel_messages`, the target type `channel`, and the channel ID as the target. Its metadata keys are `limit`, `result_count` for the messages in this page, and `has_more`. A supplied `before` or `after` cursor is added under the same key.+To page further, send the oldest returned ID as `before` or the newest as `after`.-### Rate limit--100 requests per minute for each authenticated user, on the shared `admin:message:operation` bucket.+The rate limit is 100 requests per minute, on the `admin:message:operation` bucket.## Get message<RouteHeader method="GET" path="/v1/admin/channels/{channel_id}/messages/{message_id}" auditReason />-Returns the requested message together with the messages surrounding it, as one array of [Admin message](#admin-message-object) objects, oldest first. Requires `message:lookup`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel |-| message_id | snowflake | The ID of the message |+Returns a message and the messages around it, oldest first. Needs `message:lookup`. An unknown message returns the window around where it would be, and an unknown channel returns an empty array.### Query parameters| Field | Type | Description || --- | --- | --- |-| context_limit?<sup>1</sup> | integer | Size of the whole returned window, counting the requested message (1-100, default 50) |--<sup>1</sup> At most `context_limit` divided by two, rounded down, are newer than the requested message and the rest are older, so the default returns at most 25 newer and 24 older+| context_limit? | integer | Size of the whole window including the message (1-100, default 50) |### Response body| Field | Type | Description || --- | --- | --- |-| messages<sup>1</sup> | array[[Admin message](#admin-message-object) object] | The requested message and its surrounding window (at most 100) |-| message_responses? | array[[message](/http-api/messages/#message-object) object] | The same messages in the public wire shape, same order (at most 100) |-| message_id<sup>2</sup> | ?snowflake | The requested message ID |--<sup>1</sup> The requested message is one entry of this array, and it is absent when it no longer exists--<sup>2</sup> Echoes the path parameter and is never null here+| messages | array[[Admin message](#admin-message-object) object] | The message and its surrounding window (at most 100) |+| message_responses? | array[[message](/http-api/messages/#message-object) object] | The same messages as public message objects (at most 100) |+| message_id | ?snowflake | The requested message ID |### Response@@ -217,36 +162,19 @@ Returns the requested message together with the messages surrounding it, as one| --- | --- | --- || 200 | response body | Window was returned |-An unknown message returns 200 with the window surrounding the position the missing ID would have occupied, so this operation never returns `UNKNOWN_MESSAGE`. An unknown channel returns 200 with an empty `messages` array.--### Side effects--One [Admin audit entry](/admin-api/#admin-audit-entry-object) is recorded with the action `get_message`, the target type `message`, and the message ID as the target. Its metadata keys are `channel_id`, `context_limit`, `result_count` for the messages returned, and `found`, which is `true` when the requested message is in `messages` and `false` otherwise.--### Rate limit--100 requests per minute for each authenticated user, on the shared `admin:message:operation` bucket.+The rate limit is 100 requests per minute, on the `admin:message:operation` bucket.## Delete message<RouteHeader method="DELETE" path="/v1/admin/channels/{channel_id}/messages/{message_id}" auditReason />-Permanently deletes one message and purges the attachments it owned. Requires `message:delete`.--This route is for removals that involve nobody's conduct, such as cleanup of webhook or system messages, or a holder's request. To remove a message for breaking a rule, [shred it](/admin-api/users/#shred-user-messages) with the `enforcement` basis, so a decision records the removal and the author is told.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel |-| message_id | snowflake | The ID of the message |+Permanently deletes one message and its attachments. Needs `message:delete`. Use it to clean up webhook or system messages, or for a [holder request](/admin-api/enforcement/#basis). To remove a message for breaking a rule, [shred it](/admin-api/users/#shred-user-messages) with the `enforcement` basis.### JSON body| Field | Type | Description || --- | --- | --- |-| basis | [basis](/admin-api/enforcement/#basis) object | `holder_request` or `housekeeping`. The `enforcement` basis fails body validation |+| basis | [basis](/admin-api/enforcement/#basis) object | `holder_request` or `housekeeping` |### Response body@@ -258,134 +186,78 @@ This route is for removals that involve nobody's conduct, such as cleanup of web| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Request completed and the audit entry was written |+| 200 | response body | The request completed, even for an unknown channel or message |-An unknown channel or message returns 200 with `success` true and still records an audit entry.--:::danger[Deletion purges the message and its attachments]-There is no grace period and no restore operation.+:::danger[Deletion can't be undone]+There is no grace period and no way to restore the message.:::-### Side effects--The message and its attachments are permanently removed, including from search results and the CDN.--[Message Delete](/gateway/events/#message-delete) is sent to the guild when the channel belongs to one, and to each recipient when the channel is private. No other Dispatch is emitted, and deleting a pinned message here emits no [Channel Pins Update](/gateway/events/#channel-pins-update).--A deleted message in a thread no longer counts towards `message_count` of the [thread object](/http-api/threads/#thread-object). Fluxer emits no [Thread Update](/gateway/threads/#thread-update) for the change.+Fluxer sends [Message Delete](/gateway/events/#message-delete) to the guild, or to each recipient in a private channel.-One [Admin audit entry](/admin-api/#admin-audit-entry-object) is recorded with the action `delete_message` and the target type `message`, targeting the message ID. Its metadata is `channel_id`, `message_id` and `basis`. The entry is written whether or not a message was found.--### Rate limit--100 requests per minute for each authenticated user, on the shared `admin:message:operation` bucket.+The rate limit is 100 requests per minute, on the `admin:message:operation` bucket.## Search messages<RouteHeader method="GET" path="/v1/admin/messages" auditReason />-Searches the message index of one channel, or resolves one message in that channel by message ID or by attachment identity. Requires `message:lookup`.--A request with `message_id` or `attachment_id` returns the lookup response body. Any other request returns the search response body.+Searches the messages of one channel, or looks up one message by message ID or attachment ID. Needs `message:lookup`. A request with `message_id` or `attachment_id` returns the lookup body and any other request returns the search body.### Query parameters| Field | Type | Description || --- | --- | --- |-| channel_id | snowflake | The channel every returned message was sent in |-| q?<sup>1</sup> | string | Free-text query matched against message content (1-200 characters) |-| message_id?<sup>2</sup> | snowflake | Resolve the message with this ID together with its surrounding window |-| attachment_id?<sup>2</sup> <sup>3</sup> | snowflake | Resolve the message with this attachment together with its surrounding window |-| filename?<sup>3</sup> | string | The exact filename of the attachment named by `attachment_id` (1-255 characters) |-| context_limit?<sup>2</sup> | integer | Size of the window returned by a lookup, counting the resolved message (1-100, default 50) |-| limit?<sup>1</sup> | integer | Maximum messages to return when searching (1-100, default 25) |--<sup>1</sup> Applies to the search mode only. Omitting `q` searches for the empty string+| channel_id | snowflake | The channel to search or look up in |+| q? | string | Free-text query on message content (1-200 characters) |+| message_id?<sup>1</sup> | snowflake | Look up this message and its surrounding window |+| attachment_id?<sup>1</sup> <sup>2</sup> | snowflake | Look up the message with this attachment and its surrounding window |+| filename?<sup>2</sup> | string | The exact filename of the attachment (1-255 characters) |+| context_limit? | integer | Window size for a lookup (1-100, default 50) |+| limit? | integer | Maximum messages to return when searching (1-100, default 25) |-<sup>2</sup> `message_id` takes precedence over every other member, and `attachment_id` over `q`. A lookup ignores `limit` and a search ignores `context_limit`+<sup>1</sup> `message_id` takes precedence over `attachment_id`, and `attachment_id` over `q`-<sup>3</sup> Supply both together. Sending `attachment_id` without `filename` returns 400 `INVALID_FORM_BODY` against `filename`+<sup>2</sup> `attachment_id` needs `filename`, or the request fails with `INVALID_FORM_BODY` on `filename`### Search response body-Returned when neither `message_id` nor `attachment_id` was supplied.-| Field | Type | Description || --- | --- | --- |-| messages<sup>4</sup> | array[[Admin message](#admin-message-object) object] | Matching messages (at most 100) |-| message_responses? | array[[message](/http-api/messages/#message-object) object] | The same messages in the public wire shape, same order (at most 100) |-| total<sup>5</sup> | integer | The number of matches that still exist |--<sup>4</sup> Holds at most `limit` entries. There is no cursor and no offset member, so this operation returns the first page of matches only--<sup>5</sup> Counts every surviving match, so it can exceed the length of `messages`+| messages | array[[Admin message](#admin-message-object) object] | Matching messages (at most 100) |+| message_responses? | array[[message](/http-api/messages/#message-object) object] | The same messages as public message objects (at most 100) |+| total | integer | The number of matching messages |### Lookup response body-Returned when `message_id` or `attachment_id` was supplied. It is the same body [Get message](#get-message) returns.+This is the body [Get message](#get-message) returns.| Field | Type | Description || --- | --- | --- || messages | array[[Admin message](#admin-message-object) object] | The resolved message and its surrounding window, oldest first (at most 100) |-| message_responses? | array[[message](/http-api/messages/#message-object) object] | The same messages in the public wire shape, same order (at most 100) |-| message_id<sup>6</sup> | ?snowflake | The ID of the resolved message |+| message_responses? | array[[message](/http-api/messages/#message-object) object] | The same messages as public message objects (at most 100) |+| message_id<sup>1</sup> | ?snowflake | The ID of the resolved message |-<sup>6</sup> Null only for an attachment lookup that matched no attachment, in which case `messages` is empty too. A `message_id` lookup echoes the supplied ID even when no such message exists+<sup>1</sup> Null only when an attachment lookup matches nothing### Response| Status | Body | Condition || --- | --- | --- |-| 200 | search or lookup response body | Search or lookup completed |+| 200 | search or lookup response body | Search or lookup completed, with empty results when nothing matches |-The result is empty for an unknown channel, for a message that does not exist, and for an attachment whose filename does not match. This operation never answers 404.+Search has no pagination and returns at most `limit` matches. On an instance without message search set up, it returns no messages and a `total` of 0.-With no message search service configured the search mode returns an empty `messages` array and `total` zero. The lookup modes are unaffected.--:::note[A deleted message never appears in a result]-A hit whose message no longer exists is dropped from the page and excluded from `total`.-:::--### Side effects--One [Admin audit entry](/admin-api/#admin-audit-entry-object) is recorded with the action `search_messages`. Its metadata key `mode` is `message` for a `message_id` lookup, `attachment` for an attachment lookup, and `search` otherwise, and `result_count` is the number of messages returned.--- A `message_id` lookup has the target type `message` and the message ID as the target. It adds `channel_id`, `context_limit`, and `found`, which is `true` when the message is in `messages`.-- An attachment lookup has the target type `channel` and the channel ID as the target. It adds `attachment_id`, `context_limit`, and `found`, which is `true` when the attachment resolved. A resolved attachment also adds `message_id`.-- A search has the target type `channel` and the channel ID as the target. It adds `limit` and `total`, and `has_query` as `true` when `q` is supplied.--The query text and the filename are not recorded. A 400 records nothing.--### Rate limit--100 requests per minute for each authenticated user, on the shared `admin:message:operation` bucket.+The rate limit is 100 requests per minute, on the `admin:message:operation` bucket.## Get message shred job<RouteHeader method="GET" path="/v1/admin/messages/shreds/{job_id}" auditReason />-Returns one [message shred status](#message-shred-status-object) object. Requires `message:shred`.--Shred jobs are created by [Shred user messages](/admin-api/users/#shred-user-messages) and by the non-dry-run form of [Delete all user messages](/admin-api/users/#delete-all-user-messages). Both return the identifier this operation reads.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| job_id<sup>1</sup> | snowflake | The message shred job ID, taken from the queueing response |--<sup>1</sup> A snowflake issued when the job was queued, so a value that is not a decimal integer fails path validation instead of reporting `not_found`+Returns the [message shred status](#message-shred-status-object) of a job that [Shred user messages](/admin-api/users/#shred-user-messages) or [Delete all user messages](/admin-api/users/#delete-all-user-messages) started. Needs `message:shred`.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [message shred status](#message-shred-status-object) object | Job state was returned, including `not_found` for an unknown or expired job |--### Side effects--One [Admin audit entry](/admin-api/#admin-audit-entry-object) is recorded with the action `get_message_shred_status`, the target type `message_shred`, and the target ID `0`. Its metadata keys are `job_id` and `status`, which is the returned job state.--### Rate limit+| 200 | [message shred status](#message-shred-status-object) object | Job state was returned |-100 requests per minute for each authenticated user, on the shared `admin:message:operation` bucket.+The rate limit is 100 requests per minute, on the `admin:message:operation` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/reports.mdx b/fluxer_docs/src/content/docs/admin-api/reports.mdxindex 77270ea7e..768f481e8 100644--- a/fluxer_docs/src/content/docs/admin-api/reports.mdx+++ b/fluxer_docs/src/content/docs/admin-api/reports.mdx@@ -1,30 +1,16 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Admin reports-description: Report listing and search, captured evidence, report resolution, report deletion, and report retention.+description: Admin API routes for reviewing, resolving and deleting reports.---import RouteHeader from '@/components/RouteHeader.astro';-A report is one complaint filed against a message, an account, or a guild, together with the evidence captured when it was filed. These routes list and search reports, return that evidence, resolve a report with a comment shown to the reporter, keep internal notes on a report, hold a report past its retention period, and delete a report before it.--Report submission belongs to the public [Reports](/http-api/reports/) resource, which defines the [report categories](/http-api/reports/#report-categories) and the [report reasons](/http-api/reports/#report-reasons) a report is filed under.--Reporter contact fields require `report:view:reporter_pii` on top of `report:view`. Without it `reporter_email`, `reporter_full_legal_name`, and `reporter_country_of_residence` are null on every report, so a redacted field looks like a field the reporter never supplied.--:::note[A report stores the evidence as filed]-The captured fields are the guild name, icon hash, invite code, channel name, safety levels, and message content. Later edits to any of them do not change the report.-:::--:::note[Reporter and reported identity are current values]-Fluxer reads the tag, username, display name, and discriminator of both accounts when it produces the response. The author identity on each captured message stays as it was captured.-:::+A report is one complaint against a message, an account or a guild, with the evidence Fluxer captured when it was filed. Use these routes to review reports, resolve them and delete them. People file reports through the public [Reports](/http-api/reports/) resource, which defines the [categories](/http-api/reports/#report-categories) and [reasons](/http-api/reports/#report-reasons).## Admin report object-A report is written once, when the reporter files it. [Update report](#update-report) moves it from PENDING to RESOLVED with an optional comment. [Schedule user deletion](/admin-api/users/#schedule-user-deletion) for one of the abuse reasons listed there also resolves the pending reports against the deleted account, with no public comment, and sends each reporter the generic notice [Update report](#update-report) describes. A report in the `child_safety`, `underage_user`, or `self_harm` category is never resolved this way and stays PENDING. A report is deleted at the end of its [retention period](#report-retention), or earlier through [Delete report](#delete-report).--[List reports](#list-reports) returns this object without message context. [Get report](#get-report) returns the [Admin report detail object](#admin-report-detail-object), which extends it.+[List reports](#list-reports) returns this object. [Get report](#get-report) returns the [Admin report detail object](#admin-report-detail-object), which extends it with message context. The guild, channel, webhook and message fields are copied when the report is filed. The account names are looked up when Fluxer builds the response. `reporter_email`, `reporter_full_legal_name` and `reporter_country_of_residence` are null unless you have `report:view:reporter_pii` as well as `report:view`.### Structure@@ -32,105 +18,71 @@ A report is written once, when the reporter files it. [Update report](#update-re| --- | --- | --- || report_id | snowflake | The ID of the report || reporter_id<sup>1</sup> | ?snowflake | The account that filed the report |-| reporter_tag<sup>1</sup> <sup>2</sup> <sup>18</sup> | ?string | The reporter username and four-digit discriminator joined by `#` |-| reporter_username<sup>1</sup> <sup>2</sup> | ?string | The username of the reporter |-| reporter_global_name<sup>1</sup> <sup>2</sup> | ?string | The display name of the reporter, or null when unset |-| reporter_discriminator<sup>1</sup> <sup>2</sup> | ?string | The zero-padded four-digit reporter discriminator |-| reporter_email<sup>3</sup> | ?string | The email address of the reporter |-| reporter_full_legal_name<sup>3</sup> | ?string | The legal name supplied with a Digital Services Act notice |-| reporter_country_of_residence<sup>3</sup> | ?string | The country of residence supplied with a Digital Services Act notice |-| reported_at | ISO8601 timestamp | When the report was submitted |+| reporter_tag<sup>1</sup> | ?string | The reporter username and discriminator joined by `#` |+| reporter_username<sup>1</sup> | ?string | The username of the reporter |+| reporter_global_name<sup>1</sup> | ?string | The display name of the reporter |+| reporter_discriminator<sup>1</sup> | ?string | The four-digit discriminator of the reporter |+| reporter_email | ?string | The email address of the reporter |+| reporter_full_legal_name | ?string | The legal name supplied with a Digital Services Act notice |+| reporter_country_of_residence | ?string | The country of residence supplied with a Digital Services Act notice |+| reported_at | ISO8601 timestamp | When the report was filed || status | integer | The [report status](#report-status) || report_type | integer | The [report type](#report-type) |-| category | ?string | The [report category](/http-api/reports/#report-categories), derived from `reason` when the report has one |-| reason?<sup>7</sup> <sup>10</sup> | ?string | The [report reason](/http-api/reports/#report-reasons) the report was filed under |-| reason_label?<sup>7</sup> <sup>11</sup> | ?string | The English label of the reason |-| reason_highest_priority?<sup>7</sup> <sup>12</sup> | ?boolean | Whether the reason is one moderators see first |-| flow?<sup>7</sup> <sup>10</sup> | ?[report flow answers](#report-flow-answers-object) object | The answers the reporter gave, described in English |-| reporter_good_faith_confirmed?<sup>7</sup> <sup>13</sup> | ?boolean | Whether the reporter confirmed the notice in good faith |+| category | ?string | The [report category](/http-api/reports/#report-categories) |+| reason? | ?string | The [report reason](/http-api/reports/#report-reasons), or null when filed without a report flow |+| reason_label? | ?string | The English label of the reason |+| reason_highest_priority? | ?boolean | Whether moderators see this reason first |+| flow? | ?[report flow answers](#report-flow-answers-object) object | The answers the reporter gave in the report flow |+| reporter_good_faith_confirmed? | ?boolean | Whether the reporter of a Digital Services Act notice confirmed good faith || additional_info | ?string | The free-text detail the reporter supplied |-| reported_user_id<sup>14</sup> | ?snowflake | The reported account, or null for a guild report |-| reported_user_tag<sup>2</sup> <sup>18</sup> | ?string | The reported username and four-digit discriminator joined by `#` |+| reported_user_id<sup>2</sup> | ?snowflake | The reported account |+| reported_user_tag<sup>2</sup> | ?string | The reported username and discriminator joined by `#` || reported_user_username<sup>2</sup> | ?string | The username of the reported account |-| reported_user_global_name<sup>2</sup> | ?string | The display name of the reported account, or null when unset |-| reported_user_discriminator<sup>2</sup> | ?string | The zero-padded four-digit reported account discriminator |-| reported_user_avatar_hash<sup>4</sup> | ?string | The avatar hash of the reported account, or null when unset |-| reported_user_bot?<sup>2</sup> <sup>7</sup> <sup>17</sup> | ?boolean | Whether the reported account is a bot |-| reported_webhook_id?<sup>7</sup> <sup>14</sup> | ?snowflake | The [webhook](/http-api/webhooks/) that sent the reported message |-| reported_webhook_name?<sup>4</sup> <sup>7</sup> <sup>14</sup> | ?string | The name the reported message was sent under |-| reported_webhook_avatar_hash?<sup>4</sup> <sup>7</sup> <sup>14</sup> | ?string | The avatar hash the reported message was sent with, or null when unset |-| reported_webhook_default_name?<sup>4</sup> <sup>7</sup> <sup>14</sup> <sup>15</sup> | ?string | The name set on the webhook itself |-| reported_webhook_default_avatar_hash?<sup>4</sup> <sup>7</sup> <sup>14</sup> <sup>15</sup> | ?string | The avatar hash set on the webhook itself, or null when unset |-| reported_webhook_type?<sup>4</sup> <sup>7</sup> <sup>14</sup> <sup>15</sup> | ?integer | The [webhook type](/http-api/webhooks/#webhook-types) |-| reported_webhook_application_id?<sup>4</sup> <sup>7</sup> <sup>14</sup> <sup>15</sup> | ?snowflake | The [application](/http-api/applications/#application-object) whose bot account created the webhook, or null when a user account created it |-| reported_webhook_channel_id?<sup>4</sup> <sup>7</sup> <sup>14</sup> <sup>15</sup> | ?snowflake | The channel the webhook belonged to |-| reported_webhook_guild_id?<sup>4</sup> <sup>7</sup> <sup>14</sup> <sup>15</sup> | ?snowflake | The guild the webhook belonged to |-| reported_webhook_created_at?<sup>7</sup> <sup>14</sup> | ?ISO8601 timestamp | When the webhook was created, derived from its ID |-| reported_webhook_creator_id?<sup>4</sup> <sup>7</sup> <sup>14</sup> <sup>15</sup> | ?snowflake | The account that created the webhook |-| reported_webhook_creator_tag?<sup>4</sup> <sup>7</sup> <sup>14</sup> <sup>15</sup> <sup>16</sup> <sup>18</sup> | ?string | The creator username and four-digit discriminator joined by `#` |-| reported_webhook_creator_username?<sup>4</sup> <sup>7</sup> <sup>14</sup> <sup>15</sup> <sup>16</sup> | ?string | The username of the creator |-| reported_webhook_creator_global_name?<sup>4</sup> <sup>7</sup> <sup>14</sup> <sup>15</sup> <sup>16</sup> | ?string | The display name of the creator, or null when unset |-| reported_webhook_creator_discriminator?<sup>4</sup> <sup>7</sup> <sup>14</sup> <sup>15</sup> <sup>16</sup> | ?string | The zero-padded four-digit creator discriminator |-| reported_webhook_creator_avatar_hash?<sup>4</sup> <sup>7</sup> <sup>14</sup> <sup>15</sup> <sup>16</sup> | ?string | The avatar hash of the creator, or null when unset |-| reported_guild_id | ?snowflake | The reported guild, or null when the report names none |-| reported_guild_name<sup>4</sup> | ?string | The name of the reported guild |-| reported_guild_icon_hash<sup>4</sup> | ?string | The icon hash of the reported guild, or null when unset |+| reported_user_global_name<sup>2</sup> | ?string | The display name of the reported account |+| reported_user_discriminator<sup>2</sup> | ?string | The four-digit discriminator of the reported account |+| reported_user_avatar_hash<sup>2</sup> | ?string | The avatar hash of the reported account |+| reported_user_bot?<sup>2</sup> | ?boolean | Whether the reported account is a bot |+| reported_webhook_id?<sup>2</sup> | ?snowflake | The [webhook](/http-api/webhooks/) that sent the reported message |+| reported_webhook_name?<sup>2</sup> | ?string | The name the reported message was sent under |+| reported_webhook_avatar_hash?<sup>2</sup> | ?string | The avatar hash the reported message was sent with |+| reported_webhook_default_name?<sup>2</sup> | ?string | The name set on the webhook itself |+| reported_webhook_default_avatar_hash?<sup>2</sup> | ?string | The avatar hash set on the webhook itself |+| reported_webhook_type?<sup>2</sup> | ?integer | The [webhook type](/http-api/webhooks/#webhook-types) |+| reported_webhook_application_id?<sup>2</sup> | ?snowflake | The [application](/http-api/applications/#application-object) whose bot created the webhook |+| reported_webhook_channel_id?<sup>2</sup> | ?snowflake | The channel the webhook belonged to |+| reported_webhook_guild_id?<sup>2</sup> | ?snowflake | The guild the webhook belonged to |+| reported_webhook_created_at?<sup>2</sup> | ?ISO8601 timestamp | When the webhook was created |+| reported_webhook_creator_id?<sup>2</sup> | ?snowflake | The account that created the webhook |+| reported_webhook_creator_tag?<sup>2</sup> | ?string | The creator username and discriminator joined by `#` |+| reported_webhook_creator_username?<sup>2</sup> | ?string | The username of the creator |+| reported_webhook_creator_global_name?<sup>2</sup> | ?string | The display name of the creator |+| reported_webhook_creator_discriminator?<sup>2</sup> | ?string | The four-digit discriminator of the creator |+| reported_webhook_creator_avatar_hash?<sup>2</sup> | ?string | The avatar hash of the creator |+| reported_guild_id | ?snowflake | The reported guild |+| reported_guild_name | ?string | The name of the reported guild |+| reported_guild_icon_hash | ?string | The icon hash of the reported guild || reported_message_id | ?snowflake | The reported message, or null for a user or guild report || reported_channel_id | ?snowflake | The channel the reported content was sent in |-| reported_channel_name<sup>4</sup> | ?string | The channel name, or null for a direct message channel |-| reported_channel_nsfw<sup>5</sup> | ?boolean | The effective NSFW state of the reported channel |-| reported_guild_invite_code<sup>4</sup> | ?string | The invite code the reported guild was reached by |-| reported_guild_nsfw_level<sup>6</sup> | ?integer | The guild [NSFW level](/http-api/guilds/#nsfw-levels) |-| reported_guild_nsfw?<sup>4</sup> <sup>7</sup> | ?boolean | Whether the reported guild was marked NSFW |-| reported_guild_content_warning_level?<sup>4</sup> <sup>7</sup> | ?integer | The [guild content warning level](/http-api/guilds/#guild-content-warning-levels) |-| reported_guild_content_warning_text?<sup>4</sup> <sup>7</sup> | ?string | The guild content warning text (at most 200 characters) |-| reported_channel_nsfw_override?<sup>4</sup> <sup>7</sup> | ?boolean | The NSFW override set on the reported channel itself |-| reported_channel_content_warning_level?<sup>4</sup> <sup>7</sup> | ?integer | The [content warning level](/http-api/channels/#content-warning-levels) set on the channel itself |-| reported_channel_content_warning_text?<sup>4</sup> <sup>7</sup> | ?string | The content warning text set on the channel itself (at most 200 characters) |-| reported_channel_effective_nsfw?<sup>7</sup> <sup>8</sup> | ?boolean | Whether the channel was NSFW once the guild setting was applied |-| reported_channel_effective_content_warning_level?<sup>7</sup> <sup>8</sup> | ?integer | The channel content warning level once the guild setting was applied |-| reported_channel_effective_content_warning_text?<sup>7</sup> <sup>8</sup> | ?string | The channel content warning text once the guild setting was applied |-| resolved_at<sup>9</sup> | ?ISO8601 timestamp | When the report was resolved |-| resolved_by_admin_id<sup>9</sup> | ?snowflake | The Admin account that resolved the report |-| public_comment<sup>9</sup> | ?string | The comment shown to the reporter (at most 512 characters) |--<sup>1</sup> Null for an anonymous Digital Services Act notice, which is filed without a Fluxer account, so every reporter identity field is null exactly when `reporter_id` is null--<sup>2</sup> Resolved from the account when the response is produced, and null when the account can no longer be read--<sup>3</sup> Null unless the caller holds `report:view:reporter_pii`, and null when the reporter supplied no value. For a report filed from an account, `reporter_email` is the current address of that account, and null when the account no longer exists or has no address. For a Digital Services Act notice it is the verified address the notice was filed with--<sup>4</sup> Captured when the report was filed and never updated afterwards--<sup>5</sup> The captured effective state when the report recorded one, otherwise the current NSFW state of the reported channel--<sup>6</sup> Derived from the captured guild NSFW flag, where true is level 3 and false is level 0. Otherwise it is read from the reported guild, the filing guild, or the channel's guild--<sup>7</sup> Always emitted, so an absent member and a null member mean the same thing--<sup>8</sup> Computed when the report was filed by applying the guild setting over the channel setting--<sup>9</sup> Null while the report is PENDING and set when it moves to RESOLVED--<sup>10</sup> Null on a report filed without a report flow, which includes every report filed before report flows existed--<sup>11</sup> Null when `reason` is null, and the raw reason key when this API does not know the reason--<sup>12</sup> Null when `reason` is null or unknown to this API--<sup>13</sup> True on a Digital Services Act notice filed through a report flow, and null on every other report--<sup>14</sup> A message a webhook sent has no author account, so its report has a null `reported_user_id` and null reported user fields, and records the webhook instead. Every webhook field is null on any other report, and a message a bot account sent is reported as that account--<sup>15</sup> Read from the webhook when the report was filed, and null when the webhook had already been deleted by then--<sup>16</sup> Captured from the account that created the webhook. Null when that account had been deleted by the time the report was filed, while `reported_webhook_creator_id` still names it. The creator is context for moderators and is not the reported account, so `reported_user_id` stays null--<sup>17</sup> Null when the report names no reported account, which includes a report about a message a webhook sent--<sup>18</sup> On an instance with the `none` tag style the tag of an account that is not a bot is the bare username, with no `#0000`--For a report in a thread, `reported_channel_nsfw`, the three `reported_channel_effective_` fields, and `channel_nsfw` of each context entry resolve through the parent channel, as [Thread object](/http-api/threads/#thread-object) describes.+| reported_channel_name | ?string | The channel name, or null for a direct message channel |+| reported_channel_nsfw | ?boolean | Whether the reported channel was NSFW, or is now when the report captured no value |+| reported_guild_invite_code | ?string | The invite code the reporter sent with a guild report |+| reported_guild_nsfw_level | ?integer | The guild [NSFW level](/http-api/guilds/#nsfw-levels), or the current level when the report captured no value |+| reported_guild_nsfw? | ?boolean | Whether the reported guild was marked NSFW |+| reported_guild_content_warning_level? | ?integer | The [guild content warning level](/http-api/guilds/#guild-content-warning-levels) |+| reported_guild_content_warning_text? | ?string | The guild content warning text (at most 200 characters) |+| reported_channel_nsfw_override? | ?boolean | The NSFW override set on the channel itself |+| reported_channel_content_warning_level? | ?integer | The [content warning level](/http-api/channels/#content-warning-levels) set on the channel itself |+| reported_channel_content_warning_text? | ?string | The content warning text set on the channel itself (at most 200 characters) |+| reported_channel_effective_nsfw? | ?boolean | Whether the channel was NSFW after applying the guild setting |+| reported_channel_effective_content_warning_level? | ?integer | The channel content warning level after applying the guild setting |+| reported_channel_effective_content_warning_text? | ?string | The channel content warning text after applying the guild setting |+| resolved_at | ?ISO8601 timestamp | When the report was resolved, or null while pending |+| resolved_by_admin_id | ?snowflake | The admin who resolved the report, or null while pending |+| public_comment | ?string | The comment shown to the reporter (at most 512 characters) |++<sup>1</sup> Null for an anonymous Digital Services Act notice, which is filed without an account++<sup>2</sup> A report on a webhook message has null `reported_user_*` fields and has the webhook fields set instead. On every other report, the webhook fields are null### Example@@ -153,8 +105,7 @@ For a report in a thread, `reported_channel_nsfw`, the three `reported_channel_e"locale": "de","steps": [{"screen_id": "root_message", "screen_title": "Report message", "option_id": "abuse", "option_label": "Abusive or harmful content", "items": []},- {"screen_id": "abuse", "screen_title": "What does it involve?", "option_id": "harassment", "option_label": "Bullying, harassment or stalking", "items": []},- {"screen_id": "harassment", "screen_title": "How is someone being targeted?", "option_id": "harassment_direct", "option_label": "Repeatedly targeting someone with insults or abuse", "items": []}+ {"screen_id": "abuse", "screen_title": "What does it involve?", "option_id": "harassment", "option_label": "Bullying, harassment or stalking", "items": []}]},"reporter_good_faith_confirmed": null,@@ -176,8 +127,8 @@ For a report in a thread, `reported_channel_nsfw`, the three `reported_channel_e| Value | Name | Description || --- | --- | --- |-| 0 | PENDING | Report is waiting to be reviewed |-| 1 | RESOLVED | Report has been reviewed and resolved |+| 0 | PENDING | The report is waiting for review |+| 1 | RESOLVED | The report was reviewed and resolved |## Report type@@ -189,89 +140,51 @@ For a report in a thread, `reported_channel_nsfw`, the three `reported_channel_e## Admin report detail object-The detail object extends the [Admin report object](#admin-report-object) with the evidence too large to return in a list page. [Get report](#get-report) emits these members, and [List reports](#list-reports) omits them.+The detail object extends the [Admin report object](#admin-report-object) with these fields, which only [Get report](#get-report) returns.### Structure| Field | Type | Description || --- | --- | --- |-| mutual_dm_channel_id<sup>1</sup> | ?snowflake | The direct message channel shared by the reporter and the reported account |-| message_context<sup>2</sup> | array[[report message context](#report-message-context-object) object] | The messages captured around the reported content |-| message_responses<sup>3</sup> | array[[message](/http-api/messages/#message-object) object] | The current state of the same messages, read live |-| reported_profile_snapshot?<sup>4</sup> | ?[report profile snapshot](#report-profile-snapshot-object) object | The reported profile as it was when the report was filed |-| legal_hold_until?<sup>5</sup> | ?ISO8601 timestamp | When the legal hold on the report ends |-| legal_hold_reason?<sup>5</sup> | ?string | Why the report is held |-| notes?<sup>6</sup> | array[[report note](#report-note-object) object] | The internal notes on the report, oldest first |--<sup>1</sup> Set only for a USER report that has both a reporter and a reported account, and null when the two share no direct message channel--<sup>2</sup> Empty for a report that captured no message context, which is every user report and every guild report. An entry for which neither the capture nor the report records a channel is left out--<sup>3</sup> Resolved when the response is produced, so an edited message differs from its captured entry--<sup>4</sup> Always emitted. Null for a report filed before profile snapshots were stored, for a report about a message a webhook sent, and when the stored snapshot cannot be read--<sup>5</sup> Always emitted. Null when the report has no hold. [Set report legal hold](#set-report-legal-hold) places and clears the hold, and [Report retention](#report-retention) describes its effect--<sup>6</sup> Always emitted. Empty when the report has no notes--:::note[The live array can be shorter than the capture]-Fluxer skips an entry when neither the capture nor the report records its channel. It also omits a message that no longer exists, or whose channel can no longer be read.-:::+| mutual_dm_channel_id | ?snowflake | The DM channel the reporter and reported account share, on a USER report |+| message_context | array[[report message context](#report-message-context-object) object] | The messages captured around the reported message |+| message_responses | array[[message](/http-api/messages/#message-object) object] | The current state of the same messages, without deleted ones |+| reported_profile_snapshot? | ?[report profile snapshot](#report-profile-snapshot-object) object | The reported profile as it was when the report was filed |+| legal_hold_until? | ?ISO8601 timestamp | When the [legal hold](#set-report-legal-hold) ends, or null without one |+| legal_hold_reason? | ?string | Why the report is held |+| notes? | array[[report note](#report-note-object) object] | The internal notes on the report, oldest first |## Report message context object-A context entry preserves a message as it was when the report was filed. Later edits or deletions do not change it, and attachment evidence survives deletion of the original.--A message report captures the reported message together with at most 25 messages before it and at most 25 after it, for at most 51 entries. A Digital Services Act notice about a direct message, a group DM, or a guild channel that @everyone cannot view and read the history of captures the reported message alone. A message whose author account no longer existed at capture time is kept under the `DeletedUser` identity with discriminator `0000` and its original author ID. A message a webhook sent is captured under the name and avatar it was sent with.+A copy of a message as it was when the report was filed. A message report captures the reported message and up to 25 messages before and after it. User and guild reports capture none. Attachment copies stay when the original is deleted.### Structure| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the message |-| channel_id<sup>1</sup> | snowflake | The channel the captured messages were read from |-| channel_nsfw<sup>2</sup> | ?boolean | The current NSFW state of that channel |-| channel_content_warning_level?<sup>3</sup> <sup>4</sup> | ?integer | The channel [content warning level](/http-api/channels/#content-warning-levels) |-| channel_content_warning_text?<sup>3</sup> <sup>4</sup> | ?string | The channel content warning text |-| guild_id<sup>5</sup> | ?snowflake | The guild the report is scoped to, or null when the report names none |-| guild_nsfw_level<sup>2</sup> | ?integer | The current guild [NSFW level](/http-api/guilds/#nsfw-levels) |-| guild_nsfw?<sup>3</sup> <sup>4</sup> | ?boolean | Whether the guild is marked NSFW |-| guild_content_warning_level?<sup>3</sup> <sup>4</sup> | ?integer | The guild [content warning level](/http-api/guilds/#guild-content-warning-levels) |-| guild_content_warning_text?<sup>3</sup> <sup>4</sup> | ?string | The guild content warning text |-| content | string | The captured message content, empty when the message had none |-| timestamp<sup>6</sup> | ISO8601 timestamp | When the message was sent |-| attachments<sup>7</sup> | array[[report message attachment](#report-message-attachment-object) object] | The captured attachment copies |-| author_id<sup>8</sup> | snowflake | The author of the message |-| author_username<sup>8</sup> | string | The captured author username |-| author_global_name<sup>4</sup> | ?string | The display name of the author |-| author_discriminator<sup>8</sup> | string | The captured zero-padded four-digit author discriminator |-| author_avatar<sup>8</sup> | ?string | The captured author avatar hash, or null when unset |-| webhook_id?<sup>3</sup> <sup>9</sup> | ?snowflake | The [webhook](/http-api/webhooks/) that sent the message |-| author_bot?<sup>3</sup> <sup>10</sup> | ?boolean | Whether the author account is a bot |-| missing_attachments?<sup>3</sup> <sup>11</sup> | array[[report missing attachment](#report-missing-attachment-object) object] | Attachments that could not be copied into the report |--<sup>1</sup> The channel of the captured entry, otherwise the reported channel. An entry for which neither records a channel is left out of `message_context`--<sup>2</sup> Read from the current channel or guild, and null when the record can no longer be read--<sup>3</sup> Always emitted, so an absent member and a null member mean the same thing--<sup>4</sup> Always null, because the capture stores no value for it--<sup>5</sup> The reported guild, or the guild the report was filed from, so every entry of one report has the same value--<sup>6</sup> Derived from the message ID--<sup>7</sup> Fluxer drops an evidence copy that records no file name, resolves to no channel, or receives no download URL, so this array can be shorter than the original--<sup>8</sup> For a message a webhook sent, the webhook ID, the name and avatar hash the message was sent with, and the discriminator `0000`, as the [message object](/http-api/messages/#message-object) shows the author of a webhook message--<sup>9</sup> Null for a message an account sent--<sup>10</sup> Read from the author account when the response is produced. Null for a message a webhook sent and for an author account that no longer resolves--<sup>11</sup> Empty when every attachment was copied, and on a report filed before missing attachments were recorded. An attachment is listed here when its copy failed or, for a file embedded in the message, when the file was no longer stored+| channel_id | snowflake | The channel the message was sent in |+| channel_nsfw | ?boolean | The current NSFW state of the channel |+| channel_content_warning_level? | ?integer | Always null |+| channel_content_warning_text? | ?string | Always null |+| guild_id | ?snowflake | The guild the report is about or was filed from |+| guild_nsfw_level | ?integer | The current guild [NSFW level](/http-api/guilds/#nsfw-levels) |+| guild_nsfw? | ?boolean | Always null |+| guild_content_warning_level? | ?integer | Always null |+| guild_content_warning_text? | ?string | Always null |+| content | string | The message content, empty when it had none |+| timestamp | ISO8601 timestamp | When the message was sent |+| attachments | array[[report message attachment](#report-message-attachment-object) object] | The attachment copies |+| author_id | snowflake | The author, or the webhook ID for a webhook message |+| author_username | string | The author username, or the name a webhook message was sent under |+| author_global_name | ?string | Always null |+| author_discriminator | string | The four-digit author discriminator, `0000` for a webhook message |+| author_avatar | ?string | The author avatar hash |+| webhook_id? | ?snowflake | The [webhook](/http-api/webhooks/) that sent the message |+| author_bot? | ?boolean | Whether the author account is a bot |+| missing_attachments? | array[[report missing attachment](#report-missing-attachment-object) object] | Attachments Fluxer could not copy |++When the author's account was already deleted, the copy has the username `DeletedUser` and the discriminator `0000`.### Report message attachment object@@ -280,52 +193,42 @@ A message report captures the reported message together with at most 25 messages| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the attachment |-| filename | string | The captured file name |-| url<sup>12</sup> | string | The download URL for the evidence copy |+| filename | string | The file name |+| url | string | The download URL for the copy, valid for five minutes || nsfw | ?boolean | Whether the attachment was marked NSFW |-| content_type | ?string | The captured MIME type, or null when unknown |-| width | ?integer | The pixel width, or null for a non-image attachment |-| height | ?integer | The pixel height, or null for a non-image attachment |-| size?<sup>3</sup> | ?integer | The size in bytes, or null when unknown |--<sup>12</sup> The URL expires after five minutes. Fetch the report again for fresh attachment links+| content_type | ?string | The MIME type |+| width | ?integer | The width in pixels, or null for a non-image |+| height | ?integer | The height in pixels, or null for a non-image |+| size? | ?integer | The size in bytes |### Report missing attachment object-An attachment of a captured message that Fluxer could not copy into the report. It has the captured metadata and no download URL.+An attachment Fluxer could not copy into the report. It has no download URL.#### Structure| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the attachment |-| filename | string | The captured file name |+| filename | string | The file name || nsfw | ?boolean | Whether the attachment was marked NSFW |-| content_type | ?string | The captured MIME type, or null when unknown |-| width | ?integer | The pixel width, or null for a non-image attachment |-| height | ?integer | The pixel height, or null for a non-image attachment |-| size<sup>13</sup> | ?integer | The size in bytes, or null when unknown |--<sup>13</sup> `0` for a file embedded in the message that was no longer stored when the report was filed+| content_type | ?string | The MIME type |+| width | ?integer | The width in pixels, or null for a non-image |+| height | ?integer | The height in pixels, or null for a non-image |+| size | ?integer | The size in bytes |## Report profile snapshot object-The reported profile as it was when the report was filed. A user report keeps the account, a guild report keeps the guild, and a message report keeps the author account. Each image is a copy Fluxer made when the report was filed, so a later profile change or deletion does not affect it.+The reported profile as it was when the report was filed, with copies of its images.### Structure| Field | Type | Description || --- | --- | --- || captured_at | ISO8601 timestamp | When the snapshot was taken |-| user<sup>1</sup> | ?[snapshot user](#snapshot-user-object) object | The reported account |-| member<sup>2</sup> | ?[snapshot member](#snapshot-member-object) object | The guild profile of the reported account |-| guild<sup>3</sup> | ?[snapshot guild](#snapshot-guild-object) object | The reported guild |--<sup>1</sup> Null on a guild report--<sup>2</sup> Set when the report names a guild the account was a member of, which is a user report with `guild_id` or a message report in a guild channel--<sup>3</sup> Set on a guild report only+| user | ?[snapshot user](#snapshot-user-object) object | The reported account, or null on a guild report |+| member | ?[snapshot member](#snapshot-member-object) object | The guild profile of the reported account, when the report is about a guild |+| guild | ?[snapshot guild](#snapshot-guild-object) object | The reported guild, on a guild report only |### Snapshot user object@@ -334,15 +237,13 @@ The reported profile as it was when the report was filed. A user report keeps th| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the account |-| username<sup>4</sup> | ?string | The username |-| discriminator<sup>4</sup> | ?string | The zero-padded four-digit discriminator |-| global_name<sup>4</sup> | ?string | The display name, or null when unset |-| bio<sup>4</sup> | ?string | The profile bio, or null when unset |-| pronouns<sup>4</sup> | ?string | The pronouns, or null when unset |-| avatar<sup>4</sup> | ?[snapshot asset](#snapshot-asset-object) object | The avatar, or null when unset |-| banner<sup>4</sup> | ?[snapshot asset](#snapshot-asset-object) object | The profile banner, or null when unset |--<sup>4</sup> Null for an account whose deletion had started when the report was filed, which is kept by ID alone with no member profile+| username | ?string | The username |+| discriminator | ?string | The four-digit discriminator |+| global_name | ?string | The display name |+| bio | ?string | The profile bio |+| pronouns | ?string | The pronouns |+| avatar | ?[snapshot asset](#snapshot-asset-object) object | The avatar |+| banner | ?[snapshot asset](#snapshot-asset-object) object | The profile banner |### Snapshot member object@@ -351,12 +252,12 @@ The reported profile as it was when the report was filed. A user report keeps th| Field | Type | Description || --- | --- | --- || guild_id | snowflake | The guild the profile belongs to |-| nick | ?string | The guild nickname, or null when unset |-| bio | ?string | The guild profile bio, or null when unset |-| pronouns | ?string | The guild profile pronouns, or null when unset |+| nick | ?string | The guild nickname |+| bio | ?string | The guild profile bio |+| pronouns | ?string | The guild profile pronouns || joined_at | ?ISO8601 timestamp | When the account joined the guild |-| avatar | ?[snapshot asset](#snapshot-asset-object) object | The guild avatar, or null when unset |-| banner | ?[snapshot asset](#snapshot-asset-object) object | The guild profile banner, or null when unset |+| avatar | ?[snapshot asset](#snapshot-asset-object) object | The guild avatar |+| banner | ?[snapshot asset](#snapshot-asset-object) object | The guild profile banner |### Snapshot guild object@@ -366,10 +267,10 @@ The reported profile as it was when the report was filed. A user report keeps th| --- | --- | --- || id | snowflake | The ID of the guild || name | ?string | The guild name |-| vanity_url_code | ?string | The vanity invite code, or null when unset |-| icon | ?[snapshot asset](#snapshot-asset-object) object | The icon, or null when unset |-| banner | ?[snapshot asset](#snapshot-asset-object) object | The banner, or null when unset |-| splash | ?[snapshot asset](#snapshot-asset-object) object | The invite splash, or null when unset |+| vanity_url_code | ?string | The vanity invite code |+| icon | ?[snapshot asset](#snapshot-asset-object) object | The icon |+| banner | ?[snapshot asset](#snapshot-asset-object) object | The banner |+| splash | ?[snapshot asset](#snapshot-asset-object) object | The invite splash |### Snapshot asset object@@ -378,41 +279,11 @@ The reported profile as it was when the report was filed. A user report keeps th| Field | Type | Description || --- | --- | --- || hash | string | The asset hash when the report was filed |-| url<sup>5</sup> | ?string | The download URL for the copy |--<sup>5</sup> Expires after five minutes. Null when the image could not be copied into the report, or when no download URL could be made--### Example--```json-{- "captured_at": "2026-03-04T18:22:10.502Z",- "user": {- "id": "1490118377238528000",- "username": "marlow",- "discriminator": "0117",- "global_name": "Marlow",- "bio": "Ask me about trains",- "pronouns": null,- "avatar": {"hash": "4be1c7a09d2e3f56", "url": "https://reports.example.com/reports/1502771904419102720/profile/user_avatar/4be1c7a09d2e3f56?X-Amz-Expires=300"},- "banner": null- },- "member": {- "guild_id": "1471002884199612416",- "nick": "Conductor",- "bio": null,- "pronouns": null,- "joined_at": "2026-01-12T09:41:00.000Z",- "avatar": null,- "banner": null- },- "guild": null-}-```+| url | ?string | The download URL for the copy, valid for five minutes, or null when the copy failed |## Report flow answers object-The answers a reporter gave in a [report flow](/http-api/reports/#report-flows), described in English whatever locale the reporter saw. Fluxer builds the description from the stored IDs when it produces the response, so the labels follow the current catalogue.+The answers a reporter gave in a [report flow](/http-api/reports/#report-flows), with English labels from the current catalog.### Structure@@ -421,7 +292,7 @@ The answers a reporter gave in a [report flow](/http-api/reports/#report-flows),| revision_hash | string | The [revision hash](/http-api/reports/#revision-hash) the reporter's client sent || surface | string | The [report flow surface](/http-api/reports/#report-flow-surfaces), `in_app` or `dsa` || locale | ?string | The [locale](/topics/locales/) the reporter saw the flow in |-| steps | array[[report flow answer step](#report-flow-answer-step-object) object] | The answered screens in walk order |+| steps | array[[report flow answer step](#report-flow-answer-step-object) object] | The answered screens in order |### Report flow answer step object@@ -430,16 +301,10 @@ The answers a reporter gave in a [report flow](/http-api/reports/#report-flows),| Field | Type | Description || --- | --- | --- || screen_id | string | The ID of the screen |-| screen_title<sup>1</sup> | string | The English title of the screen |-| option_id<sup>2</sup> | ?string | The ID of the chosen option |-| option_label<sup>1</sup> <sup>2</sup> | ?string | The English label of the chosen option |-| items<sup>3</sup> | array[[report flow answer item](#report-flow-answer-item-object) object] | The ticked checklist items |--<sup>1</sup> The raw ID when the current catalogue no longer has the screen or option--<sup>2</sup> Null on a checklist screen and an info screen--<sup>3</sup> In checklist order, not the order the reporter ticked them, and empty on a choice screen and an info screen+| screen_title | string | The English title of the screen |+| option_id | ?string | The ID of the chosen option, or null on a checklist or info screen |+| option_label | ?string | The English label of the chosen option |+| items | array[[report flow answer item](#report-flow-answer-item-object) object] | The checked checklist items |### Report flow answer item object@@ -448,11 +313,11 @@ The answers a reporter gave in a [report flow](/http-api/reports/#report-flows),| Field | Type | Description || --- | --- | --- || id | string | The ID of the item |-| label | string | The English label of the item, or its raw ID when the current catalogue no longer has it |+| label | string | The English label of the item |## Report reason object-One entry of the [report reason](/http-api/reports/#report-reasons) catalogue, as [List report reasons](#list-report-reasons) returns it.+An entry in the [report reason](/http-api/reports/#report-reasons) catalog, as [List report reasons](#list-report-reasons) returns it.### Structure@@ -467,30 +332,21 @@ One entry of the [report reason](/http-api/reports/#report-reasons) catalogue, a## Report resolution object-A report resolution is the reduced view [Update report](#update-report) returns. It has the fields the update writes and nothing else.+[Update report](#update-report) returns this object.### Structure| Field | Type | Description || --- | --- | --- || report_id | snowflake | The ID of the report |-| status | integer | The [report status](#report-status), always RESOLVED on a successful update |+| status | integer | The [report status](#report-status), always RESOLVED || resolved_at | ?ISO8601 timestamp | When the report was resolved |-| public_comment | ?string | The comment shown to the reporter, or null when none was supplied |--### Example--```json-{- "report_id": "1502771904419102720",- "status": 1,- "resolved_at": "2026-03-05T11:04:53.902Z",- "public_comment": "Thanks for the report. We actioned the account."-}-```+| public_comment | ?string | The comment shown to the reporter, or null when `notify_reporter` was false |## Report legal hold object+[Set report legal hold](#set-report-legal-hold) returns this object.+### Structure| Field | Type | Description |@@ -501,238 +357,176 @@ A report resolution is the reduced view [Update report](#update-report) returns.## Report note object-A note is internal context a staff member adds to a report. Notes are staff only. Fluxer never shows them to the reporter or the reported account, and never puts them in a notice, email or direct message. A note never changes once it is written. Notes have no retention period of their own and are deleted together with the report.+A note is for admins only, and Fluxer never shows it to the reporter or the reported account. A note can't be edited, and it's deleted with its report.### Structure| Field | Type | Description || --- | --- | --- || note_id | snowflake | The ID of the note |-| author_id | snowflake | The staff member who wrote it |+| author_id | snowflake | The admin who wrote it || body | string | The note || created_at | ISO8601 timestamp | When it was written |## Report retention-A pending report is kept until it is resolved. Once a report is resolved, Fluxer deletes it when its retention period ends, together with its notes and its stored evidence: the captured message context, the profile snapshot and its images, the attachment copies, and its search index entry. The reporter's duplicate-report reservation for it goes too, so the reporter can report the same message, account or guild again.--The retention period ends 365 days after `resolved_at`, or the number of days in `FLUXER_REPORT_RETENTION_DAYS`. Some reports are kept longer, whatever that setting says:+A pending report is kept until it is resolved. A resolved report is deleted with its notes and evidence copies 365 days after `resolved_at`, and you can change the number of days with `FLUXER_REPORT_RETENTION_DAYS` on `worker`, which runs retention once a day. Three kinds of report are kept longer.-- A report in the `child_safety` category is kept for at least 365 days after it was resolved.-- A report listed in the `report_ids` of an [enforcement decision](/admin-api/enforcement/#enforcement-decision-object) is kept for at least 365 days after the newest such decision was recorded, as long as the decision's evidence.-- A report with a [legal hold](#set-report-legal-hold) that ends later is kept until the next run after the hold ends.+- A `child_safety` report is kept at least 365 days after it was resolved, even when `FLUXER_REPORT_RETENTION_DAYS` is lower.+- A report linked from an [enforcement decision](/admin-api/enforcement/#enforcement-decision-object) is kept at least 365 days after the newest such decision.+- A report with a [legal hold](#set-report-legal-hold) is kept until the hold ends.-A report resolved with the outcome `no_violation` loses its copied context 184 days after it was resolved, which covers the six months the Digital Services Act gives a reporter to contest the outcome. Fluxer then removes the captured message context, the profile snapshot, the reporter's additional information, and the stored evidence copies, and keeps the rest of the record, its notes and its search index entry until the end of the retention period. This does not apply to a `child_safety` report, to a report linked to an enforcement decision, or while a legal hold has not ended.+Every report, pending or resolved, loses its message context, profile snapshot, additional info and evidence copies 365 days after it was filed, unless it has a legal hold. The record and its notes stay.-An evidence copy that a retained report also uses is kept for that report.+When a report is resolved as `no_violation` and isn't one of the reports above, its message context, profile snapshot, additional info and evidence copies are deleted 184 days after it was resolved, and the rest of the record is deleted when the retention period ends.-The job runs once a day in `worker`. Each run logs one `Processed report retention` line with the counts it found, deleted and cleared and the periods it used. A report that fails to delete or clear keeps its record and is retried on the next run. [Delete report](#delete-report) deletes one report straight away.--:::caution[Deleted evidence cannot be restored]-Retention deletes for real unless `FLUXER_REPORT_RETENTION_DRY_RUN` is `true` on `worker`. In a dry run each run only counts what it would delete or clear and changes nothing.+:::caution[Deleted evidence can't be restored]+To see what retention would delete before it deletes anything, set `FLUXER_REPORT_RETENTION_DRY_RUN` to `true` on `worker`. It then logs each report it would delete and deletes nothing.:::## List reports<RouteHeader method="GET" path="/v1/admin/reports" auditReason />-Returns a page of [Admin report](#admin-report-object) objects without message context. Requires `report:view`.--The operation has two branches. Both read the report search index, and both return `total`, `offset`, and `limit` beside the page. A request that supplies `status` and no other filter takes the status branch, which lists the reports with that status newest first by `reported_at` and ignores `sort_by` and `sort_order`. Every other request takes the search branch, which applies the supplied filters and sort.--The search branch applies no status filter when `status` is omitted, so a request with no query string returns reports of every status.--An instance with no search backend returns 403 `FEATURE_TEMPORARILY_DISABLED` on both branches.+Returns a page of [Admin report](#admin-report-object) objects. You need `report:view`.### Query parameters| Field | Type | Description || --- | --- | --- |-| q?<sup>1</sup> | string | Free-text query matched against the searchable report fields (1-1024 characters) |-| status? | pending \| resolved | Restrict results to one [report status](#report-status) |-| report_type? | message \| user \| guild | Restrict results to one [report type](#report-type) |-| category? | string | Restrict results to one submitted category (1-128 characters) |-| reason? | string | Restrict results to one [report reason](/http-api/reports/#report-reasons) key (1-64 characters) |-| reporter_id? | snowflake | Restrict results to one reporter |-| reported_user_id? | snowflake | Restrict results to one reported account |-| reported_webhook_id? | snowflake | Restrict results to messages one [webhook](/http-api/webhooks/) sent |-| reported_guild_id? | snowflake | Restrict results to one reported guild |-| reported_channel_id? | snowflake | Restrict results to one reported channel |-| guild_context_id? | snowflake | Restrict results to reports filed from within one guild |-| resolved_by_admin_id? | snowflake | Restrict results to one resolving Admin account |+| q?<sup>1</sup> | string | Free-text query (1-1024 characters) |+| status? | pending \| resolved | Filter by [report status](#report-status) |+| report_type? | message \| user \| guild | Filter by [report type](#report-type) |+| category? | string | Filter by category (1-128 characters) |+| reason? | string | Filter by [report reason](/http-api/reports/#report-reasons) key (1-64 characters) |+| reporter_id? | snowflake | Filter by reporter |+| reported_user_id? | snowflake | Filter by reported account |+| reported_webhook_id? | snowflake | Filter by the [webhook](/http-api/webhooks/) that sent the reported message |+| reported_guild_id? | snowflake | Filter by reported guild |+| reported_channel_id? | snowflake | Filter by reported channel |+| guild_context_id? | snowflake | Filter by the guild the report was filed from |+| resolved_by_admin_id? | snowflake | Filter by the admin who resolved the report || sort_by?<sup>2</sup> | created_at \| reported_at \| resolved_at | Sort field (default `reported_at`) |-| sort_order? | asc \| desc | Sort direction, where asc is oldest first (default `desc`) |+| sort_order?<sup>2</sup> | asc \| desc | Sort direction (default `desc`) || limit? | integer | Maximum reports to return (1-200, default 50) |-| offset?<sup>3</sup> | integer | Reports to skip (0-10000, default 0) |+| offset? | integer | Reports to skip (0-10000, default 0) |-<sup>1</sup> Matched against `category`, `additional_info`, `reported_guild_name`, and `reported_channel_name` only. Omitting it matches every report satisfying the remaining filters+<sup>1</sup> Matches `category`, `additional_info`, `reported_guild_name` and `reported_channel_name`-<sup>2</sup> `created_at` orders by the time encoded in the report ID, and `reported_at` by the submission time stored on the report--<sup>3</sup> The next page is requested with a larger `offset`+<sup>2</sup> Ignored when `status` is the only filter, and those results are always newest first by `reported_at`### Response body| Field | Type | Description || --- | --- | --- |-| reports<sup>1</sup> | array[[Admin report](#admin-report-object) object] | Reports in this page, without message context |-| total<sup>2</sup> | integer | Index hits matching the filters |-| offset | integer | The offset this page was read from |-| limit | integer | The limit this page was read with |--<sup>1</sup> An index hit whose report record no longer exists is dropped and the request still succeeds, so a full page can hold fewer entries than `limit`. Fluxer logs the dropped IDs, and a [Refresh search index](/admin-api/search-indexes/#refresh-search-index) of `reports` removes them from the index--<sup>2</sup> The index count, which still includes hits whose report record no longer exists+| reports | array[[Admin report](#admin-report-object) object] | The reports in this page |+| total | integer | The number of matching reports |+| offset | integer | The offset of this page |+| limit | integer | The limit of this page |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Report page was returned |-| 403 | [error response](/admin-api/#error-response) | No search backend is configured for the instance and the request returns `FEATURE_TEMPORARILY_DISABLED` |--### Side effects+| 200 | response body | The page was returned |+| 403 | [error response](/admin-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED` when the instance has no search backend |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `search_reports`, target type `report`, and target ID `0` on both branches. The metadata keys are `limit`, `offset`, `result_count` for the reports in this page, and `total`. The search branch adds `sort_by` and `sort_order`. A supplied `q` adds `has_query` with the value `true`, and the query text is not recorded. The supplied filters add `status`, `report_type`, `category`, `reason`, `reported_user_id`, `reported_webhook_id`, `reported_guild_id`, and `reported_channel_id` under their own names, `reporter_id` as `reporter_user_id`, `guild_context_id` as `context_guild_id`, and `resolved_by_admin_id` as `resolved_by_admin_user_id`. A 403 records nothing.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## List report reasons<RouteHeader method="GET" path="/v1/admin/report-reasons" auditReason />-Returns every [report reason](/http-api/reports/#report-reasons) a report flow can file a report under, with the category each one stores for each report type. Requires `report:view`.--The labels are English. The list is the catalogue this API was built with, so an admin client can label and filter a reason without a copy of its own.+Returns every [report reason](/http-api/reports/#report-reasons) with the category it stores for each report type. You need `report:view`.### Response body| Field | Type | Description || --- | --- | --- |-| reasons | array[[report reason](#report-reason-object) object] | Every reason, in catalogue order |+| reasons | array[[report reason](#report-reason-object) object] | Every reason, in catalog order |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The catalogue was returned |--### Side effects+| 200 | response body | The catalog was returned |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_report_reasons`, target type `report`, target ID `0`, and the metadata key `result_count`.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Get report<RouteHeader method="GET" path="/v1/admin/reports/{report_id}" auditReason />-Returns one [Admin report detail](#admin-report-detail-object) object, which adds the captured message context, the live state of those messages, and the notes on the report. Requires `report:view`.--The operation answers even when the report search index is unavailable. Reporter contact fields are redacted here exactly as they are in [List reports](#list-reports).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| report_id | snowflake | The ID of the report |+Returns an [Admin report detail](#admin-report-detail-object) object. You need `report:view`.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [Admin report detail](#admin-report-detail-object) object | Report was returned |-| 404 | [error response](/admin-api/#error-response) | Report does not exist and the request returns `UNKNOWN_REPORT` |--### Side effects+| 200 | [Admin report detail](#admin-report-detail-object) object | The report was returned |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_REPORT` when the report doesn't exist |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `get_report`, target type `report`, the report ID as target ID, and metadata keys `report_type` and `status` with the integer values of the report. The attachment download URLs are not recorded. A 404 records nothing.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Update report<RouteHeader method="PATCH" path="/v1/admin/reports/{report_id}" auditReason />-Resolves one report and returns a [report resolution](#report-resolution-object) object. Requires `report:resolve`.--`status` is required and `resolved` is the only value it accepts, so this route changes no other field.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| report_id | snowflake | The ID of the report |+Resolves a pending report and returns a [report resolution](#report-resolution-object) object. You need `report:resolve`.### JSON body| Field | Type | Description || --- | --- | --- |-| status | resolved | The status to move the report to |-| public_comment?<sup>1</sup> | string | The comment shown to the reporter (0-512 characters) |-| notify_reporter?<sup>2</sup> | boolean | Whether the notice to the reporter includes `public_comment` (default true) |-| resolution<sup>3</sup> | string | How the report was resolved, one of `actioned`, `no_violation`, or `duplicate` |-| outcome?<sup>4</sup> | string | What happened to the reported item, `removed`, `warned`, `restricted`, `action_taken`, or `no_violation` |-| duplicate_of?<sup>5</sup> | snowflake | The report this one repeats |--<sup>1</sup> Stored as null when it is omitted or empty. Otherwise it is stored, and the resolution notice shows it to the reporter unless `notify_reporter` is false--<sup>2</sup> The reporter is notified either way. False sends the notice without the comment, and the comment is still stored on the report+| status | resolved | The new status |+| public_comment? | string | The comment shown to the reporter (0-512 characters) |+| notify_reporter?<sup>1</sup> | boolean | Whether the notice to the reporter includes `public_comment` (default true) |+| resolution | string | `actioned`, `no_violation` or `duplicate` |+| outcome? | string | `removed`, `warned`, `restricted`, `action_taken` or `no_violation` |+| duplicate_of? | snowflake | The report this one repeats |-<sup>3</sup> Not stored on the report and not returned by any report route. It is recorded in the audit entry+<sup>1</sup> The reporter gets a notice either way. False leaves the comment out of the notice and off the report, and Fluxer keeps it only in the audit entry as `internal_comment`-<sup>4</sup> Required for `actioned`, which refuses `no_violation`. Optional for `no_violation`, which sets `no_violation` and refuses any other value. Refused for `duplicate`. A mistake fails with `REPORT_OUTCOME_INVALID`. `removed` means the reported content, profile field or community was removed. `warned` means the account responsible was warned, and the reporter is told only that action was taken. `restricted` means the reported account was restricted and the item was left up. `action_taken` means Fluxer acted under its rules in another way, and the reporter is not told how. `no_violation` means the item breaks no rule and was left as it is. The outcome is stored on the report and the reporter is told it+The `resolution` decides which of the other fields you send.-<sup>5</sup> Required for `duplicate` and refused otherwise, as is a report naming itself, with `REPORT_OUTCOME_INVALID`. The duplicate takes the outcome stored on that report and the reporter is told it. While that report has no outcome, because it is still pending or was resolved before outcomes were stored, the duplicate is resolved without a notice to its reporter. An unknown report returns 404 `UNKNOWN_REPORT`+| resolution | outcome | duplicate_of |+| --- | --- | --- |+| actioned | Required, any value except `no_violation` | Not allowed |+| no_violation | Optional, only `no_violation` | Not allowed |+| duplicate | Not allowed, copied from the `duplicate_of` report | Required, and not this report |-The admin panel's resolve form has a required Resolution select with three choices: Action taken (`actioned`), No violation (`no_violation`), and Duplicate (`duplicate`). Action taken also shows a required Outcome select: Content removed (`removed`), Warning given (`warned`), Account restricted (`restricted`), and Other action taken (`action_taken`). No violation sends the outcome `no_violation`. Duplicate shows a required Duplicate of field for the report ID. The panel refuses a submission without a resolution, without an outcome for Action taken, or without a report ID for Duplicate, and the report stays pending. After a resolve, the panel confirms the choice in its message, such as "Report resolved: No violation". Staff find the choice in the `resolution` and `outcome` metadata of the `resolve_report` entry in the audit log.+The `outcome` is one of these values.-A [decision](/admin-api/enforcement/) that links pending reports resolves them as `actioned` itself, with the outcome its kind implies, so no separate update is needed.+| Outcome | Description |+| --- | --- |+| removed | The reported content, profile field or guild was removed |+| warned | The account responsible was warned, and the reporter is told action was taken |+| restricted | The reported account was restricted |+| action_taken | Fluxer acted another way and doesn't tell the reporter how |+| no_violation | The reported content breaks no rule |-:::caution[Resolution is terminal]-Resolving a report notifies the reporter whatever `notify_reporter` says, as the side effects below describe. A resolved report never returns to PENDING, and a second update against it returns 400 `REPORT_ALREADY_RESOLVED` without changing the stored public comment.-:::+[Schedule user deletion](/admin-api/users/#schedule-user-deletion) with [deletion reason](/admin-api/users/#deletion-reasons) 3, 4, 5, 6, 8, 11, 17, 18, 20, 21 or 22 also resolves the pending reports against that account with the outcome `restricted` and no comment, except reports in the `child_safety`, `underage_user` and `self_harm` categories. An [enforcement decision](/admin-api/enforcement/) resolves the pending reports it links.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [report resolution](#report-resolution-object) object | Report was resolved |-| 400 | [error response](/admin-api/#error-response) | The report is already resolved and the request returns `REPORT_ALREADY_RESOLVED` |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY`, because `resolution` is missing or the outcome or `duplicate_of` does not match it |-| 404 | [error response](/admin-api/#error-response) | The report or the `duplicate_of` report does not exist and the request returns `UNKNOWN_REPORT` |+| 200 | [report resolution](#report-resolution-object) object | The report was resolved |+| 400 | [error response](/admin-api/#error-response) | `REPORT_ALREADY_RESOLVED` when the report is already resolved |+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` with `REPORT_OUTCOME_INVALID` when `outcome` or `duplicate_of` doesn't fit `resolution` |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_REPORT` when the report or the `duplicate_of` report doesn't exist |### Side effects-The report moves to RESOLVED and records `resolved_at`, `resolved_by_admin_id`, the public comment and the outcome.--Fluxer records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with target type `report`, target ID equal to the report ID, and action `resolve_report`. The metadata is `report_id`, `report_type`, `notify_reporter`, `reporter_dm_sent`, `reporter_email_sent`, `reporter_dsa_email_sent`, `resolution`, `duplicate_of` for a duplicate, and `outcome`, which a duplicate of a report with no outcome leaves out. When Fluxer does not attempt a notice, `reporter_notice_skipped` names the reason: `reporter_account_deleted`, `reporter_report_banned`, `reporter_lookup_failed`, `no_reporter_email`, or `duplicate_outcome_unknown`.--Fluxer tells the reporter the decision about the item they reported: that the content was removed, that the account was restricted without saying how, that action was taken without saying what, or that it broke no rule and was left as it is. A reporter with an account receives a system direct message, and an email when the account has an address. A Digital Services Act notice has no reporter account, so its verified address receives the same decision by email. Each notice gives the report ID and the comment when one is shared. It never names a decision, a sanction or the other account's history. Nothing is sent when the reporter account is deleted, or was barred from reporting when the report was filed.--A reporter who does not already have the system channel open receives [Channel Create](/gateway/events/#channel-create), and every session of the reporter receives [Message Create](/gateway/events/#message-create). Fluxer logs a delivery failure, and the request still succeeds.+The reporter gets a system DM with the outcome, which sends [Channel Create](/gateway/events/#channel-create) and [Message Create](/gateway/events/#message-create), and an email when the account has an email address. A Digital Services Act notice and an instance with direct messages turned off get the email only. Fluxer sends nothing when the reporter's account is deleted, when it was barred from reporting at the time of the report, or when the report is a duplicate of one with no outcome yet.-### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## List report notes<RouteHeader method="GET" path="/v1/admin/reports/{report_id}/notes" auditReason />-Returns the [notes](#report-note-object) on one report, oldest first. Requires `report:view`. [Get report](#get-report) returns the same notes in `notes`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| report_id | snowflake | The ID of the report |+Returns the [notes](#report-note-object) on a report, oldest first. You need `report:view`.### Response body@@ -745,27 +539,15 @@ Returns the [notes](#report-note-object) on one report, oldest first. Requires `| Status | Body | Condition || --- | --- | --- || 200 | response body | The notes were returned |-| 404 | [error response](/admin-api/#error-response) | Report does not exist and the request returns `UNKNOWN_REPORT` |--### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_report_notes`, target type `report`, the report ID as target ID, and the metadata key `result_count`. A 404 records nothing.+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_REPORT` when the report doesn't exist |-### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Add a note to a report<RouteHeader method="POST" path="/v1/admin/reports/{report_id}/notes" auditReason />-Appends an internal note to one report and returns the [report note](#report-note-object) object. Requires `report:resolve`. A note can be added to a pending or a resolved report.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| report_id | snowflake | The ID of the report |+Adds a [note](#report-note-object) to a report, pending or resolved, and returns it. You need `report:resolve`.### JSON body@@ -778,88 +560,46 @@ Appends an internal note to one report and returns the [report note](#report-not| Status | Body | Condition || --- | --- | --- || 200 | [report note](#report-note-object) object | The note was added |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY`, because `body` is empty or longer than 2000 characters |-| 404 | [error response](/admin-api/#error-response) | Report does not exist and the request returns `UNKNOWN_REPORT` |--### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `annotate_report`, target type `report`, the report ID as target ID, and the metadata keys `report_id` and `note_id`. The note text is not recorded. A rejected request records nothing.--### Rate limit+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` when `body` is empty or over 2000 characters |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_REPORT` when the report doesn't exist |-100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Set report legal hold<RouteHeader method="POST" path="/v1/admin/reports/{report_id}/legal-hold" auditReason />-Places or clears a legal hold on one report and returns a [report legal hold](#report-legal-hold-object) object. Requires `report:resolve`.--A held report is kept past the end of its [retention period](#report-retention) until the hold ends, and [Delete report](#delete-report) refuses it. A hold can be placed on a pending or a resolved report, and a new hold replaces the previous one.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| report_id | snowflake | The ID of the report |+Places or clears a legal hold and returns a [report legal hold](#report-legal-hold-object) object. You need `report:resolve`. [Retention](#report-retention) doesn't delete a held report until the hold ends, and a new hold replaces the old one.### JSON body| Field | Type | Description || --- | --- | --- |-| legal_hold_until<sup>1</sup> | ?ISO8601 timestamp | When the hold ends, or null to clear the hold |-| legal_hold_reason?<sup>2</sup> | ?string | Why the report is kept (1-512 characters) |--<sup>1</sup> Must be in the future. A time in the past, or a value that is not an ISO 8601 timestamp, returns 400 `INVALID_FORM_BODY` on `legal_hold_until`--<sup>2</sup> Required to place a hold, and a missing or null reason returns 400 `INVALID_FORM_BODY` on `legal_hold_reason`. Ignored when the hold is cleared, which also clears the reason+| legal_hold_until | ?ISO8601 timestamp | When the hold ends (in the future), or null to clear the hold |+| legal_hold_reason? | ?string | Why the report is held (1-512 characters), required to place a hold |### Response| Status | Body | Condition || --- | --- | --- || 200 | [report legal hold](#report-legal-hold-object) object | The hold was placed or cleared |-| 400 | [error response](/admin-api/#error-response) | The end time or the reason is invalid and the request returns `INVALID_FORM_BODY` |-| 404 | [error response](/admin-api/#error-response) | Report does not exist and the request returns `UNKNOWN_REPORT` |--### Side effects+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` when `legal_hold_until` isn't in the future or a hold has no reason |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_REPORT` when the report doesn't exist |-Fluxer records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with target type `report` and the report ID as target ID. Placing a hold records action `set_report_legal_hold` with the metadata keys `report_id`, `report_type`, `legal_hold_until`, and `legal_hold_reason`. Clearing a hold records action `clear_report_legal_hold` with `report_id` and `report_type`. Either adds `previous_legal_hold_until` when the report already had a hold end time stored, including one that has passed. A rejected request records nothing.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Delete report<RouteHeader method="DELETE" path="/v1/admin/reports/{report_id}" auditReason />-Deletes one report straight away. Requires `report:delete`, which `report:resolve` does not include.--This is the deletion [report retention](#report-retention) runs at the end of the retention period, without waiting for it. It removes the report record with its captured message context and profile snapshot, its notes, its stored evidence copies, its search index entry, and the reporter's duplicate-report reservation for it. An evidence copy that another report also uses is kept for that report. A pending or a resolved report can be deleted, and the reporter is not told.--:::caution[Deletion is permanent]-Deleted evidence cannot be restored. A report with a legal hold that has not ended is refused. Clear the hold first when the report should go.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| report_id | snowflake | The ID of the report |+Deletes a report with its notes and evidence copies right away, without telling the reporter. You need `report:delete`.### Response| Status | Body | Condition || --- | --- | --- || 204 | empty | The report was deleted |-| 404 | [error response](/admin-api/#error-response) | Report does not exist and the request returns `UNKNOWN_REPORT` |-| 409 | [error response](/admin-api/#error-response) | The report has a legal hold that ends later and the request returns `REPORT_UNDER_LEGAL_HOLD` |--### Side effects--Fluxer records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `delete_report`, target type `report`, and the report ID as target ID. The metadata keys are `report_id`, `report_type`, `status`, `objects_deleted` for the evidence copies removed, and `shared_objects_kept` for the copies kept because another report uses them. A refused request records nothing.--### Rate limit+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_REPORT` when the report doesn't exist |+| 409 | [error response](/admin-api/#error-response) | `REPORT_UNDER_LEGAL_HOLD` when the report has a legal hold that hasn't ended |-200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/search-indexes.mdx b/fluxer_docs/src/content/docs/admin-api/search-indexes.mdxindex 21edd6c81..03ed45c02 100644--- a/fluxer_docs/src/content/docs/admin-api/search-indexes.mdx+++ b/fluxer_docs/src/content/docs/admin-api/search-indexes.mdx@@ -1,57 +1,43 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Search indexes-description: Administrative search index rebuilds, index names, and rebuild progress.+description: Rebuilding search indexes and reading rebuild progress.---import RouteHeader from '@/components/RouteHeader.astro';-These routes rebuild search indexes from current data and report progress. Rebuilds appear in [Jobs](/admin-api/jobs/) as `refreshSearchIndex`.--Both routes require the [ACL](/admin-api/#acl-evaluation) `guild:lookup`.+You can rebuild a search index from current data and check how far the rebuild has got. Each rebuild shows up in [Jobs](/admin-api/jobs/) as `refreshSearchIndex`.## Search index names-`index_name` is one of the following values. A value outside the set fails path validation.+A rebuild clears the index first, and search over that index returns partial results until the rebuild finishes. `discovery` and `threads` do not clear anything.| Value | Scope | Description || --- | --- | --- |-| guilds | Instance-wide | Every guild, backing Admin guild search |-| users | Instance-wide | Every account, backing Admin user search |-| reports | Instance-wide | Every report, backing Admin report search |-| audit_logs | Instance-wide | Every Admin audit entry, backing Admin audit search |-| discovery<sup>1</sup> | Instance-wide | Discovery metadata written onto the guild documents of approved listings |-| channel_messages<sup>2</sup> | One guild | Messages of every channel and thread in one guild, requiring `guild_id` |-| guild_members<sup>3</sup> | One guild | Members of one guild, requiring `guild_id` |-| favorite_memes<sup>4</sup> | One user | Favourited [memes](/http-api/memes/) of one user, requiring `user_id` |-| threads<sup>5</sup> | One guild | Threads of one guild, backing [Search threads](/http-api/threads/#search-threads), requiring `guild_id` |--<sup>1</sup> Refreshes the description, category, primary language and tags of approved discovery listings without removing guilds from search--<sup>2</sup> Clears the guild's message index and queues `indexChannelMessages` jobs for its channels. Completion of the parent job does not mean those jobs have finished--<sup>3</sup> Clears the guild's member index first and updates `members_indexed_at` on completion--<sup>4</sup> Rebuilding this index is not supported. The request is accepted, but the job fails without reporting progress+| guilds | Instance | Every guild |+| users | Instance | Every account |+| reports | Instance | Every report |+| audit_logs | Instance | Every Admin audit log entry |+| discovery | Instance | Discovery details of approved listings in the `guilds` index |+| channel_messages<sup>1</sup> | Guild | Messages in every channel and thread of one guild |+| guild_members | Guild | Members of one guild |+| favorite_memes<sup>2</sup> | User | Favorited [memes](/http-api/memes/) of one user |+| threads<sup>3</sup> | Guild | Threads used by [Search threads](/http-api/threads/#search-threads) |-<sup>5</sup> [Search threads](/http-api/threads/#search-threads) returns 202 for the guild until the rebuild completes+<sup>1</sup> Progress shows `completed` once every channel is queued for indexing, and `total` and `indexed` count channels. Messages keep indexing after that.-Every instance-wide name other than `discovery` deletes its documents before the first batch is written, so search over that index is incomplete for the whole run.+<sup>2</sup> The rebuild is queued but always fails, and its progress reads as `not_found`.-A `discovery` rebuild instead updates the existing guild documents in place, so those documents stay searchable for the whole run.+<sup>3</sup> [Search threads](/http-api/threads/#search-threads) returns 202 for the guild until the rebuild completes.## Search index refresh object-A receipt for one queued rebuild.-### Structure| Field | Type | Description || --- | --- | --- || success | boolean | Always true |-| job_id<sup>1</sup> | string | The ID of the queued rebuild, used to read its progress |--<sup>1</sup> The value is a [snowflake](/snowflakes/) rendered as a string. It addresses the progress record that [Get search index refresh](#get-search-index-refresh) reads. It differs from the `job_id` of the [Jobs](/admin-api/jobs/) ledger entry for the same rebuild, and appears there only inside that entry's `payload`+| job_id | string | The ID of the rebuild, used to [get its progress](#get-search-index-refresh) |### Example@@ -64,7 +50,7 @@ A receipt for one queued rebuild.## Search index refresh progress object-Progress for one queued rebuild. The object shape is selected by `status`.+An unknown or expired `job_id` returns the not found structure, and every other rebuild returns the progress structure.### Not found structure@@ -78,118 +64,59 @@ Progress for one queued rebuild. The object shape is selected by `status`.| --- | --- | --- || status | string | One of `in_progress`, `completed`, or `failed` || index_type | string | The [search index name](#search-index-names) being rebuilt |-| total?<sup>1</sup> | number | The number of documents expected, present while the rebuild reports progress and once it completes |-| indexed?<sup>2</sup> | number | The number of documents written so far |-| started_at?<sup>3</sup> | ISO8601 timestamp | The time the rebuild last reported progress |-| completed_at? | ISO8601 timestamp | The time the rebuild finished, present only when `status` is `completed` |-| failed_at? | ISO8601 timestamp | The time the rebuild failed, present only when `status` is `failed` |-| error? | string | The failure text, present only when `status` is `failed` |--<sup>1</sup> `total` is the same value as `indexed` while the rebuild runs and becomes the real total on completion. The `discovery` rebuild reports the approved listing count from its first batch onwards--<sup>2</sup> Each document the rebuild writes counts as one. A `channel_messages` rebuild counts the channels it queued--<sup>3</sup> Rewritten on every progress report, so its value moves forward while the rebuild runs--A failed result includes `status`, `index_type`, `error` and `failed_at`, but neither `total` nor `indexed`.--### Example--```json-{- "status": "in_progress",- "index_type": "guilds",- "total": 3000,- "indexed": 3000,- "started_at": "2026-08-31T09:12:44.118Z"-}-```+| total? | number | Equal to `indexed` until `status` is `completed`, except for `discovery`, where it is the number of approved listings |+| indexed? | number | The number of documents written so far |+| started_at? | ISO8601 timestamp | The time the rebuild last reported progress |+| completed_at? | ISO8601 timestamp | The time the rebuild finished, when `status` is `completed` |+| failed_at? | ISO8601 timestamp | The time the rebuild failed, when `status` is `failed` |+| error? | string | The failure text, when `status` is `failed` |## Refresh search index<RouteHeader method="POST" path="/v1/admin/search/indexes/{index_name}/refreshes" auditReason />-Queues a rebuild of the named index. Requires `guild:lookup`. Returns a [search index refresh](#search-index-refresh-object) object on success.+Queues a rebuild of the index and returns its `job_id`. You need the `guild:lookup` [ACL](/admin-api/#acl-evaluation). A failed rebuild is not retried, so queue a new one.### Path parameters| Field | Type | Description || --- | --- | --- |-| index_name | string | The [search index name](#search-index-names) to rebuild |+| index_name | string | One of the [search index names](#search-index-names) |### JSON body-Every field is optional. Fluxer reads an absent or empty body as an empty object, so an instance-wide rebuild can send no body at all. A body that is not parseable JSON returns 400 `INVALID_FORM_BODY` with the validation code `INVALID_FORMAT` at the `body` path.-| Field | Type | Description || --- | --- | --- |-| guild_id?<sup>1</sup> | snowflake | The ID of the guild whose documents in the index are rebuilt |-| user_id?<sup>2</sup> | snowflake | The ID of the user whose documents in the index are rebuilt |--<sup>1</sup> Required by `channel_messages`, `guild_members`, and `threads`. Every other index name ignores it--<sup>2</sup> Required by `favorite_memes`. Every other index name ignores it--Fluxer records both values on the audit entry whenever they are supplied, including on an index name that ignores them.+| guild_id? | snowflake | The ID of the guild to rebuild, needed by `channel_messages`, `guild_members` and `threads` |+| user_id? | snowflake | The ID of the user to rebuild, needed by `favorite_memes` |### Response| Status | Body | Condition || --- | --- | --- || 200 | [search index refresh](#search-index-refresh-object) object | The rebuild was queued |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` because the scope ID the index name requires is missing, or the body is not parseable JSON |-| 403 | [error response](/admin-api/#error-response) | `MISSING_PERMISSIONS` without `admin:authenticate`, or `MISSING_ACL` without `guild:lookup` |-| 500 | [error response](/admin-api/#error-response) | The job could not be queued |--A missing scope ID names `guild_id` or `user_id` in `errors`. Fluxer queues no job and records no audit entry for that failure.--:::caution[The rebuild runs after the response]-Search results over the named index can be incomplete until the rebuild finishes.-:::--### Side effects--A guild-scoped rebuild for an unknown guild produces an empty index.+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` when the index needs `guild_id` or `user_id` and it is missing |-A failed rebuild is not retried automatically.+Fluxer records an Admin audit log entry with the action `queue_refresh_index` and the target type `search_index`.-Fluxer records one Admin audit entry with the action `queue_refresh_index`, the target type `search_index`, and the target ID `0`. Its metadata has `index_type`, `job_id`, and whichever of `guild_id` and `user_id` the request supplied. Fluxer emits no Gateway Dispatch.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Get search index refresh<RouteHeader method="GET" path="/v1/admin/search/index-refreshes/{job_id}" />-Returns the [search index refresh progress](#search-index-refresh-progress-object) object for one queued rebuild. Requires `guild:lookup`.+Returns the [progress](#search-index-refresh-progress-object) of a rebuild. You need `guild:lookup`. Progress expires one hour after the last update.### Path parameters| Field | Type | Description || --- | --- | --- |-| job_id<sup>1</sup> | string | The identifier returned by [Refresh search index](#refresh-search-index) |--<sup>1</sup> The value is bounded at 1 to 128 characters after Fluxer removes every form feed (U+000C) and right-to-left override (U+202E) character and trims whitespace from both ends. It need not be a snowflake+| job_id | string | The `job_id` returned by [Refresh search index](#refresh-search-index) |### Response| Status | Body | Condition || --- | --- | --- |-| 200<sup>1</sup> | [search index refresh progress](#search-index-refresh-progress-object) object | A progress record was returned, including the not-found shape |-| 403 | [error response](/admin-api/#error-response) | `MISSING_PERMISSIONS` without `admin:authenticate`, or `MISSING_ACL` without `guild:lookup` |--<sup>1</sup> An unknown identifier answers 200 with `status` set to `not_found`, which is also the answer for an expired record and for a rebuild that failed before writing its first record--:::note[Progress expires after one hour]-Each write of the progress record renews a one-hour lifetime, so a completed or failed outcome stays readable for one hour after its final update.-:::--### Side effects--The operation records no [Admin audit entry](/admin-api/#admin-audit-entry-object).--### Rate limit+| 200 | [search index refresh progress](#search-index-refresh-progress-object) object | The progress or the `not_found` structure was returned |-200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/system-dms.mdx b/fluxer_docs/src/content/docs/admin-api/system-dms.mdxindex fcdd576e3..7847a417b 100644--- a/fluxer_docs/src/content/docs/admin-api/system-dms.mdx+++ b/fluxer_docs/src/content/docs/admin-api/system-dms.mdx@@ -1,66 +1,46 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: System DMs-description: The system direct message broadcast and the delivery job it queues.+description: The route that sends one direct message from the system account to a list of users or to every user.---import RouteHeader from '@/components/RouteHeader.astro';-A system DM broadcast delivers one identical message, authored by the system account, to each supplied recipient or to every user. A recipient receives a normal message in a normal direct message channel.--The [Jobs](/admin-api/jobs/) resource reports delivery progress. [Cancelling that job](/admin-api/jobs/#cancel-job) stops an in-flight broadcast.+Each recipient gets the message in their direct message channel with the system account, whatever their privacy settings or blocks.## Create system DM broadcast<RouteHeader method="POST" path="/v1/admin/system-dms" auditReason />-Queues one message for delivery to every supplied recipient, or to every user when `all_users` is set. Requires `system_dm:send`. Returns the number of recipients queued.+Queues a `sendSystemDm` [job](/admin-api/jobs/) that delivers the message. You need `system_dm:send`.++To follow or stop the broadcast, find the job with [List jobs](/admin-api/jobs/#list-jobs) and `task_type=sendSystemDm`, then [cancel it](/admin-api/jobs/#cancel-job). A failed delivery doesn't stop the job.### JSON body| Field | Type | Description || --- | --- | --- |-| content<sup>1</sup> | string | The message delivered to every recipient (1-4000 characters) |-| user_ids?<sup>2</sup> | array[snowflake] | The recipients of the broadcast (1-10,000 entries) |-| all_users?<sup>3</sup> | boolean | Whether to deliver to every user instead of `user_ids` |--<sup>1</sup> Content with no visible character is accepted and then fails for every recipient+| content | string | The message sent to every recipient (1-4000 characters) |+| user_ids? | array[snowflake] | The recipients (1-10,000 entries) |+| all_users?<sup>1</sup> | boolean | Whether to send to every user |-<sup>2</sup> Fluxer keeps duplicate IDs, so a repeated recipient receives the message once per occurrence. An ID naming no account is accepted here and skipped at delivery time--<sup>3</sup> Supply exactly one of `user_ids` or `all_users: true`. A broadcast to every user skips bots, the system account, and accounts that are deleted, self-deleted, or disabled+<sup>1</sup> Send exactly one of `user_ids` or `all_users: true`. Fluxer doesn't deduplicate `user_ids`, so a repeated ID gets the message once per entry. A broadcast to every user skips bots, system accounts and deleted or disabled accounts.### Response body| Field | Type | Description || --- | --- | --- |-| recipient_count | ?integer | The number of entries in the submitted `user_ids` array, or null for a broadcast to every user |+| recipient_count | ?integer | The number of entries in `user_ids`, or null for a broadcast to every user |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The delivery job was queued |-| 500 | [error response](/admin-api/#error-response) | The broadcast could not be scheduled |--:::caution[The job continues past a failed recipient]-Failed deliveries do not stop the remaining recipients. A completed run reports `succeeded` even when some deliveries failed.-:::--:::caution[The response has no job ID]-Filter [List jobs](/admin-api/jobs/#list-jobs) by the `sendSystemDm` task type to find the queued work. The job is queued with no requester and no reason, so its `requested_by_user_id` and `audit_log_reason` are both null.-:::+| 200 | response body | The job was queued |+| 400 | [error response](/admin-api/#error-response) | `DIRECT_MESSAGES_DISABLED` when the instance has direct messages turned off |### Side effects-For each recipient the job opens the direct message channel between the system account and that recipient, then sends the message. [Channel Create](/gateway/events/#channel-create) reaches a recipient only when the channel is newly created or was closed on that recipient's side. A recipient who already has the channel open observes only [Message Create](/gateway/events/#message-create).--Recipients need not have interacted with the system account before. Fluxer skips the direct message permission checks for the system account. A block, no friendship, no mutual guild, and the recipient's direct message privacy settings do not stop delivery.--Cancellation stops remaining deliveries and leaves sent messages in place. The [job](/admin-api/jobs/#admin-job-object) then reports `cancelled`.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with the action `system_dm.send`, the target type `system_dm`, and the target ID `0`. Its metadata has `recipient_count` and `content_length` as decimal strings, with `recipient_count` set to `all` for a broadcast to every user. The content itself is not recorded.--### Rate limit+Each recipient gets [Channel Create](/gateway/events/#channel-create) if the channel wasn't open for them, then [Message Create](/gateway/events/#message-create). The `system_dm.send` audit entry doesn't include the message content.-100 requests per minute for each authenticated user, on the `admin:message:operation` bucket.+The rate limit is 100 requests per minute, on the `admin:message:operation` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/threads.mdx b/fluxer_docs/src/content/docs/admin-api/threads.mdxindex e880bbb88..28b14723d 100644--- a/fluxer_docs/src/content/docs/admin-api/threads.mdx+++ b/fluxer_docs/src/content/docs/admin-api/threads.mdx@@ -1,24 +1,18 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Admin threads-description: Guild thread lookup and thread deletion.+description: List the threads of any guild and delete a thread.---import RouteHeader from '@/components/RouteHeader.astro';-The Admin API reads and deletes [threads](/http-api/threads/) in any guild.+You can list and delete [threads](/http-api/threads/) in any guild through the Admin API.## List guild threads<RouteHeader method="GET" path="/v1/admin/guilds/{guild_id}/threads" auditReason />-Returns every thread of a guild, active and archived, newest first. Requires `guild:lookup`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns every thread of a guild, active and archived, with the most recently created first. You need `guild:lookup`.### Response body@@ -30,44 +24,26 @@ Returns every thread of a guild, active and archived, newest first. Requires `gu| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Threads were listed |--The operation does not verify that the guild exists. An unknown guild ID returns an empty `threads` array.--### Side effects--One [Admin audit entry](/admin-api/#admin-audit-entry-object) is recorded with the action `list_guild_threads`, the target type `guild`, and the guild ID as the target. Its metadata key `result_count` is the number of threads returned.+| 200 | response body | The threads were returned |-### Rate limit+An unknown guild ID returns an empty `threads` array.-200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Delete thread<RouteHeader method="DELETE" path="/v1/admin/channels/{channel_id}" auditReason />-Deletes a thread with its messages, attachments, and memberships. Requires `message:delete_all`. Returns 204 with no body.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the thread |+Deletes a thread with its messages and memberships. You need `message:delete_all`.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Thread was deleted |-| 400 | [error response](/admin-api/#error-response) | `INVALID_CHANNEL_TYPE` when the channel is not a public, private, or announcement thread |+| 204 | empty | The thread was deleted |+| 400 | [error response](/admin-api/#error-response) | `INVALID_CHANNEL_TYPE` when the channel is not a thread || 404 | [error response](/admin-api/#error-response) | `UNKNOWN_CHANNEL` when no channel has this ID |-### Side effects--Emits a [Thread Delete](/gateway/threads/#thread-delete) Gateway event. The source message of a thread started from a message loses `HAS_THREAD`, and Fluxer emits [Message Update](/gateway/events/#message-update) for it. Fluxer removes the thread and its messages from search.--One [Admin audit entry](/admin-api/#admin-audit-entry-object) is recorded with the action `delete_thread`, the target type `channel`, and the thread ID as the target. Its metadata keys are `guild_id`, `parent_id`, and `type`. `type` is the channel type as a decimal string. The guild's own audit log records nothing.--### Rate limit+Fluxer sends [Thread Delete](/gateway/threads/#thread-delete). If the thread started from a message, it also sends [Message Update](/gateway/events/#message-update) for that message. The deletion doesn't show up in the guild's audit log.-100 requests per minute for each authenticated user, on the `admin:message:operation` bucket.+The rate limit is 100 requests per minute, on the `admin:message:operation` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/users.mdx b/fluxer_docs/src/content/docs/admin-api/users.mdxindex 5548013a9..143466d4e 100644--- a/fluxer_docs/src/content/docs/admin-api/users.mdx+++ b/fluxer_docs/src/content/docs/admin-api/users.mdx@@ -1,104 +1,76 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Admin users-description: Reading and editing accounts, including contact fields, flags, bans, sessions, deletions, and archives.+description: Admin API routes for reading and changing accounts, their sessions, flags, suspensions and deletions.---import RouteHeader from '@/components/RouteHeader.astro';-These routes read and edit any account on the instance. An account has more fields here than the public [Users](/http-api/users/) resource returns, including its contact details, its network addresses, and its lifecycle state.+These routes read and change any account on the instance. Each field group has its own route and [ACL](/admin-api/#acl-registry), and every route except [Get current Admin user](#get-current-admin-user) records an [Admin audit entry](/admin-api/#admin-audit-entry-object), reads included.-Each mutable field group has its own route, its own [ACL](/admin-api/#acl-registry), and its own [audit action](/admin-api/#audit-actions), so there is no combined update.--On an instance where members sign in with a username, [Change user email](#change-user-email), [Verify user email](#verify-user-email), [Resend verification email](#resend-verification-email) and [Send password reset](#send-password-reset) return 400 `EMAIL_UNAVAILABLE_ON_INSTANCE`. [Create password reset link](#create-password-reset-link) is the way to reset a password there, and it returns 400 `USERNAME_SIGN_IN_ONLY` on an email instance.--Every operation on this page records an [Admin audit entry](/admin-api/#admin-audit-entry-object), reads included. [Get current Admin user](#get-current-admin-user) is the exception and records nothing. `POST /v1/admin/users/{user_id}/avatar-block` addresses a user path but belongs to [Blocklists](/admin-api/blocklists/#block-a-users-current-avatar).--:::caution[A missing PII ACL nulls the protected fields]-A caller without `user:view:email` receives a null `email`. A caller without `user:view:dob` receives a null `date_of_birth`, and a caller without `user:view:ip` receives null `last_active_ip`, `last_active_ip_reverse`, and `last_active_location`. The read still succeeds, so a null field is no evidence that the account has none.-:::+On an instance where members sign in with a username, the email routes return 400 `EMAIL_UNAVAILABLE_ON_INSTANCE` and you reset a password with [Create password reset link](#create-password-reset-link), which also works on an email instance that doesn't send email. On routes that record an [enforcement decision](/admin-api/enforcement/), the `X-Audit-Log-Reason` header is required and becomes the decision's first note. Blocking a user's avatar is on [Blocklists](/admin-api/blocklists/#block-a-users-current-avatar).## Admin user object-The complete administrative view of one account. It has every stored flag, the private lifecycle fields, and the contact and network fields that the public [user object](/http-api/users/#user-object) never exposes.--When the caller lacks `user:view:email`, `user:view:dob`, or `user:view:ip`, Fluxer redacts the fields that the missing ACL protects and still returns every key, so the object shape is identical for every caller.+The full admin view of one account, with the flags, lifecycle, contact and network fields the public [user object](/http-api/users/#user-object) leaves out. Without `user:view:email`, `user:view:dob` or `user:view:ip`, the fields that ACL protects are null (or false for the email booleans) and the request still succeeds.### Structure| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the account |-| username | string | The username of the account, unique only together with its discriminator (1-32 characters) |-| discriminator<sup>1</sup> | integer | Discriminator from 0 to 9999, unpadded |-| global_name | ?string | The display name of the account, or null when unset |+| username | string | The username (1-32 characters) |+| discriminator<sup>1</sup> | integer | The discriminator from 0 to 9999, unpadded |+| global_name | ?string | The display name || bot | boolean | Whether the account is a bot || system | boolean | Whether the account is an official system account |-| flags<sup>2</sup> | string | [Account flags](#account-flags) as an unsigned 64-bit decimal string |+| flags | string | [Account flags](#account-flags) as a decimal string || premium_flags | integer | [Premium flags](#premium-flags) |-| avatar | ?string | The avatar hash, or null when the account has none |-| banner | ?string | The profile banner hash, or null when the account has none |-| bio | ?string | The profile biography, or null when unset |-| pronouns | ?string | The profile pronouns, or null when unset |-| accent_color | ?integer | The profile accent colour packed into an integer, or null when unset |-| email<sup>3</sup> | ?string | The registered email address, or null when the account has none |-| email_verified<sup>3</sup> | boolean | Whether the registered address has been verified |-| email_bounced<sup>3</sup> | boolean | Whether delivery to the registered address hard bounced |-| date_of_birth<sup>4</sup> | ?string | The date of birth in `YYYY-MM-DD` form, or null when none is stored |-| locale | ?string | The saved [locale](/topics/locales/#supported-locales), or null when the account has never set one |+| avatar | ?string | The avatar hash |+| banner | ?string | The profile banner hash |+| bio | ?string | The profile bio |+| pronouns | ?string | The profile pronouns |+| accent_color | ?integer | The profile accent color |+| email<sup>2</sup> | ?string | The email address |+| email_verified<sup>2</sup> | boolean | Whether the email address is verified |+| email_bounced<sup>2</sup> | boolean | Whether mail to the address hard bounced |+| date_of_birth<sup>3</sup> | ?string | The date of birth as `YYYY-MM-DD` |+| locale | ?string | The saved [locale](/topics/locales/#supported-locales) || premium_type | ?integer | [Premium type](#premium-types) |-| premium_since | ?ISO8601 timestamp | The time the premium subscription began, or null when the account has none |-| premium_until | ?ISO8601 timestamp | The time the premium subscription expires, or null when the account has none |-| premium_grace_ends_at | ?ISO8601 timestamp | The time the payment grace period ends, or null when no grace period is running |-| premium_lifetime_sequence | ?integer | The sequence number of the lifetime purchase, or null when the account holds none |-| profile_badges<sup>13</sup> | array[[Admin profile badge](#admin-profile-badge-object) object] | Every badge the account qualifies for, in display order |-| temp_banned_until<sup>5</sup> | ?ISO8601 timestamp | The time the ban expires, or null when no ban stands |-| pending_deletion_at | ?ISO8601 timestamp | The time the scheduled deletion runs, or null when none is scheduled |-| pending_bulk_message_deletion_at<sup>6</sup> | ?ISO8601 timestamp | The time the account's own scheduled bulk message deletion runs |+| premium_since | ?ISO8601 timestamp | When premium started |+| premium_until | ?ISO8601 timestamp | When premium ends |+| premium_grace_ends_at | ?ISO8601 timestamp | When the payment grace period ends |+| premium_lifetime_sequence | ?integer | The sequence number of the lifetime purchase |+| profile_badges | array[[Admin profile badge](#admin-profile-badge-object) object] | Every badge the account qualifies for, including hidden ones |+| temp_banned_until | ?ISO8601 timestamp | When the current suspension ends, or null when none is in force |+| pending_deletion_at | ?ISO8601 timestamp | When the scheduled deletion runs |+| pending_bulk_message_deletion_at | ?ISO8601 timestamp | When the account holder's own scheduled message deletion runs || deletion_reason_code | ?integer | [Deletion reason](#deletion-reasons) |-| deletion_public_reason | ?string | The reason shown to the holder of a deletion scheduled before enforcement decisions existed. No longer written |-| deletion_audit_log_reason | ?string | The private reason stored with the pending deletion, and null without `audit_log:view` |-| deletion_scheduled_by | ?snowflake | The ID of the account that scheduled the pending deletion, or null when it was not recorded |-| deletion_scheduled_at | ?ISO8601 timestamp | The time the pending deletion was scheduled, or null when it was not recorded |-| enforcement_decision_id | ?snowflake | The [enforcement decision](/admin-api/enforcement/) behind the current suspension, or null when none owns it |-| acls<sup>7</sup> | array[string] | Effective [Admin ACLs](/admin-api/#acl-registry), with at most 106 entries |-| traits<sup>8</sup> | array[string] | The free-form operator labels set on the account, with at most 100 entries |-| has_totp<sup>9</sup> | boolean | Whether a TOTP authenticator is registered |+| deletion_public_reason | ?string | The reason shown to the account holder, set only on older deletions |+| deletion_audit_log_reason | ?string | The private deletion reason, null without `audit_log:view` |+| deletion_scheduled_by | ?snowflake | The ID of the account that scheduled the deletion |+| deletion_scheduled_at | ?ISO8601 timestamp | When the deletion was scheduled |+| enforcement_decision_id | ?snowflake | The [enforcement decision](/admin-api/enforcement/) that owns the account's state |+| acls | array[string] | The [Admin ACLs](/admin-api/#acl-registry) set on the account |+| traits | array[string] | The operator labels on the account, sorted (at most 100) |+| has_totp | boolean | Whether a TOTP authenticator is registered || has_password | boolean | Whether the account has a password |-| claimed | boolean | Whether the account can be signed in to from another device, through a confirmed email, a password or a passkey |-| account_tier | string | The [account tier](/http-api/users/#account-tiers), one of `unclaimed`, `unverified` or `verified` |-| date_of_birth_required | boolean | Whether the account still has to set its date of birth, which clients ask for before anything else |-| authenticator_types<sup>9</sup> <sup>12</sup> | array[integer] | Registered [authenticator types](/http-api/users/#authenticator-types), with at most 10 entries |-| last_active_at | ?ISO8601 timestamp | The time of the last recorded activity, or null when none is recorded |-| last_active_ip<sup>10</sup> | ?string | The IP address the account was last active from |-| last_active_ip_reverse<sup>10</sup> <sup>11</sup> | ?string | The reverse DNS name of that IP address |-| last_active_location<sup>10</sup> <sup>11</sup> | ?string | The approximate location of that IP address |--<sup>1</sup> An unpadded JSON number here, unlike the zero-padded string `discriminator` of the [Admin user summary](/admin-api/#admin-user-summary-object) and the [Admin resolved user](#admin-resolved-user-object) embedded in other Admin objects. On an instance with the `none` tag style every account that is not a bot has `0`, and its username is unique on its own--<sup>2</sup> Serialised as a decimal string--<sup>3</sup> Requires `user:view:email`. Without it `email` is null while `email_verified` and `email_bounced` are both false regardless of the stored state, so an unverified account and a redacted one are indistinguishable+| claimed | boolean | Whether the account can sign in from another device |+| account_tier | string | The [account tier](/http-api/users/#account-tiers) |+| date_of_birth_required | boolean | Whether the account still has to set its date of birth |+| authenticator_types | array[integer] | Second-factor [authenticator types](/http-api/users/#authenticator-types) (at most 10) |+| last_active_at | ?ISO8601 timestamp | When the account was last active |+| last_active_ip<sup>4</sup> | ?string | The IP address the account was last active from |+| last_active_ip_reverse<sup>4</sup> | ?string | The reverse DNS name of that address |+| last_active_location<sup>4</sup> | ?string | The approximate location of that address |-<sup>4</sup> Requires `user:view:dob`, and without it the field is null+<sup>1</sup> Other Admin objects use a zero-padded string. On an instance with the `none` tag style, every account that is not a bot has `0`-<sup>5</sup> Set by [Suspend user](#suspend-user) for both modes. An expiry that has already passed is reported as null, so an elapsed temporary ban reads the same as no ban+<sup>2</sup> Needs `user:view:email`-<sup>6</sup> Written when the account holder schedules its own bulk message deletion, and cleared by [Cancel scheduled message deletion](#cancel-scheduled-message-deletion)+<sup>3</sup> Needs `user:view:dob`-<sup>7</sup> The set written by [Set user ACLs](#set-user-acls), returned in stored order with any value outside the [ACL registry](/admin-api/#acl-registry) left out. This set alone decides whether the account can reach the Admin API, and the `STAFF` [account flag](#account-flags) plays no part in that--<sup>8</sup> Sorted in ascending order, unlike `acls`--<sup>9</sup> Never redacted, and returned in full to any caller the operation admitted--<sup>10</sup> Requires `user:view:ip`, and without it the field is null and no network lookup is attempted--<sup>11</sup> Resolved live from `last_active_ip` for each response, and null when the lookup fails or returns nothing. The reverse DNS result is cached for one day--<sup>12</sup> `WEBAUTHN` is present only while the account chose passkeys as a second factor. A registered credential does not add it, so `has_totp` false with an empty array still describes an account holding passkeys--<sup>13</sup> The list ignores the account's badge privacy settings and its standing, so it also holds the badges the public profile leaves out. Labels follow the caller's locale+<sup>4</sup> Needs `user:view:ip`### Example@@ -137,48 +109,50 @@ When the caller lacks `user:view:email`, `user:view:dob`, or `user:view:ip`, Flu## Admin profile badge object-A [profile badge](/http-api/users/#profile-badge-object) with one extra field.+A [profile badge](/http-api/users/#profile-badge-object) with a `suppressed` field.++### Structure| Field | Type | Description || --- | --- | --- |-| kind | string | The stable badge key |-| label | string | The full badge description in the caller's locale |+| kind | string | The badge key |+| label | string | The badge description in the caller's locale || asset | ?string | The badge image hash, or null for a text badge |-| aspect_ratio | ?number | The image width divided by its height, or null for a square badge |-| caption | ?string | The short text the badge stands for, such as `#42`, or null |-| href | ?string | The absolute URL a click opens, or null |-| small_asset? | string | The image hash for 20 pixels and smaller, used by dense rows |-| count? | ?integer | Never present on a self-hosted instance |+| aspect_ratio | ?number | The image width divided by its height |+| caption | ?string | The short badge text, such as `#42` |+| href | ?string | The URL a click opens |+| small_asset? | string | The image hash for 20 pixels and smaller |+| count? | ?integer | Not used on a self-hosted instance || accessible_label? | ?string | The label for screen readers |-| details? | ?[badge details](/http-api/users/#badge-details-object) object | The content of the vertical tooltip |-| suppressed | boolean | Whether the public profile leaves the badge out |+| details? | ?[badge details](/http-api/users/#badge-details-object) object | The tooltip content |+| suppressed | boolean | Whether the public profile hides the badge |## Account flags-The `flags` field of the [Admin user object](#admin-user-object) is a 64-bit bitfield serialised as an unsigned decimal string. It has every stored flag, including the ones the [HTTP API](/http-api/users/#public-user-flags) leaves out of its public subset.+The `flags` field is a 64-bit bitfield sent as a decimal string. It has every stored flag, including the ones the [public flags](/http-api/users/#public-user-flags) leave out.| Value | Name | Description || --- | --- | --- || 1 << 0 | STAFF | Account is a staff member || 1 << 2 | PARTNER | Account is a partner || 1 << 3 | BUG_HUNTER | Account is a bug hunter |-| 1 << 4 | FRIENDLY_BOT | Bot accepts friend requests from users |-| 1 << 5 | FRIENDLY_BOT_MANUAL_APPROVAL | Bot requires manual approval for friend requests |+| 1 << 4 | FRIENDLY_BOT | Bot accepts friend requests |+| 1 << 5 | FRIENDLY_BOT_MANUAL_APPROVAL | Bot approves friend requests by hand || 1 << 6 | SPAMMER | Account is flagged as a spammer || 1 << 7 | PROFILE_HIDDEN | Profile details are hidden from other users |-| 1 << 33 | HIGH_GLOBAL_RATE_LIMIT | Account has elevated global rate limits |-| 1 << 34 | DELETED | Account has been deleted |-| 1 << 36 | SELF_DELETED | Account was self-deleted |+| 1 << 33 | HIGH_GLOBAL_RATE_LIMIT | Account has a higher global rate limit |+| 1 << 34 | DELETED | Account is deleted |+| 1 << 36 | SELF_DELETED | Account holder deleted the account || 1 << 38 | DISABLED | Account is disabled || 1 << 39 | HAS_SESSION_STARTED | Account has started a session |-| 1 << 47 | RATE_LIMIT_BYPASS | Account can bypass rate limits |-| 1 << 48 | REPORT_BANNED | Account is banned from reporting |+| 1 << 47 | RATE_LIMIT_BYPASS | Account skips rate limits |+| 1 << 48 | REPORT_BANNED | Account cannot send reports || 1 << 49 | VERIFIED_NOT_UNDERAGE | Account is verified as not underage || 1 << 50 | ACCOUNT_LIMITED | Account is [limited](/http-api/users/#account-limitation) |-| 1 << 51 | HAS_DISMISSED_PREMIUM_ONBOARDING | Account has dismissed premium onboarding |+| 1 << 51 | HAS_DISMISSED_PREMIUM_ONBOARDING | Account dismissed premium onboarding || 1 << 53 | APP_STORE_REVIEWER | Account belongs to an app store reviewer || 1 << 57 | STAFF_HIDDEN | Staff status is hidden from public flags |-| 1 << 60 | AGE_VERIFIED_ADULT | Account verified its age as an adult through the UK card check, which is no longer offered |+| 1 << 60 | AGE_VERIFIED_ADULT | Account verified its age as an adult || 1 << 62 | LIMIT_EXEMPT | Account is never limited |## Premium flags@@ -190,24 +164,26 @@ The `flags` field of the [Admin user object](#admin-user-object) is a 64-bit bit| 1 << 2 | BADGE_MASKED | Premium badge is masked || 1 << 3 | BADGE_TIMESTAMP_HIDDEN | Premium badge timestamp is hidden || 1 << 4 | BADGE_SEQUENCE_HIDDEN | Premium badge sequence is hidden |-| 1 << 5 | PERKS_SANITIZED | Premium perks are sanitised |-| 1 << 6 | PURCHASE_DISABLED | Premium purchase is disabled |-| 1 << 7 | ENABLED_OVERRIDE | Premium status has an enabled override |-| 1 << 8 | PERKS_DISABLED | Premium perks are temporarily disabled |+| 1 << 5 | PERKS_SANITIZED | Premium perks are sanitized |+| 1 << 6 | PURCHASE_DISABLED | Premium purchase is blocked |+| 1 << 7 | ENABLED_OVERRIDE | Premium is turned on by override |+| 1 << 8 | PERKS_DISABLED | Premium perks are paused |## Premium types| Value | Name | Description || --- | --- | --- |-| 0 | NONE | No premium subscription |-| 1 | SUBSCRIPTION | Active premium subscription |-| 2 | LIFETIME | Lifetime premium subscription |+| 0 | NONE | No premium |+| 1 | SUBSCRIPTION | Premium subscription |+| 2 | LIFETIME | Lifetime premium |## Deletion reasons+Values 1, 2, 19, 32 and 33 are not enforcement reasons. Only the others are accepted in an [enforcement decision input](/admin-api/enforcement/#enforcement-decision-input).+| Value | Name | Description || --- | --- | --- |-| 1 | USER_REQUESTED<sup>1</sup> | Account holder requested deletion |+| 1 | USER_REQUESTED | Account holder asked for deletion || 2 | OTHER | Other reason || 3 | SPAM | Spam || 4 | CHEATING_OR_EXPLOITATION | Cheating or exploitation |@@ -243,403 +219,245 @@ The `flags` field of the [Admin user object](#admin-user-object) is a 64-bit bit## Profile fields-The values [Clear user profile fields](#clear-user-profile-fields) accepts in `fields`.+The values [Clear user profile fields](#clear-user-profile-fields) accepts.| Value | Description || --- | --- |-| avatar | Profile avatar image |-| banner | Profile banner image |-| bio | Profile biography |-| pronouns | Profile pronouns |+| avatar | Avatar image |+| banner | Banner image |+| bio | Bio |+| pronouns | Pronouns || global_name | Display name |## Relationship categories+The values [Clear user relationships](#clear-user-relationships) and [Remove user relationship](#remove-user-relationship) accept.+| Value | Description || --- | --- |-| friend | A mutual friendship |-| incoming_request | A friend request the account has received |-| outgoing_request | A friend request the account has sent |-| blocked | An account this account has blocked |--Removing a friendship or friend request removes it for both accounts. Removing a block affects only the account that set it.+| friend | A friendship |+| incoming_request | A friend request the account received |+| outgoing_request | A friend request the account sent |+| blocked | An account this account blocked |## Password reset link object-A password reset link an administrator hands to the account holder.+A link the account holder opens to choose a password. Anyone with the link can set the password until it expires.### Structure| Field | Type | Description || --- | --- | --- |-| url<sup>1</sup> | string | The web app reset link, the app base URL followed by `/reset#token=` and the token |-| expires_at | ISO8601 timestamp | When the link stops working |--<sup>1</sup> The token is in the URL fragment, which a browser never sends to a server. It is the same 64-character token [reset a password](/http-api/authentication/#reset-a-password) accepts, and it expires one hour after it is issued+| url | string | The web app link, ending in `/reset#token=` and the token |+| expires_at | ISO8601 timestamp | When the link stops working, one hour after it is made |## Sign-in link object-A one-time sign-in link for an admin account, created with rexctl on the server.+A one-time sign-in link for an admin account. Anyone with the link can sign in as that admin until it is used or expires.### Structure| Field | Type | Description || --- | --- | --- |-| url<sup>1</sup> | string | The web app sign-in link, the app base URL followed by `/login#sign_in_link=` and the token |-| expires_at | ISO8601 timestamp | When the link stops working |--<sup>1</sup> The token is in the URL fragment, which a browser never sends to a server. It is the token [redeem a sign-in link](/http-api/authentication/#redeem-a-sign-in-link) accepts, and it expires 15 minutes after it is issued+| url | string | The web app link, ending in `/login#sign_in_link=` and the token |+| expires_at | ISO8601 timestamp | When the link stops working, 15 minutes after it is made |## Admin user session object-One entry for each authentication session of an account. Terminated sessions remain listed with `deleted_at` set. No operation returns the session token.+One sign-in session of an account. Ended sessions stay in the list with `deleted_at` set.### Structure| Field | Type | Description || --- | --- | --- |-| session_id_hash | string | The base64url-encoded hash of the session ID (8-256 characters) |-| created_at | ISO8601 timestamp | The time the session was created |-| approx_last_used_at | ISO8601 timestamp | The approximate time the session was last used |-| client_ip<sup>1</sup> | string | The IP address the session was created from |-| client_ip_reverse<sup>1</sup> <sup>2</sup> | ?string | The reverse DNS name of that IP address |-| client_os<sup>3</sup> | ?string | The client operating system derived from the stored user agent |-| client_platform<sup>3</sup> | ?string | The client platform derived from the stored user agent |-| client_location<sup>1</sup> <sup>2</sup> | ?string | The approximate location of that IP address |-| deleted_at | ?ISO8601 timestamp | The time the session was terminated, or null while it is still active |--<sup>1</sup> Requires `user:view:ip`. Without it `client_ip` is the literal string `[redacted]`, both derived fields are null, and no network lookup is attempted--<sup>2</sup> Resolved live for each response, and null for that entry when its own lookup fails--<sup>3</sup> Derived from the stored user agent at read time, so a session recorded without one reports null for both+| session_id_hash | string | The base64url hash of the session ID (8-256 characters) |+| created_at | ISO8601 timestamp | When the session started |+| approx_last_used_at | ISO8601 timestamp | About when the session was last used |+| client_ip<sup>1</sup> | string | The IP address the session started from |+| client_ip_reverse<sup>1</sup> | ?string | The reverse DNS name of that address |+| client_os | ?string | The operating system from the user agent |+| client_platform | ?string | The platform from the user agent |+| client_location<sup>1</sup> | ?string | The approximate location of that address |+| deleted_at | ?ISO8601 timestamp | When the session ended, or null while it is active |-### Example--```json-{- "session_id_hash": "Zm9vYmFyLXNlc3Npb24taGFzaC1leGFtcGxl",- "created_at": "2026-07-02T11:31:09.400000+00:00",- "approx_last_used_at": "2026-08-30T20:58:14.120000+00:00",- "client_ip": "203.0.113.24",- "client_ip_reverse": "host24.example.com",- "client_os": "Windows",- "client_platform": "Desktop",- "client_location": "Stockholm, Sweden",- "deleted_at": null-}-```+<sup>1</sup> Needs `user:view:ip`. Without it `client_ip` is `[redacted]` and the other two are null## Admin resolved user object-The account summary embedded in the Admin direct message channel object and the Admin relationship object. It is the [Admin user summary](/admin-api/#admin-user-summary-object) that audit entries embed, with `avatar` added.+The account summary in Admin direct message channel and relationship objects.### Structure| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the account |-| username | string | The username of the account |-| discriminator<sup>1</sup> | string | The four-digit discriminator of the account |-| global_name | ?string | The display name of the account, or null when unset |-| avatar | ?string | The avatar hash, or null when the account has none |--<sup>1</sup> Left-padded with zeroes to four digits, unlike the unpadded integer `discriminator` of the [Admin user object](#admin-user-object)--### Example--```json-{- "id": "1493004551122763776",- "username": "kelsier",- "discriminator": "0042",- "global_name": "Kelsier",- "avatar": "a1b2c3d4e5f60718293a4b5c6d7e8f90"-}-```+| username | string | The username |+| discriminator | string | The discriminator, zero-padded to four digits |+| global_name | ?string | The display name |+| avatar | ?string | The avatar hash |## Admin direct message channel object-One entry for each direct message or group direct message channel the account has taken part in. The field names differ from the public [channel object](/http-api/channels/#channel-object).+A direct message or group direct message channel the account is in.### Structure| Field | Type | Description || --- | --- | --- || channel_id | snowflake | The ID of the channel |-| channel_type | ?integer | [Channel type](/http-api/channels/#channel-types), or null when the channel record is unavailable |-| channel_nsfw | ?boolean | Whether the channel is age-restricted, or null when the channel record is unavailable |-| guild_nsfw_level<sup>1</sup> | ?integer | [NSFW level](/http-api/guilds/#nsfw-levels) of the owning guild |-| recipient_ids | array[snowflake] | The IDs of the channel recipients, with at most 100 entries |-| recipients<sup>2</sup> | array[[Admin resolved user](#admin-resolved-user-object) object] | The resolved recipient accounts, with at most 100 entries |-| last_message_id | ?snowflake | The ID of the latest message, or null when the channel is empty |-| is_open | boolean | Whether the channel is open in the target account's client |-| name | ?string | The group name, or null when unnamed |-| icon | ?string | The group icon hash, or null when the group has none |-| owner_id | ?snowflake | The ID of the group owner, or null for a one-to-one direct message |--<sup>1</sup> Always null--<sup>2</sup> Contains only the recipients whose accounts still exist, so it can be shorter than `recipient_ids`--### Example--```json-{- "channel_id": "1496118820043030528",- "channel_type": 3,- "channel_nsfw": false,- "guild_nsfw_level": null,- "recipient_ids": ["1493004551122763776", "1489200013322551296"],- "recipients": [],- "last_message_id": "1500992244771848192",- "is_open": true,- "name": "Weekend plans",- "icon": null,- "owner_id": "1493004551122763776"-}-```+| channel_type | ?integer | [Channel type](/http-api/channels/#channel-types) |+| channel_nsfw | ?boolean | Whether the channel is age-restricted |+| guild_nsfw_level | ?integer | Always null |+| recipient_ids | array[snowflake] | The IDs of the recipients (at most 100) |+| recipients | array[[Admin resolved user](#admin-resolved-user-object) object] | The recipients whose accounts still exist (at most 100) |+| last_message_id | ?snowflake | The ID of the latest message |+| is_open | boolean | Whether the channel is open in the account's client |+| name | ?string | The group name |+| icon | ?string | The group icon hash |+| owner_id | ?snowflake | The ID of the group owner |## Admin relationship object+One relationship between the account and another account.+### Structure| Field | Type | Description || --- | --- | --- || target_user_id | snowflake | The ID of the other account || category | string | [Relationship category](#relationship-categories) |-| nickname | ?string | The nickname the account assigned to the other party |-| since | ?ISO8601 timestamp | The time the relationship was established, or null when unrecorded |-| target<sup>1</sup> | ?[Admin resolved user](#admin-resolved-user-object) object | The resolved other account |--<sup>1</sup> Null when the other account no longer exists, while `target_user_id` remains present--### Example--```json-{- "target_user_id": "1489200013322551296",- "category": "friend",- "nickname": null,- "since": "2026-04-18T14:22:51.006000+00:00",- "target": {- "id": "1489200013322551296",- "username": "operator",- "discriminator": "0042",- "global_name": "Operator"- }-}-```+| nickname | ?string | The nickname the account gave the other account |+| since | ?ISO8601 timestamp | When the relationship started |+| target | ?[Admin resolved user](#admin-resolved-user-object) object | The other account, or null when it no longer exists |## Admin user change log object-One recorded change to the account's email address or its username and discriminator. The account holder's own changes appear here, and so do [Change user username](#change-user-username) and [Change user email](#change-user-email).+One change to the account's email address or tag, by the account holder or an Admin.### Structure| Field | Type | Description || --- | --- | --- |-| event_id<sup>1</sup> | string | The ID of the change entry as an unsigned 64-bit decimal string |-| field | string | The field that changed, either `email` or `fluxer_tag` |-| old_value<sup>2</sup> | ?string | The value before the change, or null when the field was unset |-| new_value<sup>2</sup> | ?string | The value after the change, or null when the field was cleared |-| reason<sup>3</sup> | ?string | The recorded reason for the change, or null when unrecorded |-| actor_user_id | ?snowflake | The ID of the acting Admin, or null for a user-originated change |-| event_at | ISO8601 timestamp | The time the change was recorded |--<sup>1</sup> Sent back as `page_token` to continue the walk. An entry stored without its own event ID reports the account ID here instead--<sup>2</sup> An `email` entry read without `user:view:email` keeps the entry and replaces both value fields with the literal string `[redacted]`. An absent value is null--<sup>3</sup> An Admin change records the literal value `admin_action`+| event_id | string | The ID of the entry, which you send as `page_token` |+| field | string | `email` or `fluxer_tag` |+| old_value<sup>1</sup> | ?string | The value before the change |+| new_value<sup>1</sup> | ?string | The value after the change |+| reason | ?string | The reason, `admin_action` for an Admin change |+| actor_user_id | ?snowflake | The ID of the Admin, or null for the account holder's own change |+| event_at | ISO8601 timestamp | When the change happened |-### Example--```json-{- "event_id": "1500992244771848192",- "field": "email",- "old_value": "[redacted]",- "new_value": "[redacted]",- "reason": "admin_action",- "actor_user_id": "1489200013322551296",- "event_at": "2026-08-14T07:55:31.882000+00:00"-}-```+<sup>1</sup> An `email` entry shows `[redacted]` without `user:view:email`## Message shred entry object+One message to shred.+### Structure| Field | Type | Description || --- | --- | --- |-| channel_id | snowflake | The ID of the channel the message was sent in |-| message_id | snowflake | The ID of the message to shred |--### Example--```json-{- "channel_id": "1496118820043030528",- "message_id": "1500992244771848192"-}-```+| channel_id | snowflake | The ID of the channel |+| message_id | snowflake | The ID of the message |## List users<RouteHeader method="GET" path="/v1/admin/users" auditReason />-Lists and searches accounts. Requires `user:lookup`, and `user:view:email` or `user:view:ip` for the selectors marked below. The response has an array of [Admin user](#admin-user-object) objects and a total.--Fluxer honours exactly one selector, in this precedence order: `user_id`, `resolve`, `email`, `last_active_ip`, `acl`, then the indexed `q` search. A lower-precedence parameter sent alongside a higher-precedence one is ignored, and the request still succeeds. A request with no selector runs the indexed search with an empty query.+Finds accounts by one selector and returns [Admin user](#admin-user-object) objects. You need `user:lookup`. When you send more than one selector, the first one in this order wins: `user_id`, `resolve`, `email`, `last_active_ip`, `acl`, then `q`.### Query parameters| Field | Type | Description || --- | --- | --- |-| user_id?<sup>1</sup> | array[snowflake] | Exact account IDs, with at most 100 values |-| resolve?<sup>2</sup> | string | One exact identifier to resolve (1-1024 characters) |-| email?<sup>3</sup> | string | Exact registered email address (1-320 characters) |-| last_active_ip?<sup>4</sup> | string | Exact last active IP address (1-64 characters) |-| acl? | string | One ACL from the [ACL registry](/admin-api/#acl-registry). Lists the accounts granted it, ordered by ID |-| q?<sup>5</sup> | string | Free-text indexed query (1-1024 characters) |-| limit?<sup>6</sup> | integer | Maximum accounts to return (1-200, default 50) |-| offset?<sup>6</sup> | integer | Number of results to skip (0-100000, default 0) |--<sup>1</sup> Repeat the parameter to pass more than one value. The response is unordered and has no entry for an ID that matches no account, so a client matches each returned account by its `id`--<sup>2</sup> Resolves at most one account, and a value containing `@` requires `user:view:email`. An unmatched value returns an empty array--<sup>3</sup> Matched exactly after trimming, returns at most one account, and requires `user:view:email`--<sup>4</sup> Matched exactly after trimming against the account's stored last active address, so a subnet or a partial address matches nothing. Requires `user:view:ip`+| user_id? | array[snowflake] | Exact account IDs, repeated for more than one (at most 100) |+| resolve?<sup>1</sup> | string | A tag, account ID or email address to match one account (1-1024 characters) |+| email?<sup>2</sup> | string | An exact email address (1-320 characters) |+| last_active_ip?<sup>3</sup> | string | An exact last active IP address (1-64 characters) |+| acl? | string | An [ACL](/admin-api/#acl-registry), to list the accounts that have it |+| q? | string | A search query (1-1024 characters) |+| limit?<sup>4</sup> | integer | How many accounts to return (1-200, default 50) |+| offset?<sup>4</sup> | integer | How many results to skip (0-100000, default 0) |-<sup>5</sup> Served by the user search index. An instance with no search backend configured returns 403 `FEATURE_TEMPORARILY_DISABLED`+<sup>1</sup> A value with `@` needs `user:view:email`-<sup>6</sup> Honoured by the `last_active_ip`, `acl`, and `q` selectors. The `user_id`, `resolve`, and `email` selectors ignore both+<sup>2</sup> Needs `user:view:email`-Fluxer chooses the `resolve` lookup from the shape of the value. A `username#discriminator` value resolves the tag, a value that is entirely digits resolves the account ID, and a value containing `@` resolves the email address. Every other value resolves a Stripe subscription ID.+<sup>3</sup> Needs `user:view:ip`-A `q` value that is entirely digits also resolves that exact account ID and places it first, even when the search index did not match it, provided `offset` is zero. That direct hit raises `total` by one when the index did not already return it.+<sup>4</sup> Only for `last_active_ip`, `acl` and `q`### Response body| Field | Type | Description || --- | --- | --- |-| users | array[[Admin user](#admin-user-object) object] | The accounts in this page |-| total<sup>1</sup> | integer | The number of accounts the selector matched |--<sup>1</sup> The `user_id` and `resolve` selectors report the length of `users`, so `total` never exceeds the returned page for those two+| users | array[[Admin user](#admin-user-object) object] | The matching accounts |+| total | integer | How many accounts matched |### Response| Status | Body | Condition || --- | --- | --- |-| 200<sup>1</sup> | response body | Accounts were returned |-| 403 | [error response](/admin-api/#error-response) | `MISSING_ACL`, because the honoured selector requires `user:view:email` or `user:view:ip` |-| 403 | [error response](/admin-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED`, because the indexed search ran on an instance with no search backend |--<sup>1</sup> A selector that matches nothing returns an empty `users` array and a `total` of zero--### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `search_users`, target type `user`, and target ID `0`. The metadata keys are `selector`, `result_count` for the accounts in `users`, and `total`. `selector` is the honoured selector, one of `user_id`, `resolve`, `email`, `last_active_ip`, `acl`, or `search` for the indexed search.+| 200 | response body | The search finished, even with no matches |+| 403 | [error response](/admin-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED` when `q` runs on an instance with no search backend |-The `user_id` selector adds `user_id_count` for the number of IDs supplied, and `user_id` when exactly one ID was supplied. The `last_active_ip`, `acl`, and `search` selectors add `limit` and `offset`, and the `acl` selector also adds `acl`. The indexed search adds `has_query` as `true` when `q` is not blank. The `resolve`, `email`, `last_active_ip`, and `q` values are not recorded. A failed request records nothing.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Get current Admin user<RouteHeader method="GET" path="/v1/admin/users/@me" />-Returns the account the request authenticated as, wrapped in a `user` member, with the number of pending registrations. Requires `admin:authenticate`.--Every Admin credential holds `admin:authenticate`, so every account that can reach the Admin API can read this route. `email`, `date_of_birth`, and the IP fields are returned unredacted whatever the acting credential holds. `acls` reports the ACL set stored on the account. For an Admin API key credential that set can be wider than what the key itself can use.+Returns the account you are signed in as, unredacted. You need `admin:authenticate`.### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The account the request authenticated as |-| pending_registration_count<sup>1</sup> | ?integer | Number of [pending registrations](/admin-api/instance/#list-pending-registrations), or null when the credential does not hold `registration:review` |--<sup>1</sup> Read from the same list as [List pending registrations](/admin-api/instance/#list-pending-registrations), without recording an audit entry+| user | [Admin user](#admin-user-object) object | Your account |+| pending_registration_count | ?integer | The number of [pending registrations](/admin-api/instance/#list-pending-registrations), or null without `registration:review` |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Current Admin was returned |-| 403 | [error response](/admin-api/#error-response) | Credential type is refused, or the account does not hold `admin:authenticate` |+| 200 | response body | Your account was returned |-### Side effects--The operation records no [Admin audit entry](/admin-api/#admin-audit-entry-object).--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Get user<RouteHeader method="GET" path="/v1/admin/users/{user_id}" auditReason />-Returns one account as a single-element array. Requires `user:lookup`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Returns one account. You need `user:lookup`.### Response body| Field | Type | Description || --- | --- | --- |-| users<sup>1</sup> | array[[Admin user](#admin-user-object) object] | The requested account, or an empty array |--<sup>1</sup> The response is the same envelope [List users](#list-users) returns for its `user_id` selector, without the `total` member+| users | array[[Admin user](#admin-user-object) object] | The account, or an empty array for an unknown ID |### Response| Status | Body | Condition || --- | --- | --- |-| 200<sup>1</sup> | response body | The lookup completed |--<sup>1</sup> This operation does not answer 404. An ID with no matching account returns 200 with an empty `users` array, so a client checks the array length--An account with a pending or completed deletion is still returned, with its lifecycle state visible through `pending_deletion_at`, `deletion_reason_code`, and `deletion_public_reason`.--### Side effects+| 200 | response body | The lookup finished |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `get_user`, target type `user`, the path `user_id` as target ID, and a metadata key `found`. `found` is `true` when `users` has the account and `false` when it is empty.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Create user<RouteHeader method="POST" path="/v1/admin/users" auditReason />-Creates an account with no password and returns a [password reset link](#password-reset-link-object) for it. Requires `*`. The new account holder opens the link to choose a password.--:::caution[The link is a credential]-Anyone holding the link can set the account's password until it expires. Hand it to the account holder over a channel you trust. The response is the only place the link appears.-:::+Creates an account with no password and returns a [password reset link](#password-reset-link-object) the account holder opens to choose one. You need `*`.### JSON body| Field | Type | Description || --- | --- | --- |-| username | string | Username for the new account (1-32 characters) |-| email?<sup>1</sup> | string | Email address for the new account |-| admin? | boolean | Whether to grant the account `*` (default false) |+| username | string | The username (1-32 characters) |+| email?<sup>1</sup> | string | The email address |+| admin? | boolean | Whether to give the account `*` (default false) |-<sup>1</sup> Required on an instance where members sign in with email, and refused with 400 `USERNAME_SIGN_IN_ONLY` on an instance where they sign in with a username. While the instance sends email, Fluxer sends the address a verification email, as it does for a new registration+<sup>1</sup> Required on an email instance and refused with `USERNAME_SIGN_IN_ONLY` on a username instance### Response body@@ -653,834 +471,465 @@ Anyone holding the link can set the account's password until it expires. Hand it| Status | Body | Condition || --- | --- | --- || 200 | response body | The account was created |-| 400 | [error response](/admin-api/#error-response) | The body is invalid, the username or email address is taken, or the email address does not fit the sign-in method |-| 403 | [error response](/admin-api/#error-response) | ACL evaluation denies the request, because the credential does not hold `*` |+| 400 | [error response](/admin-api/#error-response) | The username or email address is taken or invalid |-### Side effects--The operation records two [Admin audit entries](/admin-api/#admin-audit-entry-object) with target type `user` and the new account's ID as target ID. The first has action `create_user` and the metadata keys `username` and `admin`. The second has action `create_password_reset_link`.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Change user username<RouteHeader method="PATCH" path="/v1/admin/users/{user_id}/username" auditReason />-Replaces the username, allocates or claims a discriminator, and returns the resulting account. Requires `user:update:username`.--A target account may hold a custom discriminator on a self-hosted instance in the `everyone` [premium mode](/admin-api/instance/#premium-modes), and on any other instance only when the `feature_custom_discriminator` limit resolves to a value above zero for that account.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Changes the username and returns the account. You need `user:update:username`.### JSON body| Field | Type | Description || --- | --- | --- |-| username<sup>1</sup> | string | Replacement username (1-32 characters) |-| discriminator?<sup>2</sup> | string | Requested discriminator of one to four decimal digits |--<sup>1</sup> Trimmed before validation, restricted to letters, digits, and underscores, and rejected when it lowercases to `everyone` or `here` or contains `fluxer` or `system message`+| username | string | The new username (1-32 characters) |+| discriminator?<sup>1</sup> | string | A discriminator of one to four digits |-<sup>2</sup> Honoured only when the target account may hold a custom discriminator. In every other case, including an omitted field, Fluxer allocates a free discriminator for the submitted username. On an instance with the `none` tag style an account that is not a bot always gets `0`, any other value returns the field code `DISCRIMINATOR_NOT_SUPPORTED_ON_INSTANCE`, and a username another account holds in any letter case returns `USERNAME_ALREADY_TAKEN`+<sup>1</sup> Used only when the account may have a custom discriminator. Otherwise Fluxer picks a free one### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The resulting account |+| user | [Admin user](#admin-user-object) object | The updated account |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Username was replaced |-| 400 | [error response](/admin-api/#error-response) | Path or body validation fails, or the requested tag is taken and the request returns `TAG_ALREADY_TAKEN` |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--`TAG_ALREADY_TAKEN` also covers a submitted username with no free discriminator left, and an allocation lock the operation cannot get within its 10 second wait.--### Side effects+| 200 | response body | The username was changed |+| 400 | [error response](/admin-api/#error-response) | `TAG_ALREADY_TAKEN` when the tag is taken or no discriminator is free |-[User Update](/gateway/events/#user-update) is emitted to the account's own sessions, and each guild the account is a member of receives [Guild Member Update](/gateway/events/#guild-member-update). Fluxer reindexes the member in each indexed guild in the background, so a member search result can briefly report the previous tag.+Fluxer sends [User Update](/gateway/events/#user-update) and [Guild Member Update](/gateway/events/#guild-member-update) to each guild the account is in.-The change is recorded in the contact change log and is returned by [List user change log](#list-user-change-log) with `reason` set to `admin_action` and `actor_user_id` set to the acting Admin.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `change_username`, target type `user`, and metadata keys `old_username`, `new_username`, and `discriminator`.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Change user email<RouteHeader method="PATCH" path="/v1/admin/users/{user_id}/email" auditReason />-Replaces the account's email address and returns the resulting account. Requires `user:update:email`.--The replacement address is stored unverified. Use [Verify user email](#verify-user-email) afterwards to mark it verified, or [Resend verification email](#resend-verification-email) to let the account holder verify it.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Changes the email address and returns the account. You need `user:update:email`. The new address is unverified, or verified when the instance doesn't send email. Nobody is emailed about the change.### JSON body| Field | Type | Description || --- | --- | --- |-| email<sup>1</sup> | string | Replacement email address (1-254 characters) |--<sup>1</sup> Normalised and validated as an email address. An address stored on another account, confirmed or not, returns 400 `EMAIL_ALREADY_IN_USE`+| email | string | The new email address (1-254 characters) |### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The resulting account |+| user | [Admin user](#admin-user-object) object | The updated account |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Email address was replaced |-| 400 | [error response](/admin-api/#error-response) | `EMAIL_UNAVAILABLE_ON_INSTANCE`, because members sign in with a username |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--### Side effects--`email_verified` is set to false. The stored bounce marker survives the change, so an address replaced on a bounced account remains marked bounced until a verification clears it.+| 200 | response body | The email address was changed |+| 400 | [error response](/admin-api/#error-response) | `EMAIL_ALREADY_IN_USE` when another account has the address |-No notice is sent to the previous or the replacement address. [User Update](/gateway/events/#user-update) is emitted to the account's own sessions, and no [Guild Member Update](/gateway/events/#guild-member-update) follows.+Fluxer sends [User Update](/gateway/events/#user-update).-The change is recorded in the contact change log and is returned by [List user change log](#list-user-change-log), where both values are replaced with `[redacted]` for a caller without `user:view:email`.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `change_email`, target type `user`, and metadata keys `old_email` and `new_email`. The audit log is not redacted on read, so both addresses are visible to any holder of `audit_log:view`.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Verify user email<RouteHeader method="PUT" path="/v1/admin/users/{user_id}/email-verification" auditReason />-Marks the account's current email address as verified without a confirmation link, and returns the resulting account. Requires `user:update:email`.--The operation accepts no request body and never clears verification, so the one way to mark an address unverified is to replace it with [Change user email](#change-user-email).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Marks the email address as verified, clears its bounce marker and returns the account. You need `user:update:email`.### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The resulting account |+| user | [Admin user](#admin-user-object) object | The updated account |### Response| Status | Body | Condition || --- | --- | --- |-| 200<sup>1</sup> | response body | Email address was marked verified |-| 400 | [error response](/admin-api/#error-response) | `EMAIL_UNAVAILABLE_ON_INSTANCE`, because members sign in with a username |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--<sup>1</sup> An account that has no stored email address is still accepted, and `email_verified` is set to true while `email` stays null--### Side effects--`email_verified` becomes true and `email_bounced` becomes false.+| 200 | response body | The email address was marked verified |-[User Update](/gateway/events/#user-update) is emitted to the account's own sessions. The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `verify_email`, target type `user`, and a metadata key `email` with the address as it stood before the write, or the literal `null` when the account had none.+Fluxer sends [User Update](/gateway/events/#user-update).-### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Resend verification email<RouteHeader method="POST" path="/v1/admin/users/{user_id}/verification-email" auditReason />-Requests a new verification email for the account. Requires `user:update:email`. Returns an empty 204 response.--:::caution[An already verified account gets no email]-When the account's email is already verified, Fluxer returns 204 without storing a token or sending anything.-:::--:::note[Delivery is dropped silently]-Nothing is sent when the instance email transport is disabled or when the address is marked hard bounced. Neither case changes the status code, and the audit entry is recorded either way.-:::--Each address can receive at most three verification emails in fifteen minutes, independently of the Admin rate limit. Further requests return 429 without issuing a token.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Emails the account holder a new verification link. You need `user:update:email`. Nothing is sent when the address is already verified, has bounced or the instance doesn't send email.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | The request was accepted, whether or not an email was sent |-| 400<sup>1</sup> | [error response](/admin-api/#error-response) | The path parameter is not a snowflake, or the account has no email address |-| 403 | [error response](/admin-api/#error-response) | Credential type or ACL evaluation denies the request, or `BOT_USER_AUTH_ENDPOINT_ACCESS_DENIED` when the target is a bot |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--<sup>1</sup> A missing address returns `INVALID_FORM_BODY` with the validation code `USER_DOES_NOT_HAVE_AN_EMAIL_ADDRESS`+| 204 | empty | The request was accepted |+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` with `USER_DOES_NOT_HAVE_AN_EMAIL_ADDRESS` when the account has no address |+| 403 | [error response](/admin-api/#error-response) | `BOT_USER_AUTH_ENDPOINT_ACCESS_DENIED` when the account is a bot |+| 429 | [error response](/admin-api/#error-response) | The address already got three verification emails in 15 minutes |-### Side effects--A single-use verification token is stored against the account ID and its current address, and the link is emailed to that address. The account's verification state is unchanged until the link is used.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `resend_verification_email`, target type `user`, and a metadata key `email`. No Gateway Dispatch is emitted.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Send password reset<RouteHeader method="POST" path="/v1/admin/users/{user_id}/password-reset" auditReason />-Creates a password reset token and emails it to the account holder. Requires `user:update:email`. Returns an empty 204 response.--While the instance does not send email, the request returns 400 `EMAIL_DELIVERY_OFF` and stores no token. Use [Create password reset link](#create-password-reset-link) instead.--:::caution[A dropped reset email still stores the token]-Delivery is silently dropped when the address is marked hard bounced. The token is stored either way, so a dropped delivery leaves a usable reset token that nobody received.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Emails the account holder a password reset link. You need `user:update:email`. When the instance doesn't send email, use [Create password reset link](#create-password-reset-link).### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | The request was accepted, whether or not an email was sent |-| 400<sup>1</sup> | [error response](/admin-api/#error-response) | The path parameter is not a snowflake, the account has no email address, or the instance does not send email |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--<sup>1</sup> A missing address returns `INVALID_FORM_BODY` with the validation code `USER_DOES_NOT_HAVE_AN_EMAIL_ADDRESS`--Unlike [Resend verification email](#resend-verification-email), this operation has no limit of three emails per address in fifteen minutes, and it accepts a bot account.--### Side effects--A single-use password reset token is stored against the account ID and its current email address, and the token is emailed to that address. The account's password, sessions, and other credentials are unchanged until the account holder completes the reset.+| 204 | empty | The request was accepted |+| 400 | [error response](/admin-api/#error-response) | `EMAIL_DELIVERY_OFF` when the instance doesn't send email |+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` with `USER_DOES_NOT_HAVE_AN_EMAIL_ADDRESS` when the account has no address |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `send_password_reset`, target type `user`, and a metadata key `email`. No Gateway Dispatch is emitted.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Create password reset link<RouteHeader method="POST" path="/v1/admin/users/{user_id}/password-reset-link" auditReason />-Creates a password reset token for the account and returns the link that redeems it, with nothing emailed. Requires `user:create:password_reset_link` and every ACL the target account holds. A target holding an ACL the caller lacks returns 403 `MISSING_ACL`, and a bot target returns 403 `BOT_USER_AUTH_ENDPOINT_ACCESS_DENIED`. Returns a [password reset link](#password-reset-link-object) object.--Only an instance where members sign in with a username serves this operation, and an email instance returns 400 `USERNAME_SIGN_IN_ONLY`. The account holder opens the link in the web app, which calls [validate a password reset token](/http-api/authentication/#validate-a-password-reset-token) and then [reset a password](/http-api/authentication/#reset-a-password).--:::caution[The link is a credential]-Anyone holding the link can set the account's password until it expires. Hand it to the account holder over a channel you trust. The response is the only place the link appears.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Returns a [password reset link](#password-reset-link-object) without emailing it, on an instance where members sign in with a username or one that doesn't send email. You need `user:create:password_reset_link` and every ACL the account has. Earlier reset links and the account's recovery kit stop working.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [password reset link](#password-reset-link-object) object | The token was stored and its link returned |-| 400 | [error response](/admin-api/#error-response) | The path parameter is not a snowflake, or the instance signs members in with email |-| 403 | [error response](/admin-api/#error-response) | ACL evaluation denies the request, the target holds an ACL the caller lacks, or the target is a bot |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--### Side effects--Every earlier password reset token for the account is deleted, so a link created before this one stops working. The account's recovery kit is deleted too, so its key stops working. A single-use password reset token is then stored against the account ID with no email address. The account's password, sessions, and other credentials are unchanged until the account holder completes the reset.+| 200 | [password reset link](#password-reset-link-object) object | The link was created |+| 400 | [error response](/admin-api/#error-response) | `USERNAME_SIGN_IN_ONLY` on an email instance that sends email |+| 403 | [error response](/admin-api/#error-response) | `MISSING_ACL` when the account has an ACL you lack, or `BOT_USER_AUTH_ENDPOINT_ACCESS_DENIED` for a bot |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `create_password_reset_link` and target type `user`. No Gateway Dispatch is emitted.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Create admin sign-in link<RouteHeader method="POST" path="/v1/admin/users/{user_id}/sign-in-link" auditReason />-Creates a one-time sign-in link for an account that holds `*` and returns it, with nothing emailed. Only the operator socket serves this operation, so it is reachable with rexctl on the server and nowhere else. Any other caller gets 403 `ACCESS_DENIED`. A target without `*` returns 403 `MISSING_ACL`, and a bot target returns 403 `BOT_USER_AUTH_ENDPOINT_ACCESS_DENIED`. Returns a [sign-in link](#sign-in-link-object) object.--The admin opens the link in the web app, which calls [redeem a sign-in link](/http-api/authentication/#redeem-a-sign-in-link). That signs the account in and authorizes the IP address of the browser, without a password, a second factor, or an email.--:::caution[The link is a credential]-Anyone holding the link can sign in as the admin until it is used or expires. The response is the only place the link appears.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Returns a [sign-in link](#sign-in-link-object) for an account that has `*`. Only [rexctl](/operator/rexctl/) on the server can call it. The link signs the admin in without a password, a second factor or an email.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [sign-in link](#sign-in-link-object) object | The token was stored and its link returned |-| 400 | [error response](/admin-api/#error-response) | The path parameter is not a snowflake |-| 403 | [error response](/admin-api/#error-response) | The request did not come through the operator socket, the target lacks `*`, or the target is a bot |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--### Side effects--A single-use token is stored against the account ID for 15 minutes. Earlier sign-in links keep working until they are used or expire.+| 200 | [sign-in link](#sign-in-link-object) object | The link was created |+| 403 | [error response](/admin-api/#error-response) | `ACCESS_DENIED` outside rexctl, `MISSING_ACL` when the account lacks `*` |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `create_sign_in_link` and target type `user`. Using the link records another entry with action `use_sign_in_link`, target type `user`, the admin account as both the acting Admin and the target, and `via` set to `rexctl`. No Gateway Dispatch is emitted.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Revoke user recovery kit<RouteHeader method="DELETE" path="/v1/admin/users/{user_id}/recovery-kit" auditReason />-Deletes the account's recovery kit, so its recovery key stops working. Requires `user:delete:recovery_kit` and every ACL the target account holds, and a target holding an ACL the caller lacks returns 403 `MISSING_ACL`. Returns no body.--Only an instance where members sign in with a username serves this operation, and an email instance returns 400 `USERNAME_SIGN_IN_ONLY`. The account holder can issue a new kit from their settings.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Deletes the account's recovery kit, on an instance where members sign in with a username. You need `user:delete:recovery_kit` and every ACL the account has. The account holder can make a new kit in their settings.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | none | The kit was deleted, or the account had none |-| 400 | [error response](/admin-api/#error-response) | The path parameter is not a snowflake, or the instance signs members in with email |-| 403 | [error response](/admin-api/#error-response) | ACL evaluation denies the request, or the target holds an ACL the caller lacks |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |+| 204 | none | The kit was deleted, or there was none |+| 400 | [error response](/admin-api/#error-response) | `USERNAME_SIGN_IN_ONLY` on an email instance |-### Side effects--The account's password, sessions, and other credentials are unchanged. The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `revoke_recovery_kit` and target type `user`. No Gateway Dispatch is emitted.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Change user date of birth<RouteHeader method="PATCH" path="/v1/admin/users/{user_id}/date-of-birth" auditReason />-Replaces the stored date of birth and returns the resulting account. Requires `user:update:dob`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Changes the date of birth and returns the account. You need `user:update:dob`. A deletion scheduled because the account was under the minimum age is canceled.### JSON body| Field | Type | Description || --- | --- | --- |-| date_of_birth<sup>1</sup> | string | Replacement date in `YYYY-MM-DD` form |--<sup>1</sup> Exactly ten characters matching `YYYY-MM-DD`. The field is required, so there is no way to clear a stored date of birth through this operation+| date_of_birth | string | The new date as `YYYY-MM-DD` |### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The resulting account |+| user | [Admin user](#admin-user-object) object | The updated account |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Date of birth was replaced |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--### Side effects--The new date changes what age-restricted content the account may reach. [User Update](/gateway/events/#user-update) is emitted to the account's own sessions. A deletion scheduled because the account was below the minimum age is cancelled, unless a lost payment dispute also scheduled the account for deletion.--The change is not written to the contact change log. The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `change_dob`, target type `user`, and metadata keys `old_dob`, `new_dob`, `cleared_below_minimum_age` and `outside_plausible_range`, where an absent previous value is the literal `null`. An administrator may set a date that is today or later or more than 120 years back, and `outside_plausible_range` is then `true`.+| 200 | response body | The date of birth was changed |-### Rate limit+Fluxer sends [User Update](/gateway/events/#user-update).-100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Clear user profile fields<RouteHeader method="DELETE" path="/v1/admin/users/{user_id}/profile-fields" auditReason />-Clears the named profile fields and returns the resulting account. Requires `user:update:profile`.--Clearing is the only profile change on this resource. No route sets a biography, display name, avatar, or banner to a new value.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Clears [profile fields](#profile-fields) and returns the account. You need `user:update:profile`. The `enforcement` basis saves the old values as evidence, records a profile reset [decision](/admin-api/enforcement/) and sends its notice.### JSON body| Field | Type | Description || --- | --- | --- |-| fields<sup>1</sup> | array[string] | [Profile fields](#profile-fields) to clear, with 1 to 10 entries |-| basis<sup>2</sup> | [basis](/admin-api/enforcement/#basis) object | Why the fields are cleared |--<sup>1</sup> Required. A value outside the registry fails body validation--<sup>2</sup> The `enforcement` basis saves the current values of the fields as the evidence's `profile_values`, records a profile reset [decision](/admin-api/enforcement/) and sends its notice by email and system DM. The cleared fields are its facts, so it needs neither evidence nor a statement+| fields | array[string] | The [profile fields](#profile-fields) to clear (1-10) |+| basis | [basis](/admin-api/enforcement/#basis) object | Why the fields are cleared |### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The resulting account |+| user | [Admin user](#admin-user-object) object | The updated account |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The named fields were cleared |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY`, because the body or the [decision](/admin-api/enforcement/#validation) is invalid |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--### Side effects--Clearing `avatar` or `banner` schedules the previous asset for deletion.--[User Update](/gateway/events/#user-update) is emitted to the account's own sessions, and each guild the account is a member of receives [Guild Member Update](/gateway/events/#guild-member-update) when the operation changes `avatar` or `global_name`.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `clear_fields`, target type `user`, a metadata key `fields` with the submitted names joined by commas, and `basis`. The `enforcement` basis adds `decision_id`, `reason_code`, `kind` and `notice_status`.+| 200 | response body | The fields were cleared |+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` with a [decision validation code](/admin-api/enforcement/#validation) |-### Rate limit+Fluxer sends [User Update](/gateway/events/#user-update), and [Guild Member Update](/gateway/events/#guild-member-update) when `avatar` or `global_name` changed.-100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Set user bot status<RouteHeader method="PUT" path="/v1/admin/users/{user_id}/bot-status" auditReason />-Marks the account as a bot or as an ordinary account, and returns the resulting account. Requires `user:update:bot_status`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Marks the account as a bot or not and returns the account. You need `user:update:bot_status`. Setting `bot` to false also clears `system`.### JSON body| Field | Type | Description || --- | --- | --- |-| bot<sup>1</sup> | boolean | Whether the account is a bot |--<sup>1</sup> Required. Setting it to false also clears `system` in the same write+| bot | boolean | Whether the account is a bot |### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The resulting account |+| user | [Admin user](#admin-user-object) object | The updated account |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Bot status was set |-| 403<sup>1</sup> | [error response](/admin-api/#error-response) | Credential type or ACL evaluation denies the request. `ACCESS_DENIED` when the target holds an Admin ACL and `bot` is true |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--<sup>1</sup> A staff account cannot be converted into a bot. Clear its ACL set with [Set user ACLs](#set-user-acls) first+| 200 | response body | The bot status was set |+| 403 | [error response](/admin-api/#error-response) | `ACCESS_DENIED` when the account has Admin ACLs and `bot` is true |-### Side effects+Fluxer sends [User Update](/gateway/events/#user-update), and [Guild Member Update](/gateway/events/#guild-member-update) when the status changed.-[User Update](/gateway/events/#user-update) is emitted to the account's own sessions, and each guild the account is a member of receives [Guild Member Update](/gateway/events/#guild-member-update) when the write changes `bot` or `system`.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `set_bot_status`, target type `user`, and a metadata key `bot`. Clearing `system` as a side effect records no second entry.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Set user system status<RouteHeader method="PUT" path="/v1/admin/users/{user_id}/system-status" auditReason />-Marks the account as an official system account or removes that marker, and returns the resulting account. Requires `user:update:bot_status`, the same ACL as [Set user bot status](#set-user-bot-status).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Marks a bot as an official system account or not and returns the account. You need `user:update:bot_status`.### JSON body| Field | Type | Description || --- | --- | --- |-| system<sup>1</sup> | boolean | Whether the account is a system account |--<sup>1</sup> Required. Setting it to true on an account that is not already a bot fails validation+| system | boolean | Whether the account is a system account |### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The resulting account |+| user | [Admin user](#admin-user-object) object | The updated account |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | System status was set |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--<sup>1</sup> The non-bot case is `INVALID_FORM_BODY` with the validation code `USER_MUST_BE_A_BOT_TO_BE_MARKED_AS_A_SYSTEM_USER` on the `system` path--### Side effects--[User Update](/gateway/events/#user-update) is emitted to the account's own sessions, and each guild the account is a member of receives [Guild Member Update](/gateway/events/#guild-member-update) when the write changes `system`.+| 200 | response body | The system status was set |+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` when the account is not a bot |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `set_system_status`, target type `user`, and a metadata key `system`.+Fluxer sends [User Update](/gateway/events/#user-update), and [Guild Member Update](/gateway/events/#guild-member-update) when the status changed.-### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Set user ACLs<RouteHeader method="PUT" path="/v1/admin/users/{user_id}/acls" auditReason />-Replaces the Admin ACL set held by the account and returns the resulting account. Requires `acl:set:user`.--The submitted array replaces the stored set outright. An empty array removes every ACL, which also removes the account's Admin API access and leaves every Admin API key the account created unable to satisfy any operation.--:::caution[A grant cannot exceed the acting Admin]-A submitted set naming an ACL the acting credential does not hold fails with 403 `MISSING_ACL` on the first offending value. A wildcard holder is exempt. An Admin API key is compared against the set stored on the key.-:::--:::caution[An Admin cannot write its own ACL set]-A path naming the acting account fails with 403 `ACCESS_DENIED` before the account is resolved.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Replaces the account's [Admin ACLs](/admin-api/#acl-registry) and returns the account. You need `acl:set:user`, and every ACL you grant unless you have `*`. The account can use the Admin API while its set has `admin:authenticate` or `*`, and a narrower set applies at once to its sessions and Admin API keys.### JSON body| Field | Type | Description || --- | --- | --- |-| acls<sup>1</sup> | array[string] | Replacement [Admin ACLs](/admin-api/#acl-registry), with at most 106 values |--<sup>1</sup> Required. A value outside the [ACL registry](/admin-api/#acl-registry) fails body validation, and a repeated value is collapsed+| acls | array[string] | The new [Admin ACLs](/admin-api/#acl-registry) |### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The resulting account |+| user | [Admin user](#admin-user-object) object | The updated account |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The ACL set was replaced |-| 400 | [error response](/admin-api/#error-response) | Path or body validation fails, including an `acls` value outside the [ACL registry](/admin-api/#acl-registry) |-| 403 | [error response](/admin-api/#error-response) | Credential type or ACL evaluation denies the request, or `ACCESS_DENIED` when the path names the acting account |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |+| 200 | response body | The ACLs were replaced |+| 403 | [error response](/admin-api/#error-response) | `MISSING_ACL` for an ACL you lack, `ACCESS_DENIED` when the account is your own |-The grant bound is evaluated after the account is resolved, so an unknown ID fails first with 404.+Fluxer sends [User Update](/gateway/events/#user-update).-### Side effects--The stored ACL set is replaced and appears in the next [Admin user object](#admin-user-object). The account can reach the Admin API exactly when the new set holds `admin:authenticate` or `*`. Narrowing the set narrows every existing session and Admin API key of the account without rotating any credential.--[User Update](/gateway/events/#user-update) is emitted to the account's own sessions. The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `set_acls`, target type `user`, and a metadata key `acls` with the submitted values joined by commas.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Set user traits<RouteHeader method="PUT" path="/v1/admin/users/{user_id}/traits" auditReason />-Replaces the account's trait set and returns the resulting account. Requires `user:update:traits`.--Traits are free-form operator labels that have no ACL meaning. [Limit rules](/admin-api/instance/#limit-rule-object) can filter on them, and they match a rule's trait names without regard to case. On a self-hosted instance the trait `premium` matches the premium limit rule, while a hosted instance drops it because premium there comes from the account's entitlement.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Replaces the account's traits and returns the account. You need `user:update:traits`. Traits are lowercase labels that [limit rules](/admin-api/instance/#limit-rule-object) can filter on.### JSON body| Field | Type | Description || --- | --- | --- |-| traits<sup>1</sup> | array[string] | Replacement trait set, with at most 100 values of 1 to 128 characters |--<sup>1</sup> Required. Each value is stored in lowercase. An empty array clears the stored set entirely, and a repeated value is collapsed+| traits | array[string] | The new traits, each 1-128 characters (at most 100) |### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The resulting account |+| user | [Admin user](#admin-user-object) object | The updated account |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The trait set was replaced |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--### Side effects+| 200 | response body | The traits were replaced |-The stored trait set is replaced and is returned sorted by the next [Admin user object](#admin-user-object). [User Update](/gateway/events/#user-update) is emitted to the account's own sessions.+Fluxer sends [User Update](/gateway/events/#user-update).-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `set_traits` and target type `user`. A non-empty request has a metadata key `traits` with the submitted values joined by commas, and a request that clears the set has no metadata at all.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Update user flags<RouteHeader method="PATCH" path="/v1/admin/users/{user_id}/flags" auditReason />-Adds and removes [account flags](#account-flags) and returns the resulting account. Requires `user:update:flags`.--Additions are applied before removals, so a flag named in both arrays ends up cleared. A bit outside the [account flag](#account-flags) registry is applied unchanged.--Flags that record a restriction change only through their own routes. Adding `DISABLED`, `DELETED`, `SPAMMER` or `REPORT_BANNED`, removing `DELETED`, and removing `DISABLED` while the account is suspended are refused. Removing `SPAMMER` or `REPORT_BANNED` while an active [feature limit](#limit-user-features) holds it is refused with the decision ID. A self-disabled account, which has `DISABLED` without a suspension, can still have it removed.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Adds and removes [account flags](#account-flags) and returns the account. You need `user:update:flags`. You can't add `DISABLED`, `DELETED`, `SPAMMER` or `REPORT_BANNED`, remove `DELETED`, or remove `DISABLED` from a suspended account. Use [Suspend user](#suspend-user) or [Schedule user deletion](#schedule-user-deletion) for those. [Bulk jobs](/admin-api/bulk-jobs/) can make the same change on many accounts.### JSON body| Field | Type | Description || --- | --- | --- |-| add_flags?<sup>1</sup> | array[string] | [Account flag](#account-flags) values to add, with at most 64 entries (default empty) |-| remove_flags?<sup>1</sup> | array[string] | [Account flag](#account-flags) values to remove, with at most 64 entries (default empty) |--<sup>1</sup> One 64-bit flag value as an unsigned decimal string, such as `64`. A value with several bits is applied as a mask+| add_flags? | array[string] | The flag values to add, as decimal strings (at most 64) |+| remove_flags? | array[string] | The flag values to remove, as decimal strings (at most 64) |### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The resulting account |+| user | [Admin user](#admin-user-object) object | The updated account |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Flags were updated |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` with `FLAG_REQUIRES_ENFORCEMENT_ROUTE`, because the change touches a restriction flag |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |-| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_DECISION_OWNS_STATE` with the `decision_id`, because a feature limit holds the flag |--[Bulk jobs](/admin-api/bulk-jobs/) applies the same change to up to 1,000 accounts as a queued `update_user_flags` task.+| 200 | response body | The flags were updated |+| 400 | [error response](/admin-api/#error-response) | `FLAG_REQUIRES_ENFORCEMENT_ROUTE` for a restriction flag |+| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_DECISION_OWNS_STATE` when a [feature limit](#limit-user-features) set the flag |-### Side effects+Fluxer sends [User Update](/gateway/events/#user-update), and [Guild Member Update](/gateway/events/#guild-member-update) when a public flag changed.-[User Update](/gateway/events/#user-update) is emitted to the account's own sessions. A change to the account's public flags also sends [Guild Member Update](/gateway/events/#guild-member-update) to the account's guilds.--Removing `ACCOUNT_LIMITED` or adding `LIMIT_EXEMPT` also lifts any [new conversation limit](/http-api/users/private-channels/#new-conversation-limit) on the account.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `update_flags`, target type `user`, and the metadata keys `add_flags`, `remove_flags`, and `new_flags`. An empty array is omitted from the metadata map.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Update user premium flags<RouteHeader method="PATCH" path="/v1/admin/users/{user_id}/premium-flags" auditReason />-Adds and removes [premium flags](#premium-flags) and returns the resulting account. Requires `user:update:flags`, the same ACL as [Update user flags](#update-user-flags).--Premium flags control badge display, the premium override, the purchase block, and perk sanitisation. They do not grant or revoke a subscription.--Adding `PURCHASE_DISABLED` is refused, because a purchase block is recorded through [Limit user features](#limit-user-features). Removing it while an active feature limit holds it is refused with the decision ID. A purchase block Fluxer set after repeated refunds has no decision and can be removed.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Adds and removes [premium flags](#premium-flags) and returns the account. You need `user:update:flags`. These flags don't grant or end premium. To block purchases, use [Limit user features](#limit-user-features).### JSON body| Field | Type | Description || --- | --- | --- |-| add_flags?<sup>1</sup> | array[integer] | [Premium flag](#premium-flags) values to add, with at most 64 entries (default empty) |-| remove_flags?<sup>1</sup> | array[integer] | [Premium flag](#premium-flags) values to remove, with at most 64 entries (default empty) |--<sup>1</sup> Each entry is one 32-bit flag value, such as `2`. Additions are applied before removals+| add_flags? | array[integer] | The flag values to add (at most 64) |+| remove_flags? | array[integer] | The flag values to remove (at most 64) |### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The resulting account |+| user | [Admin user](#admin-user-object) object | The updated account |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Premium flags were updated |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` with `FLAG_REQUIRES_ENFORCEMENT_ROUTE`, because `PURCHASE_DISABLED` was added |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |-| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_DECISION_OWNS_STATE` with the `decision_id`, because a feature limit holds the purchase block |--### Side effects--The next [profile read](/http-api/users/#get-user-profile) builds `profile_badges` from the new flags. [User Update](/gateway/events/#user-update) is emitted to the account's own sessions.+| 200 | response body | The premium flags were updated |+| 400 | [error response](/admin-api/#error-response) | `FLAG_REQUIRES_ENFORCEMENT_ROUTE` when adding `PURCHASE_DISABLED` |+| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_DECISION_OWNS_STATE` when a feature limit set the purchase block |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `update_premium_flags`, target type `user`, and the metadata keys `add_flags`, `remove_flags`, and `new_flags`.+Fluxer sends [User Update](/gateway/events/#user-update).-### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Suspend user<RouteHeader method="PUT" path="/v1/admin/users/{user_id}/ban" auditReason />-Suspends an account for a number of hours or permanently, records the [enforcement decision](/admin-api/enforcement/) behind it, and returns the resulting account. Requires `user:temp_ban`. The `X-Audit-Log-Reason` header is required and becomes the first note on the decision.--:::note[A permanent suspension is a distant expiry]-Both modes add the `DISABLED` [account flag](#account-flags) and set `temp_banned_until`, a permanent suspension to 100 years out. The decision's `ends_at` is null for a permanent suspension, which is how the two are told apart.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Suspends the account for some hours or permanently, records the [enforcement decision](/admin-api/enforcement/) and returns the account. You need `user:temp_ban`. The account is signed out everywhere, and a new suspension replaces the current one. To lift it, [end the decision](/admin-api/enforcement/#end-an-enforcement-decision).### JSON body| Field | Type | Description || --- | --- | --- |-| duration_hours<sup>1</sup> | integer | Whole-hour suspension length, where `0` suspends permanently (0-8760) |+| duration_hours | integer | How many hours to suspend for, or `0` for permanently (0-8760) || decision | [enforcement decision input](/admin-api/enforcement/#enforcement-decision-input) object | Why the account is suspended |-| remove_evidence?<sup>2</sup> | boolean | Whether to remove the evidence messages after they are snapshotted |-| block_networks?<sup>3</sup> | [network block request](#network-block-request) object | Networks the account used to block with the decision |+| remove_evidence?<sup>1</sup> | boolean | Whether to delete the evidence messages after they are saved |+| block_networks?<sup>2</sup> | [network block request](#network-block-request) object | The account's addresses to block |-<sup>1</sup> Required. The expiry is computed from the moment the suspension is applied. The 8760 ceiling is one year+<sup>1</sup> Needs `message:shred`-<sup>2</sup> Requires `message:shred`. Queues a [message shred job](#shred-user-messages) for the evidence messages and sets the decision's `removed_message_count`--<sup>3</sup> Permanent suspensions only. Requires `ban:ip:add` and `user:view:ip`+<sup>2</sup> Only for a permanent suspension. Needs `ban:ip:add` and `user:view:ip`### Network block request| Field | Type | Description || --- | --- | --- |-| ips<sup>1</sup> | array[string] | IPv4 or IPv6 addresses to block (1-20 items) |+| ips<sup>1</sup> | array[string] | The IP addresses to block (1-20) || days? | integer | How many days the blocks last (1-365, default 90) |-<sup>1</sup> Each address must be one the account used in the last 30 days, as [List network block candidates](#list-network-block-candidates) shows. An address on which another account that is not suspended or closed was last active fails with `ENFORCEMENT_NETWORK_SHARED`. Exempt addresses and special-purpose ranges are skipped, not refused+<sup>1</sup> Each must be one [List network block candidates](#list-network-block-candidates) returns### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The resulting account, with `enforcement_decision_id` set |-| skipped_ips | array[object] | Requested addresses that were not blocked, each with `ip` and `reason` |--`reason` is `exempt`, `special_purpose`, or `already_blocked` when a permanent plain block or another decision already covers the address. [Network blocks](/admin-api/enforcement/#network-blocks) describes the rules.+| user | [Admin user](#admin-user-object) object | The suspended account |+| skipped_ips | array[object] | The addresses not [blocked](/admin-api/enforcement/#network-blocks), each with `ip` and a `reason` of `exempt`, `special_purpose` or `already_blocked` |### Response| Status | Body | Condition || --- | --- | --- || 200 | response body | The account was suspended |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY`, with one of the [validation codes](/admin-api/enforcement/#validation) |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |-| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_ACCOUNT_CLOSED`, because the account is closed |--:::caution[The suspension signs the account out everywhere]-Every authentication session of the account is deleted. Ending the decision restores account access, but it does not restore any deleted session.-:::--### Side effects--The decision is stored first. `DISABLED` is then added to the account flags, and `temp_banned_until` and `enforcement_decision_id` are set in the same write. Every authentication session is deleted, the requested networks are blocked, linked reports are resolved, and the notice is emailed. A suspension of an account that is already suspended replaces it, and the earlier decision reads as `replaced`.+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` with a [decision validation code](/admin-api/enforcement/#validation) |+| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_ACCOUNT_CLOSED` when the account is closed |-An authentication attempt while the suspension stands fails with 403 `ACCOUNT_SUSPENDED_TEMPORARILY`, or `ACCOUNT_SUSPENDED_PERMANENTLY` for a suspension with no end date, and shows the notice. The notice of an account with no email address counts as received at its first such attempt. After the expiry, Fluxer clears `DISABLED`, `temp_banned_until` and `enforcement_decision_id` and ends the decision as `expired`. This happens at the next authentication attempt or in a scheduled task that runs every six hours, whichever comes first, and sends no email.--[User Update](/gateway/events/#user-update) is emitted after the sessions are deleted, so no connection of the account remains to receive it.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `temp_ban`, target type `user`, and the metadata keys `duration_hours`, `banned_until`, `decision_id`, `reason_code`, `kind` and `notice_status`. When networks were blocked it adds `blocked_ips` and `network_blocks_until`.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## List network block candidates<RouteHeader method="GET" path="/v1/admin/users/{user_id}/network-block-candidates" />-Lists the addresses the account used in the last 30 days, most recent first, which are the addresses `block_networks` accepts on [Suspend user](#suspend-user) and [Schedule user deletion](#schedule-user-deletion). Requires `user:view:ip`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Lists the addresses the account used in the last 30 days, newest first, which you can pass in `block_networks`. You need `user:view:ip`.### Response body| Field | Type | Description || --- | --- | --- |-| networks | array[object] | One entry per address, each with `ip`, `last_seen_at`, `skip_reason` and `other_unrestricted_accounts` |+| networks | array[object] | One entry per address, with `ip`, `last_seen_at`, `skip_reason` and `other_unrestricted_accounts` |-`last_seen_at` comes from the account's last activity and its current and ended sessions. `skip_reason` is `exempt` or `special_purpose` for an address Fluxer never blocks, and null otherwise. `other_unrestricted_accounts` counts the other accounts that are not suspended or closed and were last active on the address, matching IPv6 by its /64. An address with a count above zero cannot be blocked.+`skip_reason` is `exempt` or `special_purpose` for an address Fluxer never blocks. An address with `other_unrestricted_accounts` above zero is shared with an account in good standing and can't be blocked.### Response@@ -1488,71 +937,42 @@ Lists the addresses the account used in the last 30 days, most recent first, whi| --- | --- | --- || 200 | response body | The addresses were listed |-### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_network_block_candidates`, target type `user`, and the metadata key `result_count`.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Lift a suspension without a decision<RouteHeader method="DELETE" path="/v1/admin/users/{user_id}/ban" auditReason />-Lifts a suspension that no enforcement decision owns, such as one applied before decisions existed, and returns the resulting account. Requires `user:temp_ban`. A suspension with a decision is lifted by [ending the decision](/admin-api/enforcement/#end-an-enforcement-decision).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Lifts a suspension that no enforcement decision owns and returns the account. You need `user:temp_ban`. The account holder is emailed when the suspension was still in force. Sessions that were signed out stay signed out.### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The resulting account |+| user | [Admin user](#admin-user-object) object | The updated account |### Response| Status | Body | Condition || --- | --- | --- |-| 200<sup>1</sup> | response body | The suspension was lifted |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |-| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_DECISION_OWNS_STATE` with the `decision_id`, because a decision owns the suspension |+| 200 | response body | The suspension was lifted |+| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_DECISION_OWNS_STATE` when a decision owns the suspension |-<sup>1</sup> On an account that was never suspended it writes `temp_banned_until` as null, clears `DISABLED`, and sends no email+Fluxer sends [User Update](/gateway/events/#user-update).-### Side effects--`temp_banned_until` is cleared and `DISABLED` is removed from the account flags. Deleted sessions are not restored. When the suspension was still in force and the account is not closed, the holder is emailed that the restriction ended. The `X-Audit-Log-Reason` value is never emailed. [User Update](/gateway/events/#user-update) is emitted to the account's own sessions.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `unban`, target type `user`, and the metadata key `ended_notice`.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Warn user<RouteHeader method="POST" path="/v1/admin/users/{user_id}/warnings" auditReason />-Records a warning decision and sends its notice by email and system DM. Requires `user:update:flags`. Nothing about the account changes. The `X-Audit-Log-Reason` header is required and becomes the first note on the decision.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Records a warning decision and sends its notice by email and system DM. You need `user:update:flags`.### JSON body| Field | Type | Description || --- | --- | --- |-| decision<sup>1</sup> | [enforcement decision input](/admin-api/enforcement/#enforcement-decision-input) object | Why the account is warned |--<sup>1</sup> Reasons that allow only a suspension or content removal, such as child safety, refuse a warning with `ENFORCEMENT_KIND_NOT_ALLOWED`+| decision | [enforcement decision input](/admin-api/enforcement/#enforcement-decision-input) object | Why the account is warned |### Response body@@ -1565,258 +985,159 @@ Records a warning decision and sends its notice by email and system DM. Requires| Status | Body | Condition || --- | --- | --- || 200 | response body | The warning was recorded |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY`, with one of the [validation codes](/admin-api/enforcement/#validation) |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--### Side effects+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` with a [decision validation code](/admin-api/enforcement/#validation) |-Linked reports are resolved and the notice is sent. The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `warn_user`, target type `user`, and the metadata keys `decision_id`, `reason_code`, `kind` and `notice_status`.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Limit user features<RouteHeader method="PUT" path="/v1/admin/users/{user_id}/feature-limits" auditReason />-Records an enforcement decision that limits one feature, applies its account flag and returns the resulting account. Requires `user:update:flags`. The `X-Audit-Log-Reason` header is required and becomes the first note on the decision. The [feature limits](/admin-api/enforcement/#feature-limits) table lists the flag and the reason codes of each limit.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Records a decision that limits one feature, sets its account flag and returns the account. You need `user:update:flags`. [Feature limits](/admin-api/enforcement/#feature-limits) lists each limit's flag and reasons.### JSON body| Field | Type | Description || --- | --- | --- || limit | string | `direct_messages`, `reports` or `purchases` |-| ends_at?<sup>1</sup> | ISO8601 timestamp | When a reports limit ends |-| decision<sup>2</sup> | [enforcement decision input](/admin-api/enforcement/#enforcement-decision-input) object | Why the feature is limited |--<sup>1</sup> Reports only, at most 365 days away, and 90 days from now when omitted. Any other limit refuses it with `ENFORCEMENT_LIMIT_END_INVALID`+| ends_at?<sup>1</sup> | ISO8601 timestamp | When a `reports` limit ends |+| decision | [enforcement decision input](/admin-api/enforcement/#enforcement-decision-input) object | Why the feature is limited |-<sup>2</sup> A reason code that does not allow the limit fails with `ENFORCEMENT_LIMIT_NOT_ALLOWED`, and one that allows no feature limit at all with `ENFORCEMENT_KIND_NOT_ALLOWED`+<sup>1</sup> Only for `reports`, at most 365 days away (default 90 days)### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The resulting account |+| user | [Admin user](#admin-user-object) object | The updated account |### Response| Status | Body | Condition || --- | --- | --- || 200 | response body | The limit was recorded |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY`, with one of the [validation codes](/admin-api/enforcement/#validation) |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--### Side effects--The decision is stored first and the flag is then added. Linked reports are resolved, and the notice is sent by email and system DM.--[User Update](/gateway/events/#user-update) is emitted to the account's own sessions. The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `limit_features`, target type `user`, and the metadata keys `limit`, `decision_id`, `reason_code`, `kind` and `notice_status`, plus `ends_at` for a reports limit.+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` with a [decision validation code](/admin-api/enforcement/#validation) |-### Rate limit+Fluxer sends [User Update](/gateway/events/#user-update).-100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Schedule user deletion<RouteHeader method="PUT" path="/v1/admin/users/{user_id}/deletion" auditReason />-Closes the account, schedules its deletion and returns the resulting account. Requires `user:delete`. The `basis` says why, and the [basis](/admin-api/enforcement/#basis) decides everything else. A pending schedule is replaced only when the request names it in `replace_pending_deletion_at`, and a schedule cannot be changed once erasure starts.+Closes the account, signs it out everywhere, schedules its deletion and returns the account. You need `user:delete`. The account is kept for at least 14 days unless you set `immediate`, which queues the deletion right away and can't be undone.-- `enforcement` writes the decision's reason code and `DELETED`, keeps the account for at least 14 days, and sends the enforcement notice.-- `holder_request` writes `USER_REQUESTED` and `SELF_DELETED`, keeps the account for at least 14 days, and emails that the deletion is scheduled as asked.-- `housekeeping` writes `INACTIVITY` and `SELF_DELETED`, keeps the account for at least 14 days, and emails that the account is deleted for inactivity.--A deletion with `SELF_DELETED` is cancelled when the holder signs in, as a self-deletion is.--`immediate` skips the waiting period for every basis. The deadline is the time of the request, no email about the schedule is sent, and erasure is queued at once, so the account is gone within about a minute and cannot be restored.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+| Basis | Effect |+| --- | --- |+| `enforcement` | Records a closure decision, sends its notice and blocks the email address, except for minimum age reasons |+| `holder_request` | Sets `deletion_reason_code` to `USER_REQUESTED`, emails the account holder, and signing in cancels it |+| `housekeeping` | Sets `deletion_reason_code` to `INACTIVITY`, emails the account holder, and signing in cancels it |### JSON body| Field | Type | Description || --- | --- | --- |-| days_until_deletion<sup>1</sup> | integer | Requested whole-day delay (1-365) |-| basis | [basis](/admin-api/enforcement/#basis) object | Why the account is closed. The `enforcement` basis includes a `decision` |-| replace_pending_deletion_at?<sup>2</sup> | ISO8601 timestamp | The `pending_deletion_at` of the schedule this request replaces |-| remove_evidence?<sup>3</sup> | boolean | Remove the evidence messages after they are snapshotted |-| block_networks?<sup>4</sup> | [network block request](#network-block-request) object | Networks the account used to block with the decision |-| immediate? | boolean | Delete the account now instead of after `days_until_deletion` |--<sup>1</sup> Raised to the minimum of the basis, and ignored while `immediate` is true. There is no absolute-timestamp field+| days_until_deletion | integer | How many days until deletion, at least 14 (1-365) |+| basis | [basis](/admin-api/enforcement/#basis) object | Why the account is closed |+| replace_pending_deletion_at?<sup>1</sup> | ISO8601 timestamp | The `pending_deletion_at` of the schedule you replace |+| remove_evidence?<sup>2</sup> | boolean | Whether to delete the evidence messages after they are saved |+| block_networks?<sup>2</sup> | [network block request](#network-block-request) object | The account's addresses to block |+| immediate? | boolean | Whether to delete the account now |-<sup>2</sup> Required when the account already has a pending deletion, including one the caller scheduled. It must equal the current `pending_deletion_at`+<sup>1</sup> Required when a deletion is already scheduled-<sup>3</sup> Enforcement basis only. Any other basis refuses it with `ENFORCEMENT_EVIDENCE_REQUIRED`--<sup>4</sup> Enforcement basis only. Any other basis refuses it with `ENFORCEMENT_NETWORK_BLOCK_NOT_ALLOWED`. Requires `ban:ip:add` and `user:view:ip`+<sup>2</sup> Only with the `enforcement` basis, with the same ACLs as on [Suspend user](#suspend-user)### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The resulting account |-| skipped_ips | array[object] | Requested addresses that were not blocked, as on [Suspend user](#suspend-user) |+| user | [Admin user](#admin-user-object) object | The closed account |+| skipped_ips | array[object] | The addresses not blocked, as on [Suspend user](#suspend-user) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The deletion schedule was stored |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY`, with one of the [validation codes](/admin-api/enforcement/#validation) |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |-| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_DECISION_OWNS_STATE` with the `decision_id`, because a decision owns the account |-| 409 | [error response](/admin-api/#error-response) | `CONFLICT`, because a pending deletion was not named, erasure has started, or the deletion state changed |--`user:delete` also allows scheduling deletion of the acting Admin or an account with broader permissions.--### Side effects+| 200 | response body | The deletion was scheduled |+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` with a [decision validation code](/admin-api/enforcement/#validation) |+| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_DECISION_OWNS_STATE` when a decision owns the account |+| 409 | [error response](/admin-api/#error-response) | `CONFLICT` when `replace_pending_deletion_at` doesn't match the scheduled deletion, or erasure has started |-The account can no longer authenticate, and its existing authentication sessions and OAuth2 access and refresh tokens are deleted. The acting Admin and the time are stored as `deletion_scheduled_by` and `deletion_scheduled_at`. Erasure is scheduled for the resulting deadline. The `X-Audit-Log-Reason` value is not stored on the account.--With the `enforcement` basis, the decision is recorded first and `enforcement_decision_id` is written in the same account write as the deadline. A suspension on the account is replaced and lifted in that write. When the rule of the reason code bars new accounts, which is every rule except the minimum age, Fluxer blocks the account's email address. For the reasons `SPAM`, `CHEATING_OR_EXPLOITATION`, `COORDINATED_RAIDING`, `AUTOMATION_OR_SELFBOT`, `SCAM_OR_SOCIAL_ENGINEERING`, `HARASSMENT_OR_BULLYING`, `BAN_EVASION`, `TOKEN_OR_CREDENTIAL_SCAM`, `HATE_SPEECH_OR_EXTREMIST_CONTENT`, `MALICIOUS_LINKS_OR_MALWARE`, and `IMPERSONATION_OR_FAKE_IDENTITY`, Fluxer also resolves the pending reports against the account. A pending report in the `child_safety`, `underage_user`, or `self_harm` category is left for a moderator and stays pending. These steps are best-effort and can fail without cancelling the deletion schedule. Restricted reasons cannot close an account.--A holder request or housekeeping deletion blocks nothing and resolves no reports.--Fluxer cancels a Stripe subscription on the account without proration and refunds the charge behind its latest invoice as fraudulent. When the cancellation or refund fails, Fluxer logs the failure and still keeps the deletion schedule.--[User Update](/gateway/events/#user-update) is emitted after the sessions have already been deleted. The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `schedule_deletion`, target type `user`, and the metadata keys `basis`, `days`, `reason_code` and `pending_deletion_at`, plus `immediate` set to `true` for an immediate deletion, whose `days` is `0`. The enforcement basis adds `decision_id`, `kind` and `notice_status`, plus `blocked_ips` and `network_blocks_until` when networks were blocked, and the other bases add `notification_sent`. A replacement adds `replaced_pending_deletion_at`, `replaced_scheduled_by`, `replaced_scheduled_at`, and `replaced_reason_code` for the schedule it replaced. The email block records its own blocklist entry. For each reason that resolves reports, Fluxer also records a second entry with action `auto_resolve_reports_on_deletion`, target type `user`, and the metadata keys `outcome`, `found_count`, `resolved_count`, `failed_count`, and `notified_count`. `found_count` leaves out the reports in the three categories that stay pending. `outcome` is `completed`, `search_unavailable` when the instance has no report search backend and every report stays pending, or `enumeration_failed` when listing the pending reports failed part way and only those already found were resolved. Each resolved report tells its reporter the `restricted` outcome [Update report](/admin-api/reports/#update-report) describes, with no public comment.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Cancel user deletion<RouteHeader method="DELETE" path="/v1/admin/users/{user_id}/deletion" auditReason />-Cancels a scheduled deletion that no enforcement decision owns, such as one the holder asked for, an inactivity deletion, or a closure from before decisions existed, and returns the resulting account. Requires `user:delete`. A closure with a decision is cancelled by [ending the decision](/admin-api/enforcement/#end-an-enforcement-decision). Erasure cannot be cancelled once it starts.--:::caution[Cancellation does not undo enforcement]-Clearing the deadline permits the account to authenticate again, but it does not restore deleted sessions, reinstate a cancelled subscription, lift the email and IP blocklist entries an older closure wrote, or reopen the reports it resolved.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Cancels a scheduled deletion that no enforcement decision owns, emails the account holder and returns the account. You need `user:delete`. The account can sign in again, but signed-out sessions stay signed out. To cancel a closure with a decision, [end the decision](/admin-api/enforcement/#end-an-enforcement-decision).### JSON body| Field | Type | Description || --- | --- | --- |-| expected_pending_deletion_at<sup>1</sup> | ISO8601 timestamp | The `pending_deletion_at` of the deletion being cancelled |--<sup>1</sup> Required. It must equal the current `pending_deletion_at`, so a cancel written against one schedule never clears a different one+| expected_pending_deletion_at | ISO8601 timestamp | The current `pending_deletion_at` |### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The resulting account |+| user | [Admin user](#admin-user-object) object | The updated account |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The deletion was cancelled |-| 400 | [error response](/admin-api/#error-response) | `NO_PENDING_DELETION`, because no deletion is scheduled |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |-| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_DECISION_OWNS_STATE` with the `decision_id`, because a decision owns the deletion |-| 409 | [error response](/admin-api/#error-response) | `CONFLICT`, because a different deletion is pending, erasure has started, or the deletion state changed |--### Side effects--The deletion schedule, its reasons, and the recorded scheduler are cleared, allowing the account to authenticate again unless another restriction applies.--When the account has an email address, Fluxer always emails the holder. A deletion with an enforcement reason code, which only a closure from before decisions can have here, sends the notice that the restriction ended. Every other deletion sends the notice that the deletion was cancelled. The email never includes the `X-Audit-Log-Reason` value.+| 200 | response body | The deletion was canceled |+| 400 | [error response](/admin-api/#error-response) | `NO_PENDING_DELETION` when nothing is scheduled |+| 409 | [error response](/admin-api/#error-response) | `ENFORCEMENT_DECISION_OWNS_STATE` when a decision owns the deletion |+| 409 | [error response](/admin-api/#error-response) | `CONFLICT` when a different deletion is scheduled or erasure has started |-[User Update](/gateway/events/#user-update) is emitted to the account's own sessions. The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `cancel_deletion`, target type `user`, the metadata keys `cancelled_pending_deletion_at`, `cancelled_scheduled_by`, `cancelled_scheduled_at`, and `cancelled_reason_code` for the cancelled schedule, and `notice` naming the email that was sent.+Fluxer sends [User Update](/gateway/events/#user-update).-### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## List user guilds<RouteHeader method="GET" path="/v1/admin/users/{user_id}/guilds" auditReason />-Lists the guilds the account is a member of, in ascending guild ID order. Requires `user:list:guilds`. Both cursors apply to the account's own sorted membership list.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Lists the guilds the account is in, by ascending guild ID. You need `user:list:guilds`. Use the last guild ID as the next `after`.### Query parameters| Field | Type | Description || --- | --- | --- |-| before?<sup>1</sup> | snowflake | Return guilds ordered before this guild ID |-| after?<sup>1</sup> | snowflake | Return guilds ordered after this guild ID |-| limit? | integer | Maximum guilds to return (1-200, default 200) |-| with_counts?<sup>2</sup> | boolean | Whether to resolve live member and presence counts (default false) |--<sup>1</sup> A cursor naming a guild the account is not a member of is ignored, and the request still succeeds. `after` is applied before `before`, and the two combine to bound a window--<sup>2</sup> Only the exact strings `true`, `True`, and `1` count as true+| before? | snowflake | Return guilds before this guild ID |+| after? | snowflake | Return guilds after this guild ID |+| limit? | integer | How many guilds to return (1-200, default 200) |+| with_counts? | boolean | Whether to include member and presence counts (default false) |### Response body| Field | Type | Description || --- | --- | --- |-| guilds<sup>1</sup> | array[[Admin guild](/admin-api/guilds/#admin-guild-object) object] | The guilds in this page that the account is a member of |--<sup>1</sup> `approximate_member_count` and `approximate_presence_count` are present only when `with_counts` resolved to true. `owner_username`, `owner_global_name`, and `owner_discriminator` are resolved by this operation and are null only for an owner account that no longer exists+| guilds | array[[Admin guild](/admin-api/guilds/#admin-guild-object) object] | The guilds in this page |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The membership page was returned |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--The response has no paging state. Derive the next cursor from the last returned guild ID, and treat a short page as the end of the list.--### Side effects+| 200 | response body | The guilds were returned |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_user_guilds`, target type `user`, the path `user_id` as target ID, and the metadata keys `limit`, `with_counts`, and `guild_count` for the guilds returned. A supplied cursor adds `before_guild_id` or `after_guild_id`. A failed request records nothing.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## List user SSO identities<RouteHeader method="GET" path="/v1/admin/users/{user_id}/sso-identities" auditReason />-Lists the single sign-on provider subjects bound to the account. Requires `user:lookup`. An account holds at most one subject, so the list is empty or has one entry unless the account was bound before the instance changed its provider.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Lists the single sign-on subjects bound to the account. You need `user:lookup`.### Response body| Field | Type | Description || --- | --- | --- |-| sso_identities | array[[Admin SSO identity](#admin-sso-identity-object) object] | Every provider subject bound to the account |+| sso_identities | array[[Admin SSO identity](#admin-sso-identity-object) object] | The subjects bound to the account |### Response@@ -1824,106 +1145,73 @@ Lists the single sign-on provider subjects bound to the account. Requires `user:| --- | --- | --- || 200 | response body | The identities were returned |-### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_user_sso_identities`, target type `user`, the path `user_id` as target ID, and the metadata key `identity_count`. A failed request records nothing.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Look up an SSO identity<RouteHeader method="GET" path="/v1/admin/sso-identities" auditReason />-Finds the account a single sign-on provider subject is bound to. Requires `user:lookup`. Use it to map a person in the identity provider to their Fluxer account.+Finds the account a single sign-on subject is bound to. You need `user:lookup`.### Query parameters| Field | Type | Description || --- | --- | --- |-| provider_id | string | The provider ID, as returned in `provider_id` (1-2048 characters) |-| subject | string | The provider subject, matched exactly (1-1024 characters) |+| provider_id | string | The provider ID (1-2048 characters) |+| subject | string | The exact provider subject (1-1024 characters) |### Response body| Field | Type | Description || --- | --- | --- |-| sso_identity | ?[Admin SSO identity](#admin-sso-identity-object) object | The bound identity, or null when no account holds the subject |+| sso_identity | ?[Admin SSO identity](#admin-sso-identity-object) object | The identity, or null when no account has the subject |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The lookup completed, whether or not an account holds the subject |--### Side effects+| 200 | response body | The lookup finished |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `lookup_sso_identity` and target type `user`. The target ID is the bound account, or `0` when none holds the subject. The metadata keys are `provider_id` and `found`. The subject is not recorded.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Bind an SSO subject to a user<RouteHeader method="PUT" path="/v1/admin/users/{user_id}/sso-identities" auditReason />-Binds a provider subject under the provider in use to the account and releases every subject bound to it before. Requires `user:update:email`. Use it when the provider sends a different subject for the same person, for example after the instance moved to a new provider that does not keep the old subjects. The person signs in to this account with the new subject from then on.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Binds a subject from the current provider to the account and releases the subjects bound before. You need `user:update:email`. Use it when the provider sends a new subject for the same person.### JSON body| Field | Type | Description || --- | --- | --- |-| subject | string | The provider subject to bind, matched exactly (1-1024 characters) |+| subject | string | The exact provider subject (1-1024 characters) |### Response body| Field | Type | Description || --- | --- | --- |-| sso_identities | array[[Admin SSO identity](#admin-sso-identity-object) object] | Every provider subject bound to the account afterwards |+| sso_identities | array[[Admin SSO identity](#admin-sso-identity-object) object] | The subjects bound to the account now |### Response| Status | Body | Condition || --- | --- | --- || 200 | response body | The subject was bound |-| 400 | [error response](/admin-api/#error-response) | `SSO_IDENTITY_LINKED_TO_ANOTHER_ACCOUNT` on `subject`, because another account that is not deleted holds the subject |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--A deleted account that holds the subject loses it to this account.--### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `link_sso_identity`, target type `user`, the path `user_id` as target ID, and the metadata key `provider_id`. The subject is not recorded.--### Rate limit+| 400 | [error response](/admin-api/#error-response) | `SSO_IDENTITY_LINKED_TO_ANOTHER_ACCOUNT` when an account that isn't deleted has the subject |-100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Release the SSO subjects of a user<RouteHeader method="DELETE" path="/v1/admin/users/{user_id}/sso-identities" auditReason />-Releases every provider subject bound to the account. Requires `user:update:email`. On an instance that stores email addresses, the next single sign-on whose verified email matches the account binds it again with whatever subject the provider sends. A subject released from a deleted account can sign in again and gets a new account, which is how an account closed by an enforcement action on a username instance lets the person back in.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Releases every subject bound to the account. You need `user:update:email`. On an email instance, the next single sign-on with a matching verified email binds the account again.### Response body| Field | Type | Description || --- | --- | --- |-| sso_identities | array[[Admin SSO identity](#admin-sso-identity-object) object] | Every provider subject still bound to the account, which is empty |+| sso_identities | array[[Admin SSO identity](#admin-sso-identity-object) object] | The subjects still bound, which is empty |### Response@@ -1931,148 +1219,92 @@ Releases every provider subject bound to the account. Requires `user:update:emai| --- | --- | --- || 200 | response body | The subjects were released |-### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `unlink_sso_identities`, target type `user`, the path `user_id` as target ID, and the metadata key `identity_count`.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Move SSO subjects to the provider in use<RouteHeader method="POST" path="/v1/admin/sso-identities/migrate" auditReason />-Moves every subject bound under an earlier provider ID to the provider in use, and each subject stays on its account. Requires `instance:config:update`. The provider ID is the issuer URL, or the authorization URL when no issuer is set, so changing either one makes every person look new to Fluxer. Run this once after such a change while the provider still sends the same subjects. Without it, a person on an email instance is refused with `SSO_ACCOUNT_LINKED_TO_ANOTHER_IDENTITY`, and a person on a username instance gets a second account.+Moves every subject from an earlier provider ID to the current one, keeping each on its account. You need `instance:config:update`. The provider ID is the issuer URL, or the authorization URL without an issuer. Run this once after you change either.### JSON body| Field | Type | Description || --- | --- | --- |-| from_provider_id | string | The provider ID the subjects are bound under now, as [List user SSO identities](#list-user-sso-identities) returns it (1-2048 characters) |+| from_provider_id | string | The earlier provider ID (1-2048 characters) |### Response body| Field | Type | Description || --- | --- | --- |-| to_provider_id | string | The provider ID in use, which the subjects were moved to |-| moved_count | integer | Subjects now bound under the provider in use |-| skipped_count | integer | Subjects left in place because another account holds them under the provider in use, or their account is gone |+| to_provider_id | string | The current provider ID |+| moved_count | integer | How many subjects were moved |+| skipped_count | integer | How many subjects were left because another account has them or their account is gone |### Response| Status | Body | Condition || --- | --- | --- || 200 | response body | The move finished |-| 400 | [error response](/admin-api/#error-response) | `from_provider_id` is the provider in use |--The request reads every subject of the earlier provider, so it takes longer on a large instance. Running it again moves what is left.--### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `migrate_sso_identities`, target type `instance_config`, target ID `0`, and the metadata keys `from_provider_id`, `to_provider_id`, `moved_count` and `skipped_count`.+| 400 | [error response](/admin-api/#error-response) | `from_provider_id` is the current provider |-### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Admin SSO identity object-One provider subject bound to an account. Deleting an account releases its subjects unless an enforcement action closed it. A subject kept that way is released at its next sign-in once the email address it sends is no longer on the email blocklist, or when [Release the SSO subjects of a user](#release-the-sso-subjects-of-a-user) is called on the deleted account.+One single sign-on subject bound to an account.### Structure| Field | Type | Description || --- | --- | --- |-| provider_id | string | The issuer URL of the provider, or its authorization URL when no issuer is configured |-| subject | string | The `sub` claim the provider sent, unchanged |-| user_id | snowflake | The account the subject is bound to |-| claimed_at | ISO8601 timestamp | The time the subject was bound to the account |--### Example--```json-{- "provider_id": "https://auth.example.com/application/o/fluxer/",- "subject": "7f3c2a9e1b",- "user_id": "1402087354120593408",- "claimed_at": "2026-09-14T08:12:44.000Z"-}-```+| provider_id | string | The provider's issuer URL, or its authorization URL without an issuer |+| subject | string | The `sub` claim the provider sent |+| user_id | snowflake | The ID of the account |+| claimed_at | ISO8601 timestamp | When the subject was bound |## List user direct message channels<RouteHeader method="GET" path="/v1/admin/users/{user_id}/dm-channels" auditReason />-Lists the direct message channels the account has taken part in. Requires `user:list:dm_channels`. The read does not open, reopen, or acknowledge a channel for the target account.--:::note[The channel classes are separate reads]-`type` selects which channel class is returned. The default returns one-to-one direct message channels, and group direct messages need a second request with `type=group_dm`.-:::--The group branch ignores `before`, `after`, and `limit`, and returns every group the account is a recipient of in one response.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Lists the direct message channels the account is in, without opening or marking any as read. You need `user:list:dm_channels`. Ask for group direct messages with `type=group_dm`, which returns all of them and ignores the paging fields.### Query parameters| Field | Type | Description || --- | --- | --- |-| type? | string | Channel class, either `dm` or `group_dm` (default `dm`) |-| before?<sup>1</sup> | snowflake | Return channels with IDs lower than this channel ID |-| after?<sup>1</sup> | snowflake | Return channels with IDs higher than this channel ID |-| limit? | integer | Maximum channels to return (1-200, default 50) |+| type? | string | `dm` or `group_dm` (default `dm`) |+| before?<sup>1</sup> | snowflake | Return channels with lower IDs |+| after?<sup>1</sup> | snowflake | Return channels with higher IDs |+| limit? | integer | How many channels to return (1-200, default 50) |-<sup>1</sup> Mutually exclusive. Supplying both fails validation even when `type` is `group_dm` and neither would be used+<sup>1</sup> Send one or the other### Response body| Field | Type | Description || --- | --- | --- |-| channels<sup>1</sup> | array[[Admin direct message channel](#admin-direct-message-channel-object) object] | The channels in this page |--<sup>1</sup> Bounded at 200 entries for `dm` and at 500 entries for `group_dm`+| channels | array[[Admin direct message channel](#admin-direct-message-channel-object) object] | The channels in this page |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The channel page was returned |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--The response has no paging state. Derive the next cursor from the last returned channel ID.--### Side effects+| 200 | response body | The channels were returned |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_user_dm_channels`, target type `user`, the path `user_id` as target ID, and the metadata keys `type` and `channel_count` for the channels returned. A `dm` request also records `limit`, and `before_channel_id` or `after_channel_id` when a cursor is supplied. A 404 records nothing.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## List user applications<RouteHeader method="GET" path="/v1/admin/users/{user_id}/applications" auditReason />-Lists the OAuth2 applications the account owns. Requires `application:lookup` or `application:list:by_owner`, the same pair [List applications](/admin-api/applications/#list-applications) accepts.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the owning account |+Lists the OAuth2 applications the account owns. You need `application:list:by_owner`.### Response body| Field | Type | Description || --- | --- | --- |-| applications<sup>1</sup> | array[[Admin application](/admin-api/applications/#admin-application-object) object] | The applications the account owns |--<sup>1</sup> Returned in full in one response. The operation accepts no query string parameters and defines no cursor+| applications | array[[Admin application](/admin-api/applications/#admin-application-object) object] | The applications the account owns |### Response@@ -2080,38 +1312,22 @@ Lists the OAuth2 applications the account owns. Requires `application:lookup` or| --- | --- | --- || 200 | response body | The applications were returned |-### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_user_applications`, target type `user`, the path `user_id` as target ID, and a metadata key `application_count`. A 404 records nothing.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## List user relationships<RouteHeader method="GET" path="/v1/admin/users/{user_id}/relationships" auditReason />-Lists the friends, friend requests, and blocked accounts of the account, split into one array for each [relationship category](#relationship-categories). Requires `user:list:relationships`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Lists the account's friends, friend requests and blocks. You need `user:list:relationships`.### Response body| Field | Type | Description || --- | --- | --- |-| friends<sup>1</sup> | array[[Admin relationship](#admin-relationship-object) object] | The mutual friendships of the account |-| incoming_requests<sup>1</sup> | array[[Admin relationship](#admin-relationship-object) object] | The friend requests the account has received |-| outgoing_requests<sup>1</sup> | array[[Admin relationship](#admin-relationship-object) object] | The friend requests the account has sent |-| blocked<sup>1</sup> | array[[Admin relationship](#admin-relationship-object) object] | The accounts this account has blocked |--<sup>1</sup> A stored [relationship type](/http-api/users/relationships/#relationship-types) outside the categories is dropped from the response--The operation accepts no cursor, category filter, or limit, and returns every category in full.+| friends | array[[Admin relationship](#admin-relationship-object) object] | The account's friends |+| incoming_requests | array[[Admin relationship](#admin-relationship-object) object] | The friend requests the account received |+| outgoing_requests | array[[Admin relationship](#admin-relationship-object) object] | The friend requests the account sent |+| blocked | array[[Admin relationship](#admin-relationship-object) object] | The accounts this account blocked |### Response@@ -2119,87 +1335,47 @@ The operation accepts no cursor, category filter, or limit, and returns every ca| --- | --- | --- || 200 | response body | The relationships were returned |-### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_user_relationships`, target type `user`, the path `user_id` as target ID, and the metadata keys `friend_count`, `incoming_request_count`, `outgoing_request_count`, and `blocked_count`. A 404 records nothing.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Clear user relationships<RouteHeader method="DELETE" path="/v1/admin/users/{user_id}/relationships" auditReason />-Removes every relationship of the account in one [relationship category](#relationship-categories) and returns the removed count. Requires `user:remove:relationship`.--`category` is required, so there is no request shape that clears every category at once.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Removes all of the account's relationships in one [category](#relationship-categories). You need `user:remove:relationship`.### Query parameters| Field | Type | Description || --- | --- | --- |-| category<sup>1</sup> | string | [Relationship category](#relationship-categories) to clear |--<sup>1</sup> Required. There is no confirmation parameter and no dry-run mode+| category | string | The [relationship category](#relationship-categories) to clear |### Response body| Field | Type | Description || --- | --- | --- |-| removed_count<sup>1</sup> | integer | The number of relationships that were removed |--<sup>1</sup> Counted from the target account's perspective, so a friendship, which both accounts store, contributes one+| removed_count | integer | How many relationships were removed |### Response| Status | Body | Condition || --- | --- | --- |-| 200<sup>1</sup> | response body | Matching relationships were removed |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--<sup>1</sup> A category with no matching relationship succeeds with a `removed_count` of zero, and still records the audit entry--Removals run one at a time, so a failure partway through leaves the earlier removals applied and answers 500.+| 200 | response body | The relationships were removed |-### Side effects+Both accounts get [Relationship Remove](/gateway/events/#relationship-remove) for a removed friendship or request, and only this account for a removed block.-Friendships and friend requests are removed for both accounts. Blocks are removed only for the target account.--When a friendship or friend request is removed, both accounts receive [Relationship Remove](/gateway/events/#relationship-remove) naming the other account. A `blocked` removal dispatches only to the target account, and ordinary delivery from the unblocked account resumes.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `remove_relationships_by_category`, target type `user`, and the metadata keys `category` and `removed_count`.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Remove user relationship<RouteHeader method="DELETE" path="/v1/admin/users/{user_id}/relationships/{target_user_id}" auditReason />-Removes one relationship row in one category. Requires `user:remove:relationship`. Returns an empty 204 response.--The operation addresses one category, so an account that is both a former friend and currently blocked needs two requests.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the account that owns the relationship |-| target_user_id | snowflake | The ID of the other account |+Removes the account's relationship with `target_user_id` in one category. You need `user:remove:relationship`.### Query parameters| Field | Type | Description || --- | --- | --- |-| category | string | [Relationship category](#relationship-categories) to remove |+| category | string | The [relationship category](#relationship-categories) to remove |### Response@@ -2207,152 +1383,77 @@ The operation addresses one category, so an account that is both a former friend| --- | --- | --- || 204 | empty | The relationship was removed |-<sup>1</sup> The same code covers an owning account that does not exist and a relationship that does not exist in the named category, so a 404 does not distinguish the two+Fluxer sends [Relationship Remove](/gateway/events/#relationship-remove) as on [Clear user relationships](#clear-user-relationships).-### Side effects--A friendship or friend request is removed for both accounts. A block is removed only for the owning account.--When a friendship or friend request is removed, both accounts receive [Relationship Remove](/gateway/events/#relationship-remove) naming the other account. A `blocked` removal dispatches only to the owning account.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `remove_relationship`, target type `user`, and the metadata keys `target_user_id` and `category`.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## List user sessions<RouteHeader method="GET" path="/v1/admin/users/{user_id}/sessions" auditReason />-Lists the account's active and terminated authentication sessions. Requires `user:list:sessions`. IP, reverse DNS and location fields also require `user:view:ip`.--:::caution[Listing sessions records an audit entry]-The entry stores the `X-Audit-Log-Reason` value whether or not the caller holds `user:view:ip`, so a listing with redacted addresses is recorded too.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Lists the account's active and ended sessions, active first and then newest first. You need `user:list:sessions`, and `user:view:ip` for the address fields.### Response body| Field | Type | Description || --- | --- | --- |-| sessions<sup>1</sup> | array[[Admin user session](#admin-user-session-object) object] | The active and terminated sessions of the account |--<sup>1</sup> Active sessions are listed before terminated ones, and each group is ordered by `created_at` descending. The operation accepts no cursor or limit and returns the complete list in one response+| sessions | array[[Admin user session](#admin-user-session-object) object] | The account's sessions |### Response| Status | Body | Condition || --- | --- | --- || 200 | response body | The sessions were returned |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |-| 503<sup>1</sup> | [error response](/admin-api/#error-response) | `SERVICE_UNAVAILABLE` when at least one session exists and every location lookup fails |--<sup>1</sup> Reachable only with `user:view:ip`, because no lookup is attempted without it. The audit entry is written after the lookups, so a request that fails this way records nothing--Without `user:view:ip` the derived fields are null and `client_ip` is the literal string `[redacted]`, so a redacted address is distinguishable from a failed lookup. With it, a partial reverse DNS or location failure yields null for that field alone.--### Side effects--This read does not mutate session state and emits no Gateway Dispatch. It makes outbound reverse DNS and geolocation lookups for each session address when the caller holds `user:view:ip`.+| 503 | [error response](/admin-api/#error-response) | `SERVICE_UNAVAILABLE` when every location lookup failed |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_user_sessions`, target type `user`, and a metadata key `session_count` counting active and terminated sessions together.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket. The other lists on this resource use the `admin:lookup` read bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Terminate user sessions<RouteHeader method="DELETE" path="/v1/admin/users/{user_id}/sessions" auditReason />-Terminates every active authentication session of the account. Requires `user:update:flags`, the same ACL as [Update user flags](#update-user-flags).--There is no operation that revokes one session. The account's Admin API keys, bot token, and OAuth2 tokens are separate credentials and are not affected.+Signs the account out of every session. You need `user:update:flags`. Admin API keys, bot tokens and OAuth2 tokens keep working.-### Path parameters+### Response body| Field | Type | Description || --- | --- | --- |-| user_id | snowflake | The ID of the target account |+| terminated_count | integer | How many sessions were ended |### Response| Status | Body | Condition || --- | --- | --- |-| 200<sup>1</sup> | [terminate sessions response](#terminate-sessions-response) | Active sessions were terminated |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |+| 200 | response body | The sessions were ended |-<sup>1</sup> An account with no live session is accepted, returns `terminated_count` 0, and still records the audit entry--#### Terminate sessions response--| Field | Type | Description |-| --- | --- | --- |-| terminated_count | integer | The number of sessions that were terminated |--:::caution[A terminated session cannot be restored]-[List user sessions](#list-user-sessions) still lists the terminated session with `deleted_at` set. The session no longer authenticates any request, and no operation reactivates it.-:::--### Side effects--Every affected client is disconnected and must authenticate again. Terminated sessions remain listed with `deleted_at` set.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `terminate_sessions`, target type `user`, and no metadata.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## List user WebAuthn credentials<RouteHeader method="GET" path="/v1/admin/users/{user_id}/webauthn-credentials" auditReason />-Lists the passkeys and security keys registered on the account, as a bare JSON array. Requires `user:update:mfa`, the same ACL as [Disable user MFA](#disable-user-mfa).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Lists the account's passkeys and security keys as a JSON array. You need `user:update:mfa`.### Response| Status | Body | Condition || --- | --- | --- |-| 200<sup>1</sup> | array[[WebAuthn credential](/http-api/users/mfa/#webauthn-credential-object) object] | The credentials were returned |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--<sup>1</sup> An account with no credential receives an empty array+| 200 | array[[WebAuthn credential](/http-api/users/mfa/#webauthn-credential-object) object] | The credentials were returned |-The complete credential set is returned in one response, bounded by the ten credentials an account may register. `credential_count` counts the returned ones. No public key, attestation object, or signature counter is exposed.--### Side effects--This read does not mutate authenticator state and emits no Gateway Dispatch. It records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_webauthn_credentials`, target type `user`, and a metadata key `credential_count`.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Delete user WebAuthn credential<RouteHeader method="DELETE" path="/v1/admin/users/{user_id}/webauthn-credentials/{credential_id}" auditReason />-Deletes one passkey or security key from the account. Requires `user:update:mfa`. Returns an empty 204 response.+Deletes one passkey or security key from the account. You need `user:update:mfa`. An unknown credential returns 404 `UNKNOWN_USER`.### Path parameters| Field | Type | Description || --- | --- | --- |-| user_id | snowflake | The ID of the target account |-| credential_id | string | WebAuthn credential ID (1-512 characters) |+| user_id | snowflake | The ID of the account |+| credential_id | string | The WebAuthn credential ID (1-512 characters) |### Response@@ -2360,72 +1461,41 @@ Deletes one passkey or security key from the account. Requires `user:update:mfa`| --- | --- | --- || 204 | empty | The credential was deleted |-<sup>1</sup> A credential that does not exist on the account also answers `UNKNOWN_USER`, so a 404 with that code does not distinguish an unknown account from an unknown credential.--:::caution[A deleted passkey cannot be restored]-The passkey or security key stops authenticating immediately and cannot be restored from its deleted record. The account holder must register it again to use it later.-:::--### Side effects--The credential record is deleted. When it was the account's final WebAuthn credential and the account had enabled passkeys as a second factor, Fluxer removes the `WEBAUTHN` [authenticator type](/http-api/users/#authenticator-types) from the account, emits [User Update](/gateway/events/#user-update) to the account's own sessions, and copies the account's authenticator types onto the bot user of every application the account owns. An account that never enabled passkeys as a second factor holds no `WEBAUTHN` type to remove.--[WebAuthn Credentials Update](/gateway/events/#webauthn-credentials-update) is emitted to the target account with its remaining credentials.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `delete_webauthn_credential`, target type `user`, and a metadata key `credential_id`.--### Rate limit+Fluxer sends [WebAuthn Credentials Update](/gateway/events/#webauthn-credentials-update), and [User Update](/gateway/events/#user-update) when the account's last passkey is removed.-100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Disable user MFA<RouteHeader method="DELETE" path="/v1/admin/users/{user_id}/mfa" auditReason />-Clears the account's TOTP authenticator, its registered authenticator type set, and its backup codes. Requires `user:update:mfa`. Returns an empty 204 response.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Removes the account's TOTP authenticator, second-factor types and backup codes. You need `user:update:mfa`. Passkeys stay registered and still sign the account in until you remove them with [Delete user WebAuthn credential](#delete-user-webauthn-credential).### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | MFA state was cleared |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |+| 204 | empty | MFA was turned off |-:::caution[Stored WebAuthn credentials survive this operation]-Clearing the authenticator type set turns passkeys off as a second factor, but the credential records remain and no [WebAuthn Credentials Update](/gateway/events/#webauthn-credentials-update) is emitted. They still answer a sudo mode challenge and a passwordless login. Remove those with [Delete user WebAuthn credential](#delete-user-webauthn-credential).-:::+Fluxer sends [User Update](/gateway/events/#user-update).-### Side effects--The account's TOTP secret, authenticator type set, and every multi-factor backup code are deleted. Fluxer clears the authenticator types of the bot user of every application the account owns. Sessions and credentials are not revoked.--[User Update](/gateway/events/#user-update) is emitted to the account's own sessions. The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `disable_mfa`, target type `user`, and no metadata.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Delete all user messages<RouteHeader method="DELETE" path="/v1/admin/users/{user_id}/messages" auditReason />-Counts every message attributed to the account, and queues their deletion when the request is not a dry run. Requires `message:delete_all`.--The request counts messages before responding, so accounts with more messages take longer. A misspelled `dry_run` parameter leaves the request a dry run.+Counts the account's messages and, unless it is a dry run, queues a [shred job](/admin-api/messages/#get-message-shred-job) that deletes them. You need `message:delete_all`. The `enforcement` basis records a content removal [decision](/admin-api/enforcement/) and sends its notice. For child safety and violent extremism reasons, use [Shred user messages](#shred-user-messages).-Only the `enforcement` basis resolves the target account, so only it answers `UNKNOWN_USER`. With another basis, or in a dry run, an ID with no matching account is accepted and matches no message.+:::danger[Deleted messages can't be restored]+Only `dry_run` set to `false`, `False` or `0` deletes messages, and any other value only counts them.+:::-### Path parameters+### Query parameters| Field | Type | Description || --- | --- | --- |-| user_id | snowflake | The ID of the message author |+| dry_run? | string | Whether to only count the messages (default `true`) |### JSON body@@ -2433,247 +1503,125 @@ Only the `enforcement` basis resolves the target account, so only it answers `UN| --- | --- | --- || basis?<sup>1</sup> | [basis](/admin-api/enforcement/#basis) object | Why the messages are removed |-<sup>1</sup> Required unless the request is a dry run, which ignores it. Without it a deletion fails with `MODERATION_BASIS_REQUIRED`. The `enforcement` basis records a content removal [decision](/admin-api/enforcement/) with `removed_all_messages` and sends its notice. It refuses child safety and violent extremism reasons with `ENFORCEMENT_KIND_NOT_ALLOWED`, because the messages cannot all be snapshotted first. Use [Shred user messages](#shred-user-messages) with the messages instead--### Query parameters--| Field | Type | Description |-| --- | --- | --- |-| dry_run?<sup>1</sup> | string | Whether the operation only counts matching messages (default `true`) |--<sup>1</sup> Whitespace is trimmed and only the exact values `false`, `False`, and `0` count as false. Every other string, including `no` and `FALSE`, counts as true+<sup>1</sup> Required unless it is a dry run### Response body| Field | Type | Description || --- | --- | --- |-| success | boolean | Whether the request succeeded, always true |-| dry_run | boolean | Whether the request only counted messages |-| channel_count<sup>1</sup> | integer | The number of channels the account has messages in |-| message_count | integer | The number of messages the walk matched |-| job_id?<sup>2</sup> | string | The ID of the queued shred job |-| decision_id?<sup>3</sup> | snowflake | The content removal decision |--<sup>1</sup> Summed for each page of 200, so a channel spanning pages is counted once per page. Treat it as an upper bound--<sup>2</sup> Present only when `dry_run` resolved to false and `message_count` is above zero--<sup>3</sup> Present only when a job was queued with the `enforcement` basis+| success | boolean | Always true |+| dry_run | boolean | Whether the request only counted |+| channel_count | integer | About how many channels have the account's messages |+| message_count | integer | How many messages matched |+| job_id? | string | The ID of the queued shred job |+| decision_id? | snowflake | The content removal decision |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The count completed, and the deletion job was queued when applicable |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY`, because the basis is missing or the [decision](/admin-api/enforcement/#validation) is invalid |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the `enforcement` basis names an account that does not exist |--:::danger[A non-dry run permanently deletes messages]-The response only confirms that the job was queued. When `dry_run` resolves to false, the background job deletes every matching message, and no operation restores them.-:::--The queued job is an ordinary shred job, so its progress, totals, skips, and failures are read through [Get message shred job](/admin-api/messages/#get-message-shred-job).--### Side effects--A dry run reads and counts only. A deletion run also queues one shred job with every matched message identity, and the request returns before any message is processed. With the `enforcement` basis the decision is stored before the job is queued.+| 200 | response body | The count finished and any job was queued |+| 400 | [error response](/admin-api/#error-response) | `MODERATION_BASIS_REQUIRED` without a basis, or a [decision validation code](/admin-api/enforcement/#validation) |-The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with target type `message_deletion`, the target account ID as its target ID, and the metadata keys `user_id`, `channel_count`, `message_count`, and `dry_run`. The action is `delete_all_user_messages_dry_run` for a dry run and `delete_all_user_messages` otherwise. A deletion run adds `basis`, `job_id` when a job was queued, and for the `enforcement` basis `decision_id`, `reason_code`, `kind` and `notice_status`.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:message:operation` bucket.+The rate limit is 100 requests per minute, on the `admin:message:operation` bucket.## Shred user messages<RouteHeader method="POST" path="/v1/admin/users/{user_id}/message-shreds" auditReason />-Queues irreversible deletion of an explicit list of message identities and returns a job ID read through [Get message shred job](/admin-api/messages/#get-message-shred-job). Requires `message:shred`.--Only the `enforcement` basis resolves the target account, so only it answers `UNKNOWN_USER`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the message author |+Queues a job that deletes the listed messages for good, with their reactions and attachments. You need `message:shred`. The job skips a message that is gone or isn't the account's, and you follow it with [Get message shred job](/admin-api/messages/#get-message-shred-job).### JSON body| Field | Type | Description || --- | --- | --- |-| entries<sup>1</sup> | array[[message shred entry](#message-shred-entry-object) object] | Explicit message identities, with 1 to 1000 values |-| basis<sup>2</sup> | [basis](/admin-api/enforcement/#basis) object | Why the messages are removed |--<sup>1</sup> Required and non-empty. Without the `enforcement` basis, the entries are not checked against the target account at submission time+| entries | array[[message shred entry](#message-shred-entry-object) object] | The messages to delete (1-1000) |+| basis<sup>1</sup> | [basis](/admin-api/enforcement/#basis) object | Why the messages are removed |-<sup>2</sup> The `enforcement` basis records a content removal [decision](/admin-api/enforcement/) and sends its notice. The first 50 entries are its evidence, every entry for child safety and violent extremism reasons, and they are checked and snapshotted before the job is queued. Each one must exist and be the target account's own, and a message in a direct or group conversation needs a linked report that covers it. `decision.evidence` is refused with `ENFORCEMENT_EVIDENCE_NOT_ALLOWED`+<sup>1</sup> The `enforcement` basis records a content removal [decision](/admin-api/enforcement/), saves the first 50 entries as evidence and sends the notice### Response body| Field | Type | Description || --- | --- | --- |-| success | boolean | Whether the request succeeded, always true |-| job_id | string | The ID of the queued shred job |-| requested<sup>1</sup> | integer | The number of submitted entries |-| decision_id?<sup>2</sup> | snowflake | The content removal decision |--<sup>1</sup> An upper bound on the messages the job shreds--<sup>2</sup> Present only for the `enforcement` basis+| success | boolean | Always true |+| job_id | string | The ID of the shred job |+| requested | integer | How many entries you sent |+| decision_id? | snowflake | The content removal decision |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The shred job was queued |-| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY`, because the basis or the [decision](/admin-api/enforcement/#validation) is invalid |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the `enforcement` basis names an account that does not exist |+| 200 | response body | The job was queued |+| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` with a [decision validation code](/admin-api/enforcement/#validation) |-:::danger[Shredding deletes messages permanently]-A shred deletes every matching message with its reactions, purges the attachments it owned, and removes it from search. Only a preceding [Create user archive](#create-user-archive) retains the original text.-:::--A failed job is not retried automatically.--### Side effects--The request returns before any message is processed. The job checks each referenced message again before it deletes it, and skips a missing message or one no longer authored by the target account.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `queue_message_shred`, target type `message_shred`, the target account ID as its target ID, and the metadata keys `user_id`, `job_id`, `requested_entries` and `basis`. The `enforcement` basis adds `decision_id`, `reason_code`, `kind` and `notice_status`.--### Rate limit--100 requests per minute for each authenticated user, on the `admin:message:operation` bucket.+The rate limit is 100 requests per minute, on the `admin:message:operation` bucket.## Cancel scheduled message deletion<RouteHeader method="DELETE" path="/v1/admin/users/{user_id}/message-deletion" auditReason />-Cancels the bulk message deletion the account holder scheduled for itself and returns the resulting account. Requires `user:cancel:bulk_message_deletion`.--[Delete all user messages](#delete-all-user-messages) queues a separate Admin job over the same messages, and cancelling this schedule leaves that job running.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Cancels the message deletion the account holder scheduled for their own account and returns the account. You need `user:cancel:bulk_message_deletion`.### Response body| Field | Type | Description || --- | --- | --- |-| user | [Admin user](#admin-user-object) object | The resulting account |+| user | [Admin user](#admin-user-object) object | The updated account |### Response| Status | Body | Condition || --- | --- | --- |-| 200<sup>1</sup> | response body | The scheduled deletion was cancelled, or the account had none |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, because the account does not exist |--<sup>1</sup> The operation is idempotent. Calling it on an account with no scheduled deletion succeeds, returns the account unchanged, and still records the audit entry--### Side effects--`pending_bulk_message_deletion_at` is cleared together with the stored channel and message counts, and the account is removed from the bulk deletion queue, so no further message is deleted. Messages already deleted by an earlier run are not restored.--No [User Update](/gateway/events/#user-update) is emitted, unlike every other mutating user operation on this page, so a connected client learns of the cancellation only on its next read. The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `cancel_bulk_message_deletion`, target type `user`, and no metadata.+| 200 | response body | The deletion was canceled, or none was scheduled |-### Rate limit--100 requests per minute for each authenticated user, on the `admin:user:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.## Create user archive<RouteHeader method="POST" path="/v1/admin/users/{user_id}/archives" auditReason />-Creates an asynchronous archive of the account's data and returns the created [archive](/admin-api/archives/#archive-object) object. Requires `archive:trigger:user`.--Archive progress, download, and expiry are documented under [Archives](/admin-api/archives/).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the archive subject |+Starts building an [archive](/admin-api/archives/) of the account's data. You need `archive:trigger:user`.### JSON body| Field | Type | Description || --- | --- | --- |-| include_attachments?<sup>1</sup> | boolean | Whether uploaded files are included (default false) |--<sup>1</sup> Including attachment binaries makes the archive larger and slower to build, and only an archive that includes them retains the original uploaded media+| include_attachments? | boolean | Whether to include uploaded files (default false) |### Response| Status | Body | Condition || --- | --- | --- |-| 200<sup>1</sup> | [archive](/admin-api/archives/#archive-object) object | The archive was queued |-| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_USER`, and no archive record or build job is created |--<sup>1</sup> The archive starts with `progress_percent` at zero and `progress_step` set to `Queued`--### Side effects--Fluxer creates the archive record and queues a build job, so the response returns before any data is collected. Generating the archive reads the account's data without changing it.+| 200 | [archive](/admin-api/archives/#archive-object) object | The archive was queued |-No Gateway Dispatch is emitted.--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `trigger_user_archive`, target type `user`, the path `user_id` as target ID, and the metadata keys `archive_id` for the created archive and `include_attachments` as `true` or `false`.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## List user change log<RouteHeader method="GET" path="/v1/admin/users/{user_id}/change-log" auditReason />-Lists the identity and contact field changes recorded for the account, newest first. Requires `user:view:contact_log`. Email values also require `user:view:email`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Lists the account's email and tag changes, newest first. You need `user:view:contact_log`, and `user:view:email` to see email values.### Query parameters| Field | Type | Description || --- | --- | --- |-| limit? | integer | Maximum entries to return (1-200, default 50) |-| page_token?<sup>1</sup> | string | Cursor returned as `next_page_token` by the previous page (1-64 characters) |--<sup>1</sup> Continues the newest-first walk, so it returns entries recorded before the cursor+| limit? | integer | How many entries to return (1-200, default 50) |+| page_token? | string | The `next_page_token` from the previous page (1-64 characters) |### Response body| Field | Type | Description || --- | --- | --- |-| entries<sup>1</sup> | array[[Admin user change log](#admin-user-change-log-object) object] | The identity and contact changes in this page |-| next_page_token<sup>2</sup> | ?string | The cursor to send as `page_token`, or null when this is the last page |--<sup>1</sup> Bounded at 200 entries, which is also the maximum `limit`--<sup>2</sup> Set only when the page returned exactly `limit` entries, so a final page that happens to be full reports a cursor whose next page is empty+| entries | array[[Admin user change log](#admin-user-change-log-object) object] | The changes in this page |+| next_page_token | ?string | The token for the next page, or null at the end |### Response| Status | Body | Condition || --- | --- | --- |-| 200<sup>1</sup> | response body | The change page was returned |--<sup>1</sup> This operation does not resolve the account, so it never answers `UNKNOWN_USER`. An ID with no matching account returns an empty page--Without `user:view:email`, an `email` entry is still returned with both value fields replaced by the literal string `[redacted]`, so the fact and the time of the change stay visible while the addresses do not.--### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_user_change_log`, target type `user`, the path `user_id` as target ID, and the metadata keys `limit` and `entry_count` for the entries returned. A supplied `page_token` adds `has_page_token` as `true`, and the cursor value is not recorded.--### Rate limit+| 200 | response body | The changes were returned |-200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.diff --git a/fluxer_docs/src/content/docs/admin-api/voice.mdx b/fluxer_docs/src/content/docs/admin-api/voice.mdxindex 0e6575a44..79f3a773e 100644--- a/fluxer_docs/src/content/docs/admin-api/voice.mdx+++ b/fluxer_docs/src/content/docs/admin-api/voice.mdx@@ -1,76 +1,49 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Admin voice-description: Manage voice regions, servers, credentials, and placement eligibility.+description: Manage voice regions, voice servers and who can use them.---import RouteHeader from '@/components/RouteHeader.astro';-A voice region is a named group of media machines, and a voice server is one machine registered inside it. Together they are the topology [Voice](/voice/) places a session into when it joins a voice channel or a call.--No operation here addresses a live session, a participant, or a track. [Get voice state counts](/admin-api/gateway/#get-voice-state-counts) reports occupancy, and [List RTC regions](/http-api/channels/#list-rtc-regions) is the caller-facing view of the same regions.--:::note[Changes apply to new placements]-Every write publishes a change notification. Each API node reloads the voice configuration when it receives that notification, a short time after the write. Placements after that reload use the new configuration. No write moves or disconnects an existing session.-:::--:::caution[A failed response can follow a successful change]-A 500 response can arrive after the configuration has changed. Read it back before retrying.-:::--## Media transport--[LiveKit](https://livekit.io) is the media transport. Each voice server record names one LiveKit deployment and the API key pair the instance authenticates to it with.--`endpoint` is that deployment's signalling URL, a `ws://` or `wss://` address. Fluxer hands it to the placed session verbatim as the `endpoint` of [Voice Server Update](/gateway/events/#voice-server-update), and the client opens its media connection there. The API rewrites the same value to `http://` or `https://` for its own room service calls, and it keeps any path prefix.--`api_key` and `api_secret` mint the 600-second grant the placed session presents, as [Voice](/voice/#media-transport) describes. The grant admits the session to exactly one room and has the track sources the member's permissions allow.--A room is one voice channel. A guild channel uses the room name `guild_{guild_id}_channel_{channel_id}` and a private call uses `dm_channel_{channel_id}`.--A participant is one voice connection, identified as `user_{user_id}_{connection_id}`. One account holding several connections in a channel is several participants. Going live publishes a screen share track from the participant that already exists, so a stream needs no second server, room, or grant.+A voice region is a group of LiveKit servers, and Fluxer places each new [voice](/voice/) session in a region and then on a server inside it. Each API node reloads the configuration shortly after a write, and a write never moves or disconnects a session that is already connected.## Placement eligibility-The stored fields below decide whether a region or a server can be chosen for one placement. Fluxer evaluates them identically on both records, and it also skips a server whenever `is_active` is false. It resolves a region first, then a server inside it, so a caller admitted to a region whose servers all refuse it cannot use that region.--`allowed_user_ids` is evaluated first and on its own. A non-empty list admits only the accounts it names and refuses every other caller whatever the remaining fields say. An empty list gates nothing.+Regions and servers have the same eligibility fields, and a session can use a server only when it is active and both the server and its region admit the session.-`vip_only`, `required_guild_features`, and `allowed_guild_ids` are guild gates. When none of the three is set, the record admits every caller that passed the user gate, including a private call, which has no guild. When any of the three is set, the record admits only a placement that has a guild. A [call](/http-api/calls/#modify-call-region) or a group direct message can then never use that region or server.+| Field | Rule |+| --- | --- |+| allowed_user_ids | When the list is not empty, only the accounts in it are admitted |+| allowed_guild_ids | Admits only these guilds, or lets them skip `vip_only` and `required_guild_features` when those are set |+| vip_only | The guild needs the `VIP_VOICE` [guild feature](/http-api/guilds/#guild-features) |+| required_guild_features | The guild needs at least one of the listed features |-With a guild present, a guild named by `allowed_guild_ids` is admitted at once and the other gates are not checked. Otherwise `vip_only` requires the guild to hold the `VIP_VOICE` [guild feature](/http-api/guilds/#guild-features), and `required_guild_features` requires the guild to hold at least one of the features it names. A guild holding none of them is refused.+When `allowed_guild_ids`, `vip_only` or `required_guild_features` is set, calls in direct messages and group direct messages can't use that region or server.## Admin voice region object-A region record has the identity a client sees, the coordinate placement measures distance from, and the eligibility fields described under [placement eligibility](#placement-eligibility). It has no capacity, no health, and no server count.--The operator supplies `id` on creation. Channels reference it through `rtc_region`, and [Modify call region](/http-api/calls/#modify-call-region) accepts it. To change an ID, create a new region and delete the old one.+You pick the `id` when you create the region, and you can't change it later. A channel's `rtc_region` is this ID.### Structure| Field | Type | Description || --- | --- | --- |-| id | string | The ID of the region, chosen by the operator and never renamed (1-64 characters) |+| id | string | The ID of the region (1-64 characters) || name | string | The name shown for the region in a client (1-100 characters) |-| emoji | string | The emoji the operator configured for the region (1-64 characters) |-| latitude | number | The latitude placement measures distance from, in decimal degrees |-| longitude | number | The longitude placement measures distance from, in decimal degrees |+| emoji | string | The emoji shown for the region (1-64 characters) |+| latitude | number | The latitude placement measures distance from |+| longitude | number | The longitude placement measures distance from || is_default<sup>1</sup> | boolean | Whether automatic placement falls back to this region |-| vip_only<sup>2</sup> | boolean | Whether the guild has to hold `VIP_VOICE` |-| required_guild_features<sup>2</sup> | array[string] | [Guild features](/http-api/guilds/#guild-features) that admit a guild, any one of which is enough (max 100) |-| allowed_guild_ids<sup>2</sup><sup>3</sup> | array[snowflake] | The guilds admitted without checking the other guild gates (max 1000) |-| allowed_user_ids<sup>3</sup> | array[snowflake] | The accounts allowed to use the region at all (max 1000) |-| created_at | ?ISO8601 timestamp | Time the region record was created, or null when the stored row has none |-| updated_at | ?ISO8601 timestamp | Time the region record last changed, or null when the stored row has none |-| servers?<sup>4</sup> | array[[Admin voice server](#admin-voice-server-object) object] | The servers registered in the region |--<sup>1</sup> The flag is not exclusive, and setting it on a second region does not clear it on the first. Each API node then uses the first flagged region in the region list it loaded as the default. When no region is flagged, it uses the first region in that list--<sup>2</sup> Setting any of these three makes the region unusable for a private call--<sup>3</sup> Duplicate entries collapse and the returned order is not the submitted order+| vip_only | boolean | Whether the guild needs `VIP_VOICE` |+| required_guild_features | array[string] | [Guild features](/http-api/guilds/#guild-features) that admit a guild (max 100) |+| allowed_guild_ids | array[snowflake] | The guilds admitted without other guild checks (max 1000) |+| allowed_user_ids | array[snowflake] | The only accounts allowed to use the region, when not empty (max 1000) |+| created_at | ?ISO8601 timestamp | When the region was created |+| updated_at | ?ISO8601 timestamp | When the region last changed |+| servers? | array[[Admin voice server](#admin-voice-server-object) object] | The servers in the region, when `include_servers` is true |-<sup>4</sup> Present only on [List voice regions](#list-voice-regions) and [Get voice region](#get-voice-region), and only when `include_servers` resolved to true. [List voice regions](#list-voice-regions) sorts the array by server identifier, and [Get voice region](#get-voice-region) returns it in the order the store yields+<sup>1</sup> To change the default, turn the flag off on the old default region too.### Example@@ -93,13 +66,7 @@ The operator supplies `id` on creation. Channels reference it through `rtc_regio## Admin voice server object-A server record names one LiveKit deployment, the API key pair the instance authenticates to it with, and its own set of eligibility fields. A server is available for placement only when its region also admits the placement.--The `region_id` and `server_id` pair addresses one server, and a server belongs to exactly one region. The same server identifier can exist in two regions. Moving a server between regions means deleting it and recreating it. Both identifiers are operator-chosen strings of 1 to 64 characters, and no operation renames either one.--A server can have its own coordinate. Placement then measures distance from that coordinate to pick the closest server for an automatically placed session. A server without one takes no part in distance comparison.--A server can also have a soft connection limit, described under [soft connection limits](#soft-connection-limits).+A voice server is one LiveKit deployment in one region, identified by its `region_id` and `server_id`. To move a server to another region, delete it and create it again. You send `api_key` and `api_secret` when you create or update a server, and no read returns them.### Structure@@ -107,77 +74,33 @@ A server can also have a soft connection limit, described under [soft connection| --- | --- | --- || region_id | string | The ID of the region the server belongs to (1-64 characters) || server_id | string | The ID of the server, unique inside its region (1-64 characters) |-| endpoint<sup>1</sup> | string | The LiveKit signalling URL the client opens its media connection to |-| latitude<sup>2</sup> | ?number | The latitude replacing this server's region coordinate, in decimal degrees, or null when the region coordinate is used |-| longitude<sup>2</sup> | ?number | The longitude replacing this server's region coordinate, in decimal degrees, or null when the region coordinate is used |-| is_active<sup>3</sup> | boolean | Whether the server is in rotation for new placement |-| soft_connection_limit<sup>5</sup> | ?integer | The count at which placement starts preferring another server, or null when the server has no limit (1-2147483647) |-| vip_only | boolean | Whether the guild has to hold `VIP_VOICE` |-| required_guild_features | array[string] | [Guild features](/http-api/guilds/#guild-features) that admit a guild, any one of which is enough (max 100) |-| allowed_guild_ids<sup>4</sup> | array[snowflake] | The guilds admitted without checking the other guild gates (max 1000) |-| allowed_user_ids<sup>4</sup> | array[snowflake] | The accounts allowed to use the server at all (max 1000) |-| created_at | ?ISO8601 timestamp | Time the server record was created, or null when the stored row has none |-| updated_at | ?ISO8601 timestamp | Time the server record last changed, or null when the stored row has none |--<sup>1</sup> An instance can configure an internal URL that the API uses for its own room service calls to one designated server. That URL changes neither the stored value nor the value the session receives--<sup>2</sup> The two coordinates are set and cleared together, and a server with only one of them cannot be stored--<sup>3</sup> Fluxer skips an inactive server when it resolves a new placement. Fluxer can still mute, deafen, change the permissions of, or disconnect a participant already on it--<sup>4</sup> Duplicate entries collapse and the returned order is not the submitted order--<sup>5</sup> The limit is a preference, not a cap. It is described under [soft connection limits](#soft-connection-limits)--:::caution[Server credentials are never returned]-`api_key` and `api_secret` are stored on the record and accepted by the create and update bodies. No read returns them, so a lost secret has to be replaced with an update.-:::--### Example--```json-{- "region_id": "europe-north",- "server_id": "europe-north-server-1",- "endpoint": "wss://voice.example.com/livekit",- "latitude": null,- "longitude": null,- "is_active": true,- "soft_connection_limit": null,- "vip_only": false,- "required_guild_features": [],- "allowed_guild_ids": [],- "allowed_user_ids": [],- "created_at": "2026-02-11T08:15:22.000Z",- "updated_at": "2026-02-11T08:15:22.000Z"-}-```+| endpoint | string | The LiveKit `ws://` or `wss://` URL that clients connect to |+| latitude | ?number | The latitude used for this server, or null to use the region's |+| longitude | ?number | The longitude used for this server, or null to use the region's |+| is_active | boolean | Whether new sessions can be placed on the server |+| soft_connection_limit | ?integer | See [soft connection limits](#soft-connection-limits), or null for none (1-2147483647) |+| vip_only | boolean | Whether the guild needs `VIP_VOICE` |+| required_guild_features | array[string] | [Guild features](/http-api/guilds/#guild-features) that admit a guild (max 100) |+| allowed_guild_ids | array[snowflake] | The guilds admitted without other guild checks (max 1000) |+| allowed_user_ids | array[snowflake] | The only accounts allowed to use the server, when not empty (max 1000) |+| created_at | ?ISO8601 timestamp | When the server was created |+| updated_at | ?ISO8601 timestamp | When the server last changed |## Soft connection limits-`soft_connection_limit` is the connection count at which a server stops being a preferred placement target. It orders the candidates for one placement and never refuses one.--Placement splits the servers it may use into those below their limit and those at or above it. It picks from the first group, and it picks from the full set when the first group is empty. A server with a null limit is always in the first group, and so is a server whose current count is unknown. A session is therefore still placed on a server past its limit when no other server can take it.--The count is the number of voice connections the gateway holds for the server, the same figure [Get voice state counts](/admin-api/gateway/#get-voice-state-counts) returns. Each API node reads it at most once every 15 seconds and places against the last reading, so a burst of placements can push a server past its limit before the next reading. A node that has no reading less than 60 seconds old places as though no server had a limit.--The count is keyed by `server_id` alone. Two servers registered in different regions under the same `server_id` share one count, and each is measured against its own limit.--The limit is read when a channel is first placed and the server is pinned for it, as [Voice](/voice/#regions) describes. Later placements into that channel inherit the pin and are not measured against the limit. Lowering or clearing a limit moves no live session.+`soft_connection_limit` is the connection count at which placement starts to prefer the region's other servers, and it never refuses a session. The count comes from [Get voice state counts](/admin-api/gateway/#get-voice-state-counts). Each API node refreshes it every 15 seconds, and a burst of joins between refreshes can go past the limit. The limit is checked when a channel's first session is placed, and later joins to that channel use the same server.## List voice regions<RouteHeader method="GET" path="/v1/admin/voice/regions" auditReason />-Returns every [Admin voice region](#admin-voice-region-object) object in ascending display name order. Requires `voice:region:list`.+Returns every [Admin voice region](#admin-voice-region-object) object, sorted by name. Requires `voice:region:list`.### Query parameters| Field | Type | Description || --- | --- | --- |-| include_servers?<sup>1</sup> | boolean | Whether each region has its servers, sorted by server identifier (default false) |--<sup>1</sup> The value is read as a string and counts as true only for `true`, `True`, or `1`, so any other value, including `yes` and `TRUE`, is false. Supplying the parameter twice makes it an array, which fails validation+| include_servers? | boolean | Whether to include each region's servers (default false) |### Response body@@ -191,13 +114,7 @@ Returns every [Admin voice region](#admin-voice-region-object) object in ascendi| --- | --- | --- || 200 | response body | The regions were returned |-### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_voice_regions`, target type `voice_region`, target ID `0`, and metadata keys `include_servers` and `result_count`.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Get voice region@@ -209,194 +126,128 @@ Returns one [Admin voice region](#admin-voice-region-object) object. Requires `v| Field | Type | Description || --- | --- | --- |-| include_servers?<sup>1</sup><sup>2</sup> | boolean | Whether the region has its servers (default true) |--<sup>1</sup> The default is true here and false on [List voice regions](#list-voice-regions)--<sup>2</sup> The value is read as a string and counts as true only for `true`, `True`, or `1`, so any other value suppresses the servers+| include_servers? | boolean | Whether to include the region's servers (default true) |### Response body| Field | Type | Description || --- | --- | --- |-| region<sup>1</sup> | ?[Admin voice region](#admin-voice-region-object) object | The region, or null when no region has the identifier |--<sup>1</sup> An unknown region answers 200 with a null region, so region existence is read from the body+| region | ?[Admin voice region](#admin-voice-region-object) object | The region, or null |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | A lookup was done, whether or not it resolved |+| 200 | response body | The region was looked up, and `region` is null when none has the ID |-### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `get_voice_region`, target type `voice_region`, target ID `0`, and metadata keys `region_id`, `include_servers`, and `found`. An unknown region records `found` as `false`.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Create voice region<RouteHeader method="POST" path="/v1/admin/voice/regions" auditReason />-Stores a region and returns it. Requires `voice:region:create`.+Creates a region, and an `id` already in use overwrites that region. Requires `voice:region:create`.### JSON body| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | string | The ID to store the region under (1-64 characters) |+| id | string | The ID of the region (1-64 characters) || name | string | The name shown for the region in a client (1-100 characters) |-| emoji | string | The emoji the operator configured for the region (1-64 characters) |-| latitude | number | The latitude placement measures distance from, in decimal degrees |-| longitude | number | The longitude placement measures distance from, in decimal degrees |+| emoji | string | The emoji shown for the region (1-64 characters) |+| latitude | number | The latitude placement measures distance from |+| longitude | number | The longitude placement measures distance from || is_default? | boolean | Whether automatic placement falls back to this region (default false) |-| vip_only? | boolean | Whether the guild has to hold `VIP_VOICE` (default false) |-| required_guild_features?<sup>2</sup> | array[string] | [Guild features](/http-api/guilds/#guild-features) that admit a guild (max 100 items, default empty) |-| allowed_guild_ids? | array[snowflake] | The guilds admitted without checking the other guild gates (max 1000, default empty) |-| allowed_user_ids? | array[snowflake] | The accounts allowed to use the region at all (max 1000, default empty) |--<sup>1</sup> The identifier is not checked for collision. Reusing the identifier of an existing region overwrites that record in full, resets its creation time to now, and replaces its `required_guild_features`, `allowed_guild_ids`, and `allowed_user_ids` arrays--<sup>2</sup> Each item is 1 to 64 characters. A value that is not a real guild feature is stored as supplied and then matches no guild+| vip_only? | boolean | Whether the guild needs `VIP_VOICE` (default false) |+| required_guild_features? | array[string] | [Guild features](/http-api/guilds/#guild-features) that admit a guild (max 100) |+| allowed_guild_ids? | array[snowflake] | The guilds admitted without other guild checks (max 1000) |+| allowed_user_ids? | array[snowflake] | The only accounts allowed to use the region, when not empty (max 1000) |### Response body| Field | Type | Description || --- | --- | --- |-| region<sup>1</sup> | [Admin voice region](#admin-voice-region-object) object | The stored region |--<sup>1</sup> The object has no `servers` member+| region | [Admin voice region](#admin-voice-region-object) object | The created region |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The region was stored |--### Side effects--Each node reloads its topology after the write. One [Admin audit entry](/admin-api/#admin-audit-entry-object) with the action `create_voice_region` and the target type `voice_region` records the region identifier and its name in metadata.+| 200 | response body | The region was created |-### Rate limit--100 requests per minute for each authenticated user, on the `admin:guild:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:guild:modify` bucket.## Update voice region<RouteHeader method="PATCH" path="/v1/admin/voice/regions/{region_id}" auditReason />-Applies a partial update to a region and returns the updated record. Requires `voice:region:update`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| region_id | string | The ID of the region (1-64 characters) |+Updates a region, and an array you send replaces the stored one. Requires `voice:region:update`.### JSON body| Field | Type | Description || --- | --- | --- || name? | string | The name shown for the region in a client (1-100 characters) |-| emoji? | string | The emoji the operator configured for the region (1-64 characters) |-| latitude? | number | The latitude placement measures distance from, in decimal degrees |-| longitude? | number | The longitude placement measures distance from, in decimal degrees |+| emoji? | string | The emoji shown for the region (1-64 characters) |+| latitude? | number | The latitude placement measures distance from |+| longitude? | number | The longitude placement measures distance from || is_default? | boolean | Whether automatic placement falls back to this region |-| vip_only? | boolean | Whether the guild has to hold `VIP_VOICE` |-| required_guild_features?<sup>1</sup> | array[string] | [Guild features](/http-api/guilds/#guild-features) that admit a guild (max 100 items of 1-64 characters each) |-| allowed_guild_ids?<sup>1</sup> | array[snowflake] | The guilds admitted without checking the other guild gates (max 1000) |-| allowed_user_ids?<sup>1</sup> | array[snowflake] | The accounts allowed to use the region at all (max 1000) |--<sup>1</sup> A supplied collection replaces the stored collection outright, so removing one entry means sending the complete remaining set and clearing a collection means sending an empty array--An `id` member in the body is overwritten from the path and never renames the region.+| vip_only? | boolean | Whether the guild needs `VIP_VOICE` |+| required_guild_features? | array[string] | [Guild features](/http-api/guilds/#guild-features) that admit a guild (max 100) |+| allowed_guild_ids? | array[snowflake] | The guilds admitted without other guild checks (max 1000) |+| allowed_user_ids? | array[snowflake] | The only accounts allowed to use the region, when not empty (max 1000) |### Response body| Field | Type | Description || --- | --- | --- |-| region<sup>1</sup> | [Admin voice region](#admin-voice-region-object) object | The updated region |--<sup>1</sup> The object has no `servers` member. Read the servers with [List voice servers](#list-voice-servers) or [Get voice region](#get-voice-region)+| region | [Admin voice region](#admin-voice-region-object) object | The updated region |### Response| Status | Body | Condition || --- | --- | --- || 200 | response body | The region was updated |-| 404 | [error response](/admin-api/#error-response) | No region has the identifier, returned as `UNKNOWN_VOICE_REGION` |--### Side effects--The write sets `updated_at` to the time it ran, and each node reloads its topology. One [Admin audit entry](/admin-api/#admin-audit-entry-object) with the action `update_voice_region` and the target type `voice_region` records the region identifier in metadata. The entry has no field diff.--### Rate limit+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_VOICE_REGION` when no region has the ID |-100 requests per minute for each authenticated user, on the `admin:guild:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:guild:modify` bucket.## Delete voice region<RouteHeader method="DELETE" path="/v1/admin/voice/regions/{region_id}" auditReason />-Deletes a region and every server registered in it. Requires `voice:region:delete`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| region_id | string | The ID of the region (1-64 characters) |+Deletes a region and every server in it. Sessions on those servers stay connected, but Fluxer can't mute or disconnect them. Requires `voice:region:delete`.-:::danger[Deleting a region deletes every server in it]-There is no confirmation step or recovery operation. Save the server configuration and credentials separately before deleting a region if they will be needed again. Server reads do not return credentials.+:::danger[Keep a copy of the server credentials]+The LiveKit API keys and secrets are deleted with the servers, and no read returns them.:::### Response body| Field | Type | Description || --- | --- | --- |-| success<sup>1</sup> | boolean | Always true |--<sup>1</sup> The value is fixed, so a client reads the status to learn whether the call succeeded+| success | boolean | Always true |### Response| Status | Body | Condition || --- | --- | --- || 200 | response body | The region was deleted |-| 404 | [error response](/admin-api/#error-response) | No region has the identifier, returned as `UNKNOWN_VOICE_REGION` |--### Side effects--After each API node reloads its topology, Fluxer can no longer mute, deafen, change the permissions of, or remove a participant on a deleted server. Existing sessions are not disconnected by the deletion itself.--One [Admin audit entry](/admin-api/#admin-audit-entry-object) with the action `delete_voice_region` and the target type `voice_region` records the region identifier and its name in metadata. No `delete_voice_server` entry is written for the servers deleted with the region.+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_VOICE_REGION` when no region has the ID |-### Rate limit--100 requests per minute for each authenticated user, on the `admin:guild:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:guild:modify` bucket.## List voice servers<RouteHeader method="GET" path="/v1/admin/voice/regions/{region_id}/servers" auditReason />-Returns every [Admin voice server](#admin-voice-server-object) object registered in one region. Requires `voice:server:list`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| region_id | string | The ID of the region (1-64 characters) |+Returns every [Admin voice server](#admin-voice-server-object) object in a region. Requires `voice:server:list`.### Response body| Field | Type | Description || --- | --- | --- |-| servers<sup>1</sup> | array[[Admin voice server](#admin-voice-server-object) object] | The servers registered in the region |--<sup>1</sup> A region with no server and an identifier naming no region both answer with an empty array+| servers | array[[Admin voice server](#admin-voice-server-object) object] | The servers in the region, empty when the region doesn't exist |### Response@@ -404,13 +255,7 @@ Returns every [Admin voice server](#admin-voice-server-object) object registered| --- | --- | --- || 200 | response body | The servers were returned |-### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `list_voice_servers`, target type `voice_server`, target ID `0`, and metadata keys `region_id` and `result_count`.--### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Get voice server@@ -422,125 +267,79 @@ Returns one [Admin voice server](#admin-voice-server-object) object. Requires `v| Field | Type | Description || --- | --- | --- |-| server<sup>1</sup> | ?[Admin voice server](#admin-voice-server-object) object | The server, or null when the pair resolves to nothing |--<sup>1</sup> An unknown server answers 200 with a null server, and an unknown region is reported the same way+| server | ?[Admin voice server](#admin-voice-server-object) object | The server, or null |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | A lookup was done, whether or not it resolved |--### Side effects--The operation records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `get_voice_server`, target type `voice_server`, target ID `0`, and metadata keys `region_id`, `server_id`, and `found`. A pair that resolves to no server records `found` as `false`.+| 200 | response body | The server was looked up, and `server` is null when none matches |-### Rate limit--200 requests per minute for each authenticated user, on the `admin:lookup` bucket.+The rate limit is 200 requests per minute, on the `admin:lookup` bucket.## Create voice server<RouteHeader method="POST" path="/v1/admin/voice/regions/{region_id}/servers" auditReason />-Registers a voice server in a region and returns it. Requires `voice:server:create`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| region_id | string | The ID of the region the server belongs to (1-64 characters) |+Adds a server to a region, and a `server_id` already in the region overwrites that server. Requires `voice:server:create`.### JSON body| Field | Type | Description || --- | --- | --- |-| server_id<sup>1</sup> | string | The ID to store the server under, unique inside the region (1-64 characters) |-| endpoint<sup>2</sup> | string | The LiveKit signalling URL the client opens its media connection to |-| api_key | string | The LiveKit API key the instance authenticates with (1-256 characters) |-| api_secret | string | The LiveKit API secret the instance authenticates with (1-256 characters) |-| latitude?<sup>3</sup> | ?number | The latitude replacing this server's region coordinate, in decimal degrees, or null to use the region coordinate |-| longitude?<sup>3</sup> | ?number | The longitude replacing this server's region coordinate, in decimal degrees, or null to use the region coordinate |-| is_active? | boolean | Whether the server is in rotation for new placement (default true) |-| soft_connection_limit?<sup>4</sup> | ?integer | The count at which placement starts preferring another server, or null for no limit (1-2147483647, default null) |-| vip_only? | boolean | Whether the guild has to hold `VIP_VOICE` (default false) |-| required_guild_features? | array[string] | [Guild features](/http-api/guilds/#guild-features) that admit a guild (max 100 items of 1-64 characters each, default empty) |-| allowed_guild_ids? | array[snowflake] | The guilds admitted without checking the other guild gates (max 1000, default empty) |-| allowed_user_ids? | array[snowflake] | The accounts allowed to use the server at all (max 1000, default empty) |--<sup>1</sup> The pair of region and server identifier is not checked for collision. Reusing an existing pair overwrites that record in full, resets its creation time to now, and replaces both stored credentials--<sup>2</sup> The value has to parse as a URL. Validation does not limit the scheme, and the client receives the value unchanged--<sup>3</sup> The two coordinates are supplied together and are either both null or both a number. A mismatched pair fails body validation on the `latitude` path--<sup>4</sup> Zero and every negative value fail validation, so a server with no limit is registered by omitting the field or sending null. [Soft connection limits](#soft-connection-limits) describes what the value does--The body has no `region_id`. A `region_id` member in the body is overwritten from the path and cannot register the server under a different region.+| server_id | string | The ID of the server, unique inside the region (1-64 characters) |+| endpoint | string | The LiveKit `ws://` or `wss://` URL that clients connect to |+| api_key | string | The LiveKit API key (1-256 characters) |+| api_secret | string | The LiveKit API secret (1-256 characters) |+| latitude?<sup>1</sup> | ?number | The latitude used for this server, or null to use the region's |+| longitude?<sup>1</sup> | ?number | The longitude used for this server, or null to use the region's |+| is_active? | boolean | Whether new sessions can be placed on the server (default true) |+| soft_connection_limit? | ?integer | See [soft connection limits](#soft-connection-limits), or null for none (1-2147483647) |+| vip_only? | boolean | Whether the guild needs `VIP_VOICE` (default false) |+| required_guild_features? | array[string] | [Guild features](/http-api/guilds/#guild-features) that admit a guild (max 100) |+| allowed_guild_ids? | array[snowflake] | The guilds admitted without other guild checks (max 1000) |+| allowed_user_ids? | array[snowflake] | The only accounts allowed to use the server, when not empty (max 1000) |++<sup>1</sup> Send both coordinates or neither### Response body| Field | Type | Description || --- | --- | --- |-| server<sup>1</sup> | [Admin voice server](#admin-voice-server-object) object | The stored server |--<sup>1</sup> Neither `api_key` nor `api_secret` appears on the object+| server | [Admin voice server](#admin-voice-server-object) object | The created server |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The server was stored |-| 400 | [error response](/admin-api/#error-response) | A non-URL endpoint or an unpaired coordinate, returned as `INVALID_FORM_BODY` |-| 404 | [error response](/admin-api/#error-response) | The identifier names no region, returned as `UNKNOWN_VOICE_REGION` |--### Side effects--Each node reloads its topology after the write. One [Admin audit entry](/admin-api/#admin-audit-entry-object) with the action `create_voice_server` and the target type `voice_server` records the region identifier, the server identifier, and the endpoint in metadata. Neither credential is recorded.--### Rate limit+| 200 | response body | The server was created |+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_VOICE_REGION` when no region has the ID |-100 requests per minute for each authenticated user, on the `admin:guild:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:guild:modify` bucket.## Update voice server<RouteHeader method="PATCH" path="/v1/admin/voice/regions/{region_id}/servers/{server_id}" auditReason />-Applies a partial update to a voice server and returns the updated record. Requires `voice:server:update`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| region_id | string | The ID of the region the server belongs to (1-64 characters) |-| server_id | string | The ID of the server (1-64 characters) |+Updates a server, and an array you send replaces the stored one. Requires `voice:server:update`.### JSON body| Field | Type | Description || --- | --- | --- |-| endpoint? | string | The LiveKit signalling URL the client opens its media connection to, which has to parse as a URL |-| api_key?<sup>1</sup> | string | The LiveKit API key the instance authenticates with (1-256 characters) |-| api_secret?<sup>1</sup> | string | The LiveKit API secret the instance authenticates with (1-256 characters) |-| latitude?<sup>2</sup> | ?number | The latitude replacing this server's region coordinate, in decimal degrees, or null to use the region coordinate |-| longitude?<sup>2</sup> | ?number | The longitude replacing this server's region coordinate, in decimal degrees, or null to use the region coordinate |-| is_active? | boolean | Whether the server is in rotation for new placement |-| soft_connection_limit?<sup>4</sup> | ?integer | The count at which placement starts preferring another server, or null for no limit (1-2147483647) |-| vip_only? | boolean | Whether the guild has to hold `VIP_VOICE` |-| required_guild_features?<sup>3</sup> | array[string] | [Guild features](/http-api/guilds/#guild-features) that admit a guild (max 100 items of 1-64 characters each) |-| allowed_guild_ids?<sup>3</sup> | array[snowflake] | The guilds admitted without checking the other guild gates (max 1000) |-| allowed_user_ids?<sup>3</sup> | array[snowflake] | The accounts allowed to use the server at all (max 1000) |--<sup>1</sup> An omitted credential is left unchanged and a supplied one replaces it. An empty string fails the length bound, so a credential can be replaced but never cleared--<sup>2</sup> The two coordinates are supplied together and are either both null or both a number. Sending both as null clears the override and returns the server to its region coordinate--<sup>3</sup> A supplied collection replaces the stored collection outright, so removing one entry means sending the complete remaining set and clearing a collection means sending an empty array+| endpoint? | string | The LiveKit `ws://` or `wss://` URL that clients connect to |+| api_key? | string | The LiveKit API key (1-256 characters) |+| api_secret? | string | The LiveKit API secret (1-256 characters) |+| latitude?<sup>1</sup> | ?number | The latitude used for this server, or null to use the region's |+| longitude?<sup>1</sup> | ?number | The longitude used for this server, or null to use the region's |+| is_active? | boolean | Whether new sessions can be placed on the server |+| soft_connection_limit? | ?integer | See [soft connection limits](#soft-connection-limits), or null for none (1-2147483647) |+| vip_only? | boolean | Whether the guild needs `VIP_VOICE` |+| required_guild_features? | array[string] | [Guild features](/http-api/guilds/#guild-features) that admit a guild (max 100) |+| allowed_guild_ids? | array[snowflake] | The guilds admitted without other guild checks (max 1000) |+| allowed_user_ids? | array[snowflake] | The only accounts allowed to use the server, when not empty (max 1000) |-<sup>4</sup> An omitted limit is left unchanged and null clears it. Zero and every negative value fail validation--A `region_id` or `server_id` member in the body is overwritten from the path and cannot move the server to another region.+<sup>1</sup> Send both coordinates or neither, and send both as null to use the region's coordinates### Response body@@ -553,52 +352,27 @@ A `region_id` or `server_id` member in the body is overwritten from the path and| Status | Body | Condition || --- | --- | --- || 200 | response body | The server was updated |-| 404 | [error response](/admin-api/#error-response) | The pair resolves to no server, returned as `UNKNOWN_VOICE_SERVER` |--### Side effects--The write sets `updated_at` to the time it ran, and each node reloads its topology and uses the stored credentials for later calls to the server. Setting `is_active` to false stops new placement and does not move sessions already on the server.--One [Admin audit entry](/admin-api/#admin-audit-entry-object) with the action `update_voice_server` and the target type `voice_server` records the region identifier and the server identifier in metadata. The entry records neither credential and no field diff, so a credential rotation is indistinguishable in the audit log from any other update.+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_VOICE_SERVER` when no server matches |-### Rate limit--100 requests per minute for each authenticated user, on the `admin:guild:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:guild:modify` bucket.## Delete voice server<RouteHeader method="DELETE" path="/v1/admin/voice/regions/{region_id}/servers/{server_id}" auditReason />-Deletes a voice server. Requires `voice:server:delete`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| region_id | string | The ID of the region the server belongs to (1-64 characters) |-| server_id | string | The ID of the server (1-64 characters) |+Deletes a server and its stored credentials. Sessions on it stay connected, but Fluxer can't mute or disconnect them. Requires `voice:server:delete`.### Response body| Field | Type | Description || --- | --- | --- |-| success<sup>1</sup> | boolean | Always true |--<sup>1</sup> The value is fixed, so a client reads the status to learn whether the call succeeded+| success | boolean | Always true |### Response| Status | Body | Condition || --- | --- | --- || 200 | response body | The server was deleted |-| 404 | [error response](/admin-api/#error-response) | The pair resolves to no server, returned as `UNKNOWN_VOICE_SERVER` |--### Side effects--Each node reloads its topology after the removal, and Fluxer can then no longer mute, deafen, change the permissions of, or remove a participant still on that server. Sessions already placed on the server are not disconnected by the deletion itself. The stored credentials are removed with the record and are not recoverable.--One [Admin audit entry](/admin-api/#admin-audit-entry-object) with the action `delete_voice_server` and the target type `voice_server` records the region identifier, the server identifier, and the endpoint the server held in metadata.--### Rate limit+| 404 | [error response](/admin-api/#error-response) | `UNKNOWN_VOICE_SERVER` when no server matches |-100 requests per minute for each authenticated user, on the `admin:guild:modify` bucket.+The rate limit is 100 requests per minute, on the `admin:guild:modify` bucket.diff --git a/fluxer_docs/src/content/docs/authentication.md b/fluxer_docs/src/content/docs/authentication.mdindex c268a039a..bc7fb2ca6 100644--- a/fluxer_docs/src/content/docs/authentication.md+++ b/fluxer_docs/src/content/docs/authentication.md@@ -1,75 +1,47 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Authentication-description: Credential syntax, token formats, authorisation outcomes, and sudo mode.+description: How to send credentials to the HTTP API and Gateway, and the errors you get when one is missing or not enough.----Send one credential in the `Authorization` header. Each operation states which [credential types](#authorization-schemes) it accepts.+Send one credential in the `Authorization` header. Each operation says which credential types it accepts. The [login and registration routes](/http-api/authentication/) and [OAuth2](/http-api/oauth2/) issue and revoke credentials.-Failures use the standard [error response](/http-api/#error-response). The [Authentication HTTP API](/http-api/authentication/) and [OAuth2 HTTP API](/http-api/oauth2/) document credential issuance and revocation.+Anyone who has a credential can act as its owner. Keep credentials out of URLs, logs and source code, and treat webhook URLs, [signed media paths](/media-proxy/overview/) and [upload capabilities](/media-proxy/upload-relay/) as secrets too.-:::caution[Credential namespaces are distinct]-Bot tokens, OAuth2 access tokens, user session tokens, Admin API keys, [upload capabilities](/media-proxy/upload-relay/), and [signed media paths](/media-proxy/overview/) are not interchangeable.-:::--## Credential handling--Anyone holding a credential can act as its owner. Keep credentials out of logs, analytics, crash reports and source code, and retain them only while needed. Use TLS on untrusted networks.--Never put an `Authorization` credential in a URL. For webhook tokens, signed media paths and upload capabilities, treat the complete URL as a secret. Do not expose it through redirects, traces or referrers.--## Authorization header--Use one of the forms below with a non-empty token and no surrounding whitespace. Scheme prefixes are case-sensitive except on the two routes noted under [Bot tokens](#bot-tokens).--### <span id="authorization-schemes"></span>Authorisation schemes+## Authorization schemes| Value | Name | Description || --- | --- | --- || `Bot <token>` | Bot token | Authenticates the application's bot account |-| `Bearer <token>` | OAuth2 access token<sup>1</sup> | Access granted by an account, limited to the token's scopes |-| `<token>` | User session token | Sent without a scheme prefix |-| `Admin <token>` | Admin API key | Accepted only below `/v1/admin`, with permissions limited by the key and its owner |+| `Bearer <token>` | OAuth2 access token | Access granted by an account, limited to the token's scopes |+| `<token>` | User session token | A logged-in user's session, also accepted as `Bearer <token>` |+| `Admin <token>` | Admin API key | Accepted only below `/v1/admin` |-<sup>1</sup> One value is handled differently. `Bearer flx_` followed by 36 alphanumeric characters authenticates the user session it names+Scheme prefixes are case-sensitive.## Token formats-Treat issued tokens as opaque values. Send them unchanged with the appropriate scheme. A bot token includes its application ID and secret as `<application_id>.<secret>`.+A bot token has the form `<application_id>.<secret>`. Don't rely on the format of any other token.:::caution[A secret is shown once]-A bot token, Admin API key or client secret cannot be read back after the response that created it. A bot token preview cannot authenticate a request.+A bot token, Admin API key or client secret can't be read back after the response that created it.:::-:::note[Rotation invalidates the previous value immediately]-Rotation applies to a bot token and a client secret, and rotating a bot token also ends every Gateway session the bot holds. An Admin API key is not rotated. It is revoked and replaced.-:::--## User session tokens--A user session token authenticates an ordinary user account. Login, registration, and session exchange in the [Authentication HTTP API](/http-api/authentication/) issue it. The Gateway accepts it in [Identify](/gateway/commands/#identify).--A [sudo mode](#sudo-mode) proof supplements the token through the separate `X-Fluxer-Sudo-Mode-JWT` header.+Rotating a bot token or client secret invalidates the old value immediately, and rotating a bot token also ends its Gateway sessions. To replace an Admin API key, revoke it and create a new one.## Bot tokens-The Gateway accepts a bot token in [Identify](/gateway/commands/#identify). The HTTP operations [`GET /v1/gateway/bot`](/http-api/gateway/#get-gateway-information) and [`GET /v1/applications/@me`](/http-api/applications/#get-bot-application) accept case-insensitive scheme prefixes. `GET /v1/applications/@me` specifically requires `Bot` and returns 401 `INVALID_TOKEN` for anything else. The [Gateway authentication](#gateway-authentication) section covers `GET /v1/gateway/bot`.--A bot cannot use an operation restricted to ordinary user accounts, and such an operation returns 403 `ACCESS_DENIED`. An operation in [Authentication](/http-api/authentication/) that resolves an account from its request body or token, such as login, password recovery, email verification, email revert, and IP authorisation, returns 403 `BOT_USER_AUTH_ENDPOINT_ACCESS_DENIED` when that account is a bot.+A bot can't use an operation restricted to user accounts and gets 403 `ACCESS_DENIED`. Login, password recovery and the other [login and registration routes](/http-api/authentication/) return 403 `BOT_USER_AUTH_ENDPOINT_ACCESS_DENIED` when the account is a bot.## OAuth2 access tokens-Every OAuth2 access token belongs to an account. Supported grants are authorisation code and refresh token. See [authorisation schemes](#authorization-schemes) for the `Bearer` syntax and user session exception.+An OAuth2 access token acts for the account that authorized it. Only operations that support OAuth2 accept access tokens, and any other user operation returns 403 `ACCESS_DENIED`.-Only operations that explicitly support OAuth2 accept access tokens. A user operation without that support returns 403 `ACCESS_DENIED` for a valid access token.--An operation that accepts both a user session token and an OAuth2 access token checks the scope only on the access token. A bearer-only operation rejects a session token, bot token, or Admin API key with 401 `UNAUTHORIZED`.--A missing scope returns 403 `MISSING_OAUTH_SCOPE`. Each operation requires its named scope exactly. The [OAuth2 HTTP API](/http-api/oauth2/) defines the supported [scopes](/http-api/oauth2/#oauth2-scopes), grants, refresh, revocation, and introspection.+An operation that accepts both a session token and an access token checks scopes only on the access token. An operation that accepts only access tokens returns 401 `UNAUTHORIZED` for any other credential, and a missing scope returns 403 `MISSING_OAUTH_SCOPE` (see [OAuth2 scopes](/http-api/oauth2/#oauth2-scopes)).### Missing OAuth2 scope body-The response body has this member alongside `code` and `message`.+The response body has this field alongside `code` and `message`.| Field | Type | Description || --- | --- | --- |@@ -77,86 +49,56 @@ The response body has this member alongside `code` and `message`.## Admin API keys-An Admin API key authenticates as its creator on routes below `/v1/admin`. Permissions are limited by both the key and its creator.--Fluxer also accepts a user session token or an OAuth2 bearer token on an Admin operation, and it accepts the bearer token only when it belongs to the built-in Admin OAuth2 application. A bearer token from any other application returns 403 `ACCESS_DENIED`. A request with a bot token returns 401 `UNAUTHORIZED`.+An Admin API key authenticates as its creator on routes below `/v1/admin`. A session token works there too, and so does an OAuth2 bearer token from the built-in Admin application. A bearer token from any other application returns 403 `ACCESS_DENIED`, and a bot token returns 401 `UNAUTHORIZED`.-Every Admin request requires the user's `admin:authenticate` ACL or wildcard, otherwise it returns 403 `MISSING_PERMISSIONS`. Key-authenticated requests also require the operation's ACLs on both the key and its owner, otherwise they return 403 `MISSING_ACL`. The [Admin API](/admin-api/) defines the ACLs and audit contract.+The user needs the `admin:authenticate` ACL or `*`, otherwise the request returns 403 `MISSING_PERMISSIONS`. A request with a key also needs the operation's ACLs on both the key and its owner, otherwise it returns 403 `MISSING_ACL`. See the [Admin API](/admin-api/).-## Authorisation outcomes+## Authorization outcomes-Each protected operation states its authentication policy:+A protected operation returns 401 `UNAUTHORIZED` for a missing, malformed, unknown, expired or revoked credential, and the response doesn't say which. A valid identity that the operation denies returns 403 `ACCESS_DENIED`.-- A user operation requires a resolved user and rejects an OAuth2 bearer credential it has not opted into. A user-only operation rejects a bot account as well.-- A bot operation accepts a bot token, which resolves the application's bot account as the request identity.-- An OAuth2 operation requires the `Bearer` scheme together with the scope it names.-- An Admin operation requires a session, Admin OAuth2 bearer, or Admin API key credential together with the required ACLs.+Requests to [threads](/http-api/threads/), [thread members](/http-api/thread-members/) and [forums](/http-api/forums/) need a bot token, or a session token with the `channel_threads` [client capability](/http-api/threads/#client-capability). Any other request to them gets 404 `NOT_FOUND` instead of 401.-Only [`GET /v1/applications/@me`](/http-api/applications/#get-bot-application) requires the `Bot` prefix itself.+A credential on an unauthenticated operation selects account-based [rate limits](/topics/rate-limits/) and can waive a [CAPTCHA](/topics/captcha/).-A credential can affect even an unauthenticated operation. It selects account-based [rate limits](/topics/rate-limits/) and can waive a [CAPTCHA](/topics/captcha/). Each operation documents any other use of the credential.--A protected operation returns 401 `UNAUTHORIZED` for a missing, malformed, unknown, expired, or revoked credential. Bot tokens on Admin operations and non-bearer credentials on bearer-only operations also return 401.--The routes with a route header on [Threads](/http-api/threads/), [Thread members](/http-api/thread-members/) and [Forums](/http-api/forums/) are the exception. A bot token reaches them with no declaration. A user request reaches them only with a session token and the `channel_threads` client capability. Any other request returns 404 `NOT_FOUND`, including one with no credential or an OAuth2 access token. [Client capability](/http-api/threads/#client-capability) defines the rule.--A valid identity denied by the operation returns 403 `ACCESS_DENIED`. An [Authentication](/http-api/authentication/) operation that resolves a bot account returns 403 `BOT_USER_AUTH_ENDPOINT_ACCESS_DENIED`, as [Bot tokens](#bot-tokens) describes.--Scope and Admin permission failures use the specific codes above. A 401 has no `WWW-Authenticate` header, so clients must inspect `code`.--Ordinary authenticated operations also apply the [account state gates](#account-state-gates).+Repeated authentication failures can get your IP banned, and retrying a rejected credential counts as one.## Single sign-on enforcement-An instance can enforce single sign-on once it is configured and enabled. While enforcement is active, these [authentication operations](/http-api/authentication/) return 403 `SSO_REQUIRED`:--- [Register an account](/http-api/authentication/#register-an-account) and [Log in with a password](/http-api/authentication/#log-in-with-a-password).-- [Get discoverable WebAuthn options](/http-api/authentication/#get-discoverable-webauthn-options) and [Authenticate with WebAuthn](/http-api/authentication/#authenticate-with-webauthn).-- [Complete login with TOTP](/http-api/authentication/#complete-login-with-totp), [Get WebAuthn MFA options](/http-api/authentication/#get-webauthn-mfa-options), and [Complete login with WebAuthn MFA](/http-api/authentication/#complete-login-with-webauthn-mfa).-- [Verify an email address](/http-api/authentication/#verify-an-email-address) and [Resend email verification](/http-api/authentication/#resend-email-verification).-- [Request password recovery](/http-api/authentication/#request-password-recovery), [Validate a password reset token](/http-api/authentication/#validate-a-password-reset-token), and [Reset a password](/http-api/authentication/#reset-a-password).-- [Revert an email change](/http-api/authentication/#revert-an-email-change).-- [Authorise an IP address](/http-api/authentication/#authorise-an-ip-address), [Resend IP authorisation](/http-api/authentication/#resend-ip-authorisation), and [Poll IP authorisation](/http-api/authentication/#poll-ip-authorisation).-- [Get username suggestions](/http-api/authentication/#get-username-suggestions).--The single sign-on callback returns the same code when the provider claims match no existing account and the instance does not auto-provision.+When an instance enforces single sign-on, these [login and registration routes](/http-api/authentication/) and account operations return 403 `SSO_REQUIRED`. Turning on enforcement doesn't end existing sessions or revoke tokens and keys.-An account linked to the provider also loses its own credentials while enforcement is active. Every [email change](/http-api/users/email-and-password/) and password change operation returns 403 `SSO_REQUIRED` for it, and so does [Update current user](/http-api/users/current-user/) when the body sets `new_password` or `email_token`. Profile edits and multi-factor management stay open, and an account with no provider link keeps its email and password operations. On an instance where people sign in with an email, each sign-in through the provider replaces the account email with the verified email the provider sends, unless another account already holds that address. Enabling it leaves an already issued session token, bot token, OAuth2 access token, or Admin API key valid.+| Group | Operations |+| --- | --- |+| Sign-in | Identify an account, password login, discoverable WebAuthn options, WebAuthn login |+| Email code sign-in | Send and verify an email code |+| Registration | Register, start and create a website account |+| Multi-factor login | TOTP, WebAuthn MFA options, WebAuthn MFA |+| Email | Verify, resend verification, revert an email change |+| Recovery | Request, validate and reset a password, recover an account |+| IP authorization | Authorize, resend, poll |+| Account | Change password, create a recovery kit |+| Other | Get username suggestions, check username availability |-## Account state gates+The single sign-on callback returns the same code when the provider claims match no account and the instance doesn't create accounts automatically.-A [limited account](/http-api/users/#account-limitation) keeps its credentials and sessions. The operations listed there return 403 `ACCOUNT_LIMITED`, and every other operation accepts the account as usual.+An account linked to the provider can't change its email or password while enforcement is active. [Email and password](/http-api/users/email-and-password/) operations return 403 `SSO_REQUIRED`, and so does [Update current user](/http-api/users/current-user/) when the body sets `new_password` or `email_token`.-An account that still has to [set its date of birth](/http-api/users/current-user/#set-date-of-birth) gets 403 `DATE_OF_BIRTH_REQUIRED` from most operations until it does. An account that is not yet verified can be refused operations that reach other people, as described under [account tiers](/http-api/users/#account-tiers).+## Account restrictions-No shared gate rejects a deleted or disabled account. Each operation that reads account state applies its own rule, and login, password, and email operations refuse a deleted account outright.--## Failed authentication--Authentication errors do not distinguish between unknown, expired, revoked, or malformed credentials. See [authorisation outcomes](#authorisation-outcomes) for response codes.--Repeated authentication failures can result in an IP ban. Stop retrying a rejected credential and obtain a new one.+A [limited account](/http-api/users/#account-limitation) gets 403 `ACCOUNT_LIMITED` on the operations listed there. An account that still has to [set its date of birth](/http-api/users/current-user/#set-date-of-birth) gets 403 `DATE_OF_BIRTH_REQUIRED` from most operations. An unverified account can be refused operations that involve other people, as [account tiers](/http-api/users/#account-tiers) describe.## Sudo mode-Sudo mode is a short-lived proof that the account holder recently re-verified a credential. Each operation that requires it states that on its own page, and [Multi-factor authentication](/http-api/users/mfa/#sudo-mode) defines the accepted proofs, the [sudo verification object](/http-api/users/mfa/#sudo-verification-object) fields, and the [sudo mode methods object](/http-api/users/mfa/#sudo-mode-methods-object) returned with 403 `SUDO_MODE_REQUIRED`.+Sudo mode is a recent proof that the account holder re-verified a credential. An operation that needs it says so, and without a valid proof it returns 403 `SUDO_MODE_REQUIRED`. Send the proof as [sudo verification object](/http-api/users/mfa/#sudo-verification-object) fields in the body.-A sudo proof lasts five minutes. Present it in the `X-Fluxer-Sudo-Mode-JWT` request header. An invalid, expired, or account-mismatched token produces the same response as a missing one.+After a TOTP, passkey or emailed-code proof, the response returns a token in the `X-Fluxer-Sudo-Mode-JWT` header. Send it in that request header for five minutes to skip the proof. An account that proves sudo mode with its password gets no token and sends the password each time.-Fluxer issues a token for an account holding a TOTP secret or a registered WebAuthn credential, and after an emailed code. A password-only account that proves sudo mode with its password re-verifies for each operation that requires it. A passkey counts here whether or not the account enabled passkeys as a second factor. The `methods` object reports `totp`, `webauthn`, and `backup_codes`, and an account holding no TOTP secret presents an unconsumed backup code under `mfa_method` of `totp`. [Create WebAuthn registration options](/http-api/users/mfa/#create-webauthn-registration-options) and [Disable current account](/http-api/users/current-user/#disable-current-account) issue no sudo token and return no `X-Fluxer-Sudo-Mode-JWT` response header, even for an account that can prove a credential. A bot account satisfies sudo mode immediately. So does an account that has no password, no TOTP secret, no registered WebAuthn credential and no confirmed email address. An account without those but with a confirmed address proves sudo mode with an [emailed code](/http-api/users/mfa/#send-a-sudo-email-code).--:::note[A sudo proof covers every account session]-Revoking the session that obtained a proof leaves that proof valid until it expires.-:::+A bot account, or an account with no password, TOTP secret, WebAuthn credential or confirmed email, passes sudo mode without a proof. An account with only a confirmed email proves it with an [emailed code](/http-api/users/mfa/#send-a-sudo-email-code). [Multi-factor authentication](/http-api/users/mfa/#sudo-mode) covers the accepted proofs and the [sudo mode methods object](/http-api/users/mfa/#sudo-mode-methods-object).## Gateway authentication-Send a bot token or user session token in the [Identify command](/gateway/commands/#identify), not an `Authorization` header. An invalid or revoked credential closes the connection with [code `4004`](/gateway/opcodes-and-close-codes/#close-codes). A missing `token` closes with `4002` and reason `Invalid identify payload`.--The HTTP [Get Gateway information](/http-api/gateway/#get-gateway-information) endpoint checks only the bot token's form. A successful response does not prove the token is valid.--## Other credential surfaces+Send a bot token or user session token in [Identify](/gateway/commands/#identify). An invalid or revoked credential closes the connection with [code `4004`](/gateway/opcodes-and-close-codes/#close-codes), and a missing `token` closes it with `4002`.-A webhook execution operation has the webhook identifier and token in its request path, and it accepts no `Authorization` credential. [Webhooks](/http-api/webhooks/) defines its contract.+## Webhooks and media-The [Media Proxy API](/media-proxy/overview/) does not read the `Authorization` header on an ordinary media or relay route. A stored object is addressed by its path, external media is authorised by its path signature, and a relay request is authorised by the capability embedded in its URL. [Upload relay](/media-proxy/upload-relay/) defines the capability contract.+[Webhook](/http-api/webhooks/) execution takes the webhook ID and token in the path and accepts no `Authorization` credential. The [Media Proxy](/media-proxy/overview/) ignores the `Authorization` header. A stored object is public at its path, external media needs a path signature, and a relay request needs the [upload capability](/media-proxy/upload-relay/) in its URL.diff --git a/fluxer_docs/src/content/docs/downloads/desktop.md b/fluxer_docs/src/content/docs/downloads/desktop.mdindex 11688d298..4c9bf903a 100644--- a/fluxer_docs/src/content/docs/downloads/desktop.md+++ b/fluxer_docs/src/content/docs/downloads/desktop.md@@ -1,49 +1,44 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Desktop builds-description: Paths for desktop installers, checksums and the update feeds each platform reads.+description: Download paths for Fluxer desktop builds, their SHA-256 checksums and the update feeds.----Every desktop path below is served from `https://pkgs.fluxer.com` and is built from four coordinates.+Desktop builds are on `https://pkgs.fluxer.com`, and you can download them without signing in. Each path has a channel (`stable` or `canary`), a platform, an architecture (`x64` or `arm64`) and, for a file, a format from the table below.-| Coordinate | Values |-| --- | --- |-| `channel` | `stable`, `canary` |-| `platform` | `darwin`, `linux`, `win32` |-| `arch` | `x64`, `arm64` |-| `format` | `dmg`, `zip`, `setup`, `portable`, `appimage`, `deb`, `rpm`, `tar_gz` |--A format is only published for the platform it belongs to. `dmg` and `zip` are macOS, `setup` and `portable` are Windows, and the other four are Linux.+| Platform | Path value | Formats |+| --- | --- | --- |+| macOS | `darwin` | `dmg`, `zip` |+| Windows | `win32` | `setup`, `portable` |+| Linux | `linux` | `appimage`, `deb`, `rpm`, `tar_gz` |-## Release metadata+## Latest version```GET /desktop/{channel}/{platform}/{arch}/latest```-`latest` returns a JSON document naming the current version, its publication date, and a per-format URL and SHA256.+Returns JSON with the current `version`, its `pub_date` and a `files` object that gives each format's `url` and `sha256`.-## Artifacts+## Downloads```GET /desktop/{channel}/{platform}/{arch}/{version}/{format}GET /desktop/{channel}/{platform}/{arch}/{version}/{format}.sha256+GET /desktop/{channel}/linux/{arch}/{version}/appimage.zsync```-`version` is either a published version or the literal `latest`, which resolves to the current one. The `.sha256` sibling holds the checksum for the artifact beside it.--Linux AppImage builds also publish a zsync control file, so `AppImageUpdate`, `AppImageLauncher` and Gear Lever can fetch only the blocks that changed:+`version` is a release version such as `2026.904.135113`, or `latest` for the newest one. Add `.sha256` to a download path to get the file's SHA-256 checksum. For example, `https://pkgs.fluxer.com/desktop/stable/win32/x64/latest/setup` downloads the newest Windows installer.-```-GET /desktop/{channel}/linux/{arch}/{version}/appimage.zsync-```+AppImage builds also have an `appimage.zsync` file, which AppImage update tools use to download only the blocks that changed.## Update feeds-Each platform's updater reads the feed its own framework expects, beside the artifacts:+The macOS and Windows desktop apps check these files in `/desktop/{channel}/{platform}/{arch}/` for updates.| Platform | Feed || --- | --- || macOS | `RELEASES.json`, `releases.json` || Windows | `RELEASES`, `releases.win.json`, `assets.win.json` |-| All | `manifest.json`, `version.json`, `latest.json` |++Linux has no update feed. Installed packages update through the [Linux repositories](/downloads/linux-repositories/).diff --git a/fluxer_docs/src/content/docs/downloads/linux-repositories.md b/fluxer_docs/src/content/docs/downloads/linux-repositories.mdindex 6edf9cd75..4447096fb 100644--- a/fluxer_docs/src/content/docs/downloads/linux-repositories.md+++ b/fluxer_docs/src/content/docs/downloads/linux-repositories.md@@ -1,16 +1,21 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Linux repositories-description: The apt, dnf, pacman and Flatpak repositories Fluxer publishes, and how a client adds them.+description: How to add the apt, dnf, pacman and Flatpak repositories Fluxer publishes.----Fluxer publishes four Linux repositories. In every one the package is `fluxer` for stable and `fluxer-canary` for canary. The apt and dnf entrypoints each subscribe to one channel, so the file you install decides which of the two you track. pacman and Flatpak work the other way. One repository serves both channels, and the package name or application id selects it.+Fluxer publishes apt, dnf, pacman and Flatpak repositories, all signed with the key whose fingerprint is `09D01339EE128925F75E675C855C5BDE34D205D2`. You pick the channel with the entry file on apt and dnf, by package name on pacman and by app ID on Flatpak.-## apt+| Package manager | Pick stable with | Pick canary with |+| --- | --- | --- |+| apt | `fluxer.sources` | `fluxer-canary.sources` |+| dnf | `fluxer.repo` | `fluxer-canary.repo` |+| pacman | `fluxer` | `fluxer-canary` |+| Flatpak | `app.fluxer.Fluxer` | `app.fluxer.FluxerCanary` |-One repository serves Debian and Ubuntu. It uses the standard `dists` and `pool` layout, publishes both SHA256 and SHA512 by-hash indexes, and is signed.+## Debian and Ubuntu-```+```shsudo install -d -m 0755 /etc/apt/keyringssudo curl -fsSL -o /etc/apt/keyrings/fluxer-archive-keyring.gpg \https://pkgs.fluxer.com/keys/fluxer-archive-keyring.gpg@@ -19,52 +24,41 @@ sudo curl -fsSL -o /etc/apt/sources.list.d/fluxer.sources \sudo apt update && sudo apt install fluxer```-For the canary channel, add `fluxer-canary.sources` and install `fluxer-canary`.+A `.deb` you downloaded only gets updates after you add the entry for its channel. For canary, add the canary entry and install `fluxer-canary`.-```+```shsudo curl -fsSL -o /etc/apt/sources.list.d/fluxer-canary.sources \https://pkgs.fluxer.com/deb/fluxer-canary.sourcessudo apt update && sudo apt install fluxer-canary```-The stable entry does not list `fluxer-canary`. A canary `.deb` installed from a download stays on its version until the canary entry is added.--The `.sources` entry uses `Signed-By` rather than `Trusted: yes`, so `apt update` verifies the repository and prints nothing.+## Fedora and RHEL-## dnf+RHEL, Rocky, Alma and CentOS Stream need `sudo dnf install epel-release` first, because the package depends on `libXScrnSaver`.-One repository serves Fedora and the RHEL family, split by channel and architecture. It is signed, with both `gpgcheck` and `repo_gpgcheck` enabled.--```+```shsudo curl -fsSL -o /etc/yum.repos.d/fluxer.repo \https://pkgs.fluxer.com/rpm/fluxer.repo-sudo rpm --import https://pkgs.fluxer.com/keys/fluxer-archive-keyring.ascsudo dnf install fluxer```-The `.repo` file names the signing key by URL, so dnf fetches it rather than needing the keyring step the apt entry has. Without the `rpm --import` line dnf asks to import twice on a first install, once for the repository metadata and once for the package. With it dnf asks once, for the metadata, which dnf keeps in its own key store. Both prompts print the fingerprint, which reads `09D01339EE128925F75E675C855C5BDE34D205D2`.+dnf asks you to import the signing key on the first install, once for the repository and once for the package. Check that the fingerprint matches the one above both times.-For the canary channel, add `fluxer-canary.repo` and install `fluxer-canary`.+For canary, add the canary entry and install `fluxer-canary`.-```+```shsudo curl -fsSL -o /etc/yum.repos.d/fluxer-canary.repo \https://pkgs.fluxer.com/rpm/fluxer-canary.reposudo dnf install fluxer-canary```-Metadata expires after six hours, so a freshly published build becomes visible within that window, or immediately with `dnf --refresh upgrade`.--:::caution[RHEL, Rocky, Alma and CentOS Stream need EPEL]-The package depends on `libXScrnSaver`, which the EL base repositories do not ship. Run `sudo dnf install epel-release` first. Fedora does not need this.-:::--## pacman+dnf keeps the repository metadata for six hours, so a new build can take up to six hours to show up. Run `sudo dnf --refresh upgrade` to check sooner.-One repository named `fluxer` holds both channels. It is signed, and pacman verifies both the sync database and every package.+## Arch Linux-pacman has no per-repository key setting, so the signing key goes into the pacman keyring once:+Add the signing key to the pacman keyring once, or pacman refuses the repository with `unknown trust`.-```+```shsudo pacman-key --initcurl -fsSL -o /tmp/fluxer-archive-keyring.asc \https://pkgs.fluxer.com/keys/fluxer-archive-keyring.asc@@ -72,42 +66,28 @@ sudo pacman-key --add /tmp/fluxer-archive-keyring.ascsudo pacman-key --lsign-key 09D01339EE128925F75E675C855C5BDE34D205D2```-`--lsign-key` is the step that makes pacman trust the key. Without it the key sits in the keyring and pacman still refuses the repository with `unknown trust`. The fingerprint above is the one Fluxer uses for apt and dnf as well.--Then add the repository:+Then add the repository and install `fluxer` or `fluxer-canary`.-```+```shsudo tee -a /etc/pacman.conf >/dev/null <<'REPO'[fluxer]SigLevel = Required TrustedOnlyServer = https://pkgs.fluxer.com/arch/$repo/os/$archREPO-sudo pacman -Syu --noconfirm fluxer+sudo pacman -Syu fluxer```-Install `fluxer-canary` instead for the canary channel. Both come from this one repository and install alongside each other.--Write `$repo` and `$arch` literally. Both are pacman variables, not shell ones, which is why the heredoc above is quoted. `$repo` expands to the section name, so the `Server` line needs no editing.--`Required TrustedOnly` is pacman's built-in default written out in full. Arch ships `Required DatabaseOptional` in `/etc/pacman.conf` because the official repositories do not sign their databases. Fluxer signs both the database and every package, so leaving the `SigLevel` line out would inherit that weaker default rather than match the line above.--A pacman sync database records one version per package name, so only the current release is installable by name. An older build is still served, and `curl` followed by `pacman -U ./<file>` installs it.-## Flatpak-One remote named `fluxer` serves both application ids, `app.fluxer.Fluxer` and `app.fluxer.FluxerCanary`.+Stable is also on Flathub as `app.fluxer.Fluxer`, but canary is only in the Fluxer repository. The reference file adds a remote called `fluxer` and installs the app.-```+```shflatpak install https://pkgs.fluxer.com/flatpak/fluxer.flatpakref```-Use `fluxer-canary.flatpakref` for the canary channel. The reference file names the remote and resolves the runtime the application builds against, so this works on a machine with no remotes configured.--Once the remote exists, either application installs by id:+For canary, use the canary reference file.+```sh+flatpak install https://pkgs.fluxer.com/flatpak/fluxer-canary.flatpakref```-flatpak install fluxer app.fluxer.FluxerCanary-```--The reference file names the signing key, so flatpak configures the remote verified and imports the key. `fluxer.flatpakrepo` does the same, so `flatpak remote-add` from that URL needs no flag either. Adding the bare repository URL skips both files: flatpak still turns verification on but has no key to check against, so that route needs `--gpg-import` or `--no-gpg-verify`.diff --git a/fluxer_docs/src/content/docs/downloads/overview.md b/fluxer_docs/src/content/docs/downloads/overview.mdindex ed5dab616..99b026631 100644--- a/fluxer_docs/src/content/docs/downloads/overview.md+++ b/fluxer_docs/src/content/docs/downloads/overview.md@@ -1,32 +1,27 @@---# SPDX-License-Identifier: AGPL-3.0-or-later-title: Package origin overview-description: The public origin that serves Fluxer desktop builds and Linux package repositories.+title: Downloads overview+description: Where Fluxer publishes desktop builds and Linux package repositories.----Fluxer publishes every desktop build and every Linux package repository to one public origin, `https://pkgs.fluxer.com`. It is a static file origin. It serves bytes and nothing else, it needs no credential, and it declares no rate limit bucket.+Fluxer publishes desktop builds and Linux package repositories at `https://pkgs.fluxer.com`. You don't need to sign in to download anything.++| Page | What it has |+| --- | --- |+| [Desktop builds](/downloads/desktop/) | Fetch a build by channel, platform, architecture and version |+| [Linux repositories](/downloads/linux-repositories/) | Commands to add the apt, dnf, pacman and Flatpak repositories |## Channels-Every path names a channel, either `stable` or `canary`. The two are published independently and never share a file. The package name follows the channel: `fluxer` on stable, `fluxer-canary` on canary. A machine may install both at once.+Every build is published to either the `stable` or the `canary` channel. The apt, dnf and pacman packages are called `fluxer` on stable and `fluxer-canary` on canary, and you can install both on one machine.-## What the origin serves+## Paths| Prefix | Contents || --- | --- |-| `/desktop/` | Desktop installers, checksums and update feeds |-| `/flatpak/` | An ostree repository holding both application ids |-| `/arch/` | A pacman repository, one directory per architecture |-| `/deb/` | An apt repository in the `dists` and `pool` layout |-| `/rpm/` | A dnf repository, one directory per channel and architecture |-| `/keys/` | The public signing key for every repository |--## What it guarantees--The origin answers `Range`, `If-Range` and `If-None-Match` on every artifact, so a client may resume an interrupted download and revalidate a cached one. It never lists a directory. A request for a path that does not exist returns 404 with no body.--Artifacts under a version directory never change once published, so they are cached for a year. The files that move when a release ships, the `latest` documents and every repository index, are cached for minutes.--## Signing--Every repository is signed with one key. `/keys/` publishes it as `fluxer-archive-keyring.asc`, and as `fluxer-archive-keyring.gpg` for apt. [Linux repositories](/downloads/linux-repositories/) shows how each repository gets the key.+| `/desktop/` | [Desktop builds](/downloads/desktop/) |+| `/flatpak/` | [The Flatpak repository](/downloads/linux-repositories/#flatpak) |+| `/arch/` | [The pacman repository](/downloads/linux-repositories/#arch-linux) |+| `/deb/` | [The apt repository](/downloads/linux-repositories/#debian-and-ubuntu) |+| `/rpm/` | [The dnf repository](/downloads/linux-repositories/#fedora-and-rhel) |+| `/keys/` | [The public signing key](/downloads/linux-repositories/) for every repository |diff --git a/fluxer_docs/src/content/docs/gateway/commands.md b/fluxer_docs/src/content/docs/gateway/commands.mdindex c1b9a37a1..fee1a82d9 100644--- a/fluxer_docs/src/content/docs/gateway/commands.md+++ b/fluxer_docs/src/content/docs/gateway/commands.md@@ -1,50 +1,36 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Client commands-description: Every main Gateway client command, its payload, bounds, result, and close behaviour.+description: The Gateway commands a client sends, with their payloads, results and close behavior.----Clients send commands over the [Gateway](/gateway/overview/) WebSocket, with an integer [opcode](/gateway/opcodes-and-close-codes/#opcodes) in `op` and the command data in `d`. A command can produce a [Dispatch](/gateway/events/), a close frame, or no response.--Except for [Heartbeat](#heartbeat), [Identify](#identify), and [Resume](#resume), every command needs an authenticated session. Sending one too early closes with `4003` and reason `Not authenticated`. Heartbeat and Resume are accepted in any open state, and Identify is accepted only while the connection is unauthenticated.--## Command index+Clients send commands over the [Gateway](/gateway/overview/) WebSocket as JSON with an [opcode](/gateway/opcodes-and-close-codes/#opcodes) in `op` and the data in `d`. Every command except Heartbeat, Identify and Resume needs an authenticated session, and sending one earlier closes with `4003` and reason `Not authenticated`.| Opcode | Command | Result || --- | --- | --- |-| 1 | Heartbeat | Opcode `11` Heartbeat ACK |-| 2 | Identify | [Ready](/gateway/events/#ready), a close frame, or no response when Fluxer discards a rate-limited Identify or holds it to retry the session start |-| 3 | Presence Update | No direct response |-| 4 | Voice State Update | [Voice State Update](/gateway/events/#voice-state-update) and [Voice Server Update](/gateway/events/#voice-server-update) when state changes, or [Gateway Error](/gateway/opcodes-and-close-codes/#gateway-error) for a reported refusal |-| 6 | Resume | Replayed Dispatches followed by [Resumed](/gateway/events/#resumed), Invalid Session, or a close frame |-| 13 | Voice Signal | [Voice Signal](/gateway/events/#voice-signal) for the target connection's session, or no response |-| 8 | Request Guild Members | One or more [Guild Members Chunk](/gateway/events/#guild-members-chunk) events |-| 14 | Lazy Request | [Guild Sync](/gateway/events/#guild-sync), [Guild Member List Update](/gateway/events/#guild-member-list-update), [Thread List Sync](/gateway/threads/#thread-list-sync), and [Thread Member List Update](/gateway/threads/#thread-member-list-update) |-| 15 | Request Guild Counts | [Guild Counts Update](/gateway/events/#guild-counts-update) |-| 16 | Request Channel Member Counts | [Channel Member Counts Update](/gateway/events/#channel-member-counts-update) |+| 1 | [Heartbeat](#heartbeat) | Opcode `11` Heartbeat ACK |+| 2 | [Identify](#identify) | [Ready](/gateway/events/#ready), a close frame, or no response while Fluxer holds a rate-limited Identify |+| 3 | [Presence Update](#presence-update) | None |+| 4 | [Voice State Update](#voice-state-update) | [Voice State Update](/gateway/events/#voice-state-update) and [Voice Server Update](/gateway/events/#voice-server-update) |+| 6 | [Resume](#resume) | Replayed Dispatches and [Resumed](/gateway/events/#resumed), Invalid Session, a close frame, or no response while rate limited |+| 8 | [Request Guild Members](#request-guild-members) | [Guild Members Chunk](/gateway/events/#guild-members-chunk) |+| 13 | [Voice Signal](#voice-signal) | [Voice Signal](/gateway/events/#voice-signal) for the target connection |+| 14 | [Lazy Request](#lazy-request) | [Guild Sync](/gateway/events/#guild-sync) and member list and thread list updates |+| 15 | [Request Guild Counts](#request-guild-counts) | [Guild Counts Update](/gateway/events/#guild-counts-update) |+| 16 | [Request Channel Member Counts](#request-channel-member-counts) | [Channel Member Counts Update](/gateway/events/#channel-member-counts-update) || 28 | [Request Forum Unreads](/gateway/threads/#request-forum-unreads) | [Forum Unreads](/gateway/threads/#forum-unreads) |-## Payload handling--A frame that fails the size, decompression, or decoding checks closes the connection without consuming any budget. A frame that decodes to something other than an object closes with `4002` and reason `Decode failed`, and an object with no `op` closes with `4002` and reason `Invalid payload`.--Fluxer charges every command that gets past those checks against the [source IP, session, and connection payload budgets](/gateway/limits-and-rate-limits/#connection-and-command-rate-limits) before it handles the opcode. Each session has its own session budget, so two sessions of one account never share one, and Fluxer skips that budget while the connection is unauthenticated.--An opcode outside the registry closes with `4001` and reason `Unknown opcode` once a session is attached, and with `4003` while the connection is unauthenticated. A payload that has `op` but no `d` also closes with `4001`, except for Identify, which closes with `4005`. [Request Forum Unreads](/gateway/threads/#request-forum-unreads) closes with `4001` for a `d` that is not an object and for a user session without `CHANNEL_THREADS`.--A Boolean command field is set only by `true`, and by the string `"true"` where noted. Every other value resolves to false, except in the Lazy Request [guild subscription object](#guild-subscription-object), which states its own rule.+A frame that does not decode to an object closes with `4002` and reason `Decode failed`, and an object with no `op` closes with `4002` and reason `Invalid payload`. Once the session is authenticated, an unknown opcode closes with `4001` and reason `Unknown opcode`. A payload with `op` but no `d` does the same, except Identify and Resume, which close with `4005` and reason `Already authenticated`. Every command counts against the [payload budgets](/gateway/limits-and-rate-limits/#connection-and-command-rate-limits).-:::note[Most command payloads are permissive]-Identify, Resume, and Presence Update reject a malformed payload with a close. The [bounded query commands](#bounded-requests) coerce or discard whatever they cannot parse, so a wrong field type usually produces an empty result.-:::+The [bounded commands](#bounded-requests) never close the connection, and they skip input they cannot parse.## Heartbeat-Opcode `1` has the last Dispatch sequence the client processed, or `null` before the first Dispatch.+Opcode `1` sends the last Dispatch sequence the client processed, or `null` before the first Dispatch. See [Gateway overview](/gateway/overview/#heartbeats) for the timing.| Field | Type | Description || --- | --- | --- |-| d | ?integer | The last Dispatch sequence the client processed, or null before the first Dispatch |+| d | ?integer | The last Dispatch sequence the client processed |```json{@@ -53,13 +39,7 @@ Opcode `1` has the last Dispatch sequence the client processed, or `null` before}```-Before authentication the Gateway accepts any `d` value and sends Opcode `11`. A payload with no `d` key closes with `4001` and reason `Unknown opcode`.--Once authenticated, a `d` that is neither `null` nor an integer closes with `4007` and reason `Invalid sequence`. Every integer is accepted, but acknowledgements never move backwards. Dispatches at or below the highest acknowledged sequence are no longer available for Resume.--When the session ends, Fluxer sends Opcode `9` with `d: false`, after which heartbeats are acknowledged again. A heartbeat that arrives in the short window between the session ending and that frame closes with `4007`.--See [Gateway overview](/gateway/overview/#heartbeats) for the timing contract.+Once authenticated, a `d` that is neither `null` nor an integer closes with `4007` and reason `Invalid sequence`.## Identify@@ -70,18 +50,18 @@ Opcode `2` authenticates and creates a new session.| token | string | The account or bot token, with no HTTP authentication prefix || properties | [identify properties](#identify-properties-object) object | The software and capabilities of the connecting client || presence?<sup>1</sup> | ?[initial presence](#initial-presence-object) object | The presence to publish when the session starts |-| ignored_events?<sup>2</sup> | ?array[string] | The Dispatch event names this session does not want, at most 256 entries |+| ignored_events?<sup>2</sup> | ?array[string] | The Dispatch event names this session does not want (at most 256) || flags? | integer | A non-negative [session flags](#session-flags) bitfield (default `0`) || initial_guild_id?<sup>3</sup> | ?snowflake | The [snowflake](/snowflakes/) of one guild the session joins as active || shard?<sup>4</sup> | ?array[integer] | The `[shard_id, shard_count]` pair |-<sup>1</sup> Null and an omitted key both select the account's saved status and saved custom status+<sup>1</sup> Null and an omitted key both use the account's saved status and custom status-<sup>2</sup> Names are upper-cased and deduplicated. See [Event filtering](/gateway/event-filtering/) for the exact suppression rule+<sup>2</sup> See [Event filtering](/gateway/event-filtering/) for the suppression rule-<sup>3</sup> The session is active in that guild without a [Lazy Request](#lazy-request), as [Event filtering](/gateway/event-filtering/#active-and-passive-guilds) describes, and receives no initial [Guild Sync](/gateway/events/#guild-sync). A value that is not a canonical decimal Snowflake string is ignored without failing Identify+<sup>3</sup> The session is [active](/gateway/event-filtering/#active-and-passive-guilds) in that guild without a [Lazy Request](#lazy-request) and gets no initial [Guild Sync](/gateway/events/#guild-sync). An invalid value is ignored-<sup>4</sup> `shard_count` is an integer from 1 through 16,384, and `shard_id` is an integer that is at least 0 and below `shard_count`+<sup>4</sup> `shard_count` is from 1 through 16,384, and `shard_id` is at least 0 and below `shard_count````json{@@ -105,33 +85,26 @@ Opcode `2` authenticates and creates a new session.}```-`token` and `properties` are required. Fluxer ignores unknown fields. There is no `intents` field and no intent system.--The following faults close with `4002` and reason `Invalid identify payload`:--- A missing `token` or `properties`.-- `properties` that is not an object.-- `properties` whose `os`, `browser`, or `device` is missing or is not a string.-- An `ignored_events` value that is not an array of strings, or one that holds more than 256 entries.-- A `flags` value that is not a non-negative integer.+Identify closes the connection on these faults.-A malformed `shard` closes with `4010` and reason `Invalid shard`.--Fluxer refuses a bot session that resolves to more than 2,500 guilds after any `shard` filter is applied. The connection closes with `4011` and reason `Sharding required`. A user session is never refused for its guild count.--A token the backend rejects closes with `4004` and reason `Invalid token`. A non-bot account that already holds 100 live sessions closes with `4008` and reason `Too many sessions`. A bot credential is not bounded by that count. An Identify sent on a socket that already has a session attached closes with `4005` and reason `Already authenticated`, whether or not it has `d`.+| Fault | Close |+| --- | --- |+| A missing `token` or `properties`, or an invalid `properties`, `ignored_events` or `flags` | `4002` `Invalid identify payload` |+| Malformed `shard` | `4010` `Invalid shard` |+| A bot session with more than 2,500 guilds after the `shard` filter | `4011` `Sharding required` |+| The backend rejects the token | `4004` `Invalid token` |+| A non-bot account with 100 live sessions | `4008` `Too many sessions` |+| The socket already has a session | `4005` `Already authenticated` |### Session flags| Value | Name | Description || --- | --- | --- |-| 1 << 1 | DEBOUNCE_MESSAGE_REACTIONS | Merge runs of reaction additions into [Message Reaction Add Many](/gateway/events/#message-reaction-add-many) |-| 1 << 2 | [CHANNEL_THREADS](/gateway/threads/#session-flag) | The client can parse thread, forum, and media channels |+| 1 << 1 | DEBOUNCE_MESSAGE_REACTIONS | Merges runs of DM and group DM reactions into [Message Reaction Add Many](/gateway/events/#message-reaction-add-many) |+| 1 << 2 | [CHANNEL_THREADS](/gateway/threads/#session-flag) | The client can parse thread, forum and media channels || 1 << 3 | GUILD_VISITS | The session receives the guilds the account is [visiting](/http-api/guilds/#visiting-guilds) |-Bit `0` and every bit above `3` are undefined. An undefined bit is accepted and ignored without closing the connection.--`DEBOUNCE_MESSAGE_REACTIONS` applies to a reaction in a direct message or group direct message. A reaction in a guild channel is never merged and arrives as its own [Message Reaction Add](/gateway/events/#message-reaction-add).+Undefined bits are ignored.### Identify properties object@@ -144,18 +117,14 @@ Bit `0` and every bit above `3` are undefined. An undefined bit is accepted and| device | string | The device or application identifier || e2ee_capable?<sup>1</sup> | boolean | Whether the client can take part in end-to-end encrypted voice || mobile?<sup>2</sup> | boolean | Whether the session is mobile (default false) |-| latitude?<sup>3</sup> | string | The client latitude as a decimal string of 1 through 32 characters |-| longitude?<sup>3</sup> | string | The client longitude as a decimal string of 1 through 32 characters |+| latitude?<sup>3</sup> | string | The client latitude as a decimal string (1-32 characters) |+| longitude?<sup>3</sup> | string | The client longitude as a decimal string (1-32 characters) |<sup>1</sup> A session without it is refused from an end-to-end encrypted voice channel with `VOICE_E2EE_REQUIRED`-<sup>2</sup> Read only when `presence` is absent or null, in which case it decides the session's mobile flag. Otherwise the [initial presence object](#initial-presence-object) decides it+<sup>2</sup> Used only when `presence` is absent or null. Otherwise the [initial presence object](#initial-presence-object) decides-<sup>3</sup> Used to order the Ready `rtc_regions` array by distance--`os`, `browser`, and `device` are required strings. The remaining fields are optional hints. Fluxer accepts and ignores unrecognised properties.--`latitude` and `longitude` are accepted here only as strings. A number fails validation and the whole session start fails, so send `"52.52"`. Both must be sent together to have any effect, and a string that does not parse as a number counts as absent. A client with no location omits them, and Ready orders `rtc_regions` by region ID instead.+<sup>3</sup> Send both as strings to order the Ready `rtc_regions` array by distance### Initial presence object@@ -163,16 +132,16 @@ Bit `0` and every bit above `3` are undefined. An undefined bit is accepted and| Field | Type | Description || --- | --- | --- |-| status?<sup>1</sup> | string | The initial status, accepting `online`, `idle`, `dnd`, `invisible`, or `offline` |+| status?<sup>1</sup> | string | The initial status, one of `online`, `idle`, `dnd`, `invisible` or `offline` || afk? | boolean | Whether the session is away (default false) || mobile? | boolean | Whether the presence is mobile (default false) || custom_status?<sup>2</sup> | ?[custom status](#custom-status-object) object | The custom status this session publishes |-<sup>1</sup> The account's saved status is used when `status` is absent, when it is null or any other non-string, when it is the string `unknown`, and when it is `online` while the saved status is not `online`. The empty string resolves to `online`, and the remaining accepted values are used as sent+<sup>1</sup> Fluxer uses the account's saved status when `status` is missing, not a string or `unknown`, and when it is `online` but the saved status is something else-<sup>2</sup> Read only when the account has no saved custom status, and stored as sent with no validation+<sup>2</sup> Used only when the account has no saved custom status, and stored as sent-Identify accepts `offline` as a distinct initial status, and [Presence Update](#presence-update) normalises `offline` to `invisible`. A session whose resolved status is `offline` or `invisible` publishes `status: "offline"` and a null `custom_status` to other users.+A session whose status is `offline` or `invisible` shows as offline with no custom status to other users.### Custom status object@@ -180,24 +149,22 @@ Identify accepts `offline` as a distinct initial status, and [Presence Update](#| Field | Type | Description || --- | --- | --- |-| text? | ?string | The text of the custom status, from 1 through 128 characters |+| text? | ?string | The text of the custom status (1-128 characters) || expires_at?<sup>1</sup> | ?ISO8601 timestamp | The time the custom status expires || emoji_id?<sup>2</sup> | ?snowflake | The [snowflake](/snowflakes/) of the custom emoji |-| emoji_name?<sup>3</sup> | ?string | The Unicode emoji, from 1 through 32 characters |--<sup>1</sup> The timestamp is in the future+| emoji_name?<sup>3</sup> | ?string | The Unicode emoji (1-32 characters) |-<sup>2</sup> The Snowflake names an emoji that exists. Fluxer drops the field from the published object, without failing the rest of it, when the account has no global expressions entitlement+<sup>1</sup> Must be in the future-<sup>3</sup> A single Unicode emoji. Fluxer strips the field before validation when `emoji_id` is supplied+<sup>2</sup> Must be an existing emoji. Fluxer drops the field when the account has no global expressions entitlement-Only these fields are read. [Presence Update](#presence-update) validates the object against the account before publishing it.+<sup>3</sup> A single Unicode emoji, ignored when `emoji_id` is sent-The published presence adds `emoji_animated` to this object.+[Presence Update](/gateway/events/#presence-update) events also include `emoji_animated`.## Resume-Opcode `6` restores a retained session.+Opcode `6` restores a retained session. All fields are required, and a missing or mistyped field closes with `4002` and reason `Invalid resume payload`.| Field | Type | Description || --- | --- | --- |@@ -205,26 +172,29 @@ Opcode `6` restores a retained session.| session_id | string | The session ID from [Ready](/gateway/events/#ready) || seq | integer | The last Dispatch sequence the client processed |-All fields are required. A missing field, a non-string `token` or `session_id`, or a `seq` that is not an integer closes with `4002` and reason `Invalid resume payload`.+Send Resume on a new socket. Fluxer replays every retained Dispatch above `seq` in order and then sends [Resumed](/gateway/events/#resumed). If another socket still has the session, that socket gets Opcode `7` and is closed.-An unknown or expired session produces Opcode `9` with `d: false` and leaves the socket unauthenticated. A `seq` below the [replay floor](/gateway/limits-and-rate-limits/#replay-and-backpressure), the highest sequence already dropped from the buffer, produces the same frame. A token that does not own the session closes with `4004` and reason `Invalid token`. A `seq` above the session's current sequence, or below the sequence it has already acknowledged, closes with `4007` and reason `Invalid sequence`. A negative `seq` closes with `4000` and reason `Session unavailable`, and so does a session that cannot be reached. None of those closes ends the retained session that `session_id` names.--A successful Resume replays every retained Dispatch strictly above `seq` in order and finishes with [Resumed](/gateway/events/#resumed). It also replaces the session's socket, and the displaced socket receives Opcode `7` followed by a close.--Send Resume only on a fresh socket. It is also accepted on an authenticated socket, where it replaces the attached session.+| Condition | Result |+| --- | --- |+| Unknown or expired session | Opcode `9` with `d: false` |+| `seq` below the [replay floor](/gateway/limits-and-rate-limits/#replay-and-backpressure) | Opcode `9` with `d: false` |+| Token does not own the session | Close `4004` `Invalid token` |+| `seq` above the session sequence or below the acknowledged one | Close `4007` `Invalid sequence` |+| Negative `seq`, or the session cannot be restored right now | Close `4000` `Session unavailable` |+| The socket already has a session | Close `4005` `Already authenticated` |## Presence Update-Opcode `3` replaces the current session presence.+Opcode `3` replaces the current session presence. Updates over the [Presence Update limit](/gateway/limits-and-rate-limits/#connection-and-command-rate-limits) are dropped without a close.| Field | Type | Description || --- | --- | --- |-| status | string | The status to publish, accepting `online`, `idle`, `dnd`, `invisible`, or `offline` |+| status | string | The status to publish, one of `online`, `idle`, `dnd`, `invisible` or `offline` || afk? | boolean | Whether the session is away (default false) || mobile? | boolean | Whether the session is mobile (default false) || custom_status?<sup>1</sup> | ?[custom status](#custom-status-object) object | The custom status that replaces the current one |-<sup>1</sup> An object identical to the current one in `text`, `expires_at`, `emoji_id`, and `emoji_name` is reused without revalidation+<sup>1</sup> Omitting the key keeps the current custom status and `null` clears it. A rejected object, such as one from a [limited account](/http-api/users/#account-limitation), leaves it unchanged```json{@@ -240,46 +210,36 @@ Opcode `3` replaces the current session presence.}```-`status` is required. A payload that is not an object, an object with no `status` key, and a `status` string outside the accepted set all close with `4002` and reason `Invalid presence payload`. The empty string resolves to `online`.--Fluxer accepts a non-string `status`. Null and a Boolean publish the session as offline, and every other non-string value resolves to `online`.--`offline` is normalised to `invisible`, so a Presence Update cannot publish a session as offline while it is connected.--`custom_status` is replaced only when the key is present. Omitting the key keeps the current custom status, `null` clears it, and a value that is neither an object nor null is ignored. An object the backend rejects, such as an `emoji_id` that names no emoji, an `expires_at` in the past, or any object from a [limited account](/http-api/users/#account-limitation), leaves the current custom status in place. The connection stays open.--The published presence has a [custom status](#custom-status-object) object and no activities.--Presence Update has its own limit of five accepted commands per 20 seconds on one WebSocket. A further update inside that window is discarded without closing the connection, after it has consumed the [shared payload budgets](/gateway/limits-and-rate-limits/#connection-and-command-rate-limits).+A payload that is not an object, has no `status`, or has a string `status` outside the set closes with `4002` and reason `Invalid presence payload`. `offline` is stored as `invisible`.## Voice State Update-Opcode `4` joins, moves, updates, or leaves the voice membership associated with the current Gateway session.+Opcode `4` joins, moves, updates or leaves the voice membership of the current session. Every field is optional. A `d` that is not an object closes with `4002` and reason `Invalid voice payload`, and other invalid updates are dropped.| Field | Type | Description || --- | --- | --- |-| guild_id? | ?snowflake | The guild containing the voice channel, where null selects the DM and group DM call context |-| channel_id? | ?snowflake | The channel to join or move to, where null leaves the current membership in that context |+| guild_id? | ?snowflake | The guild with the voice channel, where null selects the DM and group DM call context |+| channel_id? | ?snowflake | The channel to join or move to, where null leaves the membership || connection_id?<sup>1</sup> | ?string | The existing voice connection this update applies to |-| self_mute?<sup>2</sup> | boolean | Whether the client has muted its own microphone (default false) |-| self_deaf?<sup>2</sup> | boolean | Whether the client has deafened its own output (default false) |+| self_mute?<sup>2</sup> | boolean | Whether the client has muted its microphone (default false) |+| self_deaf?<sup>2</sup> | boolean | Whether the client has deafened its output (default false) || self_video?<sup>2</sup> | boolean | Whether the client publishes camera video (default false) |-| self_stream?<sup>4</sup> | boolean | Whether this connection advertises a screenshare track (default false) |+| self_stream?<sup>3</sup> | boolean | Whether this connection advertises a screenshare track (default false) || is_mobile?<sup>2</sup> | boolean | Whether this is a mobile voice client (default false) |-| viewer_stream_keys?<sup>3</sup> | ?array[string] | The stream keys this connection is watching, where an omitted key keeps the current list and null clears it |+| viewer_stream_keys?<sup>4</sup> | ?array[string] | The stream keys this connection watches, where an omitted key keeps the list and null clears it || latitude? | number or string | The client latitude, used to pick a voice region || longitude? | number or string | The client longitude, used to pick a voice region || p2p?<sup>5</sup> | boolean | Whether the client agrees to peer-to-peer media for a new connection, or leaves the mesh on an existing one |-<sup>1</sup> A `channel_id` with no `connection_id` opens a new connection, and a `channel_id` with one updates or moves that connection. An update that leaves one guild, meaning a non-null `guild_id` with `channel_id: null`, requires a `connection_id`, and one that omits it is refused with `VOICE_MISSING_CONNECTION_ID`+<sup>1</sup> A `channel_id` with no `connection_id` opens a new connection and one with it updates or moves that connection. Leaving a guild with `channel_id: null` needs a `connection_id`, or the update is refused with `VOICE_MISSING_CONNECTION_ID`-<sup>2</sup> Only `true` and the string `"true"` set the flag. Every other value resolves to false+<sup>2</sup> Only `true` and the string `"true"` set the flag-<sup>3</sup> Every entry is a stream key whose scope, guild, and channel match this update. An entry that fails that check, or a value that is not an array, refuses the update with `VOICE_INVALID_STATE`, and an entry naming a connection that does not exist refuses it with `VOICE_CONNECTION_NOT_FOUND`+<sup>3</sup> Set like the other flags, and `false` is published when the member lacks `STREAM` in the channel. It sends no [Voice Server Update](/gateway/events/#voice-server-update)-<sup>4</sup> Only `true` and the string `"true"` set it, and Fluxer publishes `false` when the member lacks `STREAM` in the channel. The screenshare track uses this same connection, so setting the flag issues no grant and sends no [Voice Server Update](/gateway/events/#voice-server-update)+<sup>4</sup> Each entry is a stream key matching this update's scope, guild and channel, or the update is refused with `VOICE_INVALID_STATE`. An entry with no connection is refused with `VOICE_CONNECTION_NOT_FOUND`-<sup>5</sup> Only the JSON Boolean `true` agrees and only the JSON Boolean `false` switches. On a new connection `true` states that the client supports peer-to-peer media and accepts it for this join. A bot session never agrees, whatever it sends. On an existing connection an explicit `false` converts the whole channel or call to LiveKit, and an omitted key or `true` changes nothing. [Peer-to-peer voice](/gateway/events/#peer-to-peer-voice) states when a join is peer-to-peer and when it is refused+<sup>5</sup> Only the JSON Boolean `true` agrees. On an existing connection, `false` moves the whole channel or call to LiveKit. A bot session never agrees. See [Peer-to-peer voice](/gateway/events/#peer-to-peer-voice)```json{@@ -295,30 +255,22 @@ Opcode `4` joins, moves, updates, or leaves the voice membership associated with}```-Every field is optional. A non-null `guild_id` or `channel_id` is a canonical decimal [snowflake](/snowflakes/) string, and a positive integer is also accepted. Every other value fails validation, and Fluxer drops the update with no close code and no event.--`guild_id: null` with `channel_id: null` and a `connection_id` leaves the DM or group DM call connection with that identifier. The same shape without a `connection_id` disconnects the session from every voice membership it holds. `guild_id: null` with a `channel_id` selects the DM or group DM call context.--`latitude` and `longitude` accept a number or a string here, and Fluxer coerces both to a string.--The command has no `session_id` field. Fluxer identifies the voice membership by the Gateway session that sends the command.--Joining or replacing a grant produces [Voice Server Update](/gateway/events/#voice-server-update) with the token and endpoint for the media connection, or with the ICE servers of a peer-to-peer grant, and [Voice State Update](/gateway/events/#voice-state-update) for every session that can see the channel.+`guild_id: null` with `channel_id: null` and a `connection_id` leaves that DM or group DM call connection. Without a `connection_id` it disconnects the session from every voice membership.-A refusal with `VOICE_P2P_CONSENT_REQUIRED`, `VOICE_P2P_UNAVAILABLE`, or `VOICE_CHANNEL_FULL` reaches the requesting session as a [Gateway Error](/gateway/opcodes-and-close-codes/#gateway-error) payload. Every other refusal sends nothing.+Joining or moving sends [Voice Server Update](/gateway/events/#voice-server-update) to you and [Voice State Update](/gateway/events/#voice-state-update) to every session that can see the channel. A refusal with `VOICE_P2P_CONSENT_REQUIRED`, `VOICE_P2P_UNAVAILABLE` or `VOICE_CHANNEL_FULL` comes back as a [Gateway Error](/gateway/opcodes-and-close-codes/#gateway-error). Other refusals send nothing.-The first two updates in a rolling one-second window take effect immediately. Later updates can be delayed or replaced by newer updates for the same `guild_id` and `connection_id`. See [command rate limits](/gateway/limits-and-rate-limits/#connection-and-command-rate-limits) for the timing and capacity bounds.+Updates over the [Voice State Update limit](/gateway/limits-and-rate-limits/#connection-and-command-rate-limits) are queued, and a newer one replaces a queued one.## Voice Signal-Opcode `13` sends one signalling message to one other connection of a [peer-to-peer](/gateway/events/#peer-to-peer-voice) voice channel or call.+Opcode `13` sends one signaling message to another connection in a [peer-to-peer](/gateway/events/#peer-to-peer-voice) voice channel or call. Send it after a [Voice Server Update](/gateway/events/#voice-server-update) with `p2p: true`.| Field | Type | Description || --- | --- | --- |-| guild_id? | ?snowflake | The guild containing the voice channel, where null or an omitted key selects the DM and group DM call context |+| guild_id? | ?snowflake | The guild with the voice channel, where null or omitted selects the DM and group DM call context || channel_id | snowflake | The voice channel or call channel both connections are in || to | string | The `connection_id` of the voice state the signal is for |-| data | object | The signalling message, which Fluxer relays unread |+| data | object | The signaling message, which Fluxer relays unread |```json{@@ -335,37 +287,31 @@ Opcode `13` sends one signalling message to one other connection of a [peer-to-p}```-Fluxer relays the signal when the sending session owns a voice state with `p2p: true` in that channel and `to` names another voice state with `p2p: true` in the same channel. The target connection's session alone receives [Voice Signal](/gateway/events/#voice-signal).--Every other signal is dropped with no event and no close. That covers a channel or call that is not peer-to-peer, a `to` that names no connection there, a `to` that names the sender's own connection, a `data` that is not an object, and a session with no voice state in the channel.--`data` is opaque to Fluxer. Clients agree on its contents among themselves, typically a session description or an ICE candidate. The whole frame stays within the [inbound payload bound](/gateway/overview/#framing).--A client sends this command only after it has received a [Voice Server Update](/gateway/events/#voice-server-update) with `p2p: true` for the connection. [Command rate limits](/gateway/limits-and-rate-limits/#connection-and-command-rate-limits) states the Voice Signal budget.+Fluxer relays the signal when both the sender and the `to` connection have a voice state with `p2p: true` in that channel. Only the target connection's session gets the [Voice Signal](/gateway/events/#voice-signal). Any other signal is dropped with no event and no close.## Request Guild Members-Opcode `8` requests bounded member chunks.+Opcode `8` requests member chunks for one or more guilds.| Field | Type | Description || --- | --- | --- || guild_id?<sup>1</sup> | snowflake | The ID of the single guild to query || guild_ids?<sup>1</sup> | array[snowflake] | A non-empty array of the guild IDs to query || query?<sup>2</sup> | string | The display name prefix to match (default empty string) |-| limit?<sup>3</sup> | integer | The result limit, from 0 through 100 and clamped (default 0) |-| user_ids?<sup>4</sup> | array[snowflake] | The explicit user IDs to select, at most 100 (default empty) |+| limit?<sup>3</sup> | integer | The result limit (0-100, default 0) |+| user_ids?<sup>4</sup> | array[snowflake] | The explicit user IDs to select (at most 100, default empty) || presences?<sup>5</sup> | boolean | Whether results include presences (default false) || nonce? | string | A value of at most 32 bytes echoed in each chunk |-<sup>1</sup> A non-empty `guild_ids` array is used. `guild_id` is read only when `guild_ids` is absent or empty+<sup>1</sup> `guild_id` is used only when `guild_ids` is absent or empty. The nonce is echoed only when the request has one guild-<sup>2</sup> Matched case-insensitively as a prefix of the member's display name, which is the guild nickname, then the global name, then the username+<sup>2</sup> Matched case-insensitively against the guild nickname, then the global name, then the username-<sup>3</sup> A `limit` of `0` with a non-empty `query` resolves to 25 results, and a `limit` of `0` with an empty `query` requests the full member list up to 100,000 entries+<sup>3</sup> `0` with a non-empty `query` gives 25 results. `0` with an empty `query` requests the full member list, up to 100,000 entries-<sup>4</sup> A non-empty `user_ids` array selects those members directly and ignores `query` and `limit`+<sup>4</sup> A non-empty array selects those members and ignores `query` and `limit`. More than 100 entries abandons the request-<sup>5</sup> Presences whose status is `offline` or `invisible` are omitted from the result+<sup>5</sup> Offline and invisible presences are omitted```json{@@ -380,38 +326,21 @@ Opcode `8` requests bounded member chunks.}```-The command never closes the connection. Invalid input is coerced or discarded:--- A guild ID that is not a positive Snowflake abandons the whole request.-- Duplicate guild IDs are collapsed.-- A `user_ids` array longer than 100 entries abandons the whole request. Individual entries that are not positive Snowflakes are dropped.-- A `limit` that is not a non-negative integer becomes `0`, and a larger value is clamped to `100`.-- Any non-string `query` becomes the empty string.-- A `nonce` that is not a string of at most 32 bytes becomes null.--The nonce is echoed only when the request named exactly one guild.+Guilds the session is not connected to are skipped, and a request with no connected guild gets no chunk. A full member list needs `MANAGE_ROLES`, `KICK_MEMBERS` and `BAN_MEMBERS` together, and the owner and `ADMINISTRATOR` satisfy that. Without them the request is dropped silently.-Fluxer skips a guild this session is not connected to. A request that resolves to no connected guild produces no chunk.+A bot can request one guild at a time. A bot asking for the full list gets one accepted request per guild every 30 seconds, and another inside that window gets [Rate Limited](/gateway/events/#rate-limited) and no chunk.-A bot requests one guild at a time, and a bot request naming two or more guilds is abandoned.--An empty `query`, a `limit` of `0`, and an empty `user_ids` together request the complete member list. A human account requesting the complete list needs `MANAGE_ROLES`, `KICK_MEMBERS`, and `BAN_MEMBERS` together in that guild, and a request holding only some of them is dropped silently. The guild owner and any member with `ADMINISTRATOR` satisfy that check.--A bot requesting the complete list is limited to one accepted request per guild every 30 seconds. A request inside that window produces [Rate Limited](/gateway/events/#rate-limited) and no member chunk.--Results arrive as [Guild Members Chunk](/gateway/events/#guild-members-chunk) in pages of at most 1,000 members, each with `chunk_index` and `chunk_count`. Those chunks are delivered live and are never retained for Resume replay.--Only one member request runs at a time on one WebSocket. While one runs, a newer request replaces any earlier pending request and starts when the active one finishes. [Bounded requests](#bounded-requests) covers the four-slot limit this command shares with the other bounded commands.+Results arrive as [Guild Members Chunk](/gateway/events/#guild-members-chunk) pages of at most 1,000 members with `chunk_index` and `chunk_count`. Chunks are not replayed on Resume. If you send a new request while one is running, it replaces any request still waiting.## Lazy Request-Opcode `14` sets the per-guild subscriptions that decide member list, typing, synchronisation, and [thread](/gateway/threads/#lazy-request-thread-options) traffic for the session.+Opcode `14` sets the per-guild subscriptions that decide member list, typing, sync and [thread](/gateway/threads/#lazy-request-thread-options) traffic.| Field | Type | Description || --- | --- | --- || subscriptions<sup>1</sup> | map[snowflake, [guild subscription](#guild-subscription-object) object] | The subscription options for each guild, keyed by guild ID |-<sup>1</sup> Fluxer keeps each guild's options for the session and applies them again when the session connects to that guild later+<sup>1</sup> Fluxer applies each guild's options again when the session connects to that guild later```json{@@ -440,37 +369,29 @@ Opcode `14` sets the per-guild subscriptions that decide member list, typing, sy| sync?<sup>1</sup> | boolean | Whether the session requests a [Guild Sync](/gateway/events/#guild-sync) for the guild || typing? | boolean | Whether the guild delivers [Typing Start](/gateway/events/#typing-start), overriding the active flag || member_list_channels?<sup>2</sup> | map[snowflake, array[array[integer]]] | The member list windows to subscribe to, keyed by channel ID |-| members? | array[snowflake] | The explicit member IDs to subscribe to, at most 1,000 |+| members? | array[snowflake] | The explicit member IDs to subscribe to (at most 1,000) || focused_channel_id?<sup>3</sup> | ?snowflake | The channel or public thread a visiting session has open |-<sup>1</sup> Both are Booleans when present. Any other value stops Fluxer from applying the remaining options for that guild and every guild it has not yet processed, without a close and without a result--<sup>2</sup> Subscriptions may be combined over a 100 ms window. Ranges sent during that window are merged for the same channel, and an empty range list clears its pending ranges--<sup>3</sup> Read only for a guild the session is visiting, where it is the only option applied. A channel the visitor cannot read, or null, clears the focus. Messages and reactions reach a visiting session only for its focused channel+<sup>1</sup> A non-Boolean value stops Fluxer applying the remaining options for that guild and the guilds after it-Fluxer applies each option only when its key is present, in the order `active`, `sync`, `member_list_channels`, `members`, `typing`. The [thread options](/gateway/threads/#lazy-request-thread-options) `threads` and `thread_member_lists` follow `typing`.+<sup>2</sup> Each range is `[start, end]` with `start` at least 0, `end` at least `start` and at most 100,000, and `end - start` at most 99. Invalid ranges are dropped and each channel keeps its first 10-Marking a guild active changes how much traffic it produces, and [Event filtering](/gateway/event-filtering/) specifies the difference. A transition from passive to active, and a transition from active to passive, both imply a sync even when `sync` is absent. Every sync request, implied or explicit, is dropped when the guild is already marked synced for that session. Going passive clears that mark, so the next sync request produces a fresh Guild Sync. Going passive also clears the [`threads`](/gateway/threads/#lazy-request-thread-options) subscription.+<sup>3</sup> Used only for a guild the session is visiting, where it is the only option applied. Null or an unreadable channel clears it. A visiting session gets messages and reactions only for this channel-`member_list_channels` maps a channel ID to a list of `[start, end]` ranges. A range needs `start` at least 0, `end` at least `start`, `end` at most 100,000, and `end - start` at most 99. Ranges that fail those bounds are dropped, and each channel keeps at most the first 10 that pass. A channel key that is not a Snowflake is skipped.+[Event filtering](/gateway/event-filtering/) describes what `active` changes.-`VIEW_CHANNEL` and `VIEW_CHANNEL_MEMBERS` together control the member list subscription, and both are evaluated for each channel separately. A channel the session cannot view, or can view without holding `VIEW_CHANNEL_MEMBERS` there, receives no [Guild Member List Update](/gateway/events/#guild-member-list-update) while its siblings subscribe normally. A thread ID in `member_list_channels` subscribes to nothing. A thread member list uses [`thread_member_lists`](/gateway/threads/#lazy-request-thread-options).+Switching a guild between passive and active sends a [Guild Sync](/gateway/events/#guild-sync) unless the session already has one for that guild. Going passive also clears the [`threads`](/gateway/threads/#lazy-request-thread-options) subscription, and the next switch to active syncs again.-Subscribing a channel to at least one range drops the session's other member list subscriptions in that guild. One session holds at most one guild member list per guild. Thread member lists are counted separately.--`members` entries that are not Snowflakes are dropped, and the first 1,000 that pass are kept. A member the session shares no viewable channel with is dropped as well.--`typing` is a Boolean, and Fluxer ignores any other value. It decides [Typing Start](/gateway/events/#typing-start) delivery for the guild independently of the active flag.+A channel gets [Guild Member List Update](/gateway/events/#guild-member-list-update) only when you have `VIEW_CHANNEL` and `VIEW_CHANNEL_MEMBERS` in it. Thread IDs here subscribe to nothing, so use [`thread_member_lists`](/gateway/threads/#lazy-request-thread-options). Subscribing a channel to a range drops the session's other member list in that guild.## Request Guild Counts-Opcode `15` requests the current member and online counts for guilds.+Opcode `15` requests the member and online counts for guilds.| Field | Type | Description || --- | --- | --- |-| guild_ids | array[snowflake] | The guild IDs to query, deduplicated, sorted, and truncated to 100 |-| nonce? | string | A value from 1 through 64 bytes echoed in the result |+| guild_ids | array[snowflake] | The guild IDs to query, deduplicated and truncated to 100 |+| nonce? | string | A value of 1-64 bytes echoed in the result |```json{@@ -482,9 +403,7 @@ Opcode `15` requests the current member and online counts for guilds.}```-Entries that are not positive Snowflakes are dropped. A guild the session is not connected to is skipped. A `nonce` outside the length bound is omitted from the result. The command never closes the connection.--Results arrive in one [Guild Counts Update](/gateway/events/#guild-counts-update). The request has a 3,000 ms deadline, and a guild that does not answer within 2,000 ms is omitted.+Guilds the session is not connected to are skipped. Results arrive in one [Guild Counts Update](/gateway/events/#guild-counts-update), and a guild that does not answer within 2,000 ms is omitted.## Request Channel Member Counts@@ -493,11 +412,11 @@ Opcode `16` requests the member and online counts for channels in one guild.| Field | Type | Description || --- | --- | --- || guild_id | snowflake | The ID of the guild whose channels are queried |-| channel_ids | array[snowflake] | The channel IDs to query, deduplicated, sorted, and truncated to 25 |-| channel_id?<sup>1</sup> | snowflake | The ID of the single channel to query, read only when `channel_ids` is absent |-| nonce? | string | A value from 1 through 64 bytes echoed in the result |+| channel_ids | array[snowflake] | The channel IDs to query, deduplicated and truncated to 25 |+| channel_id?<sup>1</sup> | snowflake | The ID of the single channel to query |+| nonce? | string | A value of 1-64 bytes echoed in the result |-<sup>1</sup> A `channel_ids` value that is present but is not an array also falls back to `channel_id`+<sup>1</sup> Used only when `channel_ids` is absent or not an array```json{@@ -510,12 +429,8 @@ Opcode `16` requests the member and online counts for channels in one guild.}```-A `guild_id` that is not a positive Snowflake, or a guild the session is not connected to, produces an empty result. Channel entries that are not positive Snowflakes are dropped. The command never closes the connection.--Results arrive in one [Channel Member Counts Update](/gateway/events/#channel-member-counts-update) with a 2,000 ms guild deadline. A channel is counted only when the requesting session holds both `VIEW_CHANNEL` and `VIEW_CHANNEL_MEMBERS` there, and every other named channel is omitted from the result.+An invalid or unconnected guild gives an empty result. Results arrive in one [Channel Member Counts Update](/gateway/events/#channel-member-counts-update), and a channel is counted only when you have `VIEW_CHANNEL` and `VIEW_CHANNEL_MEMBERS` in it.## Bounded requests-One WebSocket processes at most four bounded requests at once across [Request Guild Members](#request-guild-members), [Lazy Request](#lazy-request), [Request Guild Counts](#request-guild-counts), [Request Channel Member Counts](#request-channel-member-counts), and [Request Forum Unreads](/gateway/threads/#request-forum-unreads). A command that arrives when all four slots are taken is dropped, without a close and without a result. Request Forum Unreads from a user session without `CHANNEL_THREADS` still closes with `4001`, as [Gateway threads](/gateway/threads/#request-forum-unreads) describes. Each request has a 10,000 ms deadline, after which it produces no further events.--Request Guild Members also keeps one replaceable pending request while another member request is active, whether or not a slot is free. See [Bounded commands](/gateway/limits-and-rate-limits/#bounded-commands).+A command sent while four [bounded commands](/gateway/limits-and-rate-limits/#bounded-commands) are running is dropped with no close and no result.diff --git a/fluxer_docs/src/content/docs/gateway/event-filtering.md b/fluxer_docs/src/content/docs/gateway/event-filtering.mdindex 1212632f9..fb508633f 100644--- a/fluxer_docs/src/content/docs/gateway/event-filtering.md+++ b/fluxer_docs/src/content/docs/gateway/event-filtering.md@@ -1,132 +1,88 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Event filtering-description: Event visibility, guild subscriptions, ignored events, and sharding.+description: Which sessions receive each Dispatch, and how to receive fewer of them.----A client controls [Dispatch](/gateway/events/) traffic with [Lazy Request](/gateway/commands/#lazy-request) subscriptions, the [Identify](/gateway/commands/#identify) `ignored_events` list, and the Identify `CHANNEL_THREADS` [session flag](/gateway/threads/#session-flag). Guild availability, permissions and sharding also restrict delivery.--Fluxer has no `intents` field, no intent close code, and no privileged-intent approval. A client ported from a protocol that uses intents replaces its intent mask with those mechanisms.--## The gates--Fluxer evaluates a guild-scoped Dispatch against these gates in order.--| Gate | Name | What it decides |-| --- | --- | --- |-| 1 | Guild availability | Whether the guild dispatches anything except [Guild Update](/gateway/events/#guild-update) |-| 2 | Permission and visibility | Which sessions may see the event at all |-| 3 | Guild subscription state | Whether a passive session in a guild with more than 250 members still receives it, as [Active and passive guilds](#active-and-passive-guilds) lists |-| 4 | Session-level filters | Whether the thread access filter, the shard filter, or the `ignored_events` list drops it inside the session after the guild has already chosen the recipients |--A guild with the `UNAVAILABLE_FOR_EVERYONE` or `UNAVAILABLE_FOR_EVERYONE_BUT_STAFF` feature fails gate 1. `UNAVAILABLE_FOR_EVERYONE_BUT_STAFF` decides what a session receives when it connects. A staff session receives the guild's full state, and every other session receives an `unavailable` stub. Gate 1 has no staff exemption, so a staff session also receives nothing but Guild Update while the feature is set.--An account-scoped Dispatch skips gates 1 through 3 and is subject only to gate 4. Direct message traffic, relationship changes, and account record changes arrive that way.--A session without [thread access](/gateway/threads/#session-flag) receives none of the events on [Gateway threads](/gateway/threads/#dispatch-events).+Fluxer has no gateway intents, and you limit [Dispatch](/gateway/events/) traffic with [Lazy Request](/gateway/commands/#lazy-request) subscriptions, the [Identify](/gateway/commands/#identify) `ignored_events` list and the `CHANNEL_THREADS` [session flag](/gateway/threads/#session-flag).## Permission and visibility-The guild resolves each event to one of these recipient sets.--| Event class | Events | Recipients |-| --- | --- | --- |-| Channel-scoped | [Channel Create](/gateway/events/#channel-create), [Channel Update](/gateway/events/#channel-update), [Channel Delete](/gateway/events/#channel-delete)<sup>1</sup>, [Message Create](/gateway/events/#message-create), [Message Delete Bulk](/gateway/events/#message-delete-bulk), [Typing Start](/gateway/events/#typing-start), [Channel Pins Update](/gateway/events/#channel-pins-update), [Webhooks Update](/gateway/events/#webhooks-update) | Sessions that can view the channel |-| Message-access filtered | [Message Update](/gateway/events/#message-update), [Message Delete](/gateway/events/#message-delete), [Message Reaction Add](/gateway/events/#message-reaction-add), [Message Reaction Remove](/gateway/events/#message-reaction-remove), [Message Reaction Remove All](/gateway/events/#message-reaction-remove-all), [Message Reaction Remove Emoji](/gateway/events/#message-reaction-remove-emoji) | Sessions that can view the channel and can access that message |-| Invite | [Invite Create](/gateway/events/#invite-create), [Invite Delete](/gateway/events/#invite-delete) | Sessions holding `MANAGE_CHANNELS` on the invite's channel |-| Audit log | [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create) | Sessions holding `VIEW_AUDIT_LOG` in the guild<sup>2</sup> |-| Thread | The events on [Gateway threads](/gateway/threads/#dispatch-events) | The recipients each event states there |-| Guild-wide | Everything else | Every session connected to the guild |--<sup>1</sup> Channel Delete is filtered against the guild state as it was before the deletion, so the session that could see the channel is the session that learns it is gone--<sup>2</sup> A session without [thread access](/gateway/threads/#session-flag) receives no `THREAD_CREATE`, `THREAD_UPDATE`, or `THREAD_DELETE` entry and no entry about a message in a thread--An event in the first two rows whose channel is a thread reaches the sessions [Events in a thread](#events-in-a-thread) describes. Thread visibility and message access follow [Thread permissions](/http-api/threads/#thread-permissions).+Fluxer sends each guild event to the sessions in the Recipients column. A session that is still connecting to the guild gets none of them.-Every one of those sets excludes a session that has not yet received the guild's initial state.+| Event class | Recipients |+| --- | --- |+| Channel create, update and delete, [Message Create](/gateway/events/#message-create), [Message Delete Bulk](/gateway/events/#message-delete-bulk), [Typing Start](/gateway/events/#typing-start), [Channel Pins Update](/gateway/events/#channel-pins-update), [Webhooks Update](/gateway/events/#webhooks-update) | Sessions that can view the channel |+| [Message Update](/gateway/events/#message-update), [Message Delete](/gateway/events/#message-delete) and the reaction events | Sessions that can view the channel and access the message |+| [Invite Create](/gateway/events/#invite-create) and [Invite Delete](/gateway/events/#invite-delete) | Sessions with `MANAGE_CHANNELS` on the invite's channel |+| [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create) | Sessions with `VIEW_AUDIT_LOG`. Entries about threads need [thread access](/gateway/threads/#session-flag). |+| [Voice State Update](/gateway/events/#voice-state-update) | Sessions that can view the voice state's channel or the channel the user left |+| Thread events | Listed for each event on [Gateway threads](/gateway/threads/#dispatch-events) |+| Everything else | Every session connected to the guild |-Channel visibility is `VIEW_CHANNEL` on the channel, plus extensions. A category is visible when at least one of its children is visible. For a session without [thread access](/gateway/threads/#session-flag), a forum or media channel does not count as a visible child. A user with a live voice connection in a channel keeps virtual access to it whenever the channel would otherwise stop being visible. That covers a role or overwrite change removing `VIEW_CHANNEL`, and a move into a channel the user cannot view. Virtual access is keyed by user, so it applies to every session of that user. It is dropped when the user's voice connection to the channel ends.+A session can view a channel when it has `VIEW_CHANNEL`, and it can view a category when it can view one of the category's channels. A user in a voice channel can still view it until they leave, even after a permission change that would hide it.-Message access is `READ_MESSAGE_HISTORY` on the channel. Without that permission a session still receives events for messages newer than the guild's [message history cutoff](/http-api/guilds/#guild-object). A guild that sets no cutoff offers no such fallback, so a session without `READ_MESSAGE_HISTORY` receives none of the message-access filtered events there.+A session can access a message when it has `READ_MESSAGE_HISTORY` or when the message is newer than the guild's [message history cutoff](/http-api/guilds/#guild-object).-[Channel Update Bulk](/gateway/events/#channel-update-bulk) contains only channels the recipient can view. If none are visible, no event is sent.+[Channel Update Bulk](/gateway/events/#channel-update-bulk) has only the channels the session can view.-[Voice State Update](/gateway/events/#voice-state-update) takes its own path. The guild sends it straight to the sessions that can view the channel the voice state names, or, when the state names no channel, the channel the user just left. A voice state with no connection ID is not broadcast at all.+When you pass the `session_id` query parameter to [Add own reaction](/http-api/messages/#add-own-reaction), [Remove own reaction](/http-api/messages/#remove-own-reaction) or [Remove another user's reaction](/http-api/messages/#remove-another-users-reaction), that session gets no [Message Reaction Add](/gateway/events/#message-reaction-add) or [Message Reaction Remove](/gateway/events/#message-reaction-remove) for the change.-### Excluding the acting session--[Message Reaction Add](/gateway/events/#message-reaction-add) and [Message Reaction Remove](/gateway/events/#message-reaction-remove) accept a `session_id` on the originating HTTP request. Fluxer excludes that session from the resulting Dispatch and strips the field before it sends the payload. Every other mutation delivers its Dispatch to the acting session like any other eligible session.+A guild with the `UNAVAILABLE_FOR_EVERYONE` or `UNAVAILABLE_FOR_EVERYONE_BUT_STAFF` feature sends only [Guild Update](/gateway/events/#guild-update).## Active and passive guilds-A user session is passive in every guild until [Lazy Request](/gateway/commands/#lazy-request) marks that guild `active: true`. The guild named in the [Identify](/gateway/commands/#identify) `initial_guild_id` is active from the start. A bot session is never passive. A guild with 250 members or fewer is active for every session. The rule below applies only to a passive user session in a guild with more than 250 members. Thread message delivery is the exception, as [Events in a thread](#events-in-a-thread) describes.+A user session is passive in every guild until a [Lazy Request](/gateway/commands/#lazy-request) sets `active: true` for that guild. The guild in [Identify](/gateway/commands/#identify) `initial_guild_id` starts active. Bot sessions are never passive, and every session is active in a guild with 250 members or fewer.-Such a session receives exactly this set:+A passive session in a larger guild gets only these events.-- [Guild Update](/gateway/events/#guild-update)-- [Guild Delete](/gateway/events/#guild-delete)+- [Guild Update](/gateway/events/#guild-update) and [Guild Delete](/gateway/events/#guild-delete)- [Guild Role Update](/gateway/events/#guild-role-update) and [Guild Role Update Bulk](/gateway/events/#guild-role-update-bulk)-- [Channel Create](/gateway/events/#channel-create), [Channel Update](/gateway/events/#channel-update), [Channel Update Bulk](/gateway/events/#channel-update-bulk), and [Channel Delete](/gateway/events/#channel-delete)+- [Channel Create](/gateway/events/#channel-create), [Channel Update](/gateway/events/#channel-update), [Channel Update Bulk](/gateway/events/#channel-update-bulk) and [Channel Delete](/gateway/events/#channel-delete)- [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create)+- [Message Create](/gateway/events/#message-create) and [Message Update](/gateway/events/#message-update) for a message that mentions the session's user, and Message Create for the user's own messages+- [Guild Member Update](/gateway/events/#guild-member-update) and [Guild Member Remove](/gateway/events/#guild-member-remove) for the session's own user+- [Voice State Update](/gateway/events/#voice-state-update) for channels it can view+- Thread events that [Gateway threads](/gateway/threads/#dispatch-events) lists for passive sessions- [Passive Updates](/gateway/events/#passive-updates)-Every other Dispatch the guild produces is suppressed:--- [Message Update](/gateway/events/#message-update) for a message that does not mention the session's user-- [Message Delete](/gateway/events/#message-delete) and [Message Delete Bulk](/gateway/events/#message-delete-bulk)-- Every reaction event-- [Invite Create](/gateway/events/#invite-create) and [Invite Delete](/gateway/events/#invite-delete)-- [Channel Pins Update](/gateway/events/#channel-pins-update)-- [Webhooks Update](/gateway/events/#webhooks-update)-- [Guild Member Add](/gateway/events/#guild-member-add)-- [Guild Role Create](/gateway/events/#guild-role-create) and [Guild Role Delete](/gateway/events/#guild-role-delete)-- [Guild Ban Add](/gateway/events/#guild-ban-add) and [Guild Ban Remove](/gateway/events/#guild-ban-remove)-- [Guild Emojis Update](/gateway/events/#guild-emojis-update) and [Guild Stickers Update](/gateway/events/#guild-stickers-update)--[Voice State Update](/gateway/events/#voice-state-update) never reaches this gate. It takes the separate path described above, so a passive session in a large guild still receives it for every channel it can view.+A message mentions the user when `mentions` has the user, `mention_roles` has one of the user's roles, or `mention_here` or `mention_everyone` is set.-A message mentions the session's user when the payload names that user in `mentions`, names one of that user's roles in `mention_roles`, sets `mention_here`, or sets `mention_everyone`. The guild reads only the first 100 entries of `mention_roles`, so a message that mentions more roles than that can miss a passive recipient.--Every 30 seconds a passive session receives [Passive Updates](/gateway/events/#passive-updates). The payload has the changed per-channel `last_message_id` watermarks and the changed voice states for the channels it can view, so the session keeps unread state and voice rosters correct without the suppressed message events. A cycle that finds nothing changed sends nothing.+[Passive Updates](/gateway/events/#passive-updates) comes every 30 seconds with the changed `last_message_id` values and voice states for channels the session can view, and Fluxer skips it when nothing changed.### Typing is decided separately-[Typing Start](/gateway/events/#typing-start) never follows the rule above. When the session set `typing` for the guild through [Lazy Request](/gateway/commands/#lazy-request), that value alone decides delivery. Without an override the event follows the active state, so a passive session in a large guild does not receive it.--The override applies to every session, including a bot session. The only way for a bot to stop Typing Start in one guild and keep it in other guilds is to set `typing` to false for that guild.+When you set `typing` for a guild in [Lazy Request](/gateway/commands/#lazy-request), that value alone decides whether the session gets [Typing Start](/gateway/events/#typing-start), including for bots. Without it the event follows the active state.### Events in a thread-A message, reaction, typing, or pin event in a thread follows the rules on this page and also needs one of the conditions in [Gateway threads](/gateway/threads/#dispatch-events). A session meets the [`threads`](/gateway/threads/#lazy-request-thread-options) condition only while the guild is active for it, through [Lazy Request](/gateway/commands/#lazy-request) `active` or the [Identify](/gateway/commands/#identify) `initial_guild_id`. A guild with 250 members or fewer gives no exception to that condition.+A message, reaction, typing or pin event in a thread also has to meet one of the conditions on [Gateway threads](/gateway/threads/#dispatch-events). The [`threads`](/gateway/threads/#lazy-request-thread-options) condition applies only while the guild is active for the session.### Member lists-[Guild Member List Update](/gateway/events/#guild-member-list-update) has its own subscription. A session receives it only for a channel it named in `member_list_channels`, and only while it can view that channel and holds `VIEW_CHANNEL_MEMBERS` on it. One session holds at most one member list subscription per guild. [Thread Member List Update](/gateway/threads/#thread-member-list-update) has a separate subscription, as [Lazy Request thread options](/gateway/threads/#lazy-request-thread-options) describes.+[Guild Member List Update](/gateway/events/#guild-member-list-update) goes to a session only for a channel in its `member_list_channels` that it can view with `VIEW_CHANNEL_MEMBERS`. A session has one member list subscription per guild.## Visited guilds-A session [visiting](/http-api/guilds/#visiting-guilds) a guild receives only these events for it, and every other event is withheld, including any event added later:+A session [visiting](/http-api/guilds/#visiting-guilds) a guild gets only these events for it.-- [Guild Update](/gateway/events/#guild-update), and the role, emoji, and sticker events.-- [Channel Create](/gateway/events/#channel-create), [Channel Update](/gateway/events/#channel-update), [Channel Update Bulk](/gateway/events/#channel-update-bulk), and [Channel Delete](/gateway/events/#channel-delete) for channels a visitor can read, with only the @everyone permission overwrite. A channel a visitor can no longer read arrives as Channel Delete, and one that becomes readable arrives as Channel Create.-- [Channel Pins Update](/gateway/events/#channel-pins-update) for channels a visitor can read.-- Message and reaction events for the channel the session has focused with `focused_channel_id` in [Lazy Request](/gateway/commands/#lazy-request). Reaction events have no `user_id` and no `member`.-- Thread Create, Thread Update, and Thread Delete for public threads in channels a visitor can read.+- [Guild Update](/gateway/events/#guild-update) and the role, emoji and sticker events+- Channel create, update and delete events for channels a visitor can read, with only the @everyone overwrite+- [Channel Pins Update](/gateway/events/#channel-pins-update) for channels a visitor can read+- Message and reaction events for the channel set as `focused_channel_id` in [Lazy Request](/gateway/commands/#lazy-request)+- [Thread create, update and delete events](/gateway/threads/#dispatch-events) for public threads in channels a visitor can read-Visitors never appear in member lists, presences, typing, voice states, or member counts, and members receive nothing when a visitor connects or leaves. Member list ranges, [Request Guild Members](/gateway/commands/#request-guild-members), acknowledgements, and typing are ignored for a visited guild.+Visitors never appear in member lists, presences, typing, voice states or member counts. Fluxer ignores member list ranges, [Request Guild Members](/gateway/commands/#request-guild-members), read acknowledgments and typing from a session for a visited guild.## Presence subscriptions-[Presence Update](/gateway/events/#presence-update) skips gates 1 through 3 and is subject only to gate 4. A guild dispatches it only to a session that named the subject in the `members` array of a [Lazy Request](/gateway/commands/#lazy-request), that can view at least one channel the subject can view, and that does not belong to the subject.--A session that no longer shares a viewable channel with the subject is dropped from that subject's subscriber set, so a client that regains access MUST resend `members` to restore delivery. Each `members` array replaces the session's previous subscription set for that guild.--A bot session holds no friend or group direct message presence subscriptions, so a bot receives a presence through this guild path alone.+A session gets a [Presence Update](/gateway/events/#presence-update) for a guild member only if it listed that user in the `members` array of a [Lazy Request](/gateway/commands/#lazy-request) and can view a channel the user can view. Each `members` array replaces the previous set for that guild. If the session loses access to every channel it shares with a user, send that user in `members` again once access comes back.## Ignored events-Identify accepts `ignored_events`, an array of up to 256 Dispatch event names. Fluxer upper-cases and deduplicates the names at Identify. An absent field and a JSON `null` both mean the empty list. Fluxer closes the connection with `4002` and reason `Invalid identify payload` for any other value that is not an array of strings, and for any array of more than 256 entries. A Dispatch whose `t` appears in the list is dropped and never enters the replay buffer.+`ignored_events` in Identify is an array of up to 256 Dispatch event names. Fluxer drops each listed event for the session, and the list can only change with a new Identify. An invalid value closes the connection with `4002`.++Fluxer still sends [Message Create](/gateway/events/#message-create) when `MESSAGE_CREATE` is ignored if the message mentions the user directly or uses `@here` or `@everyone`, but not for a role mention. A dropped event uses no sequence number.```json{@@ -141,14 +97,8 @@ Identify accepts `ignored_events`, an array of up to 256 Dispatch event names. F## The shard filter-A session that identified with a `shard` pair whose `shard_id` is not 0 drops every Dispatch that does not name a guild. A Dispatch names a guild through a non-empty `guild_id`, or through a non-empty `id` on a [Guild Create](/gateway/events/#guild-create), [Guild Update](/gateway/events/#guild-update), [Guild Delete](/gateway/events/#guild-delete), or [Guild Sync](/gateway/events/#guild-sync) payload. [Rate Limited](/gateway/events/#rate-limited), [Guild Counts Update](/gateway/events/#guild-counts-update), and [Channel Member Counts Update](/gateway/events/#channel-member-counts-update) answer a command the session sent, and each passes the gate whatever its payload holds.--Account-level traffic, direct message traffic, relationship changes, and calls therefore never reach a session on a shard other than 0.--Sessions on shard 0, and sessions that identified without a `shard` pair, filter nothing at this gate. Fluxer still filters guilds by shard at Identify, as [Sharding](/gateway/overview/#sharding) describes, so a shard 0 session is only ever connected to the guilds its shard owns.+A session that identified with a `shard_id` other than 0 drops every Dispatch that has no guild. This filter does not drop [Rate Limited](/gateway/events/#rate-limited), [Guild Counts Update](/gateway/events/#guild-counts-update) or [Channel Member Counts Update](/gateway/events/#channel-member-counts-update), which answer a command the session sent. Account, direct message, relationship and call events arrive only on shard 0 or on a session that sent no `shard` pair (see [Sharding](/gateway/overview/#sharding)).## What a bot should send-A bot session is never passive, so `active` changes nothing for it and a typical bot needs no [Lazy Request](/gateway/commands/#lazy-request) at all. It shapes traffic with `ignored_events` and pulls members with [Request Guild Members](/gateway/commands/#request-guild-members).--A bot that does not process typing or reactions saves the most by ignoring `TYPING_START`, `MESSAGE_REACTION_ADD`, and `MESSAGE_REACTION_REMOVE`. Ignoring `PRESENCE_UPDATE` saves a bot nothing, because a bot receives no presence until it subscribes to one.+A bot needs no Lazy Request, and if it doesn't use typing or reactions, add `TYPING_START`, `MESSAGE_REACTION_ADD` and `MESSAGE_REACTION_REMOVE` to `ignored_events`.diff --git a/fluxer_docs/src/content/docs/gateway/events.md b/fluxer_docs/src/content/docs/gateway/events.mdindex 2b1740fa0..b46c25ed3 100644--- a/fluxer_docs/src/content/docs/gateway/events.md+++ b/fluxer_docs/src/content/docs/gateway/events.md@@ -1,10 +1,10 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Gateway events-description: Every main Gateway Dispatch event, its payload, its delivery scope, and its replay behaviour.+description: Every Gateway Dispatch event with its payload and who receives it.----A Dispatch reports a change or command result through the [Gateway](/gateway/overview/). It has [opcode](/gateway/opcodes-and-close-codes/#opcodes) 0, an event name, and a payload.+A Dispatch tells a [Gateway](/gateway/overview/) session that something changed or answers one of its commands. It has [opcode](/gateway/opcodes-and-close-codes/#opcodes) 0, an event name in `t` and the payload in `d`.## Dispatch envelope@@ -13,7 +13,7 @@ A Dispatch reports a change or command result through the [Gateway](/gateway/ove| op | integer | Value 0 || t | string | Uppercase event name || s | integer | Non-negative session sequence |-| d | any | Payload defined for the named event |+| d | any | Payload defined for the event in `t` |```json{@@ -24,109 +24,117 @@ A Dispatch reports a change or command result through the [Gateway](/gateway/ove}```-[Ready](#ready) establishes sequence 1. Live Dispatches advance it by one. Replayed Dispatches keep their original sequence and can have gaps. [Resumed](#resumed) has the session's current sequence without advancing it. The next live Dispatch has that sequence plus one. The sequence is local to one Gateway session and orders nothing across shards or HTTP operations.+[Ready](#ready) has sequence 1 and each live Dispatch after it adds one. Replayed Dispatches keep their original sequence and can have gaps. The sequence counts Dispatches for one session and says nothing about order across shards or HTTP requests.## Dispatch delivery-[Event filtering](/gateway/event-filtering/) defines delivery by guild availability, channel visibility, permissions, and session settings. Account-scoped Dispatches go through the session-level filters alone. Those are the [thread access](/gateway/threads/#session-flag) filter, the shard filter, and the `ignored_events` list.+[Event filtering](/gateway/event-filtering/) decides which sessions receive each Dispatch. A user session without the [`CHANNEL_THREADS`](/gateway/threads/#session-flag) flag also gets reduced payloads and no thread events.-Most guild-scoped Dispatches have a `guild_id` string. [Guild Create](#guild-create) and [Guild Sync](#guild-sync) identify the guild as `id`, and so does every [Guild Delete](#guild-delete) other than the one the guild itself dispatches when the guild is deleted. [Guild Counts Update](#guild-counts-update) and [Channel Member Counts Update](#channel-member-counts-update) have no top-level `guild_id`, and each entry in their `counts` array has its own.+Most guild events have a `guild_id`. [Guild Create](#guild-create), [Guild Sync](#guild-sync) and [Guild Delete](#guild-delete) use `id`, and [Guild Counts Update](#guild-counts-update) and [Channel Member Counts Update](#channel-member-counts-update) put `guild_id` on each entry.-The originating session is excluded from a Dispatch only for [Message Reaction Add](#message-reaction-add) and [Message Reaction Remove](#message-reaction-remove) in a guild channel, and only when the request supplied a `session_id`. That field is removed from the payload. The same field on a direct message or group direct message reaction is forwarded to every recipient unchanged and excludes nobody. The actor that issues any other mutation receives the resulting Dispatch like every other eligible session.+The session that made a change receives the Dispatch like any other session. The one exception is a guild-channel reaction, where the request's `session_id` excludes that session from [Message Reaction Add](#message-reaction-add) and [Message Reaction Remove](#message-reaction-remove).-A Dispatch is buffered for [Resume](/gateway/commands/#resume) replay unless it is [Guild Sync](#guild-sync), [Guild Member List Update](#guild-member-list-update), [Guild Members Chunk](#guild-members-chunk), [Thread List Sync](/gateway/threads/#thread-list-sync), or [Thread Member List Update](/gateway/threads/#thread-member-list-update). Those are delivered live and never retained. A single oversized Dispatch is delivered but not retained, as [Limits and rate limits](/gateway/limits-and-rate-limits/#replay-and-backpressure) describes. [Ready](#ready) and the guild burst that follows it for a bot session are also sent outside the replay buffer. The initial [Call Create](#call-create) events are retained like any other Dispatch and are replayed on Resume.+[Resume](/gateway/commands/#resume) replays every Dispatch except [Ready](#ready) and the [Guild Create](#guild-create) and [Guild Delete](#guild-delete) burst a bot gets after Ready. These events are live only and are never replayed.++- [Guild Sync](#guild-sync)+- [Guild Member List Update](#guild-member-list-update)+- [Guild Members Chunk](#guild-members-chunk)+- [Thread List Sync](/gateway/threads/#thread-list-sync)+- [Thread Member List Update](/gateway/threads/#thread-member-list-update)++[Limits and rate limits](/gateway/limits-and-rate-limits/#replay-and-backpressure) explains when an oversized Dispatch is not kept.## Dispatch events-| Event | Description | Scope |-| --- | --- | --- |-| [Ready](#ready) | The initial session state after a successful Identify | Session lifecycle |-| [Resumed](#resumed) | Retained replay completes after a successful Resume | Session lifecycle |-| [Sessions Replace](#sessions-replace) | The account's live session presence set is replaced | Current user |-| [Auth Session Change](#auth-session-change) | The account's authentication session is rotated | Current user |-| [Rate Limited](#rate-limited) | A member request is refused by its budget | Command response |-| [User Update](#user-update) | The current user's account record changes | Current user |-| [User Settings Update](#user-settings-update) | The current user's account-wide settings change | Current user |-| [User Guild Settings Update](#user-guild-settings-update) | One guild notification record changes | Current user |-| [User Note Update](#user-note-update) | The current user writes or clears a private note | Current user |-| [User Pinned DMs Update](#user-pinned-dms-update) | The current user's pinned private channel set is replaced | Current user |-| [User Connections Update](#user-connections-update) | The current user's external connection set is replaced | Current user |-| [WebAuthn Credentials Update](#webauthn-credentials-update) | The current user's WebAuthn credential set is replaced | Current user |-| [Relationship Add](#relationship-add) | The current user gains a relationship | Current user |-| [Relationship Update](#relationship-update) | One of the current user's relationships changes | Current user |-| [Relationship Remove](#relationship-remove) | The current user loses a relationship | Current user |-| [Saved Message Create](#saved-message-create) | The current user saves a message | Current user |-| [Saved Message Delete](#saved-message-delete) | The current user unsaves a message | Current user |-| [Recent Mention Delete](#recent-mention-delete) | The current user removes a recent mention | Current user |-| [Favorite Meme Create](#favorite-meme-create) | The current user saves a meme | Current user |-| [Favorite Meme Update](#favorite-meme-update) | One of the current user's memes changes | Current user |-| [Favorite Meme Delete](#favorite-meme-delete) | The current user deletes a meme | Current user |-| [Guild Create](#guild-create) | A guild becomes available to the session | Guild connection |-| [Guild Sync](#guild-sync) | A subscribed session receives the guild's full current state again | Guild connection |-| [Guild Update](#guild-update) | A guild's configuration changes | Guild connection |-| [Guild Delete](#guild-delete) | A guild leaves the session's visibility or becomes unavailable | Guild connection |-| [Guild Role Create](#guild-role-create) | A role is created in a guild | Guild connection |-| [Guild Role Update](#guild-role-update) | Exactly one role record changes | Guild connection |-| [Guild Role Update Bulk](#guild-role-update-bulk) | One operation changes several role records together | Guild connection |-| [Guild Role Delete](#guild-role-delete) | A role is deleted from a guild | Guild connection |-| [Guild Emojis Update](#guild-emojis-update) | A guild's emojis change | Guild connection |-| [Guild Stickers Update](#guild-stickers-update) | A guild's stickers change | Guild connection |-| [Channel Create](#channel-create) | A channel becomes visible to the session | Channel visibility |-| [Channel Update](#channel-update) | A visible channel changes | Channel visibility |-| [Channel Update Bulk](#channel-update-bulk) | One operation changes several channels together | Channel visibility |-| [Channel Delete](#channel-delete) | A channel leaves the session's visibility | Channel visibility |-| [Channel Recipient Add](#channel-recipient-add) | A user joins a group direct message the session belongs to | Private channel |-| [Channel Recipient Remove](#channel-recipient-remove) | A user leaves a group direct message the session belongs to | Private channel |-| [Webhooks Update](#webhooks-update) | The webhook set of a viewable guild channel changes | Channel visibility |-| [Invite Create](#invite-create) | An invite is created | Invite audience |-| [Invite Delete](#invite-delete) | An invite is deleted | Invite audience |-| [Thread Create](/gateway/threads/#thread-create) | A thread is created or the session joins one | Thread visibility |-| [Thread Update](/gateway/threads/#thread-update) | A visible thread changes | Thread visibility |-| [Thread Delete](/gateway/threads/#thread-delete) | A thread is deleted | Thread visibility |-| [Thread List Sync](/gateway/threads/#thread-list-sync) | The session's active thread set is replaced | Guild connection |-| [Thread Member Update](/gateway/threads/#thread-member-update) | The session's own thread membership changes | Current user |-| [Thread Members Update](/gateway/threads/#thread-members-update) | Users join or leave a thread | Thread visibility |-| [Thread Member List Update](/gateway/threads/#thread-member-list-update) | A subscribed thread member list resyncs | Member list subscription |-| [Forum Unreads](/gateway/threads/#forum-unreads) | Unread counts for forum posts are returned | Command response |-| [Guild Member Add](#guild-member-add) | A user becomes a member of a connected guild | Guild connection |-| [Guild Member Update](#guild-member-update) | A member's guild state or public user representation changes | Guild connection |-| [Guild Member Remove](#guild-member-remove) | A user stops being a member of a connected guild | Guild connection |-| [Guild Members Chunk](#guild-members-chunk) | A bounded member result answers Request Guild Members | Command response |-| [Guild Member List Update](#guild-member-list-update) | A subscribed member list resyncs the subscriber's ranges | Member list subscription |-| [Guild Audit Log Entry Create](#guild-audit-log-entry-create) | An audit log entry is written in a guild | Holders of `VIEW_AUDIT_LOG` |-| [Guild Ban Add](#guild-ban-add) | A guild ban is created | Guild connection |-| [Guild Ban Remove](#guild-ban-remove) | A guild ban is removed | Guild connection |-| [Presence Update](#presence-update) | One visible presence changes | Presence subscription |-| [Presence Update Bulk](#presence-update-bulk) | A recovering guild delivers its visible presences together | Guild connection |-| [Passive Updates](#passive-updates) | Channel `last_message_id` values or voice states changed for one passive session | Passive session |-| [Message Create](#message-create) | A visible message is created | Channel visibility |-| [Message Update](#message-update) | A visible message changes and is republished in full | Message access |-| [Message Delete](#message-delete) | One visible message is deleted | Message access |-| [Message Delete Bulk](#message-delete-bulk) | Several messages in one channel are deleted together | Channel visibility |-| [Message ACK](#message-ack) | The current user's read state advances for a channel | Current user |-| [Message Reaction Add](#message-reaction-add) | A user adds a reaction to a message | Message access |-| [Message Reaction Add Many](#message-reaction-add-many) | A debouncing session receives several reaction additions as one event | Message access |-| [Message Reaction Remove](#message-reaction-remove) | One user's reaction is removed from a message | Message access |-| [Message Reaction Remove All](#message-reaction-remove-all) | Every reaction is removed from a message at once | Message access |-| [Message Reaction Remove Emoji](#message-reaction-remove-emoji) | Every reaction using one emoji is removed from a message | Message access |-| [Typing Start](#typing-start) | A visible user begins typing in a channel | Channel visibility |-| [Channel Pins Update](#channel-pins-update) | A channel's most recent pin time changes | Channel visibility |-| [Channel Pins ACK](#channel-pins-ack) | The current user acknowledges a channel's pins | Current user |-| [Voice State Update](#voice-state-update) | A guild or call participant's voice state changes | Channel visibility |-| [Voice Server Update](#voice-server-update) | The session receives or replaces its own voice grant | Current session |-| [Voice Signal](#voice-signal) | Another peer-to-peer voice connection sends this connection a signalling message | Current session |-| [Entrance Sound Play](#entrance-sound-play) | A participant's entrance sound plays in a voice channel | Voice channel |-| [Call Create](#call-create) | A private channel call begins or becomes visible | Call recipient |-| [Call Update](#call-update) | The ringing set, participant roster, or region of a call changes | Call recipient |-| [Call Delete](#call-delete) | A call ends or becomes unavailable | Call recipient |-| [Guild Counts Update](#guild-counts-update) | Member and online counts are returned for connected guilds | Command response |-| [Channel Member Counts Update](#channel-member-counts-update) | Per-channel member and online counts are returned for one guild | Command response |+| Event | Description |+| --- | --- |+| [Ready](#ready) | The initial session state after a successful Identify |+| [Resumed](#resumed) | Replay after a Resume is finished |+| [Sessions Replace](#sessions-replace) | The account's live sessions changed |+| [Auth Session Change](#auth-session-change) | A password change replaced the authentication session |+| [Rate Limited](#rate-limited) | A bot asked for a full member list too often |+| [User Update](#user-update) | The current user's account record changes |+| [User Settings Update](#user-settings-update) | The current user's account-wide settings change |+| [User Guild Settings Update](#user-guild-settings-update) | One guild notification record changes |+| [User Note Update](#user-note-update) | The current user writes or clears a private note |+| [User Pinned DMs Update](#user-pinned-dms-update) | The current user's pinned private channel set is replaced |+| [User Connections Update](#user-connections-update) | The current user's external connection set is replaced |+| [WebAuthn Credentials Update](#webauthn-credentials-update) | The current user's WebAuthn credential set is replaced |+| [Relationship Add](#relationship-add) | The current user gains a relationship |+| [Relationship Update](#relationship-update) | One of the current user's relationships changes |+| [Relationship Remove](#relationship-remove) | The current user loses a relationship |+| [Saved Message Create](#saved-message-create) | The current user saves a message |+| [Saved Message Delete](#saved-message-delete) | The current user unsaves a message |+| [Recent Mention Delete](#recent-mention-delete) | The current user removes a recent mention |+| [Favorite Meme Create](#favorite-meme-create) | The current user saves a meme |+| [Favorite Meme Update](#favorite-meme-update) | One of the current user's memes changes |+| [Favorite Meme Delete](#favorite-meme-delete) | The current user deletes a meme |+| [Guild Create](#guild-create) | A guild becomes available to the session |+| [Guild Sync](#guild-sync) | A subscribed session receives the guild's full current state again |+| [Guild Update](#guild-update) | A guild's configuration changes |+| [Guild Delete](#guild-delete) | A guild leaves the session's visibility or becomes unavailable |+| [Guild Role Create](#guild-role-create) | A role is created in a guild |+| [Guild Role Update](#guild-role-update) | One role changed |+| [Guild Role Update Bulk](#guild-role-update-bulk) | Several roles changed at once |+| [Guild Role Delete](#guild-role-delete) | A role is deleted from a guild |+| [Guild Emojis Update](#guild-emojis-update) | A guild's emojis change |+| [Guild Stickers Update](#guild-stickers-update) | A guild's stickers change |+| [Channel Create](#channel-create) | A channel becomes visible to the session |+| [Channel Update](#channel-update) | A visible channel changes |+| [Channel Update Bulk](#channel-update-bulk) | One operation changes several channels together |+| [Channel Delete](#channel-delete) | A channel leaves the session's visibility |+| [Channel Recipient Add](#channel-recipient-add) | A user joins a group direct message the session belongs to |+| [Channel Recipient Remove](#channel-recipient-remove) | A user leaves a group direct message the session belongs to |+| [Webhooks Update](#webhooks-update) | The webhook set of a viewable guild channel changes |+| [Invite Create](#invite-create) | An invite is created |+| [Invite Delete](#invite-delete) | An invite is deleted |+| [Thread Create](/gateway/threads/#thread-create) | A thread is created or the session joins one |+| [Thread Update](/gateway/threads/#thread-update) | A visible thread changes |+| [Thread Delete](/gateway/threads/#thread-delete) | A thread is deleted |+| [Thread List Sync](/gateway/threads/#thread-list-sync) | The session's active thread set is replaced |+| [Thread Member Update](/gateway/threads/#thread-member-update) | The session's own thread membership changes |+| [Thread Members Update](/gateway/threads/#thread-members-update) | Users join or leave a thread |+| [Thread Member List Update](/gateway/threads/#thread-member-list-update) | A subscribed thread member list changed |+| [Forum Unreads](/gateway/threads/#forum-unreads) | Unread counts for forum posts are returned |+| [Guild Member Add](#guild-member-add) | A user becomes a member of a connected guild |+| [Guild Member Update](#guild-member-update) | A member's guild state or public user representation changes |+| [Guild Member Remove](#guild-member-remove) | A user stops being a member of a connected guild |+| [Guild Members Chunk](#guild-members-chunk) | The answer to Request Guild Members |+| [Guild Member List Update](#guild-member-list-update) | A subscribed member list changed |+| [Guild Audit Log Entry Create](#guild-audit-log-entry-create) | An audit log entry is written in a guild |+| [Guild Ban Add](#guild-ban-add) | A guild ban is created |+| [Guild Ban Remove](#guild-ban-remove) | A guild ban is removed |+| [Presence Update](#presence-update) | One visible presence changes |+| [Presence Update Bulk](#presence-update-bulk) | Online presences of a guild that was unavailable |+| [Passive Updates](#passive-updates) | Channel `last_message_id` values or voice states changed for one passive session |+| [Message Create](#message-create) | A visible message is created |+| [Message Update](#message-update) | A message changed |+| [Message Delete](#message-delete) | One visible message is deleted |+| [Message Delete Bulk](#message-delete-bulk) | Several messages in one channel are deleted together |+| [Message ACK](#message-ack) | The current user's read state advances for a channel |+| [Message Reaction Add](#message-reaction-add) | A user adds a reaction to a message |+| [Message Reaction Add Many](#message-reaction-add-many) | Several reactions grouped into one event |+| [Message Reaction Remove](#message-reaction-remove) | One user's reaction is removed from a message |+| [Message Reaction Remove All](#message-reaction-remove-all) | Every reaction is removed from a message at once |+| [Message Reaction Remove Emoji](#message-reaction-remove-emoji) | Every reaction using one emoji is removed from a message |+| [Typing Start](#typing-start) | A visible user begins typing in a channel |+| [Channel Pins Update](#channel-pins-update) | A channel's most recent pin time changes |+| [Channel Pins ACK](#channel-pins-ack) | The current user acknowledges a channel's pins |+| [Voice State Update](#voice-state-update) | A guild or call participant's voice state changes |+| [Voice Server Update](#voice-server-update) | The session receives or replaces its own voice grant |+| [Voice Signal](#voice-signal) | A signaling message from another peer-to-peer connection |+| [Entrance Sound Play](#entrance-sound-play) | A participant's entrance sound plays in a voice channel |+| [Call Create](#call-create) | A private channel call begins or becomes visible |+| [Call Update](#call-update) | The ringing set, participant roster, or region of a call changes |+| [Call Delete](#call-delete) | A call ends or becomes unavailable |+| [Guild Counts Update](#guild-counts-update) | Member and online counts are returned for connected guilds |+| [Channel Member Counts Update](#channel-member-counts-update) | Per-channel member and online counts are returned for one guild |## Session and current user### <span id="ready-object"></span>READY-The initial session state. Sent once after a successful [Identify](/gateway/commands/#identify), always with sequence 1.+The session's initial state, sent once after a successful [Identify](/gateway/commands/#identify).| Field | Type | Description || --- | --- | --- |@@ -137,86 +145,73 @@ The initial session state. Sent once after a successful [Identify](/gateway/comm| private_channels | array[[channel](/http-api/channels/#channel-object) object] | Direct message and group direct message channels || relationships<sup>2</sup> | array[[relationship](/http-api/users/relationships/#relationship-object) object] | The account's relationships || presences<sup>3</sup> | array[[presence object](#presence-object)] | Visible presences at connection time |-| users<sup>4</sup> | array[[partial user](/http-api/users/#partial-user-object) object] | Users referenced by the payload |-| sessions | array[[session presence object](#session-presence-object)] | The account's other live sessions |-| read_states<sup>5</sup> | array[[read state](/http-api/read-states/#read-state-object) object] | Per-channel read state |+| users<sup>2</sup> | array[[partial user](/http-api/users/#partial-user-object) object] | Users referenced by the payload |+| sessions | array[[session presence object](#session-presence-object)] | Every live session of the account, after a combined `all` entry |+| read_states | array[[read state](/http-api/read-states/#read-state-object) object] | Per-channel read state || user_settings | ?[user settings](/http-api/users/#user-settings-object) object | Account-wide settings |-| user_guild_settings<sup>5</sup> | array[[user guild settings](/http-api/users/settings/#user-guild-settings-object) object] | Per-guild notification settings |+| user_guild_settings | array[[user guild settings](/http-api/users/settings/#user-guild-settings-object) object] | Per-guild notification settings || notes | map[snowflake, string] | Private notes keyed by user ID || pinned_dms | array[snowflake] | Pinned private channel IDs || favorite_memes | array[[meme](/http-api/memes/#meme-object) object] | Saved memes || webauthn_credentials | array[[WebAuthn credential object](#webauthn-credential-object)] | Registered WebAuthn credentials |-| rtc_regions | array[[RTC region object](#rtc-region-object)] | Voice regions, ordered nearest first |-| country_code | string | Country resolved from the connecting address, `US` when the address resolves to none |-| latitude? | string | Latitude resolved from the connecting address, rendered as a decimal string |-| longitude? | string | Longitude resolved from the connecting address, rendered as a decimal string |+| rtc_regions | array[[RTC region object](#rtc-region-object)] | Voice regions, nearest first |+| country_code | string | Country of the connecting address, `US` when unknown |+| latitude? | string | Latitude of the connecting address as a decimal string |+| longitude? | string | Longitude of the connecting address as a decimal string || auth_session_id_hash? | string | Base64url hash identifying the authentication session |-| shard? | array[integer] | The accepted `[shard_id, shard_count]` pair, present only when Identify supplied one |-| _timings? | object | HTTP-side timing breakdown, present only for a staff account |-| _timings_gw? | object | Gateway-side timing breakdown, present only for a staff account |--<sup>1</sup> On a bot session every entry is an unavailable guild with `id` and `unavailable: true` alone. The burst described below then sends a [Guild Create](#guild-create) with the full state of each available guild, and a [Guild Delete](#guild-delete) for each unavailable one--<sup>2</sup> Each entry has its `user` field removed and the removed accounts appear in `users` instead, so a client resolves a relationship through the entry's `id`+| shard? | array[integer] | The accepted `[shard_id, shard_count]` pair, when Identify sent one |+| _timings? | object | HTTP-side timing breakdown, only for a staff account |+| _timings_gw? | object | Gateway-side timing breakdown, only for a staff account |-<sup>3</sup> A bot session always receives an empty array here+<sup>1</sup> On a bot session every entry is `{"id": "...", "unavailable": true}`, and a [Guild Create](#guild-create) or [Guild Delete](#guild-delete) for each one follows Ready-<sup>4</sup> Collected from the account's relationships, the recipients of its private channels, and the members in `guilds`, deduplicated by account ID. A bot session always receives an empty array here+<sup>2</sup> Relationships in Ready have no `user`, and each guild member's `user` has only `id`. The full accounts are in `users`. A bot gets an empty `users`, its Guild Create burst after Ready has members with the same `{"id": "..."}` user, and it fetches the accounts with [Request Guild Members](/gateway/commands/#request-guild-members). A later Guild Create and every Guild Sync have full members.-<sup>5</sup> A session without [thread access](/gateway/threads/#session-flag) receives no read state that has `flags`, no channel override of a forum or media channel, and no `flags` on an override+<sup>3</sup> Always empty for a bot session-Ready is sent outside the replay buffer, so a [Resume](/gateway/commands/#resume) never replays it.--A bot session receives one [Guild Create](#guild-create) per available guild immediately after Ready, and one [Guild Delete](#guild-delete) per unavailable guild. Together they resolve the entries of the `guilds` array. Those Dispatches are also sent outside the replay buffer.--Shortly after Ready, every session receives one [Call Create](#call-create) for each of its private channels that has an active call.+Shortly after Ready, the session gets a [Call Create](#call-create) for each private channel with an active call.#### Guild ready object-The same structure appears in Ready, [Guild Create](#guild-create), and [Guild Sync](#guild-sync).+The guild state in Ready, [Guild Create](#guild-create) and [Guild Sync](#guild-sync).| Field | Type | Description || --- | --- | --- || id | snowflake | Guild ID |-| properties | [guild](/http-api/guilds/#guild-object) object | Guild record without its roles, channels, emojis, stickers, or members |+| properties | [guild](/http-api/guilds/#guild-object) object | Guild record without its roles, channels, emojis, stickers or members || roles | array[[guild role](/http-api/permissions/#guild-role-object) object] | Every role in the guild || channels | array[[channel](/http-api/channels/#channel-object) object] | Channels the session can view || emojis | array[[guild emoji](/http-api/guild-emojis/#guild-emoji-object) object] | Every emoji in the guild || stickers | array[[guild sticker](/http-api/guild-stickers/#guild-sticker-object) object] | Every sticker in the guild || members<sup>1</sup> | array[[guild member](/http-api/guild-members/#guild-member-object) object] | The members the session needs immediately || member_count | integer | Total member count |-| online_count<sup>2</sup> | integer | Online member count |-| presences<sup>3</sup> | array[[presence object](#presence-object)] | Always an empty array |+| online_count | integer | Members with a live session and a status other than `offline` or `invisible` |+| presences<sup>2</sup> | array[[presence object](#presence-object)] | Always an empty array || voice_states | array[[voice state object](#voice-state-object)] | Voice states in channels the session can view |-| joined_at | ?ISO8601 timestamp | When the account joined the guild, null when the account is not a member |+| joined_at | ?ISO8601 timestamp | When the account joined the guild, null when it is not a member || unavailable? | boolean | Whether the guild is unavailable |+| visiting? | boolean | Whether the account is [visiting](/http-api/guilds/#visiting-guilds) the guild without being a member || unavailable_hidden? | boolean | Whether an unavailable guild is hidden from the client |-| threads?<sup>4</sup> | array[[thread](/http-api/threads/#thread-object) object] | The active threads the session receives, as [Guild threads](/gateway/threads/#guild-threads) describes |--<sup>1</sup> The session's own member object plus the member object of every participant named by `voice_states`, and nothing else. A client that needs the rest of the roster asks for it with [Request Guild Members](/gateway/commands/#request-guild-members) or subscribes to a member list through [Lazy Request](/gateway/commands/#lazy-request)+| threads?<sup>3</sup> | array[[thread](/http-api/threads/#thread-object) object] | Active threads, as [Guild threads](/gateway/threads/#guild-threads) describes |-<sup>2</sup> Counts the members that hold a live Gateway session and publish a status other than `offline` or `invisible`. Every recipient receives the same guild-wide figure. [Guild Counts Update](#guild-counts-update) reports a per-viewer count+<sup>1</sup> Only the session's own member and the members in `voice_states`. Use [Request Guild Members](/gateway/commands/#request-guild-members) or a member list from [Lazy Request](/gateway/commands/#lazy-request) for the rest-<sup>3</sup> Guild presences arrive as separate [Presence Update](#presence-update) and [Presence Update Bulk](#presence-update-bulk) Dispatches+<sup>2</sup> Presences arrive as [Presence Update](#presence-update) and [Presence Update Bulk](#presence-update-bulk)-<sup>4</sup> Present only for a bot session and for a user session that set [`CHANNEL_THREADS`](/gateway/threads/#session-flag)+<sup>3</sup> Only for a session with [thread access](/gateway/threads/#session-flag)-A user session without `CHANNEL_THREADS` receives reduced `roles` and `channels`, as [Session flag](/gateway/threads/#session-flag) describes.--An unavailable guild is reduced to `id` and `unavailable: true`, plus `unavailable_hidden: true` when the guild is hidden. It has none of the other fields. Every entry in a bot session's [Ready](#ready) `guilds` array has this form, with `id` and `unavailable: true` alone.--Inside [Ready](#ready), and inside the [Guild Create](#guild-create) burst a bot receives immediately after Ready, each entry in `members` has its `user` replaced by `{"id": "..."}`. A bot session's Ready has no `members` at all, because each of its guilds is an unavailable guild, so a bot sees the reduced form in the burst alone. On a user session the removed accounts appear in the Ready payload's `users` array. A bot's `users` array is empty, so a bot pulls those accounts with [Request Guild Members](/gateway/commands/#request-guild-members). A [Guild Create](#guild-create) sent later in the session, and every [Guild Sync](#guild-sync), have the members with `user` intact.+An unavailable guild has only `id`, `unavailable: true` and, when hidden, `unavailable_hidden: true`.#### Session presence object| Field | Type | Description || --- | --- | --- |-| session_id | string | Session identifier, or the literal `all` for the aggregate entry |-| status | string | `online`, `idle`, `dnd`, `invisible`, or `offline` |+| session_id | string | Session identifier, or `all` for the combined entry |+| status | string | `online`, `idle`, `dnd`, `invisible` or `offline` || afk | boolean | Whether the session is away || mobile | boolean | Whether the session is mobile |-The first entry always has `session_id: "all"` and the account's combined status, which is the first of `dnd`, `online`, `idle`, and `invisible` that any of its sessions has, or `offline` when none has one.+The first entry is always `all`, with the account's combined status.#### WebAuthn credential object@@ -236,62 +231,52 @@ The first entry always has `session_id: "all"` and the account's combined status| name | string | Human-readable region name || emoji | string | Region emoji |-The array always begins with a synthetic entry whose `id` is `automatic`, `name` is `Automatic`, and `emoji` is the globe. Choosing that entry leaves the region to the server. Every other entry is a region the account can select, ordered by distance from the `latitude` and `longitude` in the [Identify properties](/gateway/commands/#identify-properties-object). Fluxer orders by distance only when both values parse as finite numbers, and otherwise orders by region ID.+The first entry is always `automatic`, which lets Fluxer pick the region. The rest are sorted by distance from the `latitude` and `longitude` in the [Identify properties](/gateway/commands/#identify-properties-object), or by ID when those are missing.### RESUMED-Sent after a successful [Resume](/gateway/commands/#resume) has replayed every retained Dispatch above the supplied sequence.+Sent after a successful [Resume](/gateway/commands/#resume) has replayed the missed Dispatches. Its `s` is the current sequence and the next live Dispatch adds one.| Field | Type | Description || --- | --- | --- |-| _timings_gw? | object | Gateway-side timing breakdown, present only for a staff account |--The payload is otherwise empty. Resumed has the session's current sequence in `s` without advancing it, and the next live Dispatch has that sequence plus one.+| _timings_gw? | object | Gateway-side timing breakdown, only for a staff account |### <span id="sessions-replace"></span>SESSIONS_REPLACE-The account's set of live sessions changed. The payload is a bare JSON array of [session presence objects](#session-presence-object) and is always the complete set. A client that stores the sessions replaces them with this array. [Ready](#ready) sends the initial set as `sessions`.+The account's live sessions changed. The payload is an array of every [session presence object](#session-presence-object), and it replaces the `sessions` list from [Ready](#ready).### <span id="auth-session-change"></span>AUTH_SESSION_CHANGE-The account's authentication session was rotated by a password change.+A password change replaced the account's authentication session.| Field | Type | Description || --- | --- | --- |-| old_auth_session_id_hash | string | Base64url hash of the authentication session that was replaced |-| new_auth_session_id_hash | string | Base64url hash of the replacement authentication session |+| old_auth_session_id_hash | string | Base64url hash of the replaced authentication session |+| new_auth_session_id_hash | string | Base64url hash of the new authentication session |-The event never includes the replacement token. The API closes every gateway session of the replaced authentication session before it sends the event, so those sessions do not receive it. The client that changed the password gets the replacement token and `auth_session_id_hash` in the HTTP response. It MUST use that token for every later HTTP request and for any later [Identify](/gateway/commands/#identify), and MUST replace its own `auth_session_id_hash` from [Ready](#ready) with the one in the response.+Fluxer closes the Gateway sessions of the old authentication session before it sends this event, and they never receive it.### <span id="rate-limited"></span>RATE_LIMITED-A [Request Guild Members](/gateway/commands/#request-guild-members) command was refused by the bot full-member-list budget. Delivered to the requesting session alone.+A bot sent [Request Guild Members](/gateway/commands/#request-guild-members) for the full member list of a guild more than once in 30 seconds. Only the requesting session receives it.| Field | Type | Description || --- | --- | --- |-| opcode | integer | The refused opcode, which is always `8` |-| retry_after | number | Seconds until the request can be retried |-| meta | object | Context for the refused request |--`meta` has `guild_id` and, when the request named exactly one guild and supplied a valid nonce, `nonce`.--That budget admits one unfiltered member request per bot account and guild every 30,000 ms, and `retry_after` is the remainder of that window in seconds. Every other command refusal is silent.+| opcode | integer | The refused opcode, always `8` |+| retry_after | number | Seconds until you can retry |+| meta | object | `guild_id`, plus `nonce` when the request had one |### <span id="user-update"></span>USER_UPDATE-The current user's account record changed. The payload is the complete [user object](/http-api/users/#user-object) in its private representation.--Presence subscribers receive the updated `user` in a [Presence Update](#presence-update), unless the user's published status is `offline`.+The current user's account changed. The payload is the [user object](/http-api/users/#user-object) in its private representation.### <span id="user-settings-update"></span>USER_SETTINGS_UPDATE-The current user's account-wide settings changed. The payload is the complete [user settings object](/http-api/users/#user-settings-object).--Fluxer republishes the account's presence on every settings update, whether or not `status` or `custom_status` changed. A `status` of `offline` in the payload is treated as `invisible`, and it forces every live session of the account to that status.+The current user's settings changed. The payload is the [user settings object](/http-api/users/#user-settings-object).### <span id="user-guild-settings-update"></span>USER_GUILD_SETTINGS_UPDATE-One guild's notification settings changed. The payload is that guild's complete user guild settings object. A session without [thread access](/gateway/threads/#session-flag) receives it without the channel overrides of forum and media channels and without `flags` on an override.+The notification settings for one guild changed. The payload is that guild's [user guild settings object](/http-api/users/settings/#user-guild-settings-object).### <span id="user-note-update"></span>USER_NOTE_UPDATE@@ -304,45 +289,39 @@ The current user wrote or cleared a private note.### <span id="user-pinned-dms-update"></span>USER_PINNED_DMS_UPDATE-The current user's pinned private channel set changed. The payload is a bare JSON array of channel ID strings in pinned order and is always the complete set. A client that stores the pinned channels replaces them with this array. [Ready](#ready) sends the initial set as `pinned_dms`.+The pinned private channels changed. The payload is an array of every pinned channel ID in order, and it replaces `pinned_dms` from [Ready](#ready).### <span id="user-connections-update"></span>USER_CONNECTIONS_UPDATE-The current user's external connection set changed.+The current user's external connections changed.| Field | Type | Description || --- | --- | --- |-| connections | array[connection object] | Every connection the account holds |--`connections` is always the complete set. A client that stores the connections replaces them with this array.+| connections | array[connection object] | Every connection on the account |### <span id="webauthn-credentials-update"></span>WEBAUTHN_CREDENTIALS_UPDATE-The current user's WebAuthn credential set changed. The payload is a bare JSON array of [WebAuthn credential objects](#webauthn-credential-object) and is always the complete set. A client that stores the credentials replaces them with this array. [Ready](#ready) sends the initial set as `webauthn_credentials`.+The current user's passkeys changed. The payload is an array of every [WebAuthn credential object](#webauthn-credential-object), and it replaces `webauthn_credentials` from [Ready](#ready).### <span id="relationship-add"></span>RELATIONSHIP_ADD-The current user gained a relationship. The payload is the complete relationship object.+The current user has a new relationship.| Field | Type | Description || --- | --- | --- || id | snowflake | The other user's ID || type | integer | [Relationship type](/http-api/users/relationships/#relationship-types) || user | [partial user](/http-api/users/#partial-user-object) object | The other user |-| since? | ISO8601 timestamp | When the relationship was created, absent when the record has no timestamp |+| since? | ISO8601 timestamp | When the relationship was created || nickname | ?string | Private nickname for the other user |-| share_voice_activity | boolean | Whether the current user shares voice activity with this friend on the Active Now panel |+| share_voice_activity | boolean | Whether the current user shares voice activity with this friend || friend_shares_voice_activity<sup>1</sup> | boolean | Whether the other user shares voice activity with the current user |-<sup>1</sup> Always `true` on this Dispatch, even for a friendship whose counterpart has sharing off--A client that needs the real value MUST read it from [List relationships](/http-api/users/relationships/#list-relationships).+<sup>1</sup> Only accurate in a Relationship Update sent by [Modify voice activity sharing](/http-api/users/settings/#modify-voice-activity-sharing). [List relationships](/http-api/users/relationships/#list-relationships) always has the real value.### <span id="relationship-update"></span>RELATIONSHIP_UPDATE-An existing relationship changed. The payload has the same structure as [Relationship Add](#relationship-add).--`friend_shares_voice_activity` is the counterpart's real setting only on the pair of Dispatches that [Modify voice activity sharing](/http-api/users/settings/#modify-voice-activity-sharing) sends to both parties of each friendship. Every other Relationship Update sends `true`.+A relationship changed. The payload has the same fields as [Relationship Add](#relationship-add).### <span id="relationship-remove"></span>RELATIONSHIP_REMOVE@@ -354,9 +333,7 @@ A relationship ended.### <span id="saved-message-create"></span>SAVED_MESSAGE_CREATE-The current user saved a message. The payload is the complete [message object](/http-api/messages/#message-object) as that user sees it.--A session without [thread access](/gateway/threads/#session-flag) receives no Saved Message Create for a message in a thread.+The current user saved a message. The payload is the [message object](/http-api/messages/#message-object).### <span id="saved-message-delete"></span>SAVED_MESSAGE_DELETE@@ -368,19 +345,19 @@ The current user unsaved a message.### <span id="recent-mention-delete"></span>RECENT_MENTION_DELETE-The current user removed a message from the recent mention feed.+The current user removed a message from their recent mentions.| Field | Type | Description || --- | --- | --- |-| message_id | snowflake | The message removed from the feed |+| message_id | snowflake | The message removed from recent mentions |### <span id="favorite-meme-create"></span>FAVORITE_MEME_CREATE-The current user saved a meme. The payload is the complete [meme object](/http-api/memes/#meme-object).+The current user saved a meme. The payload is the [meme object](/http-api/memes/#meme-object).### <span id="favorite-meme-update"></span>FAVORITE_MEME_UPDATE-One of the current user's memes changed. The payload is the complete [meme object](/http-api/memes/#meme-object).+One of the current user's memes changed. The payload is the [meme object](/http-api/memes/#meme-object).### <span id="favorite-meme-delete"></span>FAVORITE_MEME_DELETE@@ -394,31 +371,23 @@ The current user deleted a meme.### <span id="guild-create"></span>GUILD_CREATE-A guild became available to the session. The payload is a [guild ready object](#guild-ready-object).+A guild became available to the session, for example after joining it or when an unavailable guild recovers. The payload is a [guild ready object](#guild-ready-object).-`roles`, `channels`, `emojis`, `stickers`, and `voice_states` are always complete. A client that stores any of them for the guild replaces its stored list with the new array. `members` is a partial list. A client adds or updates those members and keeps every other member it already stores. `threads` is the complete set [Guild threads](/gateway/threads/#guild-threads) describes, and a client replaces its stored threads for the guild with it.+Replace your stored `roles`, `channels`, `emojis`, `stickers`, `voice_states` and `threads` for the guild with the new arrays. `members` is partial, and you add or update those members and keep the others.-Every session receives Guild Create when a guild becomes available after Ready, for example after joining one or after an unavailable guild recovers. A bot session also receives one for each available guild in the burst that follows Ready.--A guild the account is [visiting](/http-api/guilds/#visiting-guilds) arrives with `visiting: true`, `joined_at: null`, and empty `members`, `presences`, and `voice_states`. Its `channels` hold only the channels a visitor can read, each with only the @everyone overwrite. Ready lists visited guilds the same way for a session with the `GUILD_VISITS` [session flag](/gateway/commands/#session-flags). A later Guild Create without `visiting` for a visited guild means the account joined it, and a client replaces the guild in place without clearing its messages.--A bot session's Guild Create has `unavailable: false` unless it is the first Guild Create for a guild the bot joined during the session and [Ready](#ready) did not list. That Dispatch has no `unavailable` field, even when a [Guild Delete](#guild-delete) with `unavailable: true` for the guild came before it. A user session never receives the field on Guild Create.+A later Guild Create without `visiting` means the account joined.### <span id="guild-sync"></span>GUILD_SYNC-A session that asked for a sync through [Lazy Request](/gateway/commands/#lazy-request) receives the guild's full current state again. The payload is a [guild ready object](#guild-ready-object), and a client handles it the same way as [Guild Create](#guild-create).--Fluxer sends a sync when a Lazy Request switches the guild between [active and passive](/gateway/event-filtering/#active-and-passive-guilds), and when `sync: true` names a guild the session has not already synced. A second `sync: true` for an already-synced guild sends nothing.+The guild's full state again, sent after a [Lazy Request](/gateway/commands/#lazy-request) asks for a sync or switches the guild between [active and passive](/gateway/event-filtering/#active-and-passive-guilds). The payload is a [guild ready object](#guild-ready-object), handled like [Guild Create](#guild-create).### <span id="guild-update"></span>GUILD_UPDATE-A guild's configuration changed. The payload is the complete [guild object](/http-api/guilds/#guild-object) with `guild_id` added, which repeats the object's own `id`.--Guild Update is the only Dispatch an unavailable guild sends. A client learns from it that a guild entered or left the unavailable state.+A guild's settings changed. The payload is the [guild object](/http-api/guilds/#guild-object) with `guild_id` added. An unavailable guild sends no other event.### <span id="guild-delete"></span>GUILD_DELETE-A guild left the session's visibility, or became unavailable.+The session lost a guild, or the guild became unavailable.| Field | Type | Description || --- | --- | --- |@@ -427,13 +396,13 @@ A guild left the session's visibility, or became unavailable.| unavailable? | boolean | True when the guild is temporarily unavailable || unavailable_hidden? | boolean | True when an unavailable guild is hidden from the client |-<sup>1</sup> Present only when the guild itself is deleted. The payload has `id` alone when the account leaves a guild or is removed from one, and `id` with `unavailable` in the unavailable form+<sup>1</sup> Only when the guild itself was deleted-Without `unavailable`, the account is no longer a member or no longer visiting, and a client deletes everything it stores for that guild. With `unavailable: true`, the guild is temporarily unreachable. A client keeps the guild as an unavailable entry until a later [Guild Create](#guild-create) sends its full state again.+Without `unavailable`, delete everything you store for the guild. With `unavailable: true`, keep it as unavailable until a [Guild Create](#guild-create) arrives.### <span id="guild-role-create"></span>GUILD_ROLE_CREATE-A role was created in a guild.+A role was created.| Field | Type | Description || --- | --- | --- |@@ -442,25 +411,25 @@ A role was created in a guild.### <span id="guild-role-update"></span>GUILD_ROLE_UPDATE-Exactly one role record changed.+One role changed.| Field | Type | Description || --- | --- | --- || guild_id | snowflake | Guild the role belongs to |-| role | [guild role](/http-api/permissions/#guild-role-object) object | The role's complete updated representation |+| role | [guild role](/http-api/permissions/#guild-role-object) object | The updated role |### <span id="guild-role-update-bulk"></span>GUILD_ROLE_UPDATE_BULK-One operation changed several roles together, most often a reorder.+Several roles changed at once, usually in a reorder.| Field | Type | Description || --- | --- | --- || guild_id | snowflake | Guild the roles belong to |-| roles | array[[guild role](/http-api/permissions/#guild-role-object) object] | Every changed role in its complete updated representation |+| roles | array[[guild role](/http-api/permissions/#guild-role-object) object] | Every changed role |### <span id="guild-role-delete"></span>GUILD_ROLE_DELETE-A role was deleted from a guild.+A role was deleted.| Field | Type | Description || --- | --- | --- |@@ -469,7 +438,7 @@ A role was deleted from a guild.### <span id="guild-emojis-update"></span>GUILD_EMOJIS_UPDATE-A guild's emojis changed.+A guild's emojis changed. Replace your stored emojis with the array.| Field | Type | Description || --- | --- | --- |@@ -478,7 +447,7 @@ A guild's emojis changed.### <span id="guild-stickers-update"></span>GUILD_STICKERS_UPDATE-A guild's stickers changed.+A guild's stickers changed. Replace your stored stickers with the array.| Field | Type | Description || --- | --- | --- |@@ -487,36 +456,28 @@ A guild's stickers changed.### <span id="channel-create"></span>CHANNEL_CREATE-A channel became visible to the session, whether newly created or newly permitted. The payload is the complete [channel object](/http-api/channels/#channel-object), with `guild_id` present for a guild channel.--A session with thread access that gains view access to a channel with active threads then receives [Thread List Sync](/gateway/threads/#thread-list-sync) for that channel.+A channel was created or the session can see it for the first time. The payload is the [channel object](/http-api/channels/#channel-object).### <span id="channel-update"></span>CHANNEL_UPDATE-A visible channel changed. The payload is the complete [channel object](/http-api/channels/#channel-object). Converting a text channel into an announcement channel, or back, emits it with the new `type`. That conversion also emits [Thread Update](/gateway/threads/#thread-update) for each active public thread of the channel, as [Thread types](/http-api/threads/#thread-types) describes.+A visible channel changed. The payload is the [channel object](/http-api/channels/#channel-object).### <span id="channel-update-bulk"></span>CHANNEL_UPDATE_BULK-One operation changed several channels together, most often a reorder.+Several channels changed at once, usually in a reorder. Each session gets only the channels it can view.| Field | Type | Description || --- | --- | --- || guild_id | snowflake | Guild the channels belong to |-| channels | array[[channel](/http-api/channels/#channel-object) object] | Every changed channel in its complete updated representation |--Each recipient sees only channels they can view. An empty result produces no Dispatch and consumes no sequence number.+| channels | array[[channel](/http-api/channels/#channel-object) object] | Every changed channel |### <span id="channel-delete"></span>CHANNEL_DELETE-A channel left the session's visibility, whether deleted or newly hidden. The payload is the complete [channel object](/http-api/channels/#channel-object) as it was before the change.--Recipients are the sessions that could see the channel before it was deleted.--Deleting a channel deletes its threads, and Fluxer emits no [Thread Delete](/gateway/threads/#thread-delete) for them. A client removes every thread whose `parent_id` is the channel.+A channel was deleted or the session can no longer see it. The payload is the [channel object](/http-api/channels/#channel-object) as it was before. Remove every thread whose `parent_id` is the channel yourself, because Fluxer sends no [Thread Delete](/gateway/threads/#thread-delete) for them.### <span id="channel-recipient-add"></span>CHANNEL_RECIPIENT_ADD-A user joined a group direct message the session belongs to.+A user joined a group direct message the session is in.| Field | Type | Description || --- | --- | --- |@@ -525,7 +486,7 @@ A user joined a group direct message the session belongs to.### <span id="channel-recipient-remove"></span>CHANNEL_RECIPIENT_REMOVE-A user left a group direct message the session belongs to.+A user left a group direct message the session is in.| Field | Type | Description || --- | --- | --- |@@ -534,9 +495,7 @@ A user left a group direct message the session belongs to.### <span id="webhooks-update"></span>WEBHOOKS_UPDATE-The webhook set of a guild channel changed. The event has no webhook data, so a client that needs the new set reads it over the HTTP API.--A [follow](/http-api/channels/#follow-announcement-channel) and an unfollow each emit it for the target channel. Moving a webhook emits it for the previous channel and again for the new one. Removing the follows of a deleted or converted announcement channel emits it once for each target channel.+A guild channel's webhooks changed, including when a channel follow starts or ends. The event has no webhook data. Fetch the list with [List channel webhooks](/http-api/webhooks/#list-channel-webhooks).| Field | Type | Description || --- | --- | --- |@@ -545,54 +504,40 @@ A [follow](/http-api/channels/#follow-announcement-channel) and an unfollow each### <span id="invite-create"></span>INVITE_CREATE-An invite was created. The payload is the complete [invite object](/http-api/invites/#invite-object) extended with its [invite metadata](/http-api/invites/#invite-metadata-object).--A guild invite reaches the sessions holding `MANAGE_CHANNELS` on the invite's channel. A group direct message invite reaches every recipient of that group, with no permission check.+An invite was created. The payload is the [invite object](/http-api/invites/#invite-object) with its [invite metadata](/http-api/invites/#invite-metadata-object). A guild invite goes to sessions with `MANAGE_CHANNELS` on its channel, and a group direct message invite goes to every recipient.### <span id="invite-delete"></span>INVITE_DELETE-An invite was deleted.+An invite was deleted. It goes to the same sessions as [Invite Create](#invite-create).| Field | Type | Description || --- | --- | --- || code | string | The deleted invite code |-| channel_id? | snowflake | Channel the invite pointed at, absent when the invite stored none |-| guild_id?<sup>1</sup> | snowflake | Guild the invite belonged to |--<sup>1</sup> Present on every guild invite. A group direct message invite has no `guild_id`--Recipients are chosen the same way as for [Invite Create](#invite-create).+| channel_id? | snowflake | Channel the invite pointed at |+| guild_id? | snowflake | Guild the invite belonged to, absent for a group direct message invite |## Members and moderation### <span id="guild-member-add"></span>GUILD_MEMBER_ADD-A user became a member of a guild the session is connected to. The payload is the complete [guild member object](/http-api/guild-members/#guild-member-object) with `guild_id` added.+A user joined a guild. The payload is the [guild member object](/http-api/guild-members/#guild-member-object) with `guild_id` added.### <span id="guild-member-update"></span>GUILD_MEMBER_UPDATE-A member's guild state or public user representation changed. The payload is the complete [guild member object](/http-api/guild-members/#guild-member-object) with `guild_id` added.--In a guild with more than 250 members, a [passive](/gateway/event-filtering/#active-and-passive-guilds) session receives this event only when the subject is its own user.+A member or their public profile changed. The payload is the [guild member object](/http-api/guild-members/#guild-member-object) with `guild_id` added.### <span id="guild-member-remove"></span>GUILD_MEMBER_REMOVE-A user stopped being a member of a guild the session is connected to.+A user is no longer a member of a guild. Fluxer also sends a [Thread Members Update](/gateway/threads/#thread-members-update) for each thread they were in.| Field | Type | Description || --- | --- | --- || guild_id | snowflake | Guild the user left |-| user<sup>1</sup> | object | The user that is no longer a member |--<sup>1</sup> The object has `id` alone. No other account field is sent, so a client MUST resolve the account from state it already holds--In a guild with more than 250 members, a [passive](/gateway/event-filtering/#active-and-passive-guilds) session receives this event only when the subject is its own user.--Removal from the guild removes every membership in its threads. Fluxer emits a [Thread Members Update](/gateway/threads/#thread-members-update) for each of them, as [Thread member flags](/http-api/thread-members/#thread-member-flags) states.+| user | object | The user, with `id` only |### <span id="guild-members-chunk"></span>GUILD_MEMBERS_CHUNK-Answers [Request Guild Members](/gateway/commands/#request-guild-members) for the requesting session.+The answer to [Request Guild Members](/gateway/commands/#request-guild-members). A request that matches nobody still gets one chunk with an empty `members`.| Field | Type | Description || --- | --- | --- |@@ -600,21 +545,17 @@ Answers [Request Guild Members](/gateway/commands/#request-guild-members) for th| members | array[[guild member](/http-api/guild-members/#guild-member-object) object] | Up to 1,000 members || chunk_index | integer | Zero-based index of this chunk || chunk_count | integer | Total chunks in this response |-| presences? | array[[presence object](#presence-object)] | Present only when the request set `presences` and at least one member has a visible presence |-| nonce? | string | Echoed only when the request named exactly one guild and supplied a valid nonce |--A request that matches no member still produces one chunk with an empty `members` array, `chunk_index` 0, and `chunk_count` 1.--This event is delivered live and is never retained for [Resume](/gateway/commands/#resume) replay.+| presences? | array[[presence object](#presence-object)] | Visible presences, when the request set `presences` |+| nonce? | string | The request's nonce, when it asked for one guild |### <span id="guild-member-list-update"></span>GUILD_MEMBER_LIST_UPDATE-A member list the session subscribed to through [Lazy Request](/gateway/commands/#lazy-request) resyncs the subscriber's ranges.+A member list the session subscribed to with [Lazy Request](/gateway/commands/#lazy-request) changed, and the event resends the subscribed ranges.| Field | Type | Description || --- | --- | --- || guild_id | snowflake | Guild the list belongs to |-| id | string | List identifier, which is always the channel ID as a string |+| id | string | List identifier, which is the channel ID || channel_id? | snowflake | Channel the list is scoped to || member_count | integer | Total members in the list || online_count | integer | Online members in the list |@@ -625,90 +566,68 @@ A member list the session subscribed to through [Lazy Request](/gateway/commands| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | string | Group identifier, which is a hoisted role ID, `online`, or `offline` |+| id | string | A hoisted role ID, `online` or `offline` || count | integer | Members in the group |-<sup>1</sup> Hoisted role groups come first in role order, then `online`, then `offline`--A group whose count is `0` is omitted. The `offline` group is also omitted once it holds more than 1,000 members, and in that case `items` omits the offline members too. `member_count` can then exceed the number of items a client can ever read back.+Hoisted roles come first, then `online`, then `offline`. Empty groups are left out, and so is the `offline` group and its members when it has more than 1,000 members.#### Member list operation object| Field | Type | Description || --- | --- | --- |-| op | string | Operation kind, which is always `SYNC` |+| op | string | Operation kind, always `SYNC` || range | array[integer] | Inclusive `[start, end]` range this operation replaces || items | array[[member list item object](#member-list-item-object)] | Replacement items for the range |#### Member list item object-Each item has exactly one of the fields.+Each item has exactly one of these fields.| Field | Type | Description || --- | --- | --- |-| group? | [member list group object](#member-list-group-object) | A group header occupying one list position |+| group? | [member list group object](#member-list-group-object) | A group header in one list position || member?<sup>1</sup> | [guild member](/http-api/guild-members/#guild-member-object) object | A member of the list |-<sup>1</sup> Extended with a `presence` field that always exists. The value is the guild's [presence object](#presence-object) for that member when the member is visibly online to the guild, and otherwise the placeholder `{"status": "offline", "mobile": false, "afk": false}`+<sup>1</sup> With a `presence` field, which is `{"status": "offline", "mobile": false, "afk": false}` when the member is not visibly online### <span id="guild-audit-log-entry-create"></span>GUILD_AUDIT_LOG_ENTRY_CREATE-An audit log entry was written. The payload is the [guild audit log entry object](/http-api/guild-audit-logs/#guild-audit-log-entry-object) that [List guild audit logs](/http-api/guild-audit-logs/#list-guild-audit-logs) returns for the same entry, with `guild_id` added. It always has `id`, `action_type`, `user_id`, and `target_id`. `reason` is resolved as the [audit log reason](/http-api/guild-audit-logs/#audit-log-reason) describes, and `options` has only the published [audit log options](/http-api/guild-audit-logs/#audit-log-options-object) keys, with the same number and boolean types. `changes` is present when at least one change survives scrubbing.--An update that changes nothing records no entry, as the [audit actions](/http-api/guild-audit-logs/#audit-actions) registry states, so it emits no event.--The `ip` change key is stripped from `changes`, so an entry whose only change was `ip` has no `changes` at all. A client MUST treat an absent `options` or `changes` as an empty set.--Recipients are every session in the guild that holds `VIEW_AUDIT_LOG`, including the acting session. A session without [thread access](/gateway/threads/#session-flag) receives no `THREAD_CREATE`, `THREAD_UPDATE`, or `THREAD_DELETE` entry and no entry about a message in a thread.+An audit log entry was written. Every session with `VIEW_AUDIT_LOG` gets it. The payload is the [audit log entry](/http-api/guild-audit-logs/#guild-audit-log-entry-object) with `guild_id` added and any `ip` entry left out of `changes`. Treat a missing `options` or `changes` as empty.### <span id="guild-ban-add"></span>GUILD_BAN_ADD-A guild ban was created.+A user was banned.| Field | Type | Description || --- | --- | --- || guild_id | snowflake | Guild the ban was created in |-| user<sup>1</sup> | object | The banned user |--<sup>1</sup> The object has `id` alone. No other account field is sent+| user | object | The banned user, with `id` only |### <span id="guild-ban-remove"></span>GUILD_BAN_REMOVE-A guild ban was removed.+A ban was removed.| Field | Type | Description || --- | --- | --- || guild_id | snowflake | Guild the ban was removed from |-| user<sup>1</sup> | object | The unbanned user |--<sup>1</sup> The object has `id` alone. No other account field is sent+| user | object | The unbanned user, with `id` only |### <span id="presence-update"></span>PRESENCE_UPDATE-One visible presence changed. The payload is a [presence object](#presence-object).--A session receives a presence for a friend, for a recipient of a group direct message it belongs to, and for a guild member it subscribed to through the `members` array of a [Lazy Request](/gateway/commands/#lazy-request). A bot session holds no friend or group direct message subscription, so the guild path is the only one that reaches it.--Presence Updates normally follow [Ready](#ready). The initial Presence Update burst omits users already included in Ready. If Ready takes more than 10,000 ms, Presence Updates can arrive before it.--Later presences can be delayed until their guild, relationship, or group direct message becomes visible. They may arrive after [Relationship Add](#relationship-add), [Relationship Update](#relationship-update), [Channel Create](#channel-create), [Channel Update](#channel-update), or [Channel Recipient Add](#channel-recipient-add). Delivery is not guaranteed for a subject that never becomes visible.+A visible presence changed. The payload is a [presence object](#presence-object). You get presences for friends, group direct message recipients and the guild members you name in a [Lazy Request](/gateway/commands/#lazy-request), as [Presence subscriptions](/gateway/event-filtering/#presence-subscriptions) describes.#### Presence object| Field | Type | Description || --- | --- | --- || user | [partial user](/http-api/users/#partial-user-object) object | The user the presence belongs to |-| status | string | `online`, `idle`, `dnd`, or `offline` |+| status | string | `online`, `idle`, `dnd` or `offline` || mobile | boolean | Whether the user's active status comes from a mobile session |-| afk | boolean | Whether every one of the user's sessions is away |-| custom_status | ?[custom status object](#custom-status-object) | The user's custom status |-| guild_id? | snowflake | Guild context, present when the presence arrived through a guild |--An account's published `status` is the highest-precedence status across its live sessions, resolved in the order `dnd`, `online`, `idle`, `invisible`, and finally `offline` when no session is live. A session that selected `invisible`, and an account with no live session, both publish `status: "offline"`. A session that lost its transport is published as `offline` 5,000 ms later, even though it stays resumable for the rest of its 60,000 ms retention window. A successful [Resume](/gateway/commands/#resume) republishes the status it last selected.+| afk | boolean | Whether every one of the user's sessions is away, always false when `mobile` is true |+| custom_status | ?[custom status object](#custom-status-object) | The user's custom status, null when `offline` |+| guild_id? | snowflake | Guild the presence came through |-`mobile` is true only when the account's resolved status is `online` and at least one online session declared itself mobile. `afk` is false whenever `mobile` is true. Otherwise it is true only when every live session is away.--`custom_status` is suppressed to `null` whenever the published status is `offline`, so an invisible account never reveals one.+`status` is the first of `dnd`, `online` and `idle` that any live session has. An invisible user, or one with no live session, shows as `offline`. A session that loses its connection stops counting after 5 seconds.#### Custom status object@@ -722,87 +641,61 @@ An account's published `status` is the highest-precedence status across its live### <span id="presence-update-bulk"></span>PRESENCE_UPDATE_BULK-Several visible presences are delivered in one Dispatch. A guild sends this only when it leaves the unavailable state. Every session that stayed connected receives it immediately after the [Guild Create](#guild-create) that restores the guild.+The online presences of a guild that was unavailable, sent right after the [Guild Create](#guild-create) that restores it.| Field | Type | Description || --- | --- | --- |-| guild_id | snowflake | Guild context applied to every entry |-| presences<sup>1</sup> | array[[presence object](#presence-object)] | The presences, at most 500 per Dispatch |--<sup>1</sup> Only visibly online presences are included, and the recipient's own presence is removed. A batch that would be empty produces no Dispatch, and a set larger than 500 is split across consecutive Dispatches--Every entry has the batch's guild context. A client MUST treat each entry as if it named `guild_id` itself.+| guild_id | snowflake | Guild the presences belong to |+| presences | array[[presence object](#presence-object)] | Up to 500 presences, split across several events when there are more |### <span id="passive-updates"></span>PASSIVE_UPDATES-A passive session in a guild with more than 250 members receives missed changes every 30,000 ms. No event is sent when nothing changed.+Fluxer sends this every 30 seconds, when something changed, for a guild with more than 250 members where the session is [passive](/gateway/event-filtering/#active-and-passive-guilds).| Field | Type | Description || --- | --- | --- |-| guild_id | snowflake | Guild the update covers |-| channels | map[snowflake, snowflake] | Changed `last_message_id` per channel |-| voice_states?<sup>1</sup> | array[[voice state object](#voice-state-object)] | Changed voice states in channels the session can view |--<sup>1</sup> Omitted when the set would be empty. A participant that left a viewable channel since the previous cycle appears here with `channel_id` set to null--`channels` contains only the channels whose `last_message_id` changed since the previous update for that session, and only channels that session can view. `voice_states` contains only the voice states whose `version` advanced.--For a session with [thread access](/gateway/threads/#session-flag), `channels` also contains the active threads its user joined.+| guild_id | snowflake | Guild the update is about |+| channels | map[snowflake, snowflake] | New `last_message_id` for each changed channel the session can view |+| voice_states? | array[[voice state object](#voice-state-object)] | Changed voice states, with a null `channel_id` for someone who left |## Messages and reactions### <span id="message-create"></span>MESSAGE_CREATE-A visible message was created. The payload is the complete [message object](/http-api/messages/#message-object) with the fields below added.+A message was created. The payload is the [message object](/http-api/messages/#message-object) with these fields added.| Field | Type | Description || --- | --- | --- |-| channel_type | integer | [Channel type](/http-api/channels/#channel-types) of the channel the message was created in |-| nicks? | map[snowflake, string] | Group direct message nicknames, present only for a group direct message that stores at least one |-| mention_here? | boolean | Always `true` when present, and present only when the message has a here mention |+| channel_type | integer | [Channel type](/http-api/channels/#channel-types) of the message's channel |+| nicks? | map[snowflake, string] | Group direct message nicknames, when the group has any |+| mention_here? | boolean | `true` when the message has a here mention || guild_id? | snowflake | Guild the channel belongs to |-| member?<sup>1</sup> | [guild member](/http-api/guild-members/#guild-member-object) object | The author's guild member object, present in a guild channel |--<sup>1</sup> The `user` field is removed from it, and the account is in the message's `author`--Each copy of a [published message](/http-api/messages/#crosspost-message) arrives in its following channel as Message Create, with the `IS_CROSSPOST` flag, and so does the `CHANNEL_FOLLOW_ADD` system message of a new follow. A copy mentions nobody.--Message Create alone overrides both the passive filter and the `ignored_events` list, and the two use different tests. A direct mention, a mention of one of the user's roles, an everyone mention, or a here mention overrides the passive filter. A message the session's user wrote overrides the passive filter too. A direct, everyone, or here mention alone overrides the `ignored_events` list.+| member? | [guild member](/http-api/guild-members/#guild-member-object) object | The author's member object without `user`, in a guild channel |-A Message Create in a thread also needs one of the conditions in [Dispatch events](/gateway/threads/#dispatch-events). [Thread messages](/http-api/threads/#thread-messages) lists the members a message adds to the thread.+A [published message](/http-api/messages/#crosspost-message) also arrives as Message Create in each following channel, with the `IS_CROSSPOST` flag.### <span id="message-update"></span>MESSAGE_UPDATE-A visible message changed. The payload is the complete current [message object](/http-api/messages/#message-object), with no `channel_type`, `nicks`, or `mention_here`. In a guild channel it is extended with `guild_id` and with `member`, the author's guild member object with its `user` field removed.--Recipients must hold `READ_MESSAGE_HISTORY` on the channel, or the message must be newer than the guild's message history cutoff.--In a guild with more than 250 members, a [passive](/gateway/event-filtering/#active-and-passive-guilds) session receives this event only for a direct mention of its user, a mention of one of its roles, an everyone mention, or a here mention.--[Publishing](/http-api/messages/#crosspost-message) a message emits it in the announcement channel with the `CROSSPOSTED` flag set. An edit of a published message emits it for each copy once Fluxer has copied the change, and deleting the published message emits it for each copy with the `SOURCE_MESSAGE_DELETED` flag and the content removed.--[Start thread from message](/http-api/threads/#start-thread-from-message) emits it for the source message with `HAS_THREAD` and `thread`, and [Delete thread](/http-api/threads/#delete-thread) emits it with `HAS_THREAD` cleared. A session without [thread access](/gateway/threads/#session-flag) receives neither.+A message changed. The payload is the full [message object](/http-api/messages/#message-object) and, in a guild channel, `guild_id` and `member` as in [Message Create](#message-create). Sessions need `READ_MESSAGE_HISTORY` unless the message is newer than the guild's message history cutoff.### <span id="message-delete"></span>MESSAGE_DELETE-One visible message was deleted.+A message was deleted.| Field | Type | Description || --- | --- | --- || id | snowflake | The deleted message || channel_id | snowflake | Channel the message was in |-| content?<sup>1</sup> | ?string | Content the message held before it was deleted |+| content?<sup>1</sup> | ?string | The message's content before it was deleted || author_id?<sup>1</sup> | snowflake | Account that wrote the message || guild_id? | snowflake | Guild the channel belongs to |-| member?<sup>2</sup> | [guild member](/http-api/guild-members/#guild-member-object) object | The author's guild member object, present in a guild channel |+| member? | [guild member](/http-api/guild-members/#guild-member-object) object | The author's member object without `user`, when the author is still a member |-<sup>1</sup> Both fields are omitted when an instance administrator deleted the message through the Admin API, when Fluxer deleted it because content moderation blocked a link preview in it, or when Fluxer removed a published message and its copies together, and `author_id` is also omitted for a message with no author--<sup>2</sup> The `user` field is removed from it, and the whole field is absent when `author_id` is absent or the author is no longer a member+<sup>1</sup> Absent when an instance admin or Fluxer itself deleted the message### <span id="message-delete-bulk"></span>MESSAGE_DELETE_BULK-Several messages in one channel were deleted together.+Several messages in one channel were deleted at once.| Field | Type | Description || --- | --- | --- |@@ -812,24 +705,20 @@ Several messages in one channel were deleted together.### <span id="message-ack"></span>MESSAGE_ACK-The current user's read state advanced for a channel, usually because another of the account's sessions read it.+The current user's read state moved forward in a channel, usually from another of their sessions.| Field | Type | Description || --- | --- | --- |-| channel_id | snowflake | Channel whose read state advanced |+| channel_id | snowflake | Channel whose read state moved || message_id | snowflake | Message the read state now points at || mention_count | integer | Remaining mention count for the channel |-| manual? | boolean | Whether the acknowledgement was explicit |+| manual? | boolean | Whether the user marked it read by hand || version? | string | Read state version as a decimal string |-| flags?<sup>1</sup> | integer | The [read state flags](/http-api/read-states/#read-state-flags) |--<sup>1</sup> Present only on the entry of a thread, a forum channel, or a media channel--A session without [thread access](/gateway/threads/#session-flag) receives no Message ACK for an entry that has `flags`.+| flags? | integer | [Read state flags](/http-api/read-states/#read-state-flags), for a thread, forum or media channel |### <span id="message-reaction-add"></span>MESSAGE_REACTION_ADD-A user added a reaction to a message.+A user reacted to a message.| Field | Type | Description || --- | --- | --- |@@ -838,9 +727,8 @@ A user added a reaction to a message.| message_id | snowflake | Message that was reacted to || emoji | [reaction emoji object](#reaction-emoji-object) | The emoji || guild_id? | snowflake | Guild the channel belongs to |-| member? | [guild member](/http-api/guild-members/#guild-member-object) object | The reacting user's guild member object, present in a guild channel |--In a guild channel the session named by the request's `session_id` is excluded and that field is removed from the payload. In a private channel the field is delivered as `session_id` and excludes nobody, so a client MUST tolerate receiving its own reaction back.+| member? | [guild member](/http-api/guild-members/#guild-member-object) object | The reacting user's member object, in a guild channel |+| session_id? | string | The session that made the request, in a private channel |#### Reaction emoji object@@ -850,24 +738,18 @@ In a guild channel the session named by the request's `session_id` is excluded a| id? | snowflake | Custom emoji ID, absent for a Unicode emoji || animated?<sup>1</sup> | boolean | Whether the custom emoji is animated |-<sup>1</sup> Present only on the [Message Reaction Add](#message-reaction-add) that creates the first reaction with that emoji on the message. An addition to an emoji that already has a reactor, a [Message Reaction Remove](#message-reaction-remove), and a [Message Reaction Remove Emoji](#message-reaction-remove-emoji) omit the field--Neither `id` nor `animated` is ever null. A Unicode reaction omits both, so a client distinguishes the forms by the presence of `id`. A client MUST NOT read an absent `animated` as `false`.+<sup>1</sup> Only on the first reaction with that emoji on the message. An absent `animated` does not mean `false`.### <span id="message-reaction-add-many"></span>MESSAGE_REACTION_ADD_MANY-With the `DEBOUNCE_MESSAGE_REACTIONS` [session flag](/gateway/commands/#session-flags), private-channel additions are grouped over 650 ms and delivered together. Each window keeps the latest 512 additions. Guild-channel additions always arrive as individual [Message Reaction Add](#message-reaction-add) events.+Reactions in private channels, grouped over 650 ms, for a session with the `DEBOUNCE_MESSAGE_REACTIONS` [session flag](/gateway/commands/#session-flags). Each window keeps only the latest 512 reactions and drops older ones. Each event covers one message. A window with a single reaction sends [Message Reaction Add](#message-reaction-add).| Field | Type | Description || --- | --- | --- |-| channel_id<sup>1</sup> | snowflake | Channel the message is in |-| message_id<sup>1</sup> | snowflake | Message that was reacted to |-| guild_id?<sup>1</sup> | snowflake | Guild the channel belongs to |-| reactions | array[[reaction addition object](#reaction-addition-object)] | The merged additions, in arrival order |--<sup>1</sup> Every addition in `reactions` belongs to this message. A window covering several messages produces a separate Dispatch for each--When the window closes holding exactly one addition, Fluxer sends [Message Reaction Add](#message-reaction-add) to the session. A session without the flag receives one Message Reaction Add per addition.+| channel_id | snowflake | Channel the message is in |+| message_id | snowflake | Message that was reacted to |+| guild_id? | snowflake | Guild the channel belongs to |+| reactions | array[[reaction addition object](#reaction-addition-object)] | The reactions, oldest first |#### Reaction addition object@@ -875,11 +757,11 @@ When the window closes holding exactly one addition, Fluxer sends [Message React| --- | --- | --- || user_id | snowflake | User that reacted || emoji | [reaction emoji object](#reaction-emoji-object) | The emoji |-| member? | [guild member](/http-api/guild-members/#guild-member-object) object | The reacting user's guild member object, present in a guild channel |+| member? | [guild member](/http-api/guild-members/#guild-member-object) object | The reacting user's member object, in a guild channel |### <span id="message-reaction-remove"></span>MESSAGE_REACTION_REMOVE-One user's reaction was removed from a message.+A user's reaction was removed.| Field | Type | Description || --- | --- | --- |@@ -888,15 +770,12 @@ One user's reaction was removed from a message.| message_id | snowflake | Message the reaction was on || emoji | [reaction emoji object](#reaction-emoji-object) | The emoji || guild_id? | snowflake | Guild the channel belongs to |-| member? | [guild member](/http-api/guild-members/#guild-member-object) object | The user's guild member object, present in a guild channel |--Exclusion works exactly as it does for [Message Reaction Add](#message-reaction-add), so the acting session is dropped in a guild channel and kept in a private one.--With reaction debouncing enabled, an addition removed within the same window produces neither event for that message, user, and emoji.+| member? | [guild member](/http-api/guild-members/#guild-member-object) object | The user's member object, in a guild channel |+| session_id? | string | The session that made the request, in a private channel |### <span id="message-reaction-remove-all"></span>MESSAGE_REACTION_REMOVE_ALL-Every reaction was removed from a message at once.+Every reaction on a message was removed.| Field | Type | Description || --- | --- | --- |@@ -906,7 +785,7 @@ Every reaction was removed from a message at once.### <span id="message-reaction-remove-emoji"></span>MESSAGE_REACTION_REMOVE_EMOJI-Every reaction using one emoji was removed from a message.+Every reaction with one emoji was removed from a message.| Field | Type | Description || --- | --- | --- |@@ -917,7 +796,7 @@ Every reaction using one emoji was removed from a message.### <span id="typing-start"></span>TYPING_START-A visible user began typing in a channel.+A user started typing. [Typing is decided separately](/gateway/event-filtering/#typing-is-decided-separately) explains which sessions get it.| Field | Type | Description || --- | --- | --- |@@ -925,9 +804,7 @@ A visible user began typing in a channel.| user_id | snowflake | User that started typing || timestamp | integer | Unix seconds when typing started || guild_id? | snowflake | Guild the channel belongs to |-| member? | [guild member](/http-api/guild-members/#guild-member-object) object | The typing user's guild member object, present in a guild channel |--The `typing` override set through [Lazy Request](/gateway/commands/#lazy-request) decides delivery in a guild. With no override, a session receives the event when it is [active](/gateway/event-filtering/#active-and-passive-guilds) in the guild or when the guild has 250 members or fewer, so a passive session in a small guild still receives it. A guild that sets the `TYPING_EVENTS` bit in its [disabled operations](/http-api/guilds/#disabled-guild-operations) produces the event for nobody. Typing in a thread also needs one of the conditions in [Dispatch events](/gateway/threads/#dispatch-events).+| member? | [guild member](/http-api/guild-members/#guild-member-object) object | The typing user's member object, in a guild channel |### <span id="channel-pins-update"></span>CHANNEL_PINS_UPDATE@@ -941,24 +818,18 @@ A channel's most recent pin time changed.### <span id="channel-pins-ack"></span>CHANNEL_PINS_ACK-The current user acknowledged a channel's pins. Every session of the account receives it, including the one that issued the acknowledgement, except as stated below.+The current user marked a channel's pins as seen.| Field | Type | Description || --- | --- | --- || channel_id | snowflake | Channel whose pins were acknowledged |-| timestamp | ISO8601 timestamp | Time the acknowledgement recorded for the channel |--A session without [thread access](/gateway/threads/#session-flag) receives no Channel Pins ACK for a thread.+| timestamp | ISO8601 timestamp | Time the acknowledgement recorded |## Voice and calls### <span id="voice-state-update"></span>VOICE_STATE_UPDATE-A participant's voice state changed. The payload is a [voice state object](#voice-state-object).--Recipients are the sessions that can view the voice channel, passive sessions included. A passive session in a guild with more than 250 members also receives the changed voice states through [Passive Updates](#passive-updates).--A `channel_id` of null means the participant left.+A participant's voice state changed. The payload is a [voice state object](#voice-state-object), and a null `channel_id` means they left.#### Voice state object@@ -967,50 +838,46 @@ A `channel_id` of null means the participant left.| guild_id | ?snowflake | Guild the voice channel belongs to, null in a call || channel_id | ?snowflake | Voice channel, null when the participant left || user_id | ?snowflake | Participant |-| connection_id | ?string | Voice connection identity |+| connection_id | ?string | Voice connection ID || session_id | ?string | Gateway session that owns the connection |-| member | ?[guild member](/http-api/guild-members/#guild-member-object) object | The participant's guild member object, null in a call |+| member | ?[guild member](/http-api/guild-members/#guild-member-object) object | The participant's member object, null in a call || mute | boolean | Server mute || deaf | boolean | Server deafen || self_mute | boolean | Local microphone mute || self_deaf | boolean | Local output deafen |-| self_video | boolean | Whether the participant publishes camera video |-| self_stream<sup>1</sup> | boolean | Whether the connection advertises a screenshare track |-| is_mobile | boolean | Whether the participant is on a mobile client |+| self_video | boolean | Whether the participant sends camera video |+| self_stream<sup>1</sup> | boolean | Whether the connection is sharing its screen |+| is_mobile | boolean | Whether the participant is on a mobile app || suppress | boolean | Whether the participant is suppressed || viewer_stream_keys | array[string] | Streams this connection is watching |-| e2ee_capable | boolean | Whether the participant's client supports end-to-end encrypted voice |-| p2p | boolean | Whether this connection exchanges media peer-to-peer and not through LiveKit |-| version | integer | Monotonic version of this participant's voice state |--<sup>1</sup> The participant's client reports this value. In a guild voice channel Fluxer sets it to false when the participant lacks `STREAM`+| e2ee_capable | boolean | Whether the participant's app supports end-to-end encrypted voice |+| p2p | boolean | Whether this connection sends media [peer-to-peer](#peer-to-peer-voice) |+| version | integer | Version of this participant's voice state, which only goes up |-The broadcast form has no `region_id`, `server_id`, `latitude`, or `longitude`.+<sup>1</sup> Always false in a guild voice channel when the participant lacks `STREAM`### <span id="voice-server-update"></span>VOICE_SERVER_UPDATE-The session received or replaced its own voice grant. Delivered to the requesting session alone.--A grant has one of two structures. A LiveKit grant has `token` and `endpoint`. A peer-to-peer grant has `p2p: true` and `ice_servers`, and never has `token`, `endpoint`, or `e2ee_key`.+The session got a voice grant, sent only to the session that asked. A LiveKit grant has `token` and `endpoint`. A peer-to-peer grant has `p2p: true` and `ice_servers`, and you follow [Peer-to-peer voice](#peer-to-peer-voice). [Voice](/voice/) has the rest.| Field | Type | Description || --- | --- | --- |-| token?<sup>1</sup> | string | The LiveKit access token this connection presents |-| endpoint?<sup>1</sup> | string | The LiveKit signalling URL to connect to, a `ws://` or `wss://` address |-| p2p?<sup>2</sup> | boolean | Always true when present. The connection exchanges media peer-to-peer |-| ice_servers?<sup>2</sup> | array[[ICE server object](#ice-server-object)] | The STUN servers the connection uses for its peer connections, empty when the instance names none |-| connection_id | string | The voice connection the grant covers |-| channel_id | snowflake | The channel the grant covers |-| guild_id?<sup>3</sup> | snowflake | The guild the channel belongs to |-| e2ee_key?<sup>4</sup> | string | The key material the channel's end-to-end encryption uses |+| token?<sup>1</sup> | string | LiveKit access token |+| endpoint?<sup>1</sup> | string | LiveKit `ws://` or `wss://` URL |+| p2p?<sup>2</sup> | boolean | Always `true` when present |+| ice_servers?<sup>2</sup> | array[[ICE server object](#ice-server-object)] | STUN servers for the peer connections, empty when the instance has none |+| connection_id | string | The voice connection the grant is for |+| channel_id | snowflake | The channel the grant is for |+| guild_id? | snowflake | The guild the channel belongs to, absent for a call |+| e2ee_key?<sup>3</sup> | string | Key for the channel's end-to-end encryption |-<sup>1</sup> Present on a LiveKit grant+<sup>1</sup> On a LiveKit grant-<sup>2</sup> Present on a peer-to-peer grant, which only a session that sent `p2p: true` in its [Voice State Update](/gateway/commands/#voice-state-update) command receives+<sup>2</sup> On a peer-to-peer grant-<sup>3</sup> Present for a guild voice channel and absent for a call, so a client reads the scope from this field+<sup>3</sup> On a LiveKit grant for an end-to-end encrypted channel-<sup>4</sup> Present only on a LiveKit grant for an end-to-end encrypted channel+A new grant comes when the connection opens, moves to another channel or changes region. A LiveKit grant for a connection that had a peer-to-peer grant means the call switched to LiveKit. Close your peer connections and connect with the new grant.#### ICE server object@@ -1018,79 +885,38 @@ A grant has one of two structures. A LiveKit grant has `token` and `endpoint`. A| --- | --- | --- || urls | array[string] | The `stun:` URLs of one server |-Fluxer never hands out a TURN server, so a peer-to-peer connection never relays media. Peers that cannot reach each other directly fail to connect, and [Peer-to-peer voice](#peer-to-peer-voice) states what a client does then.--```json-{- "p2p": true,- "ice_servers": [- {"urls": ["stun:stun.example.com:3478"]}- ],- "connection_id": "b7f3c2a94e1d4c0f",- "channel_id": "1189375284394692610",- "guild_id": "1189375284394692608"-}-```--Fluxer uses LiveKit for voice media unless the grant is peer-to-peer. There is no second voice websocket and no UDP discovery step. With a LiveKit grant a client opens a LiveKit connection to `endpoint`, presents `token` there, and speaks the LiveKit protocol from that point on. With a peer-to-peer grant a client follows [Peer-to-peer voice](#peer-to-peer-voice). [Voice](/voice/) states the room naming, the participant identity, and the track sources a grant admits.--A grant is issued when a connection opens, when it moves to another channel, and when its region changes. Toggling `self_mute`, `self_video`, or `self_stream` produces no new grant. A call region change reissues one grant to each participant of the call.--A LiveKit grant for a `connection_id` that holds a peer-to-peer grant means a participant or a region change converted the channel or call. The client closes its peer connections and connects to LiveKit with the new grant.+Fluxer never gives out a TURN server, and peers that can't connect to each other directly can't call.#### Peer-to-peer voice-A voice channel or call is peer-to-peer when it has at least one voice state and every voice state in it has `p2p: true`. The participants then form a full mesh of WebRTC peer connections, one for each pair of connections, and no media passes through LiveKit. The mesh roster is the set of voice states of the channel or call.+A voice channel or call is peer-to-peer when every voice state in it has `p2p: true`. Each pair of connections then has its own WebRTC peer connection and no media goes through LiveKit. Peers exchange session descriptions and ICE candidates with the [Voice Signal](/gateway/commands/#voice-signal) command.-Fluxer decides each new connection as follows.+Fluxer decides each join from the channel's state and the `p2p` value in the [Voice State Update](/gateway/commands/#voice-state-update) command. A bot always counts as not sending `p2p: true`.| Channel or call | The command sent `p2p: true` | Any other `p2p` value || --- | --- | --- || Peer-to-peer below the participant cap | Peer-to-peer join<sup>1</sup> | Refused with `VOICE_P2P_CONSENT_REQUIRED` || Peer-to-peer at the participant cap | Refused with `VOICE_CHANNEL_FULL` | Refused with `VOICE_P2P_CONSENT_REQUIRED` |-| Empty, with no join awaiting LiveKit confirmation | Peer-to-peer join, or a LiveKit join when Fluxer declines<sup>2</sup> | LiveKit join |+| Empty | Peer-to-peer join, or a LiveKit join when Fluxer declines | LiveKit join || Every other state | LiveKit join | LiveKit join |<sup>1</sup> Refused with `VOICE_P2P_UNAVAILABLE` when Fluxer declines peer-to-peer for this join-<sup>2</sup> The session then receives a LiveKit grant and the channel or call is not peer-to-peer--Participants are counted as connections in a guild voice channel and as users in a call. The participant cap is `max_participants` of the [peer-to-peer voice configuration](/admin-api/instance/#peer-to-peer-voice-configuration-object), 2 through 4, and every account reads it from its [peer-to-peer voice assignment](/http-api/experiments/#peer-to-peer-voice-assignment-object). A lower cap never removes a participant from a running call. A bot session counts as not having sent `p2p: true`. A connection that moves into a guild voice channel with its own Voice State Update command is decided by the same table.--Each refusal reaches the requesting session as a [Gateway Error](/gateway/opcodes-and-close-codes/#gateway-error) payload, changes no voice state, and leaves the existing participants untouched. A client that receives `VOICE_P2P_CONSENT_REQUIRED` asks its user and, on agreement, sends the join again with `p2p: true`.--Two joins can reach an empty call at the same moment with different `p2p` values. Fluxer admits the first and refuses the other with `VOICE_P2P_CONSENT_REQUIRED`. The refused session receives a [Voice State Update](#voice-state-update) with a null `channel_id` for the connection it had been granted.--The voice state of a peer-to-peer join is published at once, with no LiveKit confirmation step. Peers exchange session descriptions and ICE candidates with the [Voice Signal](/gateway/commands/#voice-signal) command, which arrives as [Voice Signal](#voice-signal).--Fluxer never converts a peer-to-peer channel or call to LiveKit by itself. Only two actions convert one.--- A participant sends a Voice State Update command for its own connection with an explicit `p2p: false`.-- The voice region changes. [Modify call region](/http-api/calls/#modify-call-region) converts a call whenever it supplies `region`, even with the current value. [Modify channel](/http-api/channels/#modify-channel) converts a guild voice channel when it stores a different `rtc_region`.--A conversion sets `p2p` to false on every voice state of the channel or call, publishes each as a [Voice State Update](#voice-state-update), and sends each connected session a LiveKit grant for its existing `connection_id`. The conversion is one way. The channel or call can be peer-to-peer again only after it has emptied.--A guild voice channel whose `rtc_p2p` is true stays peer-to-peer. Neither action converts it, and a change to `rtc_p2p` takes effect for the next call, after the channel has emptied. Fluxer does not ask for agreement before the first join of such a channel. A client whose [peer-to-peer voice assignment](/http-api/experiments/#peer-to-peer-voice-assignment-object) is enabled asks its user and sends `p2p: true` on agreement. Any other first join starts a LiveKit call.--A failed peer connection converts nothing. The affected client reports the problem to its user, who can leave or send the explicit `p2p: false`. Each client reports how its peer connections settled with [Report connection outcomes](/http-api/peer-to-peer-voice/#report-connection-outcomes).--A moderator cannot move a member into a peer-to-peer channel. [Modify guild member](/http-api/guild-members/#modify-guild-member) returns 400 `USER_NOT_IN_VOICE` and the member stays in its channel. A member moved out of a peer-to-peer channel receives a LiveKit grant for the target channel.+A refusal arrives as a [Gateway Error](/gateway/opcodes-and-close-codes/#gateway-error) and changes nothing. On `VOICE_P2P_CONSENT_REQUIRED`, ask the user and send the join again with `p2p: true` if they agree. The participant cap is `max_participants` from the [peer-to-peer voice configuration](/admin-api/instance/#peer-to-peer-voice-configuration-object), between 2 and 4.-Server mute and server deafen remain voice state flags in a peer-to-peer mesh, and each peer applies them to the media it sends and plays. A peer closes its peer connection to a connection whose voice state leaves the channel.+Fluxer never switches a call to LiveKit on its own. Only a participant sending `p2p: false` for its own connection, or a region change through [Modify call region](/http-api/calls/#modify-call-region) or [Modify channel](/http-api/channels/#modify-channel), switches it. The call stays on LiveKit until it empties. A guild voice channel with `rtc_p2p` set never switches.### <span id="voice-signal"></span>VOICE_SIGNAL-Another connection of a [peer-to-peer](#peer-to-peer-voice) voice channel or call sent this session a signalling message with the [Voice Signal](/gateway/commands/#voice-signal) command. Delivered to the session that owns the target connection alone.+Another connection in a [peer-to-peer](#peer-to-peer-voice) call sent this session a signaling message with the [Voice Signal](/gateway/commands/#voice-signal) command. Only the session that owns the target connection receives it. Ignore a signal whose `from` is no longer in your roster.| Field | Type | Description || --- | --- | --- |-| guild_id?<sup>1</sup> | snowflake | The guild the channel belongs to |+| guild_id? | snowflake | The guild the channel belongs to, absent for a call || channel_id | snowflake | The voice channel or call channel |-| from | string | The `connection_id` of the sending voice state |+| from | string | The `connection_id` of the sender || user_id | snowflake | The user who owns the sending connection |-| data | object | The signalling message exactly as the sender supplied it |--<sup>1</sup> Present for a guild voice channel and absent for a call+| data | object | The signaling message exactly as the sender sent it |```json{@@ -1107,7 +933,7 @@ Another connection of a [peer-to-peer](#peer-to-peer-voice) voice channel or cal### <span id="entrance-sound-play"></span>ENTRANCE_SOUND_PLAY-A participant asked for their entrance sound to play in a voice channel they are already connected to.+A participant played their entrance sound in the voice channel they are in. Everyone else with a voice state in the channel receives it.| Field | Type | Description || --- | --- | --- |@@ -1122,90 +948,66 @@ A participant asked for their entrance sound to play in a voice channel they are### <span id="call-create"></span>CALL_CREATE-A private channel call began, or became visible in the session's initial state.+A call started in a private channel, or the session learned of an active one after [Ready](#ready) or a lost connection. Every recipient of the channel receives it, and the same goes for [Call Update](#call-update) and [Call Delete](#call-delete).| Field | Type | Description || --- | --- | --- || channel_id | snowflake | Channel the call is in |-| message_id | snowflake | Call message that opened the call |-| region | ?string | Voice region serving the call, null until one is chosen |+| message_id | snowflake | Call message that started the call |+| region | ?string | Voice region of the call, null until one is chosen || ringing | array[snowflake] | Recipients being rung |-| voice_states<sup>1</sup> | array[[voice state object](#voice-state-object)] | Participants, ordered by participant ID |-| recipients?<sup>2</sup> | array[snowflake] | Every recipient of the channel |-| created_at?<sup>2</sup> | integer | Unix milliseconds when the call was opened |--<sup>1</sup> Entries also include `region_id` and `server_id`, which clients MUST ignore--<sup>2</sup> Present on initial or recovered call state--Initial call state arrives shortly after [Ready](#ready). Recovered state can arrive after a lost call connection, whether or not the client received [Call Delete](#call-delete).+| voice_states | array[[voice state object](#voice-state-object)] | Participants |+| recipients?<sup>1</sup> | array[snowflake] | Every recipient of the channel |+| created_at?<sup>1</sup> | integer | Unix milliseconds when the call started |-Recipients are every recipient of the channel, whether or not they joined the call. The same set receives [Call Update](#call-update) and [Call Delete](#call-delete).+<sup>1</sup> Only after Ready or a lost connection### <span id="call-update"></span>CALL_UPDATE-The ringing set, participant roster, or region of an active call changed. The payload has the same structure as [Call Create](#call-create) without `recipients` and `created_at`.--An operation with no visible effect produces no Call Update.+Who is ringing, who is in the call or the call's region changed. The payload has the same fields as [Call Create](#call-create) without `recipients` and `created_at`.### <span id="call-delete"></span>CALL_DELETE-A call ended, or became unavailable.+A call ended or became unavailable. Keep an unavailable call until a new [Call Create](#call-create) arrives.| Field | Type | Description || --- | --- | --- || channel_id | snowflake | Channel the call was in |-| unavailable?<sup>1</sup> | boolean | True when the call became unavailable |--<sup>1</sup> Absent when the call ended--With `unavailable: true`, the client MUST keep the call as an unavailable entry. If it becomes available again, a fresh [Call Create](#call-create) includes `recipients` and `created_at`. Recovery is not guaranteed.+| unavailable? | boolean | True when the call became unavailable, absent when it ended |## Count response events### <span id="guild-counts-update"></span>GUILD_COUNTS_UPDATE-Answers [Request Guild Counts](/gateway/commands/#request-guild-counts) for the requesting session.+The answer to [Request Guild Counts](/gateway/commands/#request-guild-counts). A guild that isn't connected or didn't answer in time has no entry.| Field | Type | Description || --- | --- | --- |-| counts | array[[guild count entry object](#guild-count-entry-object)] | One entry per guild that answered in time |-| nonce? | string | Echoed when the request supplied a valid nonce |--A guild that is not connected, or that missed its deadline, has no entry in `counts`.+| counts | array[[guild count entry object](#guild-count-entry-object)] | One entry per guild |+| nonce? | string | The request's nonce |#### Guild count entry object| Field | Type | Description || --- | --- | --- |-| guild_id | snowflake | Guild the counts describe |+| guild_id | snowflake | Guild the counts are for || member_count | integer | Total members |-| online_count<sup>1</sup> | integer | Online members visible to the requesting account |--<sup>1</sup> Counts only the online members that share at least one channel the requesting account can view. An account holding `ADMINISTRATOR` receives the guild's whole online count instead, and an account that can view no channel receives `1` when it is itself online and `0` when it is not+| online_count | integer | Online members who share a channel you can view, or all of them for `ADMINISTRATOR` |### <span id="channel-member-counts-update"></span>CHANNEL_MEMBER_COUNTS_UPDATE-Answers [Request Channel Member Counts](/gateway/commands/#request-channel-member-counts) for the requesting session.+The answer to [Request Channel Member Counts](/gateway/commands/#request-channel-member-counts). You only get an entry for a channel where you have `VIEW_CHANNEL_MEMBERS`.| Field | Type | Description || --- | --- | --- |-| counts | array[[channel count entry object](#channel-count-entry-object)] | One entry per channel that answered |-| nonce? | string | Echoed when the request supplied a valid nonce |--A channel the session cannot view, and a channel on which it lacks `VIEW_CHANNEL_MEMBERS`, has no entry in `counts`.+| counts | array[[channel count entry object](#channel-count-entry-object)] | One entry per channel |+| nonce? | string | The request's nonce |#### Channel count entry object| Field | Type | Description || --- | --- | --- || guild_id | snowflake | Guild the channel belongs to |-| channel_id | snowflake | Channel the counts describe |-| member_count | integer | Members that can view the channel |-| online_count | integer | Online members that can view the channel |--## Resource representation--Every resource object named on this page has the representation defined by the [HTTP API](/http-api/). A Dispatch payload with a resource object has the same fields, with the guild-scoped events adding `guild_id` and the message and reaction events adding `member`.--These reductions are specific to the Gateway and appear nowhere in the HTTP API. [Ready](#ready) strips `user` from each relationship and from each guild member and moves those accounts into its `users` array. The `member` added to a message event has its own `user` removed, and the account is in the message's `author`. A client MUST resolve those accounts from the surrounding payload.+| channel_id | snowflake | Channel the counts are for |+| member_count | integer | Members who can view the channel |+| online_count | integer | Online members who can view the channel |diff --git a/fluxer_docs/src/content/docs/gateway/limits-and-rate-limits.md b/fluxer_docs/src/content/docs/gateway/limits-and-rate-limits.mdindex 23c2af0fd..f772fcd61 100644--- a/fluxer_docs/src/content/docs/gateway/limits-and-rate-limits.md+++ b/fluxer_docs/src/content/docs/gateway/limits-and-rate-limits.md@@ -1,105 +1,78 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Limits and rate limits-description: Main Gateway session, command, replay, backpressure, and admission limits.+description: The heartbeat, session, rate, replay and payload limits on a Gateway connection.----Every main Gateway connection has limits on what it sends, how long its session lives, how many commands it runs at once, and how much Fluxer replays to it. Exceeding one closes the connection with a [close code](/gateway/opcodes-and-close-codes/#close-codes), discards the payload, or coerces the value. The [close reason registry](/gateway/opcodes-and-close-codes/#close-reasons) defines each exact reason.--## Transport and encoding--[Framing](/gateway/overview/#framing) owns the protocol version, the payload bound, and the compression contract. One inbound WebSocket message is limited to 16,384 bytes on the wire and to a further 16,384 bytes after decompression, and either bound closes with `4002` and reason `Payload too large`.--A compressed message that decompresses past 10 MiB closes with `4002` and reason `Decompression failed`. That message never closes with `Payload too large`.+Every Gateway connection (not the voice connection) has limits on what it sends, how long its session lasts and how much Fluxer replays to it. Going over a limit closes the connection with a [close code](/gateway/opcodes-and-close-codes/#close-codes), drops the payload or clamps the value. Message size limits are in [Framing](/gateway/overview/#framing).## Session lifecycle-Hello advertises a heartbeat interval of 41,250 ms. The Gateway checks the heartbeat state every 13,750 ms. When 37,125 ms have elapsed since the last acknowledgement it sends Opcode `1`, and a client answers it immediately. If no new acknowledgement is accepted before the elapsed time passes 45,000 ms, the connection closes with `4009` and reason `Heartbeat timeout`.--There is no separate authentication deadline. The heartbeat rule alone closes a socket that never authenticates.--A disconnected session remains resumable for 60,000 ms. Its presence is published as `offline` 5,000 ms after the socket drops, well before the retention window ends. A successful Resume inside the window restores the status the session last selected.--One user credential holds at most 100 live sessions. A further Identify closes with `4008` and reason `Too many sessions`. A bot credential is bounded by the guild ceiling below.+Hello sends a heartbeat interval of 41,250 ms, and the Gateway checks the heartbeat every 13,750 ms. When 37,125 ms have elapsed since the last acknowledgement, the Gateway sends opcode `1` and you send a heartbeat right away. If no acknowledgement arrives within 45,000 ms, the connection closes with `4009`, and a socket that never sends Identify closes the same way.-Shard counts run from 1 through 16,384. One bot shard covers at most 2,500 guilds. A malformed shard pair closes with `4010` for every credential. A bot assignment above the guild ceiling closes with `4011` and reason `Sharding required`. A user session is never refused for its guild count.+A disconnected session stays resumable for 60,000 ms, and its presence shows as `offline` after 5,000 ms. A Resume inside that window restores the status the session had.-:::note[Session creation can be delayed]-An Identify can remain pending with no response while the node drains, while the node is at capacity, while session starts are paused, or while the account is outside the session rollout percentage. Continue heartbeating while waiting for Ready.-:::+One user has at most 100 live sessions, and a further Identify closes with `4008`.-## Session start limit+Shard counts run from 1 through 16,384, and one bot shard has at most 2,500 guilds. A bot shard with more guilds closes with `4011`, and a `shard` that is not a valid `[shard_id, shard_count]` pair closes with `4010`. User accounts have no guild limit per session.-[`GET /v1/gateway/bot`](/http-api/gateway/#get-gateway-information) returns a [session start limit](/http-api/gateway/#session-start-limit-object) object for client compatibility. Its values are constants. Admission is bounded by the source IP Identify budget, the per-user session count, the node's concurrent session-start bucket, and the rollout percentage.+When the Gateway is busy, it holds an Identify and starts the session once it can. Keep heartbeating until Ready arrives. An Identify or Resume over the per-IP budget below gets no reply, and you can send a new one after the 60-second window. The [session start limit](/http-api/gateway/#session-start-limit-object) that `GET /v1/gateway/bot` returns has fixed values for client compatibility, and the Gateway does not enforce it.## Connection and command rate limits-The figures below are the defaults. An operator can disable these limits.--One WebSocket accepts 600 client payloads in a rolling 60-second window. One authenticated session accepts 600 client payloads in each fixed 60-second bucket. One source IP address accepts 6,000 client payloads in each fixed 60-second bucket. Exceeding any of these budgets closes the current connection with `4008` and reason `Rate limited`.--The session budget applies only after authentication.--One source IP address holds 256 concurrent Gateway WebSockets. A further connection closes with `4008` and reason `Too many connections` before Hello is sent.--One source IP address makes 300 Identify attempts in each fixed 60-second window. A further attempt is discarded without a reply and without a close. The payload is not retained and is never retried, so the client sends a new Identify itself once the budget recovers, before the heartbeat deadline closes the socket.--Presence Update accepts five commands per WebSocket in a rolling 20-second window. A further update is discarded without closing the connection.--[Request Forum Unreads](/gateway/threads/#request-forum-unreads) accepts five commands per WebSocket in a rolling 5-second window. A further command is discarded without closing the connection.+Every client payload counts toward the first three budgets.-Voice State Update processes the first two commands per session in a rolling one-second window immediately. Later updates enter a per-session queue that holds at most 64 commands and drains one command every 500 ms. A newer update replaces an older queued update for the same `guild_id` and `connection_id` pair, and a full queue discards its oldest entry before accepting the new one.+| Scope | Budget | Over the budget |+| --- | --- | --- |+| WebSocket | 600 payloads per rolling 60 seconds | The connection closes with `4008` |+| Session | 600 payloads per fixed 60-second bucket, after authentication | The connection closes with `4008` |+| IP address | 6,000 payloads per fixed 60-second bucket | The connection closes with `4008` |+| Open connections per IP | 256 WebSockets | The new connection closes with `4008` before Hello |+| Identify and Resume per IP | 300 attempts per fixed 60-second window | The command is dropped with no reply |+| Presence Update | 5 per WebSocket per rolling 20 seconds | The command is dropped |+| Request Forum Unreads | 5 per WebSocket per rolling 5 seconds | The command is dropped |+| Voice Signal | 240 per WebSocket per rolling 10 seconds | The command is dropped |+| Request Guild Members | 12 per account and 40 per guild per rolling 10 seconds | The command is dropped |-Voice Signal accepts 240 commands per WebSocket in a rolling 10-second window, which leaves room for a burst of trickle ICE candidates. A further signal is discarded without closing the connection. Every signal, discarded or not, also counts toward the three payload budgets above.+Fluxer applies the first two Voice State Updates per session in a rolling second. Later ones are applied one every 500 ms, and a newer update for the same `guild_id` and `connection_id` replaces one that is still waiting.-Request Guild Members has three command-specific budgets. Each account may send 12 requests in a rolling 10-second window, and each guild accepts 40 requests in a rolling 10-second window across all accounts. A request over either of these budgets is discarded without a result and without a close. A bot requesting a complete member list is limited to one accepted request per guild every 30 seconds, and a request inside that window produces [Rate Limited](/gateway/events/#rate-limited). The budget is keyed by the account and the guild together, so reconnecting does not reset it.+A bot can request a guild's complete member list (Request Guild Members with an empty `query`, `limit` 0 and no `user_ids`) once every 30 seconds per guild. An earlier request gets [Rate Limited](/gateway/events/#rate-limited), and reconnecting does not reset the timer.## Bounded commands-One WebSocket processes at most four bounded requests at once across [Request Guild Members](/gateway/commands/#request-guild-members), [Lazy Request](/gateway/commands/#lazy-request), [Request Guild Counts](/gateway/commands/#request-guild-counts), [Request Channel Member Counts](/gateway/commands/#request-channel-member-counts), and [Request Forum Unreads](/gateway/threads/#request-forum-unreads). Each request has a 10,000 ms deadline, after which it stops. Events already emitted are not retracted. A command that emits its result in several events can deliver a partial result and then stop.+One WebSocket runs at most four of the following commands at once, and each one stops after 10,000 ms.-Request Guild Members keeps one replaceable pending request while another member request is active. The most recent further request replaces any earlier pending one and starts when the active request finishes.+- [Request Guild Members](/gateway/commands/#request-guild-members)+- [Lazy Request](/gateway/commands/#lazy-request)+- [Request Guild Counts](/gateway/commands/#request-guild-counts)+- [Request Channel Member Counts](/gateway/commands/#request-channel-member-counts)+- [Request Forum Unreads](/gateway/threads/#request-forum-unreads)-A bounded command that finds all four slots occupied is dropped. There is no queue, no result event, and no close. Request Forum Unreads from a user session without `CHANNEL_THREADS` still closes with `4001`, as [Gateway threads](/gateway/threads/#request-forum-unreads) describes.+A command sent while all four slots are busy is dropped with no result and no close. If you send more Request Guild Members commands while one is running, only the most recent waits and the rest are dropped. A command that times out after sending some of its events does not send the rest.-Request Guild Counts queries each guild with a 2,000 ms deadline under an overall 3,000 ms batch deadline. Request Channel Member Counts queries its guild with a 2,000 ms deadline. A guild that misses its deadline is omitted from the result.+Request Guild Counts and Request Channel Member Counts leave out a guild that does not answer within 2,000 ms.## Replay and backpressure-Resume history retains at most 4,096 Dispatch events and 16,777,216 bytes of retained event data, the 16 MiB total ceiling. When either bound is exceeded, the oldest retained events are dropped from the front of the buffer.+The replay buffer keeps at most 4,096 Dispatch events and about 16 MiB of event data, and drops the oldest events past either limit. A single Dispatch over about 2 MiB is sent but never kept, and a Resume with a `seq` below that event gets opcode `9` with `d: false`. A replay can skip sequence numbers, because some events are [never replayed](/gateway/events/#dispatch-delivery).-One Dispatch larger than 2,097,152 bytes, the 2 MiB single-event ceiling, is delivered to the socket and never retained. The connection is not closed for it, so a client that resumes across such an event does not receive it again.--Both byte bounds measure in-memory size, not wire bytes, so both figures are approximate.--[Guild Members Chunk](/gateway/events/#guild-members-chunk) is delivered live and is never retained for Resume, whatever its size.--[Guild Sync](/gateway/events/#guild-sync), [Guild Member List Update](/gateway/events/#guild-member-list-update), [Thread List Sync](/gateway/threads/#thread-list-sync), and [Thread Member List Update](/gateway/threads/#thread-member-list-update) are also excluded from replay. A replay can therefore have sequence gaps even within its retention window.--A heartbeat with a sequence discards every retained Dispatch at or below that sequence and records it as the acknowledged sequence. A client MUST acknowledge only a sequence whose events it has finished processing. A heartbeat with `null`, and a heartbeat with a sequence below the acknowledged sequence, change nothing. Resume neither acknowledges nor evicts. A client that never heartbeats with a sequence keeps its full window until the count or byte bound evicts from the front.--Resume closes with `4007` on a `seq` below the acknowledged sequence, and on a `seq` above the session's current sequence.--An eviction from the count or byte bound raises a replay floor to the highest sequence it dropped. A Resume with a `seq` below that floor produces Opcode `9` with `d: false` and no close, so a client that reconnects long after it fell behind Identifies again.--Presence updates can be dropped under load without closing the connection.+Send a sequence in a heartbeat only after you finish processing that event, because the Gateway then drops kept events up to it. When `seq` is below an event that was dropped from the buffer or never kept, you get opcode `9` with `d: false` and need to Identify again.## Command payload limits-Request Guild Members accepts at most 100 user IDs, a nonce of at most 32 bytes, and a result limit from 0 through 100. Duplicate guild IDs are collapsed, an out-of-range limit is clamped, and an oversized nonce becomes null. An oversized `user_ids` array abandons the request. The nonce is echoed only when the request named exactly one guild.--Lazy Request accepts at most 10 member list ranges per channel, each with `end` at most 100,000 and `end - start` at most 99, and at most 1,000 explicit member IDs per guild. Ranges and IDs that fail validation are dropped, and valid entries past either ceiling are truncated. It keeps at most 10 [`thread_member_lists`](/gateway/threads/#lazy-request-thread-options) entries per guild.--Request Guild Counts accepts at most 100 guild IDs after deduplication. Request Channel Member Counts accepts at most 25 channel IDs after deduplication. Both nonces run from 1 through 64 bytes, and a nonce outside that bound is omitted from the result. [Request Forum Unreads](/gateway/threads/#request-forum-unreads) accepts at most 40 posts after deduplication.+| Command | Limit |+| --- | --- |+| Identify | At most 256 `ignored_events` |+| Request Guild Members | At most 100 `user_ids`, a `limit` from 0 through 100 and a nonce up to 32 bytes |+| Lazy Request | At most 10 ranges per channel of up to 100 members each, and 1,000 member IDs per guild |+| Request Guild Counts | At most 100 guild IDs and a nonce from 1 through 64 bytes |+| Request Channel Member Counts | At most 25 channel IDs and a nonce from 1 through 64 bytes |+| Request Forum Unreads | At most 40 posts |-Identify accepts at most 256 `ignored_events` entries. A longer array closes with `4002` and reason `Invalid identify payload`. Fluxer coerces or drops a value outside any other command payload bound. [Client commands](/gateway/commands/) states the exact coercion or drop rule for each field.+Going over an Identify limit closes the connection with `4002`. Other out-of-range values are clamped or dropped, as each field in [Client commands](/gateway/commands/) describes.## Voice admission-Voice admission follows the enclosing guild, DM, group DM, channel, and permission rules. A refusal closes nothing. It produces a [Gateway Error](/gateway/opcodes-and-close-codes/#gateway-error) for `VOICE_CHANNEL_FULL`, `VOICE_P2P_CONSENT_REQUIRED`, and `VOICE_P2P_UNAVAILABLE`, and no payload for every other code.--A guild voice channel admits at most `user_limit` users, where `0` means unlimited. A channel in which any participant has a camera enabled also admits at most 25 users in total, whatever its `user_limit`. A channel that already holds 25 users with cameras enabled refuses a further camera with `VOICE_CAMERA_USER_LIMIT`. [Capacity](/voice/#capacity) states these bounds in full.--A peer-to-peer mesh holds at most 4 participants, counted as connections in a guild voice channel and as users in a call. A join past that bound is refused with `VOICE_CHANNEL_FULL`, as [Peer-to-peer voice](/gateway/events/#peer-to-peer-voice) describes.+A refused voice join does not close the connection. Only `VOICE_CHANNEL_FULL`, `VOICE_P2P_CONSENT_REQUIRED` and `VOICE_P2P_UNAVAILABLE` send a [Gateway Error](/gateway/opcodes-and-close-codes/#gateway-error).-One user holds at most `voice_connection_limit` simultaneous voice connections in one guild voice channel. The field is part of the [channel object](/http-api/channels/#channel-object), defaults to 5, and is accepted from 1 through 100. Pending connections that have not yet expired count against it.+A guild voice channel admits at most `user_limit` users, where `0` means no limit. Once anyone has a camera on, it admits at most 25 users, and a 26th camera is refused with `VOICE_CAMERA_USER_LIMIT`. A peer-to-peer call has at most 4 participants and refuses more with `VOICE_CHANNEL_FULL`. One user has at most `voice_connection_limit` connections in one guild voice channel (default 5, range 1-100). See [Capacity](/voice/#capacity).diff --git a/fluxer_docs/src/content/docs/gateway/opcodes-and-close-codes.md b/fluxer_docs/src/content/docs/gateway/opcodes-and-close-codes.mdindex 0cd7d5d94..5a7cd5dd3 100644--- a/fluxer_docs/src/content/docs/gateway/opcodes-and-close-codes.md+++ b/fluxer_docs/src/content/docs/gateway/opcodes-and-close-codes.md@@ -1,95 +1,44 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Opcodes and close codes-description: Numeric registry for main Gateway opcodes, close codes, and exact close reasons.+description: The opcodes the main Gateway sends and accepts, and the close codes and reasons it uses.----An opcode is the number that names a [Gateway payload](/gateway/overview/#gateway-payload). A close code is the number the [Gateway](/gateway/overview/) sends when it ends a connection. Every value on this page belongs to the main Gateway alone. [Gateway overview](/gateway/overview/) describes the connection and its state machine, and [Client commands](/gateway/commands/) describes the payloads for these opcodes.+Every [Gateway payload](/gateway/overview/#gateway-payload) has an opcode, and the [Gateway](/gateway/overview/) ends a connection with a close code.## Opcodes-| Op | Name | Direction |+| Op | Name | Description || --- | --- | --- |-| 0 | Dispatch | Server to client |-| 1 | Heartbeat | Bidirectional |-| 2 | Identify | Client to server |-| 3 | Presence Update | Client to server |-| 4 | Voice State Update | Client to server |-| 5 | Voice Server Ping | Reserved |-| 6 | Resume | Client to server |-| 7 | Reconnect | Server to client |-| 8 | Request Guild Members | Client to server |-| 9 | Invalid Session<sup>1</sup> | Server to client |-| 10 | Hello | Server to client |-| 11 | Heartbeat ACK | Server to client |-| 12 | Gateway Error | Server to client |-| 13 | Voice Signal | Client to server |-| 14 | Lazy Request | Client to server |-| 15 | Request Guild Counts | Client to server |-| 16 | Request Channel Member Counts | Client to server |-| 28 | Request Forum Unreads | Client to server |--<sup>1</sup> Fluxer never sends Opcode 9 with `d: true`, so an Invalid Session is never an instruction to resume--### Payload and when it is sent--| Op | Payload | When sent |-| --- | --- | --- |-| 0 | Event-specific data | Fluxer sends a named event with `t` and a session sequence with `s`<sup>1</sup> |-| 1 | The last processed sequence or `null` from the client, and `null` from the server | The client sends on the advertised schedule. The server requests an immediate heartbeat once 90 per cent of the advertised interval has elapsed since the last acknowledgement<sup>2</sup> |-| 2 | [Identify object](/gateway/commands/#identify) | The client starts one authenticated session |-| 3 | [Presence Update object](/gateway/commands/#presence-update) | The client replaces its session presence |-| 4 | [Voice State Update object](/gateway/commands/#voice-state-update) | The client joins, moves, updates, or leaves voice |-| 5 | Not implemented | Never sent. A client that sends it is closed<sup>3</sup> |-| 6 | [Resume object](/gateway/commands/#resume) | The client restores a retained session<sup>4</sup> |-| 7 | No `d` field | The Gateway asks the client to replace the connection and then closes with `4000`<sup>5</sup> |-| 8 | [Request Guild Members object](/gateway/commands/#request-guild-members) | The client requests bounded member chunks |-| 9 | Literal `false` | The session named by Resume could not be reached, the supplied `seq` is below the replay floor, or an established session ended<sup>6</sup> |-| 10 | Object with `heartbeat_interval` | Sent as the WebSocket is accepted, before any client payload is read |-| 11 | No `d` field | Acknowledges an accepted client heartbeat |-| 12 | [Gateway Error object](#gateway-error) | Fluxer reports a refused voice join that the client is expected to act on |-| 13 | [Voice Signal object](/gateway/commands/#voice-signal) | The client sends peer-to-peer signalling to one other voice connection |-| 14 | [Lazy Request object](/gateway/commands/#lazy-request) | The client replaces bounded guild subscriptions |-| 15 | [Request Guild Counts object](/gateway/commands/#request-guild-counts) | The client requests current guild count records |-| 16 | [Request Channel Member Counts object](/gateway/commands/#request-channel-member-counts) | The client requests channel count records |-| 28 | [Request Forum Unreads object](/gateway/threads/#request-forum-unreads) | The client requests unread counts for posts in one forum or media channel |--<sup>1</sup> [Resumed](/gateway/events/#resumed) has the session's current sequence without advancing it, and a replayed Dispatch keeps the sequence it was first sent with--<sup>2</sup> Answer a server heartbeat request immediately, in addition to the regular schedule--<sup>3</sup> A client that sends Opcode 5 or 12 gets the same close as a client that sent an undefined opcode. Fluxer never sends Opcode 5--<sup>4</sup> Resume is accepted whether or not a session is already attached to the connection--<sup>5</sup> Opcode 7 precedes the close when the Gateway node is draining, when the node transfers the session to another Gateway node, and when a Resume from a new socket displaces this one--<sup>6</sup> After the frame, a socket whose session ended is unauthenticated. After a failed Resume, a socket that already held a session still holds it--The registry is complete. The values 17 through 27 and every value above 28 are undefined.--Fluxer resolves an inbound payload in this order.--1. A payload that has no `d` reaches no command handler. Identify closes with `4005`. Every other opcode, defined or not, closes with `4001`.-2. Heartbeat and Resume are handled whether or not a session is attached.-3. Identify closes with `4005` when a session is already attached.-4. Every remaining opcode closes with `4003` while no session is attached.-5. With a session attached, Presence Update, Voice State Update, Voice Signal, Request Guild Members, Lazy Request, Request Guild Counts, Request Channel Member Counts, and Request Forum Unreads are handled. Every other opcode, including a server opcode and an undefined value, closes with `4001`.--Request Forum Unreads from a user session that did not set [`CHANNEL_THREADS`](/gateway/threads/#session-flag) also closes with `4001`.--:::note[Unknown server opcodes are forward compatible]-A client SHOULD log an unknown opcode and ignore the frame, and MUST NOT close or reconnect solely because the server used an opcode newer than this registry.-:::+| 0 | Dispatch | Server to client. An event with its name in `t` and a sequence in `s` |+| 1 | Heartbeat | Both ways. The client sends its last sequence or `null` in `d`. Answer a server heartbeat at once |+| 2 | Identify | Client to server. Starts a session with an [Identify object](/gateway/commands/#identify) |+| 3 | Presence Update | Client to server. A [Presence Update object](/gateway/commands/#presence-update) |+| 4 | Voice State Update | Client to server. A [Voice State Update object](/gateway/commands/#voice-state-update) |+| 5 | Voice Server Ping | Reserved. The Gateway closes a client that sends it |+| 6 | Resume | Client to server. Restores a session with a [Resume object](/gateway/commands/#resume) |+| 7 | Reconnect | Server to client, with no `d`, before a close with `4000`. Reconnect and [resume](/gateway/commands/#resume) |+| 8 | Request Guild Members | Client to server. A [Request Guild Members object](/gateway/commands/#request-guild-members) |+| 9 | Invalid Session | Server to client, always with `d: false`. Start a new session with Identify |+| 10 | Hello | Server to client, with `heartbeat_interval`, as soon as the WebSocket opens |+| 11 | Heartbeat ACK | Server to client, with no `d`, for each accepted heartbeat |+| 12 | Gateway Error | Server to client. A [refused voice join](#gateway-error) |+| 13 | Voice Signal | Client to server. A [Voice Signal object](/gateway/commands/#voice-signal) for one other voice connection |+| 14 | Lazy Request | Client to server. A [Lazy Request object](/gateway/commands/#lazy-request) |+| 15 | Request Guild Counts | Client to server. A [Request Guild Counts object](/gateway/commands/#request-guild-counts) |+| 16 | Request Channel Member Counts | Client to server. A [Request Channel Member Counts object](/gateway/commands/#request-channel-member-counts) |+| 28 | Request Forum Unreads | Client to server. A [Request Forum Unreads object](/gateway/threads/#request-forum-unreads) |++Ignore a server opcode that isn't in this table.## Gateway Error-Opcode `12` reports a refused [Voice State Update](/gateway/commands/#voice-state-update) command to the session that sent it. The payload has no `s` and no `t`, is not replayed by [Resume](/gateway/commands/#resume), and closes nothing.+Opcode `12` tells the session that sent a [Voice State Update](/gateway/commands/#voice-state-update) that the join was refused. It has no `s` or `t`, and the connection stays open.| Field | Type | Description || --- | --- | --- || code | string | The refusal code |-| message | string | A description for diagnosis, which a client does not show or parse |+| message | string | A readable description for logs |```json{@@ -101,122 +50,68 @@ Opcode `12` reports a refused [Voice State Update](/gateway/commands/#voice-stat}```-Fluxer sends three codes.+The Gateway sends three codes.-- `VOICE_P2P_CONSENT_REQUIRED` means the channel or call is peer-to-peer and the join did not send `p2p: true`. Ask the user, then send the join again with `p2p: true`.-- `VOICE_P2P_UNAVAILABLE` means Fluxer declined peer-to-peer for a join into a peer-to-peer channel or call. Abort the join and tell the user.-- `VOICE_CHANNEL_FULL` means the channel is at its `user_limit`, or the peer-to-peer mesh is at its participant cap. Abort the join and tell the user.+- `VOICE_P2P_CONSENT_REQUIRED` means the call is peer-to-peer and the join didn't send `p2p: true`. Ask the user, then join again with `p2p: true`. [Peer-to-peer voice](/gateway/events/#peer-to-peer-voice) has the flow.+- `VOICE_P2P_UNAVAILABLE` means the Gateway declined peer-to-peer for this join. Abort the join and tell the user.+- `VOICE_CHANNEL_FULL` means the channel is at its `user_limit` or the peer-to-peer call is full. Abort the join and tell the user.-Every other voice refusal sends no payload. [Peer-to-peer voice](/gateway/events/#peer-to-peer-voice) states when each of the first two codes is produced.+Other refused voice joins get no opcode 12.## Close codes| Code | Name | Meaning || --- | --- | --- |-| 4000 | Unknown error | Drain, an unclassified session creation error, or a Resume whose retained session could not be reached |-| 4001 | Unknown opcode | An undefined or server opcode, a payload with no `d`, or opcode 28 without thread access or with a non-object `d` |-| 4002 | Decode error | The payload size, compression stream, encoding, or command fields are invalid |-| 4003 | Not authenticated | An authenticated command arrived before Identify or Resume attached a session |-| 4004 | Authentication failed | The token is invalid, or it does not own the retained session named by Resume |-| 4005 | Already authenticated | Identify arrived while a session was attached, or with no `d` |-| 4007 | Invalid sequence | Heartbeat or Resume supplied a sequence outside the bounds that command accepts, as stated in [Invalid sequence](#invalid-sequence) |-| 4008 | Rate limited | A concurrent connection, connection payload, source IP payload, user payload, or session count budget was exceeded |-| 4009 | Session timeout | More than 45,000 ms elapsed since the last accepted heartbeat acknowledgement while the Gateway was awaiting one |-| 4010 | Invalid shard | The Identify `shard` value is not a valid `[shard_id, shard_count]` pair<sup>1</sup> |-| 4011 | Sharding required | More than 2,500 guilds resolve to one bot Gateway session<sup>2</sup> |-| 4012 | Invalid API version | The `v` connection parameter is absent or is not `1` |+| 4000 | Unknown error | The node is draining, session creation failed, or the session in Resume could not be reached |+| 4001 | Unknown opcode | An undefined or Gateway-only opcode, a payload with no `d`, or opcode 28 without [thread access](/gateway/threads/#session-flag) or an object `d` |+| 4002 | Decode error | The payload size, compression, encoding or command fields are invalid |+| 4003 | Not authenticated | A command arrived before Identify or Resume attached a session |+| 4004 | Authentication failed | The token is invalid, or it doesn't own the session in Resume |+| 4005 | Already authenticated | Identify or Resume arrived while a session was attached, or with no `d` |+| 4007 | Invalid sequence | Heartbeat `d` isn't an integer or `null`, or Resume `seq` is [out of range](#invalid-sequence) |+| 4008 | Rate limited | A connection, payload, source IP or session budget was exceeded |+| 4009 | Session timeout | No heartbeat was accepted for 45,000 ms |+| 4010 | Invalid shard | The Identify `shard` isn't a valid `[shard_id, shard_count]` pair<sup>1</sup> |+| 4011 | Sharding required | More than 2,500 guilds belong to one bot session<sup>2</sup> |+| 4012 | Invalid API version | The `v` connection parameter is missing or isn't `1` |-<sup>1</sup> `shard_count` is an integer from 1 to 16384, and `shard_id` is a non-negative integer below `shard_count`+<sup>1</sup> `shard_count` is 1 to 16384 and `shard_id` is a non-negative integer below it-<sup>2</sup> The count is taken after the shard filter, so a bot clears it by identifying with a `shard_count` large enough that no shard owns more than 2,500 guilds+<sup>2</sup> The Gateway counts guilds after the shard filter. Raise `shard_count` until each shard has at most 2,500.-Code 4006 is unassigned, and no code above 4012 is defined. [Event filtering](/gateway/event-filtering/) describes how a client bounds the events its session receives.--### Session outcome--| Code | Resumable | Resulting state |-| --- | --- | --- |-| 4000 | Conditional | Closed. A session attached to the connection remains recoverable<sup>1</sup> |-| 4001 | Conditional | Closed. An already established session stays retained |-| 4002 | Conditional | Closed. An already established session stays retained |-| 4003 | No | Closed. No session exists for this connection |-| 4004 | Conditional | Closed. Resume does not invalidate the session it named<sup>2</sup> |-| 4005 | Conditional | Closed. A session established by an earlier Identify stays retained |-| 4007 | No for that attempt | Closed. The named session stays retained until its window expires |-| 4008 | Conditional | Closed. An already established session stays retained |-| 4009 | Conditional | Closed. An already established session stays retained |-| 4010 | No | Closed. No session was created |-| 4011 | No | Closed. No session was created |-| 4012 | No | Closed before Hello. No session exists |+If the connection had a session, you can [Resume](/gateway/commands/#resume) it for 60,000 ms after any close, including a network failure or a normal `1000` or `1001` close. When a Resume closes with `4004` or `4007`, the session stays and you can try again. Resume only replays events still in the [replay buffer](/gateway/limits-and-rate-limits/#replay-and-backpressure).-<sup>1</sup> A close that leaves a session without a socket begins a fresh 60,000 ms retention window, measured from the moment the socket ends. A session displaced by a Resume from a new socket is already attached to that socket and enters no window--<sup>2</sup> A Resume that fails token verification leaves the named session in place for the rest of its retention window, so a later Resume with the owning token still recovers it. An Identify that fails token verification leaves nothing to recover--`Resumable` describes only whether an already established session can still be recovered with [Resume](/gateway/commands/#resume). The 60,000 ms retention window and the bounded replay buffer described in [Limits and rate limits](/gateway/limits-and-rate-limits/#replay-and-backpressure) still limit whether a Resume succeeds and what it replays.--:::caution[Reconnecting unchanged reproduces `4004`, `4010`, and `4012`]-A client changes the token, the shard pair, or the version before it reconnects.-:::+Change the token, shard pair or version before you reconnect after `4004`, `4010` or `4012`.### Invalid sequence-Close `4007` follows one rule for [Heartbeat](/gateway/commands/#heartbeat) and another for [Resume](/gateway/commands/#resume).--Heartbeat tests the value's type alone, and only once a session is attached. Before Identify or Resume attaches one, the Gateway accepts every `d` and answers with Opcode 11. With a session attached, the Gateway accepts a `d` that is `null` or any integer, and every other value closes with `4007`. A sequence below the acknowledged sequence leaves that bound unchanged, and any other integer sets it and trims the replay buffer. A heartbeat that arrives in the short window between the session process ending and the socket noticing also closes with `4007`.+Heartbeat closes with `4007` only after a session is attached.-Resume tests the bounds below and its `seq` must clear both.--- The current sequence. A `seq` above the last sequence the session dispatched closes with `4007`.-- The acknowledged sequence. A `seq` below the last acknowledged sequence closes with `4007`. A heartbeat with a higher sequence moves this bound.--A third bound, the replay floor, produces no close. It is the highest sequence the replay buffer has evicted. When a `seq` is inside both bounds but below the floor, the Gateway sends Opcode 9 with `d: false` and the named session stays retained until its window expires.+Resume closes with `4007` when `seq` is above the last sequence the session dispatched or below the last acknowledged sequence. A `seq` inside those bounds but older than the oldest event in the replay buffer gets opcode 9 with `d: false`, and the session stays available.## Close reasons-The Gateway sends an exact reason string with every application close.+Every close with a 4000-range code has a reason. Branch on the code and log the reason. The reasons below say more than their code. Other codes use the close code name as the reason.| Reason | Code | Cause || --- | --- | --- |-| `Invalid API version` | 4012 | The `v` connection parameter is absent or is not `1` |-| `Too many connections` | 4008 | The source IP already holds 256 concurrent Gateway connections |-| `Encode failed` | 4002 | Hello could not be encoded<sup>1</sup> |-| `Compression failed: zstd-stream` | 4002 | Hello could not be compressed on a connection that negotiated zstd<sup>1</sup> |-| `Payload too large` | 4002 | An inbound message exceeded 4,096 bytes on the wire, or exceeded 4,096 bytes after decompression |-| `Decompression failed` | 4002 | An inbound compressed message could not be decompressed |-| `Decode failed` | 4002 | The payload is not valid JSON, or decodes to something other than an object |+| `Failed to start session` | 4000 | Session creation failed for an unclassified reason |+| `Session unavailable` | 4000 | The session could not be reached during Resume |+| `Session drain requested; reconnect to continue` | 4000 | Opcode 7 came just before the close |+| `Encode failed` | 4002 | Hello could not be encoded |+| `Compression failed: zstd-stream` | 4002 | Hello could not be compressed on a zstd connection |+| `Payload too large` | 4002 | A message is over 16,384 bytes, on the wire or after decompression |+| `Decompression failed` | 4002 | A compressed message could not be decompressed |+| `Decode failed` | 4002 | The payload isn't valid JSON or isn't an object || `Invalid payload` | 4002 | The decoded object has no `op` |-| `Rate limited` | 4008 | The connection, source IP, or user client payload budget was exceeded |-| `Unknown opcode` | 4001 | An undefined or server opcode, a payload with no `d`, or opcode 28 without [thread access](/gateway/threads/#session-flag) or with a non-object `d` |-| `Not authenticated` | 4003 | An authenticated command arrived before a session was attached |-| `Already authenticated` | 4005 | Identify arrived while a session was attached, or with no `d` || `Invalid identify payload` | 4002 | Identify is missing `token` or `properties`, or a field has the wrong type |-| `Invalid shard` | 4010 | The Identify `shard` value is not a valid `[shard_id, shard_count]` pair |-| `Sharding required` | 4011 | More than 2,500 guilds resolve to one bot session after the shard filter |-| `Too many sessions` | 4008 | The user already holds 100 live Gateway sessions<sup>2</sup> |-| `Invalid token` | 4004 | The Identify token is invalid, or the Resume token does not own the named session |-| `Failed to start session` | 4000 | Session creation returned a failure the Gateway does not classify<sup>3</sup> |-| `Invalid resume payload` | 4002 | Resume is not an object, or `token` or `session_id` is missing or is not a string, or `seq` is missing or is not an integer |-| `Invalid sequence` | 4007 | Heartbeat or Resume supplied a sequence outside the bounds stated in [Invalid sequence](#invalid-sequence) |-| `Invalid presence payload` | 4002 | Presence Update is not an object, has no `status`, or has a `status` string that is not a known value |-| `Session unavailable` | 4000 | The retained session could not be reached while Resume was in progress |-| `Session drain requested; reconnect to continue` | 4000 | Opcode `7` was sent immediately before the close<sup>4</sup> |-| `Heartbeat timeout` | 4009 | No new heartbeat acknowledgement was accepted within 45,000 ms of the preceding acknowledgement |--<sup>1</sup> Both reasons are produced only while the Hello frame is being written. A later outbound frame that cannot be encoded or compressed is dropped and the connection stays open--<sup>2</sup> A bot credential is bounded by the guild count that forces sharding, and this budget does not apply to it--<sup>3</sup> The Gateway holds the Identify and retries it silently after a classified transient failure, so the connection stays open. That covers a paused rollout, a draining node, an ineligible account, an Identify rate limit, a saturated start budget, and a failed session RPC--<sup>4</sup> The Gateway node is draining, the node is transferring the session to another Gateway node, or a Resume from a new socket displaced this one--Reason strings are stable wire values. A client branches on the code and MAY record the reason for diagnosis.--:::note[Some refusals send nothing]-A held or discarded Identify, an over-budget Presence Update, an over-budget [Request Forum Unreads](/gateway/threads/#request-forum-unreads), a dropped bounded request, an unroutable or over-budget Voice Signal, and a rejected voice state update produce no close and no reason. A rejected voice state update sends a [Gateway Error](#gateway-error) for three codes and nothing for the rest. [Client commands](/gateway/commands/) states which command behaves that way.-:::--## Ordinary WebSocket closes--A transport can end with no Fluxer application close code, as happens on a network failure, an intermediary reset, and an ordinary `1000` or `1001` close. An established session remains available for 60,000 ms after the transport ends, and a later transport end starts a new 60,000 ms window. Neither the window length nor the bounded replay history grows.+| `Invalid resume payload` | 4002 | Resume is missing `token`, `session_id` or an integer `seq`, or a field has the wrong type |+| `Invalid presence payload` | 4002 | Presence Update is not an object or has no valid `status` |+| `Invalid voice payload` | 4002 | Voice State Update `d` is not an object |+| `Invalid token` | 4004 | The Identify token is invalid or the Resume token doesn't own the session |+| `Too many connections` | 4008 | The source IP has 256 concurrent connections |+| `Rate limited` | 4008 | The connection, source IP or user payload budget was exceeded |+| `Too many sessions` | 4008 | The user already has 100 live sessions, which doesn't apply to bots |+| `Heartbeat timeout` | 4009 | No heartbeat was accepted for 45,000 ms |++The Gateway drops [some over-budget commands](/gateway/commands/), such as Presence Update and Voice Signal, without closing the connection.diff --git a/fluxer_docs/src/content/docs/gateway/overview.md b/fluxer_docs/src/content/docs/gateway/overview.mdindex 2f1ba0178..b02dc77ff 100644--- a/fluxer_docs/src/content/docs/gateway/overview.md+++ b/fluxer_docs/src/content/docs/gateway/overview.md@@ -1,30 +1,23 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Gateway overview-description: The main Gateway connection, framing, state machine, heartbeats, resumption, and sharding.+description: How to connect to the Gateway, keep the connection alive, resume a session and shard a bot.----The main Gateway is a persistent WebSocket. It sends account and [guild](/http-api/guilds/) events and accepts a small set of bounded client commands. Every other read or mutation is an [HTTP API](/http-api/) operation.--:::note[Each surface has its own framing and authentication]-The main Gateway, the HTTP API, and the [Media Proxy API](/media-proxy/overview/) each define their own. Nothing negotiated on one applies to another.-:::+The Gateway is a WebSocket that sends you account and [guild](/http-api/guilds/) events and accepts a small set of [commands](/gateway/commands/). Everything else is an [HTTP API](/http-api/) call.## Connecting-A client opens the socket, waits for Hello, sends Identify, and then heartbeats for the life of the connection.--1. Read `endpoints.gateway` from the [instance discovery document](/http-api/instance/#get-instance-discovery) and open a WebSocket to it with `?v=1&encoding=json`.-2. Read Opcode 10 [Hello](#hello-and-session-creation) and take `heartbeat_interval` from it.-3. Send Opcode 2 [Identify](/gateway/commands/#identify) with the token and `properties`.-4. Read [Ready](/gateway/events/#ready) and keep its `session_id` for a later [Resume](#resuming-a-session).-5. Send Opcode 1 [Heartbeat](#heartbeats) with the last Dispatch sequence every `heartbeat_interval` milliseconds.+1. Get `endpoints.gateway` from the [instance discovery document](/http-api/instance/#get-instance-discovery) and open a WebSocket to it with the [connection parameters](#connection-parameters).+2. Wait for opcode 10 [Hello](#hello) and start sending a [heartbeat](#heartbeats) every `heartbeat_interval` milliseconds.+3. Send opcode 2 [Identify](/gateway/commands/#identify) with your token and `properties`.+4. Keep the `session_id` from [Ready](/gateway/events/#ready) for a later [Resume](#resuming-a-session).```json{"op": 2,"d": {- "token": "flx_ZDb1GURItsMuYl1zvrgxv2qLBxyNmgNSEaWT",+ "token": "YOUR_TOKEN","properties": {"os": "Linux","browser": "Fluxer Client",@@ -34,158 +27,47 @@ A client opens the socket, waits for Hello, sends Identify, and then heartbeats}```-Only `token` and `properties` are required. Send the raw user or bot token without an HTTP authentication prefix. See [Identify](/gateway/commands/#identify) for optional fields. Account and guild updates arrive as [Dispatches](/gateway/events/#dispatch-delivery), with the event name in `t` and its data in `d`.--## Protocol version--Gateway version `1` is the only version. The `v=1` connection parameter selects it. The Gateway closes with `4012` and reason `Invalid API version` for any other value and for an omitted one, before it sends Hello.--## Discovering the endpoint--Read `endpoints.gateway` from the [instance discovery document](/http-api/instance/#get-instance-discovery). A bot can instead call [`GET /v1/gateway/bot`](/http-api/gateway/#get-gateway-information), which returns the same WebSocket URL together with a recommended [shard](#sharding) count and a [session start limit](/http-api/gateway/#session-start-limit-object) object. That route rejects any credential outside bot token form with 401 `INVALID_AUTH_TOKEN`.+Only `token` and `properties` are required. Send the raw token with no prefix. Bots can call [`GET /v1/gateway/bot`](/http-api/gateway/#get-gateway-information) to get the URL and a recommended [shard](#sharding) count.## Connection parameters-Add the connection parameters to the query of the discovered URL. The URL an instance derives from its domain has no query, but an operator can set one that has its own query. Parse the URL and set each parameter on it, and don't append `?` and a string.+Add these to the query of the discovered URL and keep any query it already has.| Field | Type | Description || --- | --- | --- || v | integer | The Gateway protocol version, which is `1` |-| encoding?<sup>1</sup> | string | The payload encoding |-| compress?<sup>2</sup> | string | The compression stream, which accepts `zstd-stream` or `none` and defaults to no compression |-| stream?<sup>3</sup> | string | The flag that enables the compression stream, which accepts `1` or `true` |--<sup>1</sup> Only `json` is implemented. Every value, including an absent one, selects JSON--<sup>2</sup> Any other value selects no compression--<sup>3</sup> `compress=zstd-stream` selects compression only when `stream` is also `1` or `true`. Without the flag the connection is uncompressed+| encoding? | string | The payload encoding, which is always `json` |+| compress? | string | `zstd-stream` for compression, and any other value turns it off |+| stream? | string | `1` or `true`, which `compress=zstd-stream` needs to take effect |-Unknown parameters are ignored. An unrecognised `compress` or `stream` value selects no compression and the connection stays open. A client MUST read whether the connection is compressed from the frame type it receives. On a `zstd-stream` connection every server frame is a binary frame.--The reference client connects with `?v=1&encoding=json&compress=zstd-stream&stream=1`.--:::caution[A connection can close before Hello]-The Gateway validates the version and applies the concurrent connection limit before sending Hello, so a rejected connection can close with no payload.-:::+A missing or different `v` closes the connection with `4012` and reason `Invalid API version` before Hello. The reference client connects with `?v=1&encoding=json&compress=zstd-stream&stream=1`.## Gateway payload-Every logical message uses the Gateway payload.+Every WebSocket message is one UTF-8 JSON payload.| Field | Type | Description || --- | --- | --- || op | integer | [Gateway opcode](/gateway/opcodes-and-close-codes/#opcodes) |-| d?<sup>1</sup> | any | The opcode payload, required in every client-to-server payload and opcode-dependent in server-to-client payloads |-| s? | integer | The non-negative session sequence, present only on Dispatch |-| t? | string | The event name, present only on Dispatch |--<sup>1</sup> Heartbeat ACK and Reconnect have no `d` at all, and Invalid Session has the Boolean `false`+| d? | any | The opcode data, which Heartbeat ACK and Reconnect leave out |+| s? | integer | The session sequence, only on Dispatch |+| t? | string | The event name, only on Dispatch |-A decoded payload that is not a JSON object closes with `4002` and reason `Decode failed`. An object with no `op` closes with `4002` and reason `Invalid payload`. An object with `op` but no `d` closes with `4001` and reason `Unknown opcode`, except for Identify and Resume, which close with `4005`.+A payload that is not a JSON object with an `op` closes the connection with a [close code](/gateway/opcodes-and-close-codes/#close-codes).-A Dispatch is a server-to-client event payload. Every live Dispatch advances the session sequence by one. A session starts at sequence 0, so the [Ready](/gateway/events/#ready) sequence is 1.--A replayed Dispatch keeps its original sequence, and a replayed run can have gaps. [Dispatch delivery](/gateway/events/#dispatch-delivery) lists the events that are delivered live and never retained. [Resumed](/gateway/events/#resumed) has the current sequence and does not advance it. The next live Dispatch after Resumed has that sequence plus one. The sequence is local to one Gateway session and has no meaning across sessions or shards.+Each live Dispatch raises `s` by one, starting from 0, and Ready has `s` 1. A replayed Dispatch keeps its original sequence, and [Resumed](/gateway/events/#resumed) has the current sequence without raising it. Some events are never replayed (see [Dispatch delivery](/gateway/events/#dispatch-delivery)).## Framing-One inbound WebSocket message is limited to 16,384 bytes on the wire, and a compressed inbound message is limited to a further 16,384 bytes after decompression. A message past either bound closes with `4002` and reason `Payload too large`. An inbound message that cannot be decompressed closes with `4002` and reason `Decompression failed`.--JSON payloads are UTF-8 objects. An uncompressed client payload is sent in a text frame, and a payload the client compressed with the negotiated zstd stream is sent in a binary frame.--The Gateway does not inspect the inbound frame type. It decodes every inbound message with the compression the connection negotiated, whatever the frame type. A client MUST send every payload in the negotiated representation. On a connection with no negotiated compression the payload is uncompressed, and on a `zstd-stream` connection every client payload goes through the same compression stream in order.--### JSON integer representation--Snowflakes are decimal strings. See [Snowflakes](/snowflakes/) for the identifier contract. Sequences, counts, versions, and bitfields are JSON numbers.--## Compression--`zstd-stream` is a continuous stream in both directions. A client MUST feed every server frame to the same decompressor in arrival order and produce every client frame from the same compressor.--One WebSocket message has exactly one Gateway payload.--Hello is already compressed on a connection that negotiated `zstd-stream`, so the first frame such a connection receives is a binary frame.--When the server cannot load the zstd streaming implementation, the connection closes with `4002` and reason `Compression failed: zstd-stream` as it tries to send that first frame.--:::note[Compression is negotiated once]-A connection cannot change its compression stream after the upgrade. Changing it requires a new WebSocket, which means a new Hello and either a new Identify or a Resume.-:::--## Signalling state machine--A connection moves through these states: Opening, Unauthenticated, Starting, Replaying, and Ready. The tables below give every event a state accepts, the action it triggers, and the state it lands in. Heartbeat is accepted in every open state, and Closed is terminal for that WebSocket.--### Opening--| Event and condition | Action | Next state |-| --- | --- | --- |-| WebSocket accepted. `v=1` and connection capacity available | Send Hello | Unauthenticated |-| Invalid version. `v` is absent or is not `1` | Close with `4012` and reason `Invalid API version` | Closed |-| Concurrent connection limit reached. The source IP already holds 256 connections | Close with `4008` and reason `Too many connections` | Closed |--### Unauthenticated--| Event and condition | Action | Next state |-| --- | --- | --- |-| Identify. Valid Identify payload and Identify capacity available | Begin session creation | Starting |-| Identify. Gateway draining, node at capacity, session starts paused, or the account outside the session rollout | Hold the payload and retry it in the background | Unauthenticated |-| Identify. The source IP Identify budget is exhausted | Discard the payload without a reply | Unauthenticated |-| Resume. Valid Resume payload | Look up the retained session named by `session_id` | Starting |-| Authenticated command. Any command other than Heartbeat, Identify, or Resume | Close with `4003` and reason `Not authenticated` | Closed |--### Starting--| Event and condition | Action | Next state |-| --- | --- | --- |-| Session creation succeeds. Identify was accepted | Send Ready | Ready |-| Session creation fails permanently. Invalid token, invalid shard, sharding required, or too many sessions | Close with the code and reason that [Hello and session creation](#hello-and-session-creation) lists for that failure | Closed |-| Session creation fails with an error the Gateway does not classify | Close with `4000` and reason `Failed to start session` | Closed |-| Session creation fails temporarily. Draining, at capacity, RPC failure, timeout, or the account outside the session rollout | Hold the Identify and retry it in the background | Unauthenticated |-| Resume succeeds. The retained session accepted the sequence | Replay retained Dispatches | Replaying |-| Session cannot be resumed. Resume named an unknown or expired session, or a `seq` below the replay floor | Send Invalid Session with `d: false` | Unauthenticated |--### Replaying+A client message can be at most 16,384 bytes on the wire and 16,384 bytes after decompression. A larger one closes with `4002`.-| Event and condition | Action | Next state |-| --- | --- | --- |-| Retained replay completes. All retained Dispatches were sent | Send Resumed | Ready |-| Authenticated command. The session is attached | Process the command | Replaying |-| Identify. A session is attached | Close with `4005` and reason `Already authenticated` | Closed |-| Resume. Valid Resume payload | Attach the named session to this socket in place of the current one | Starting |--### Ready--| Event and condition | Action | Next state |-| --- | --- | --- |-| Authenticated command. The command is valid in the session | Process the command | Ready |-| Identify. A session is attached | Close with `4005` and reason `Already authenticated` | Closed |-| Resume. Valid Resume payload | Attach the named session to this socket in place of the current one | Starting |--### Replaying or Ready--| Event and condition | Action | Next state |-| --- | --- | --- |-| The session process ends. The session was terminated while this socket held it | Send Invalid Session with `d: false` | Unauthenticated |-| Gateway drain or session transfer. The node stops serving this session | Send Reconnect and close with `4000` | Closed |-| The session is resumed elsewhere. Another socket attached this session with Resume | Send Reconnect and close with `4000` | Closed |--### Any open state--| Event and condition | Action | Next state |-| --- | --- | --- |-| Heartbeat. No session is attached, or the payload is `null`, or the attached session accepts the sequence | Send Heartbeat ACK | Same state |-| Heartbeat deadline. The connection is awaiting an acknowledgement and more than 45,000 ms have passed since the last one | Close with `4009` and reason `Heartbeat timeout` | Closed |-| Invalid frame or payload. Size, decompression, or decoding validation fails | Close with `4002` and the matching reason from [Gateway payload](#gateway-payload) or [Framing](#framing) | Closed |-| Transport ends. A session exists | Retain the session for 60,000 ms | Closed |+Snowflakes are decimal strings (see [Snowflakes](/snowflakes/)), and every other number is a JSON number.-An opcode outside the registry, and a server opcode sent by a client, close with `4001` once a session is attached and with `4003` while the connection is unauthenticated.+With `zstd-stream`, every server frame is binary, starting with Hello. Feed every frame to one decompressor in order for the whole connection, and send every client message through one compressor that also lasts the whole connection.-## Hello and session creation+## Hello-The server sends Opcode 10 Hello while accepting the WebSocket.+The server sends Hello as soon as it accepts the socket. The interval is in milliseconds.```json{@@ -196,23 +78,25 @@ The server sends Opcode 10 Hello while accepting the WebSocket.}```-The interval is in milliseconds and is authoritative for the connection.+A connection that goes over the [open connections per IP](/gateway/limits-and-rate-limits/#connection-and-command-rate-limits) limit closes with `4008` before Hello.-Opcode 2 Identify creates a session. A successful Identify sends [Ready](/gateway/events/#ready), whose `session_id` identifies the retained session. Fluxer publishes no separate resume URL, so a Resume reconnects to the same Gateway endpoint the client discovered.+## Identify-An invalid token closes with `4004` and reason `Invalid token`. A user account that already holds 100 live sessions closes with `4008` and reason `Too many sessions`, and a bot credential is not bounded by that maximum. A malformed shard pair closes with `4010` and reason `Invalid shard`. A bot shard assignment that resolves more than 2,500 guilds closes with `4011` and reason `Sharding required`.+Identify creates a session and the Gateway answers with Ready. These failures close the connection.-:::note[A held Identify sends nothing back]-A draining node, a node at capacity, paused session starts, and an account outside the rollout percentage all keep the payload and retry it every 1 to 2 seconds.-:::+| Close | Reason | Cause |+| --- | --- | --- |+| 4004 | `Invalid token` | The token is not valid |+| 4008 | `Too many sessions` | The user already has 100 live sessions (bots have no limit) |+| 4010 | `Invalid shard` | The `shard` pair is malformed |+| 4011 | `Sharding required` | A bot shard owns more than 2,500 guilds |+| 4000 | `Failed to start session` | The session could not be created for another reason |-:::caution[An over-budget Identify is dropped and the client resends]-Once the source IP Identify budget is exhausted, Fluxer keeps no copy of the payload. The client sends its next Identify itself, at a rate well below that budget.-:::+An Identify can stay pending with no reply while the Gateway is busy. Keep heartbeating until Ready arrives. An Identify or Resume over the [per-IP budget](/gateway/limits-and-rate-limits/#connection-and-command-rate-limits) is dropped without a reply, and you need to send it again later. Any command other than Heartbeat, Identify or Resume before Ready closes with `4003`, and an Identify or Resume on a socket that already has a session closes with `4005`.## Heartbeats-Opcode 1 is accepted before and after authentication. Before a session exists its payload is ignored and the server still acknowledges. Once a session exists, send the most recently processed Dispatch sequence, or `null` before any Dispatch.+Send opcode 1 with the sequence of the last Dispatch you processed, or `null` before the first one.```json{@@ -221,90 +105,50 @@ Opcode 1 is accepted before and after authentication. Before a session exists it}```-The server answers with Opcode 11 Heartbeat ACK, which has no `d`. Once a session is attached, a `d` value that is neither `null` nor an integer closes with `4007` and reason `Invalid sequence`. When the Gateway cannot confirm the sequence with the session within 5,000 ms, the connection closes with the same code and reason.--The server requests an immediate heartbeat with Opcode 1 and `d: null` once 90 per cent of the interval has passed since the last acknowledgement. Answer it with your own Opcode 1. Continue sending heartbeats at the advertised interval. A connection that misses the heartbeat deadline closes with `4009` and reason `Heartbeat timeout`.+The server answers with opcode 11 Heartbeat ACK. Once a session exists, a `d` that is neither `null` nor an integer closes with `4007`. If 90 percent of the interval passes without an acknowledgment, the server sends its own opcode 1 with `d: null`, and you answer with a heartbeat right away. After 45,000 ms with no acknowledgment the connection closes with `4009`.-A heartbeat with a sequence permanently trims every retained Dispatch at or below that sequence from the replay buffer and records it as the acknowledged sequence. A client MUST send the sequence it has processed, because a later Resume from a lower sequence closes with `4007`.+The Gateway drops replayable Dispatches up to the sequence in your heartbeat. Only send a sequence you have finished processing.## Resuming a session-Opcode 6 supplies the original token, the Ready `session_id`, and the last processed Dispatch sequence.+Opcode 6 resumes a session on a new socket within 60,000 ms after the old one closes. Send the original token, the Ready `session_id` and the last sequence you processed. A payload missing any of them closes with `4002`.```json{"op": 6,"d": {- "token": "...",+ "token": "YOUR_TOKEN","session_id": "6f1d0b7c9a2e4f83b5c1d9e7a4f20b13","seq": 42}}```-A successful Resume replays every retained Dispatch above `seq` in order and ends with [Resumed](/gateway/events/#resumed).--All fields are required. A missing field, a `token` or `session_id` that is not a string, or a `seq` that is not an integer closes with `4002` and reason `Invalid resume payload`.--The Gateway retains a disconnected session for 60,000 ms. An accepted `seq` is no greater than the session's current sequence and no less than the sequence the session has already acknowledged. A `seq` outside either bound closes with `4007` and reason `Invalid sequence`.--An unknown or expired session sends Opcode 9 with `d: false` and leaves the socket unauthenticated. A `seq` inside both bounds but below the replay floor sends the same Opcode 9. The replay floor is the highest sequence the replay buffer has evicted. A token that does not own the named session closes with `4004` and reason `Invalid token`. A session that cannot be reached closes with `4000` and reason `Session unavailable`. None of those failures destroys a separately retained session.--A successful Resume replaces the session's socket and restores the presence status the session last selected. A session whose socket dropped is published as `offline` after 5,000 ms, so a Resume later than that republishes the restored status.--Unlike Identify, Resume is accepted in every open state. A socket that already has a session attached still processes a Resume and attaches the named session in its place. Send Resume only on a fresh socket.--When the resumed session was attached to a different socket, that socket receives Opcode 7 Reconnect and then closes with `4000`.+The Gateway replays every Dispatch above `seq` in order and then sends [Resumed](/gateway/events/#resumed). Your presence shows as `offline` 5,000 ms after the socket drops, and a Resume brings back the status you had. See [Limits and rate limits](/gateway/limits-and-rate-limits/#replay-and-backpressure) for replay bounds.-:::caution[Retention covers reconnection recovery only]-[Limits and rate limits](/gateway/limits-and-rate-limits/#replay-and-backpressure) states the exact bounds, and [Dispatch delivery](/gateway/events/#dispatch-delivery) lists the events that are never retained.-:::+| Result | Response |+| --- | --- |+| The session is unknown or expired, or `seq` is below the replay floor | [Invalid Session](#invalid-session), and the socket can Identify |+| `seq` is above the session sequence or below the acknowledged one | Close with `4007` and reason `Invalid sequence` |+| The token does not own the session | Close with `4004` and reason `Invalid token` |+| The session cannot be reached | Close with `4000` and reason `Session unavailable` |## Reconnect-Opcode 7 Reconnect asks the client to open a new WebSocket. The Gateway sends it when the node drains the session, when the node transfers the session to another node, and to the socket a successful Resume displaces.--```json-{- "op": 7-}-```--The current socket then closes with `4000` and reason `Session drain requested; reconnect to continue`. A Resume sent within 60,000 ms of the close can recover the session, subject to the sequence bounds in [Resuming a session](#resuming-a-session).+Opcode 7 asks you to open a new WebSocket and [resume](#resuming-a-session). The Gateway sends it when it moves your session, or when another socket resumes the same session, and then closes the old socket with `4000`.## Invalid session-Opcode 9 with `d: false` means the named session cannot be resumed. The Gateway sends it when Resume names an unknown or expired session, when Resume names a `seq` below the replay floor, and when the session process attached to a live connection ends.--```json-{- "op": 9,- "d": false-}-```--The socket returns to the unauthenticated state, so it stays open and can Identify again. Fluxer never sends `d: true`.+Opcode 9 with `d: false` means the session cannot be resumed, after a failed [Resume](#resuming-a-session) or when the session ends while you are connected. The socket stays open, and you can send Identify on it. Fluxer never sends `d: true`.## Sharding-In Identify, a client MAY supply `shard` as a `[shard_id, shard_count]` pair. `shard_id` is a non-negative integer below `shard_count`, and `shard_count` is from 1 through 16,384. An omitted or null value applies no sharding. A malformed pair closes with `4010` and reason `Invalid shard`.--A guild belongs to `((guild_id >> 22) % shard_count)`, computed on the integer value of the guild's decimal snowflake string.+Identify takes an optional `shard` of `[shard_id, shard_count]`. `shard_id` is below `shard_count`, and `shard_count` runs from 1 through 16,384. A guild belongs to shard `(guild_id >> 22) % shard_count`.-The pair selects the session's guild membership. At Identify, Fluxer filters the account's guild list to the guilds the shard owns, and the session connects only to those.+A session only receives the guilds its shard owns. Ready lists them in `guilds` and echoes the pair as `shard`. A bot gets each guild as unavailable, followed by one [Guild Create](/gateway/events/#guild-create) or [Guild Delete](/gateway/events/#guild-delete). One bot shard can have at most 2,500 guilds, and a bot that sends no `shard` counts all its guilds.-On every session, the filtered set is also the [Ready](/gateway/events/#ready) `guilds` array. A bot session has each of those guilds as an unavailable guild, and one [Guild Create](/gateway/events/#guild-create) or [Guild Delete](/gateway/events/#guild-delete) per guild follows Ready. Ready echoes the accepted pair back as `shard`.--Fluxer checks only a bot session against the guild ceiling. A bot whose shard owns more than 2,500 guilds closes with `4011` and reason `Sharding required`. A bot that supplies no pair is checked against its whole guild list. A user session is bounded by the 100-session-per-user limit alone, whatever its guild count.--:::note[Shard 0 also receives account-level traffic]-The per-Dispatch shard filter in [Dispatch delivery](/gateway/events/#dispatch-delivery) runs only when `shard_id` is not 0. A session with a non-zero `shard_id` drops every Dispatch that names no guild, apart from Rate Limited, Guild Counts Update, and Channel Member Counts Update. Account-level Dispatches name no guild, so handle them on shard 0.-:::--Fluxer has no large bot tier, no shard-count alignment requirement, and no Identify concurrency buckets. `GET /v1/gateway/bot` returns a fixed recommendation.+Dispatches for no guild, such as account-level events, only go to shard 0, apart from Rate Limited, Guild Counts Update and Channel Member Counts Update.## Ordering-Dispatch ordering applies within one Gateway session. It creates no total order across shards, HTTP responses, or Media Proxy operations.--[Guild Create](/gateway/events/#guild-create) and [Guild Sync](/gateway/events/#guild-sync) send the complete roles, channels, emojis, stickers, and voice states for the guild they name, and a client replaces its stored lists with them, as Guild Create describes. A client replaces its stored threads for the guild with `threads` the same way. Every other Dispatch for that guild changes part of that stored state.+Events are in order within one session only. When you get [Guild Create](/gateway/events/#guild-create) or [Guild Sync](/gateway/events/#guild-sync), replace your cached roles, channels, emojis, stickers, voice states and threads for that guild, and apply every other Dispatch as a change to that cache.diff --git a/fluxer_docs/src/content/docs/gateway/threads.md b/fluxer_docs/src/content/docs/gateway/threads.mdindex 43f936157..da1acdc9e 100644--- a/fluxer_docs/src/content/docs/gateway/threads.md+++ b/fluxer_docs/src/content/docs/gateway/threads.md@@ -1,79 +1,58 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Gateway threads-description: Thread Dispatch events, thread subscriptions, forum unread counts, and the thread session flag.+description: Thread events, thread subscriptions, forum unread counts and the thread session flag.----A session receives [threads](/http-api/threads/) through the Dispatch events below. A [guild ready object](/gateway/events/#guild-ready-object) in [Ready](/gateway/events/#ready), [Guild Create](/gateway/events/#guild-create), and [Guild Sync](/gateway/events/#guild-sync) has `threads` only for a session with thread access.--:::note[User sessions need the `CHANNEL_THREADS` session flag]-A user session has thread access only when it sets `CHANNEL_THREADS` in Identify. A bot session always has thread access and needs no flag. HTTP routes read a separate client capability, as [Client capability](/http-api/threads/#client-capability) describes.-:::+Fluxer sends [thread](/http-api/threads/) changes, thread member lists and forum unread counts as the Dispatch events below. A user session needs the `CHANNEL_THREADS` [session flag](#session-flag), and a bot session always gets them.## Session flag| Value | Name | Description || --- | --- | --- |-| 1 << 2 | CHANNEL_THREADS | The client can parse thread, forum, and media channels |--The flag joins the [session flags](/gateway/commands/#session-flags) of Identify. A user session without it receives no channel of type 10, 11, 12, 15, or 16 and no event from this page. Its guild ready objects leave out a category that is visible only through a forum or media channel inside it. Its channels have no `flags` and no thread or forum fields. Its roles and permission overwrites have the thread permission bits cleared. [Ready](/gateway/events/#ready) leaves out every read state that has `flags`. It receives no [Message ACK](/gateway/events/#message-ack) for an entry that has `flags`. It receives no [Channel Pins ACK](/gateway/events/#channel-pins-ack) for a thread and no [Saved Message Create](/gateway/events/#saved-message-create) for a message in a thread.+| 1 << 2 | CHANNEL_THREADS | The client can parse thread, forum and media channels |-The same session receives no message of type 18 (`THREAD_CREATED`) or 21 (`THREAD_STARTER_MESSAGE`). Its messages have no `thread` field. The message flags `HAS_THREAD` (`1 << 5`) and `FAILED_TO_MENTION_SOME_ROLES_IN_THREAD` (`1 << 8`) are cleared.+Set it in the [session flags](/gateway/commands/#session-flags) of Identify. A user session without it gets no thread, forum or media channels, no thread messages and none of the events on this page. Its channels and messages have no thread fields, and its permission values have the [thread permissions](/http-api/permissions/#feature-gated-permission-bits) cleared.## Guild threads-`threads` on a guild ready object is an array of [thread objects](/http-api/threads/#thread-object). A user session receives the active threads it joined and can view, each with `member`. A bot session receives every active thread it can view, with `member` on the threads it joined.--The `member` of each entry has no `id`, `user_id`, `member`, or `presence`. A thread object in a guild ready object or in any event on this page has no `member_ids_preview`.+`threads` on a [guild ready object](/gateway/events/#guild-ready-object) is an array of [thread objects](/http-api/threads/#thread-object). A user session receives the active threads it joined and can view, and a bot session receives every active thread it can view. Each entry has `member` for a thread the session joined.## Dispatch events-| Event | Description | Scope |-| --- | --- | --- |-| [Thread Create](#thread-create) | A thread is created or the session joins one | Thread visibility |-| [Thread Update](#thread-update) | A visible thread changes | Thread visibility |-| [Thread Delete](#thread-delete) | A thread is deleted | Thread visibility |-| [Thread List Sync](#thread-list-sync) | The session's active thread set is replaced | Guild connection |-| [Thread Member Update](#thread-member-update) | The session's own thread membership changes | Current user |-| [Thread Members Update](#thread-members-update) | Users join or leave a thread | Thread visibility |-| [Thread Member List Update](#thread-member-list-update) | A subscribed thread member list resyncs | Member list subscription |-| [Forum Unreads](#forum-unreads) | Unread counts for forum posts are returned | Command response |--A passive session in a guild with more than 250 members receives fewer thread events, as each event states.--Messages, reactions, typing, and pins in a thread reach a session that can view the thread and meets one of these conditions. An event in the message access set of [Event filtering](/gateway/event-filtering/#permission-and-visibility) also needs message access in the thread. These events also follow [Active and passive guilds](/gateway/event-filtering/#active-and-passive-guilds).+| Event | Description |+| --- | --- |+| [Thread Create](#thread-create) | A thread is created or the session is added to one |+| [Thread Update](#thread-update) | A thread changes |+| [Thread Delete](#thread-delete) | A thread is deleted |+| [Thread List Sync](#thread-list-sync) | The session's active thread set is replaced |+| [Thread Member Update](#thread-member-update) | The session's own thread membership changes |+| [Thread Members Update](#thread-members-update) | Users join or leave a thread |+| [Thread Member List Update](#thread-member-list-update) | The full member list of a subscribed thread |+| [Forum Unreads](#forum-unreads) | Unread counts for forum posts |-- The session is a bot session.-- The user is a member of the thread.-- The session lists the thread in `thread_member_lists`.-- The session set [`threads`](#lazy-request-thread-options) and the guild is active for it, through [Lazy Request](/gateway/commands/#lazy-request) `active` or the [Identify](/gateway/commands/#identify) `initial_guild_id`, whatever the guild size.+A session that can view a thread gets its thread events when it is a bot session, when the user is a member or when the session turned on [`threads`](#lazy-request-thread-options). A [passive](/gateway/event-filtering/#active-and-passive-guilds) session gets fewer of them, as noted under each event.-[Message Create](/gateway/events/#message-create) in a thread has `channel_type` set to the thread type.+Messages, reactions, typing and pins in a thread go to a session that can view the thread when it is a bot session, the user is a member, the session lists the thread in [`thread_member_lists`](#lazy-request-thread-options), or the session set `threads` and the guild is active for it, whatever the guild size. They also follow [Event filtering](/gateway/event-filtering/#permission-and-visibility).### <span id="thread-create"></span>THREAD_CREATE-A thread was created, or the session was added to one. The payload is the [thread object](/http-api/threads/#thread-object) with the fields below.+A thread is created or the session is added to one. The payload is the [thread object](/http-api/threads/#thread-object) with these fields.| Field | Type | Description || --- | --- | --- |-| newly_created? | boolean | Always `true`, present only when the thread was just created |-| member? | [thread member](/http-api/thread-members/#thread-member-object) object | The session's own membership, present only for a member |+| newly_created? | boolean | `true` when the thread was just created, absent when the session was added to an existing thread |+| member? | [thread member](/http-api/thread-members/#thread-member-object) object | The session's own membership |-Recipients are the sessions that can view the thread and are a bot session, a member, or a session that set `threads` through [Lazy Request](#lazy-request-thread-options). A passive session in a guild with more than 250 members receives it only when its user is a member.--A user added to an existing thread receives a Thread Create with `member` and no `newly_created`. It arrives before the matching [Thread Members Update](#thread-members-update).+A passive session gets it only when its user is a member.### <span id="thread-update"></span>THREAD_UPDATE-A thread changed. The payload is the [thread object](/http-api/threads/#thread-object).--Recipients are the sessions that can view the thread and are a bot session, a member, or a session that set `threads`. Fluxer checks them before and after the change and sends to both sets. A passive session in a guild with more than 250 members receives it only for a thread it joined.--A message sent to an archived thread unarchives it and emits Thread Update. A message sent to an active thread emits none. When a thread is unarchived, each session of a member that can view it also receives a [Thread Member Update](#thread-member-update).+A thread changes, and the payload is the [thread object](/http-api/threads/#thread-object). A message sent to an archived thread unarchives it and sends this event. A passive session gets it only for a thread it joined.### <span id="thread-delete"></span>THREAD_DELETE-A thread was deleted.+A thread is deleted.| Field | Type | Description || --- | --- | --- |@@ -82,70 +61,50 @@ A thread was deleted.| parent_id | snowflake | The ID of the parent channel || type | integer | The [thread type](/http-api/threads/#thread-types) |-Recipients are the sessions that can view the thread as it stood before the deletion and are a bot session, a member, or a session that set `threads`. A member is a user the guild holds as a member of the thread, or one of up to 1,000 thread members Fluxer reads at deletion. A passive session in a guild with more than 250 members receives it only when its user is a member.+A passive session gets it only when its user is a member.### <span id="thread-list-sync"></span>THREAD_LIST_SYNC-The session's active threads were replaced for a guild or for some of its channels.+The session's active threads are replaced for a guild or for some of its channels.| Field | Type | Description || --- | --- | --- || guild_id | snowflake | The ID of the guild |-| channel_ids?<sup>1</sup> | array[snowflake] | The parent channels whose threads are replaced |-| threads<sup>2</sup> | array[[thread](/http-api/threads/#thread-object) object] | The active threads the session can view |+| channel_ids? | array[snowflake] | The parent channels whose threads are replaced, absent for the whole guild |+| threads | array[[thread](/http-api/threads/#thread-object) object] | The active threads the session can view || members | array[[thread member](/http-api/thread-members/#thread-member-object) object] | The session's memberships in those threads |-<sup>1</sup> Absent when the event replaces every thread in the guild--<sup>2</sup> With `channel_ids`, every active thread in those channels. Without it, every active thread in the guild for a bot session and for a session that set `threads`--Without `channel_ids`, a user session that did not set `threads` receives the active threads it joined.--- Fluxer sends it when [Lazy Request](#lazy-request-thread-options) sets `threads` to true for a session that had not set it. The event follows after a random delay below 5,000 ms.-- Fluxer sends it when the guild reloads its thread state. A bot session, a session that set `threads`, and a user session that joined an active thread each receive one.-- Fluxer sends it when the session gains view access to channels that have active threads. `channel_ids` lists those channels.--A guild sends a burst of up to 20 full syncs, then 20 more each second, and queues the rest. Thread List Sync is delivered live and never retained for Resume.+A user session that did not set `threads` gets only the threads it joined unless `channel_ids` is present. Fluxer sends it after [Lazy Request](#lazy-request-thread-options) sets `threads` to true and when the session gets view access to channels with active threads. Resume does not replay it.### <span id="thread-member-update"></span>THREAD_MEMBER_UPDATE-The session's own membership in a thread changed. The payload is the [thread member object](/http-api/thread-members/#thread-member-object) with `guild_id`. It has `muted` and `mute_config`.--Every session of the user that can view the thread receives it, passive or not.+The session's own membership in a thread changes. The payload is the [thread member object](/http-api/thread-members/#thread-member-object) plus `guild_id`. Every session of the user that can view the thread receives it.### <span id="thread-members-update"></span>THREAD_MEMBERS_UPDATE-Users joined or left a thread.+Users join or leave a thread.| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the thread || guild_id | snowflake | The ID of the guild || member_count | integer | The number of thread members, capped at 50 |-| added_members?<sup>1</sup> | array[[thread member](/http-api/thread-members/#thread-member-object) object] | The users who joined |+| added_members? | array[[thread member](/http-api/thread-members/#thread-member-object) object] | The users who joined, each with `member` and `presence` || removed_member_ids? | array[snowflake] | The IDs of the users who left |-<sup>1</sup> Each entry has no `muted` or `mute_config`, and adds `member` and `presence`--`member` is the guild member, or null when the guild has none for the user. `presence` is the [presence object](/gateway/events/#presence-object) with `user` reduced to `id`, or null when the user is not visibly online to the guild.--Every session of an added or removed user receives it. Any other session receives it when it can view the thread and is a bot session, a member, or a session that set `threads`. A passive session in a guild with more than 250 members receives it only when its user was added or removed.+`member` is the guild member or null. `presence` is the [presence object](/gateway/events/#presence-object) or null when the user is not visibly online. A passive session gets it only when its user was added or removed.### <span id="thread-member-list-update"></span>THREAD_MEMBER_LIST_UPDATE-A thread member list the session subscribed to through `thread_member_lists` resynced.+The full member list of a thread the session subscribed to with [`thread_member_lists`](#lazy-request-thread-options). Resume does not replay it.| Field | Type | Description || --- | --- | --- || guild_id | snowflake | The ID of the guild || thread_id | snowflake | The ID of the thread |-| members<sup>1</sup> | array[thread member list item object] | The members of the thread, at most 1,000 |--<sup>1</sup> Each item is `user_id`, `join_timestamp`, `flags`, `member`, and `presence`--`member` is the guild member or null. `presence` is the guild's [presence object](/gateway/events/#presence-object) when the user is visibly online to the guild, and otherwise the placeholder `{"status": "offline", "mobile": false, "afk": false}`.+| members | array[thread member list item object] | The members of the thread, at most 1,000 |-The event is delivered live and never retained for Resume.+Each item has `user_id`, `join_timestamp`, `flags`, `member` and `presence`. `presence` is a [presence object](/gateway/events/#presence-object) with status `offline` when the user is not visibly online.### <span id="forum-unreads"></span>FORUM_UNREADS@@ -157,34 +116,32 @@ The answer to [Request Forum Unreads](#request-forum-unreads).| channel_id | snowflake | The ID of the forum or media channel || threads | array[forum unread object] | One entry for each requested post found in the channel |-Each forum unread object is `thread_id` with either `count` or `missing`. `count` is the number of messages after the sent `ack_message_id`, capped at 25. `missing` is true when the request sent no valid `ack_message_id` for that post.+Each forum unread object has `thread_id` and either `count` or `missing`. `count` is the number of messages after the `ack_message_id` in the request, capped at 25. `missing` is true when the request had no valid `ack_message_id` for that post.## <span id="lazy-request-thread-options"></span>Lazy Request thread options-The [guild subscription object](/gateway/commands/#guild-subscription-object) of [Lazy Request](/gateway/commands/#lazy-request) takes two more options. Fluxer applies them after `typing`.+The [guild subscription object](/gateway/commands/#guild-subscription-object) of [Lazy Request](/gateway/commands/#lazy-request) takes two more options. Fluxer ignores them for a user session without `CHANNEL_THREADS`.| Field | Type | Description || --- | --- | --- |-| threads? | boolean | Whether the session receives events and messages for every thread it can view in the guild |+| threads? | boolean | Whether the session gets events and messages for every thread it can view in the guild || thread_member_lists? | array[snowflake] | The threads whose member lists the session subscribes to, at most 10 |-Fluxer ignores both options for a user session that did not set `CHANNEL_THREADS`. `threads` set to false clears the subscription, and any value that is not a Boolean is ignored. Fluxer also clears it when the session marks the guild passive.+`threads` set to false, or marking the guild passive, clears the subscription.-`thread_member_lists` replaces the previous list, and an empty array clears it. Fluxer keeps the first 10 entries that are Snowflakes and removes duplicates. It then drops each thread the session cannot view or that is not active. A value that is not an array is ignored.--Each newly listed thread produces a [Thread Member List Update](#thread-member-list-update) at once. A membership change in the thread, or a presence change of one of its listed members, produces another after a 250 ms batching delay.+`thread_member_lists` replaces the previous list, and an empty array clears it. Fluxer sends a [Thread Member List Update](#thread-member-list-update) right away for each newly listed thread, and sends another 250 ms after that thread's members change.## Request Forum Unreads-Opcode `28` requests unread counts for posts in one forum or media channel.+Opcode `28` requests unread counts for posts in one forum or media channel. Fluxer closes a user session without `CHANNEL_THREADS` with [`4001`](/gateway/opcodes-and-close-codes/#close-codes).| Field | Type | Description || --- | --- | --- || guild_id | snowflake | The ID of the guild || channel_id | snowflake | The ID of the forum or media channel |-| threads | array[forum unread request object] | The posts to count, deduplicated and truncated to 40 |+| threads | array[forum unread request object] | The posts to count, at most 40 |-Each forum unread request object is `thread_id` and an optional `ack_message_id`, the newest message the client has read in that post. An entry with no valid `thread_id` is dropped. An `ack_message_id` that is not a valid Snowflake counts as absent.+Each forum unread request object has `thread_id` and an optional `ack_message_id`, the newest message the client has read in that post.```json{@@ -197,17 +154,4 @@ Each forum unread request object is `thread_id` and an optional `ack_message_id`}```-Results arrive in one [Forum Unreads](#forum-unreads). A post that does not exist or is outside the channel has no entry. An archived post, and an active post that has a message after the sent `ack_message_id`, has no entry when Fluxer fails to count its messages.--No Dispatch follows in these cases.--- The guild or channel ID is not a valid Snowflake.-- The guild is not connected to the session.-- The channel is not a forum or media channel.-- The session cannot view the channel.-- The request has no valid `thread_id`.-- The connection has too many requests in progress.--A user session that did not set `CHANNEL_THREADS` closes with `4001` and reason `Unknown opcode`. A `d` that is not an object closes the same way.--Request Forum Unreads accepts five commands per WebSocket in a rolling 5-second window. A further command is discarded without closing the connection.+Fluxer answers with one [Forum Unreads](#forum-unreads) and sends nothing when the guild is unavailable to the session, the channel is not a forum or media channel or the session cannot view it. A connection can send five of these commands in any 5 seconds, and Fluxer drops the rest.diff --git a/fluxer_docs/src/content/docs/http-api/applications.mdx b/fluxer_docs/src/content/docs/http-api/applications.mdxindex db328ed3e..eb2fdff9a 100644--- a/fluxer_docs/src/content/docs/http-api/applications.mdx+++ b/fluxer_docs/src/content/docs/http-api/applications.mdx@@ -1,30 +1,16 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Applications-description: Application objects, bot accounts, redirect URIs, credential rotation, and deletion.+description: Application and bot objects and the routes that create, update, rotate and delete them.---import RouteHeader from '@/components/RouteHeader.astro';-An application is an OAuth2 client owned by one user account, and every bot account is registered under one. A user owns at most 25. The authorisation code grant, the scope registry, and the tokens issued to third-party clients belong to the [OAuth2 resource](/http-api/oauth2/).--## Access rules--Every route except [Get public application](#get-public-application) requires a credential. A user-only route rejects a bot token and an OAuth2 bearer with 403 `ACCESS_DENIED`.--The sudo-gated routes read `X-Fluxer-Sudo-Mode-JWT`. A valid sudo token in that header, issued to the authenticated account, satisfies [sudo mode](/http-api/users/mfa/#sudo-mode) with no body proof. Fluxer returns the same token in the `X-Fluxer-Sudo-Mode-JWT` response header. Fluxer issues no token to an account holding neither a TOTP secret nor a registered WebAuthn credential, so that account proves sudo mode with `password` in the body.--:::caution[Credentials are shown once]-A client secret is returned only by [Create application](#create-application) and [Reset client secret](#reset-client-secret), and a [bot token](/authentication/#token-formats) only by [Create application](#create-application) and [Reset bot token](#reset-bot-token).-:::--## Rate limits--A bucket whose name ends in `::client_id` gives the authenticated user one allowance. Requests for every application that user owns count against that one allowance. [List owned applications](#list-owned-applications), [Get current application](#get-current-application), [Get application](#get-application), [Get public application](#get-public-application), and [List OAuth2 authorisations](/http-api/oauth2/#list-oauth2-authorisations) all draw on one `oauth_dev:clients:list` allowance. [Get bot application](#get-bot-application) draws on the same bucket, keyed by the bot account the token names. That allowance is separate from the owner's.+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](/http-api/oauth2/).## Application object-The application record as its owner sees it.+The routes for an application you own return this object.### Structure@@ -32,17 +18,15 @@ The application record as its owner sees it.| --- | --- | --- || id | snowflake | The ID of the application || name | string | The name of the application (1-100 characters) |-| redirect_uris<sup>1</sup> | array[string] | The redirect URIs registered for the application |+| 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 bot installation requires an OAuth2 code grant |-| client_secret?<sup>2</sup> | string | The client secret that authenticates token exchange, introspection, and revocation |-| bot?<sup>3</sup> | [application bot](#application-bot-object) object | The bot account the application owns |+| bot_require_code_grant | boolean | Whether installing the bot needs an OAuth2 code grant |+| client_secret?<sup>1</sup> | string | The client secret for token exchange, introspection and revocation |+| bot?<sup>2</sup> | [application bot](#application-bot-object) object | The bot account the application owns |-<sup>1</sup> Always emitted, and an empty array when the application has registered none. [Create application](#create-application) and [Update application](#update-application) accept at most 10 entries+<sup>1</sup> Returned only by [Create application](#create-application) and [Reset client secret](#reset-client-secret)-<sup>2</sup> Present only in the response to [Create application](#create-application) and [Reset client secret](#reset-client-secret), which are the only operations that issue one--<sup>3</sup> Present in every response except [Reset client secret](#reset-client-secret), and absent for an application that owns no bot account or whose bot account record can no longer be read+<sup>2</sup> Not returned by [Reset client secret](#reset-client-secret)### Example@@ -58,42 +42,28 @@ The application record as its owner sees it.## Application bot object-The bot account an application owns. [Create application](#create-application) creates exactly one bot account with the application, so the bot user [snowflake](/snowflakes/) always equals the application ID.+Each application has one bot account, and the bot's user ID is the same as the application ID.### Structure| Field | Type | Description || --- | --- | --- |-| id | snowflake | The ID of the bot user, always equal to the application ID |-| username | string | The username of the bot account, 1 to 32 ASCII letters, digits, or underscores |-| discriminator | string | The discriminator of the bot account, always four decimal digits with leading zeroes |-| avatar?<sup>1</sup> <sup>2</sup> | ?string | The avatar hash of the bot account, or null when none is stored |-| banner?<sup>1</sup> <sup>2</sup> | ?string | The banner hash of the bot account, or null when none is stored |-| bio | ?string | The profile biography of the bot account, or null when none is stored |-| token?<sup>3</sup> | string | The bot token issued for the account |-| mfa_enabled?<sup>4</sup> | boolean | Whether the bot account has an authenticator configured |-| authenticator_types?<sup>4</sup> | array[integer] | The [authenticator types](/http-api/users/#authenticator-types) configured on the bot account |-| flags<sup>5</sup> | integer | [Bot flags](#bot-flags) |--<sup>1</sup> Declared optional by the schema and always emitted--<sup>2</sup> An animated hash retains its `a_` prefix, which is the animation indicator for this object. A bot account always holds the animated avatar and animated banner entitlements, so neither hash is ever stripped or suppressed--<sup>3</sup> Present only in the response to [Create application](#create-application). [Reset bot token](#reset-bot-token) returns the new token in the parent [bot token reset](#bot-token-reset-object) object instead--<sup>4</sup> Declared optional by the schema and always emitted, except on the [public application](#public-application-object) object, which omits both. `authenticator_types` is an empty array when the account has no authenticator, and `mfa_enabled` is true exactly when that array is not empty--<sup>5</sup> The bitfield is the account's [public user flags](/http-api/users/#public-user-flags), and [Update bot profile](#update-bot-profile) sets only the [bot flags](#bot-flags) in it--:::note[Bot token format]-A bot token is the application ID, a full stop, and an opaque secret of 32 random bytes encoded as base64url.-:::+| 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?<sup>1</sup> | string | The [bot token](/authentication/#token-formats) |+| mfa_enabled? | boolean | Whether the bot account has an authenticator |+| authenticator_types? | array[integer] | The [authenticator types](/http-api/users/#authenticator-types) on the bot account |+| flags | integer | The account's [public user flags](/http-api/users/#public-user-flags), including [bot flags](#bot-flags) |-An invalid bot token returns the same error whether or not its application exists.+<sup>1</sup> Returned only by [Create application](#create-application)## Public application object-The application as any caller sees it, including a caller that presents no credential.+Anyone can see this version of an application, with or without a credential.### Structure@@ -101,27 +71,19 @@ The application as any caller sees it, including a caller that presents no crede| --- | --- | --- || id | snowflake | The ID of the application || name | string | The name of the application |-| icon<sup>1</sup> | ?string | The avatar hash of the bot account, used as the application icon |-| description | ?string | Always null on this object |+| 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<sup>2</sup> | array[string] | [OAuth2 scopes](/http-api/oauth2/#oauth2-scopes) the application can currently be authorised for |-| bot_public<sup>3</sup> | boolean | Whether the requester can install the bot |-| bot<sup>4</sup> | ?[application bot](#application-bot-object) object | The bot account the application owns |-| current_user?<sup>5</sup> | ?[partial user](/http-api/users/#partial-user-object) object | The requesting account |--<sup>1</sup> Null when the application has no bot account or that account has no avatar. Otherwise it is the bot account's stored avatar hash, and an animated hash keeps its `a_` prefix--<sup>2</sup> Contains `bot` when the application owns a bot account, and is otherwise empty--<sup>3</sup> Reported as true for the application owner even when the bot is not public--<sup>4</sup> Null when the application has no bot account. Its `token`, `mfa_enabled`, and `authenticator_types` are never set here+| scopes | array[string] | The [OAuth2 scopes](/http-api/oauth2/#oauth2-scopes) the application can be authorized for |+| bot_public<sup>1</sup> | boolean | Whether the requester can install the bot |+| bot | ?[application bot](#application-bot-object) object | The bot account, without `token`, `mfa_enabled` or `authenticator_types` |+| current_user? | ?[partial user](/http-api/users/#partial-user-object) object | The requesting account, or null without a credential |-<sup>5</sup> Declared optional by the schema and always emitted, and null when the request has no credential that resolves to an account+<sup>1</sup> Always true for the application owner## Current bot application object-The application that issued the requesting bot token, as returned to that token.+This is the application that issued the bot token making the request.### Structure@@ -129,28 +91,18 @@ The application that issued the requesting bot token, as returned to that token.| --- | --- | --- || id | snowflake | The ID of the application || name | string | The name of the application |-| icon<sup>1</sup> | ?string | The avatar hash of the bot account, used as the application icon |-| description<sup>1</sup> | ?string | The biography of the bot account, used as the application description |+| 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 bot installation requires an OAuth2 code grant |-| verify_key<sup>2</sup> | string | A compatibility placeholder |-| owner<sup>3</sup> | [partial user](/http-api/users/#partial-user-object) object | The account that owns the application |-| bot?<sup>4</sup> | [application bot](#application-bot-object) object | The bot account the application owns |-| redirect_uris?<sup>5</sup> | array[string] | The redirect URIs registered for the application |--<sup>1</sup> Read from the bot account, so it changes with [Update bot profile](#update-bot-profile), and it is null when the application has no bot account--<sup>2</sup> Always 64 `0` characters, because no application signing key is available--<sup>3</sup> The request fails with 401 `INVALID_TOKEN` when the owning account no longer exists--<sup>4</sup> Absent when the application has no bot account, and its `token` is never set here--<sup>5</sup> Declared optional by the schema and always emitted, and an empty array when the application has registered no redirect URI+| 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](/http-api/users/#partial-user-object) object | The account that owns the application |+| bot? | [application bot](#application-bot-object) object | The bot account, without `token` |+| redirect_uris? | array[string] | The redirect URIs registered for the application |## Bot profile object-The bot account's profile fields after an update. [Update bot profile](#update-bot-profile) is the only operation that returns this shape. The object has no `token` field.+[Update bot profile](#update-bot-profile) returns this object.### Structure@@ -158,435 +110,262 @@ The bot account's profile fields after an update. [Update bot profile](#update-b| --- | --- | --- || id | snowflake | The ID of the bot user || username | string | The username of the bot account |-| discriminator | string | The discriminator of the bot account, always four decimal digits with leading zeroes |-| avatar<sup>1</sup> | ?string | The avatar hash of the bot account, or null when none is stored |-| banner<sup>1</sup> | ?string | The banner hash of the bot account, or null when none is stored |-| bio | ?string | The profile biography of the bot account, or null when none is stored |-| flags | integer | [Bot flags](#bot-flags) |--<sup>1</sup> An animated hash retains its `a_` prefix, which is the animation indicator for this object. A bot account's stored banner is never suppressed+| 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) |## Bot flags+These bits are in the bot account's `flags`, and you set them with `bot_flags` in [Update bot profile](#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 requires manual approval for friend requests |--These bits are a subset of the account's [public user flags](/http-api/users/#public-user-flags), so a bot account that also has `STAFF`, `PARTNER`, `BUG_HUNTER`, or `SPAMMER` reports that bit in the same field. A client MUST ignore a bit it does not recognise.+| 1 << 5 | FRIENDLY_BOT_MANUAL_APPROVAL | The bot needs manual approval for friend requests |## Bot token reset object-The response to [Reset bot token](#reset-bot-token).+[Reset bot token](#reset-bot-token) returns this object.### Structure| Field | Type | Description || --- | --- | --- |-| token | string | The newly issued bot token |-| bot<sup>1</sup> | [application bot](#application-bot-object) object | The bot account the token belongs to |--<sup>1</sup> The nested object omits its own `token` member+| token | string | The new bot token |+| bot | [application bot](#application-bot-object) object | The bot account, without `token` |## List owned applications<RouteHeader method="GET" path="/v1/users/@me/applications" />-Returns every [application](#application-object) object the current user owns.+Returns every [application](#application-object) the current user owns, without client secrets or bot tokens.### Response| Status | Body | Condition || --- | --- | --- || 200 | array[[application](#application-object) object] | The applications were returned |-| 403 | [error response](/http-api/#error-response) | The credential is a bot or bearer token (`ACCESS_DENIED`) |--The listing is unpaginated because one user can own at most 25 applications. No entry has a client secret or bot token. The built-in `Fluxer Admin` application belongs to the system account and never appears here.--### Rate limit-60 requests per minute for each authenticated user, on the `oauth_dev:clients:list` bucket.+The rate limit is 60 requests per minute, on the `oauth_dev:clients:list` bucket.## Get current application<RouteHeader method="GET" path="/v1/oauth2/applications/@me" bot />-Returns the caller's own applications, selected by credential type. A user session returns the same array as [List owned applications](#list-owned-applications). A bot token returns the [current bot application](#current-bot-application-object) object for the application that issued the token.--An OAuth2 bearer credential is rejected.+Returns the same array as [List owned applications](#list-owned-applications) for a user session, and the [current bot application](#current-bot-application-object) object for a bot token. OAuth2 bearer tokens get 403 `ACCESS_DENIED`.### Response| Status | Body | Condition || --- | --- | --- || 200 | array[[application](#application-object) object] \| [current bot application](#current-bot-application-object) object | The current application data was returned |-| 401 | [error response](/http-api/#error-response) | Authentication is missing or invalid (`UNAUTHORIZED`) |-| 401 | [error response](/http-api/#error-response) | The presented bot token belongs to an application whose owner account no longer exists (`INVALID_TOKEN`) |-| 403 | [error response](/http-api/#error-response) | The credential is a bearer token (`ACCESS_DENIED`) |--:::note[Response shape depends on the credential]-The body is an array for a user session and a single object for a bot token. A client that accepts both credential types MUST branch on the received shape.-:::--### Rate limit-60 requests per minute for each authenticated user, on the `oauth_dev:clients:list` bucket.+The rate limit is 60 requests per minute, on the `oauth_dev:clients:list` bucket.## Get bot application<RouteHeader method="GET" path="/v1/applications/@me" bot />-Returns the [current bot application](#current-bot-application-object) object for the application that issued the presented bot token. The route accepts only the `Bot` scheme in the `Authorization` header.+Returns the [current bot application](#current-bot-application-object) object for the bot token in the `Authorization` header.### Response| Status | Body | Condition || --- | --- | --- || 200 | [current bot application](#current-bot-application-object) object | The application was returned |-| 401 | [error response](/http-api/#error-response) | The header is absent or does not use the `Bot` scheme (`INVALID_TOKEN`) |-| 401 | [error response](/http-api/#error-response) | The header does not resolve to a live bot token (`INVALID_TOKEN`) |-| 401 | [error response](/http-api/#error-response) | The token names an application or owner account that no longer exists (`INVALID_TOKEN`) |+| 401 | [error response](/http-api/#error-response) | `INVALID_TOKEN` when the header is missing, isn't a bot token or the application was deleted |-Every rejection reports the same `INVALID_TOKEN`, so a caller cannot distinguish a malformed credential from a valid secret whose application has since been deleted.--### Rate limit--60 requests per minute for each authenticated account, or for each client IP address when no account resolved, on the `oauth_dev:clients:list` bucket.+The rate limit is 60 requests per minute, on the `oauth_dev:clients:list` bucket.## Get public application<RouteHeader method="GET" path="/v1/oauth2/applications/{id}/public" unauthenticated />-Returns the [public application](#public-application-object) object for any application. Authentication is not required. A credential that resolves to an account also sets `current_user`, and one that resolves to the application owner reports `bot_public` as true even when the bot is not public.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| id | snowflake | The ID of the application |+Returns the [public application](#public-application-object) object for any application.### Response| Status | Body | Condition || --- | --- | --- || 200 | [public application](#public-application-object) object | The application was returned |-| 400 | [error response](/http-api/#error-response) | The application ID is not a valid snowflake |-| 404 | [error response](/http-api/#error-response) | The application does not exist (`UNKNOWN_APPLICATION`) |-This representation exposes the full registered redirect URI list and the bot profile to anonymous callers. It has no client secret, no bot token, no owner identity, and nothing about the owner's MFA enrolment. An application owner should not register a redirect URI whose hostname is itself sensitive.--### Rate limit--60 requests per minute for each authenticated user, or for each client IP address when the request has no credential, on the `oauth_dev:clients:list` bucket.+The rate limit is 60 requests per minute, on the `oauth_dev:clients:list` bucket.## Create application<RouteHeader method="POST" path="/v1/oauth2/applications" />-Creates an application together with its bot account. Returns the [application](#application-object) object with the initial client secret and bot token.--An unclaimed account cannot create an application. An account is unclaimed while it holds no password credential, is not a bot, and has not been linked to a single sign-on identity.+Creates an application and its bot account, and returns the [application](#application-object) 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| Field | Type | Description || --- | --- | --- |-| X-Captcha-Token?<sup>1</sup> | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |--<sup>1</sup> A missing token returns 400 `CAPTCHA_REQUIRED` and a rejected token returns 400 `INVALID_CAPTCHA`, each with a new challenge. Fluxer skips verification when the check is off for the instance, when the account has the CAPTCHA exemption flag, or when the caller's email address is on an exempt domain+| X-Captcha-Token? | string | The solved [CAPTCHA](/topics/captcha/) token |### JSON body| Field | Type | Description || --- | --- | --- |-| name<sup>1</sup> | string | The name of the application (1-100 characters) |-| redirect_uris?<sup>2</sup> <sup>3</sup> | ?array[string] | The redirect URIs to register, at most 10 |+| name | string | The name of the application (1-100 characters) |+| redirect_uris?<sup>1</sup> | ?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 bot installation requires an OAuth2 code grant (default false) |--<sup>1</sup> Rejected with 403 `CONTENT_BLOCKED` when content moderation blocks the value--<sup>2</sup> Null registers no redirect URI. Each entry is normalised and then bounded at 1 to 256 characters+| bot_require_code_grant? | boolean | Whether installing the bot needs an OAuth2 code grant (default false) |-<sup>3</sup> Each URI must parse as an absolute URL with a host and must use HTTPS. HTTP is accepted only when the host is `localhost`, a `.localhost` subdomain, an IPv4 literal, or a bracketed IPv6 literal. A URI that content moderation blocks is rejected with 403 `CONTENT_BLOCKED`+<sup>1</sup> Each URI must be an absolute HTTPS URL. HTTP is allowed for `localhost`, `*.localhost` and IP literals### Response| Status | Body | Condition || --- | --- | --- || 200 | [application](#application-object) object | The application and its bot were created |-| 400 | [error response](/http-api/#error-response) | The body fails validation |-| 400 | [error response](/http-api/#error-response) | CAPTCHA proof is missing (`CAPTCHA_REQUIRED`) or rejected (`INVALID_CAPTCHA`) |-| 400 | [error response](/http-api/#error-response) | The account is unclaimed<sup>4</sup> |-| 400 | [error response](/http-api/#error-response) | The owner already has 25 applications (`MAX_APPLICATIONS`) |-| 403 | [error response](/http-api/#error-response) | The credential is a bot or bearer token (`ACCESS_DENIED`) |-| 403 | [error response](/http-api/#error-response) | The name, a redirect URI, or the derived bot username is blocked (`CONTENT_BLOCKED`) |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs, including when no bot username can be allocated (`BOT_USER_GENERATION_FAILED`) |+| 400 | [error response](/http-api/#error-response) | `MAX_APPLICATIONS` when you already own 25 applications |+| 403 | [error response](/http-api/#error-response) | Your account is unclaimed<sup>2</sup> |+| 403 | [error response](/http-api/#error-response) | `ACCOUNT_VERIFICATION_REQUIRED` when the instance needs a verified account and yours is not |+| 403 | [error response](/http-api/#error-response) | `CONTENT_BLOCKED` when the name, a redirect URI or the bot username is blocked |+| 500 | [error response](/http-api/#error-response) | `BOT_USER_GENERATION_FAILED` when no bot username is free |-<sup>4</sup> `UNCLAIMED_ACCOUNT_CANNOT_CREATE_APPLICATIONS`+<sup>2</sup> The error code is `UNCLAIMED_ACCOUNT_CANNOT_CREATE_APPLICATIONS`-Fluxer derives the bot username from the application name when that name yields an available tag, and otherwise assigns a random username. The resulting username and discriminator can both differ from the application name.--### Side effects--Fluxer creates the application and the bot account together. The bot starts with no avatar, banner, biography, or global display name. No Gateway Dispatch is emitted.--### Rate limit--10 requests per hour for each authenticated user, on the `oauth_dev:clients:create` bucket.+The rate limit is 10 requests per hour, on the `oauth_dev:clients:create` bucket.## Get application<RouteHeader method="GET" path="/v1/oauth2/applications/{id}" />-Returns one [application](#application-object) object. Only the owner can read it.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| id | snowflake | The ID of the application |+Returns one [application](#application-object) object you own.### Response| Status | Body | Condition || --- | --- | --- || 200 | [application](#application-object) object | The application was returned |-| 400 | [error response](/http-api/#error-response) | The application ID is not a valid snowflake |-| 403 | [error response](/http-api/#error-response) | The credential is a bot or bearer token, or the caller does not own the application (`ACCESS_DENIED`) |-| 404 | [error response](/http-api/#error-response) | The application does not exist (`UNKNOWN_APPLICATION`) |--An existing application owned by another account returns 403 `ACCESS_DENIED`.--### Rate limit-60 requests per minute for each authenticated user, on the `oauth_dev:clients:list` bucket.+The rate limit is 60 requests per minute, on the `oauth_dev:clients:list` bucket.## Update application<RouteHeader method="PATCH" path="/v1/oauth2/applications/{id}" />-Updates one application and returns the resulting [application](#application-object) object. Only the owner can update it.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| id | snowflake | The ID of the application |+Updates an application you own and returns the [application](#application-object) object.### JSON body| Field | Type | Description || --- | --- | --- |-| name?<sup>1</sup> | string | The name of the application (1-100 characters) |-| redirect_uris?<sup>2</sup> | ?array[string] | The redirect URIs to register, at most 10 |+| name? | string | The name of the application (1-100 characters) |+| redirect_uris?<sup>1</sup> | ?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 bot installation requires an OAuth2 code grant |--<sup>1</sup> Rejected with 403 `CONTENT_BLOCKED` when content moderation blocks the value+| bot_require_code_grant? | boolean | Whether installing the bot needs an OAuth2 code grant |-<sup>2</sup> Each entry is normalised, bounded at 1 to 256 characters, and validated on the same terms as [Create application](#create-application). A supplied array becomes the complete registered set, null clears every registered URI, and an omitted field leaves the current set unchanged--:::caution[Redirect URIs are replaced]-Removing a redirect URI takes effect immediately for new authorisation requests. An authorisation code that was already issued against the removed URI still requires that exact URI at [Exchange OAuth2 token](/http-api/oauth2/#exchange-oauth2-token), and previously issued access and refresh tokens are unaffected.-:::+<sup>1</sup> The array replaces the whole set, and null clears it. Each URI follows the same rules as in [Create application](#create-application)### Response| Status | Body | Condition || --- | --- | --- || 200 | [application](#application-object) object | The application was updated |-| 403 | [error response](/http-api/#error-response) | The credential is a bot or bearer token, or the caller does not own the application (`ACCESS_DENIED`) |-| 403 | [error response](/http-api/#error-response) | The name or a redirect URI is blocked (`CONTENT_BLOCKED`) |-| 404 | [error response](/http-api/#error-response) | The application does not exist (`UNKNOWN_APPLICATION`) |--### Side effects--Each submitted field replaces the stored value of that field. Neither credential is rotated, and no Gateway Dispatch is emitted.--### Rate limit+| 403 | [error response](/http-api/#error-response) | `CONTENT_BLOCKED` when the name or a redirect URI is blocked |-30 requests per minute for each authenticated user, on the `oauth_dev:clients:update::client_id` bucket, shared with [Update bot profile](#update-bot-profile).+The rate limit is 30 requests per minute, on the `oauth_dev:clients:update::client_id` bucket.## Update bot profile<RouteHeader method="PATCH" path="/v1/oauth2/applications/{id}/bot" />-Updates the bot account an application owns and returns the resulting [bot profile](#bot-profile-object) object. The caller must own the application.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| id | snowflake | The ID of the application |+Updates the bot account of an application you own and returns the [bot profile](#bot-profile-object) 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](/gateway/events/#user-update) to the bot's sessions.### JSON body| Field | Type | Description || --- | --- | --- |-| username?<sup>1</sup> | string | The new username for the bot account (1-32 characters) |-| discriminator?<sup>2</sup> | string \| integer | The discriminator, 1 to 4 decimal digits parsed as an integer |-| avatar?<sup>3</sup> | ?string | The base64-encoded avatar image, or null to clear the stored avatar |-| banner?<sup>3</sup> | ?string | The base64-encoded banner image, or null to clear the stored banner |-| bio?<sup>4</sup> | ?string | The profile biography (0-1024 characters), or null to clear the stored value |-| bot_flags?<sup>5</sup> | integer | [Bot flags](#bot-flags) |--<sup>1</sup> Trimmed before validation and restricted to ASCII letters, digits, and underscores. The value cannot be `everyone` or `here` and cannot contain `fluxer` or `system message`. A change that alters more than letter case always reallocates the discriminator. A username the profile substring blocklist rejects returns 403 `CONTENT_BLOCKED`--<sup>2</sup> Accepted only when it equals the bot's current discriminator. Any other value returns the field code `BOT_DISCRIMINATOR_CANNOT_BE_CHANGED`+| username?<sup>1</sup> | string | The username of the bot account (1-32 letters, digits or underscores) |+| discriminator?<sup>2</sup> | string \| integer | The current discriminator of the bot account |+| avatar?<sup>3</sup> | ?string | The base64-encoded avatar image |+| banner?<sup>3</sup> | ?string | The base64-encoded banner image |+| bio? | ?string | The profile biography (0-1024 characters) |+| bot_flags?<sup>4</sup> | integer | [Bot flags](#bot-flags) |-<sup>3</sup> The value can include a `data:...;base64,` prefix, which Fluxer strips before it measures the payload. The remaining base64 payload is bounded at 139810136 characters for both fields, the encoded length of a 104857600-byte image, and a longer value is rejected with the field code `BASE64_LENGTH_INVALID`. The decoded image must fit the resolved `avatar_max_size` [limit](/http-api/instance/#limit-keys), 10485760 bytes by default, or it is rejected with `IMAGE_SIZE_EXCEEDS_LIMIT`+<sup>1</sup> 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`-<sup>4</sup> Rejected with 403 `CONTENT_BLOCKED` when content moderation or the profile substring blocklist blocks the value+<sup>2</sup> Any value other than the current discriminator fails with `BOT_DISCRIMINATOR_CANNOT_BE_CHANGED`-<sup>5</sup> Fluxer reads only the [bot flags](#bot-flags) from the supplied bitfield and sets or clears each to match. It ignores every other bit+<sup>3</sup> The image must fit the `avatar_max_size` [limit](/http-api/instance/#limit-keys)-Fluxer checks the decoded bytes of `avatar` and `banner` against the instance's avatar byte ceiling, which applies to both fields and defaults to 10 MiB. An image in a format the field does not accept, an animated image on a field that accepts no animation, and any animated AVIF return the field code `INVALID_IMAGE_FORMAT`. Pixel dimensions are never checked.+<sup>4</sup> Fluxer sets or clears only the bot flags and ignores other bits### Response| Status | Body | Condition || --- | --- | --- || 200 | [bot profile](#bot-profile-object) object | The profile was updated |-| 400 | [error response](/http-api/#error-response) | The path or body fails validation |-| 400 | [error response](/http-api/#error-response) | No discriminator can be allocated for the requested username (`USERNAME_NOT_AVAILABLE`) |-| 400 | [error response](/http-api/#error-response) | The discriminator differs from the current one |-| 400 | [error response](/http-api/#error-response) | The image is malformed, oversized, or an unsupported format |-| 400 | [error response](/http-api/#error-response) | The tag change allowance is exhausted |-| 403 | [error response](/http-api/#error-response) | The credential is a bot or bearer token, or the caller does not own the application (`ACCESS_DENIED`) |-| 403 | [error response](/http-api/#error-response) | The username or biography is blocked (`CONTENT_BLOCKED`) |-| 404 | [error response](/http-api/#error-response) | The application does not exist (`UNKNOWN_APPLICATION`), or it has no bot account (`BOT_USER_NOT_FOUND`) |--This operation always clears the bot's global display name, so a bot is always presented by its username. The write consumes the tag change allowance only when it changes the username or the discriminator. Fluxer reports an exhausted allowance as a body validation entry on `username` with the code `USERNAME_CHANGED_TOO_MANY_TIMES`, never as 429.--:::note[Only null clears a stored value]-An omitted `avatar`, `banner`, or `bio` leaves the stored value untouched. Sending `{"bio": null}` clears the biography, and sending `{}` changes nothing except the global display name.-:::--### Side effects--Fluxer applies the supplied profile fields to the bot account. Replaced avatar and banner assets stop appearing after the update. A username change that alters more than letter case also replaces the discriminator with a random free one for the new username. The operation emits a [User Update](/gateway/events/#user-update) Gateway Dispatch to the bot account's own sessions.--### Rate limit+| 400 | [error response](/http-api/#error-response) | `USERNAME_NOT_AVAILABLE` when no discriminator is free for the username |+| 403 | [error response](/http-api/#error-response) | `CONTENT_BLOCKED` when the username or biography is blocked |+| 404 | [error response](/http-api/#error-response) | `BOT_USER_NOT_FOUND` when the application has no bot account |-30 requests per minute for each authenticated user, on the `oauth_dev:clients:update::client_id` bucket, shared with [Update application](#update-application), and a change to the resulting tag is also limited to 5 changes per 3 hours for each bot account.+The rate limit is 30 requests per minute, on the `oauth_dev:clients:update::client_id` bucket.## Reset bot token<RouteHeader method="POST" path="/v1/oauth2/applications/{id}/bot/reset-token" mfa />-Rotates the bot token and returns the [bot token reset](#bot-token-reset-object) object with the new token. The caller must own the application and must prove sudo mode.+Issues a new bot token for an application you own and returns the [bot token reset](#bot-token-reset-object) object. You need [sudo mode](/http-api/users/mfa/#sudo-mode).-### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| id | snowflake | The ID of the application |+:::caution[The old token stops working at once]+Every Gateway session the bot has ends, and the bot can only connect again with the new token.+:::### JSON body-The body is a [sudo verification](/http-api/users/mfa/#sudo-verification-object) object. Its fields are not required when the request already has a valid proof.+The body is a [sudo verification](/http-api/users/mfa/#sudo-verification-object) object.### Response| Status | Body | Condition || --- | --- | --- || 200 | [bot token reset](#bot-token-reset-object) object | The token was rotated |-| 400 | [error response](/http-api/#error-response) | The path or sudo body fails validation, or the supplied password or MFA code is wrong |-| 403 | [error response](/http-api/#error-response) | The credential is a bot or bearer token, or the caller does not own the application (`ACCESS_DENIED`) |-| 403 | [error response](/http-api/#error-response) | Sudo mode is required and was not proven (`SUDO_MODE_REQUIRED`) |-| 404 | [error response](/http-api/#error-response) | The application does not exist (`UNKNOWN_APPLICATION`), or it has no bot account (`BOT_USER_NOT_FOUND`) |--:::caution[Rotation disconnects the bot]-The moment the new token is stored, the previous one stops authenticating and every live main Gateway session the bot holds ends.-:::--A running bot reconnects only after its operator installs the returned token.--### Side effects--Fluxer stores the new token and ends every live main Gateway session the bot account holds. The bot's guild memberships, group direct message memberships, and OAuth2 grants are unchanged, and no resource Dispatch is emitted.+| 404 | [error response](/http-api/#error-response) | `BOT_USER_NOT_FOUND` when the application has no bot account |-### Rate limit--10 requests per hour for each authenticated user, on the `oauth_dev:clients:rotate_secret::client_id` bucket, shared with [Reset client secret](#reset-client-secret).+The rate limit is 10 requests per hour, on the `oauth_dev:clients:rotate_secret::client_id` bucket.## Reset client secret<RouteHeader method="POST" path="/v1/oauth2/applications/{id}/client-secret/reset" mfa />-Rotates the OAuth2 client secret and returns the [application](#application-object) object with the new secret. The caller must own the application and must prove sudo mode.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| id | snowflake | The ID of the application |+Issues a new client secret for an application you own and returns the [application](#application-object) object with it. You need [sudo mode](/http-api/users/mfa/#sudo-mode). The old secret stops working at once, and access and refresh tokens already issued stay valid.### JSON body-The body is a [sudo verification](/http-api/users/mfa/#sudo-verification-object) object. Its fields are not required when the request already has a valid proof.+The body is a [sudo verification](/http-api/users/mfa/#sudo-verification-object) object.### Response| Status | Body | Condition || --- | --- | --- || 200 | [application](#application-object) object | The client secret was rotated |-| 400 | [error response](/http-api/#error-response) | The path or sudo body fails validation, or the supplied password or MFA code is wrong |-| 403 | [error response](/http-api/#error-response) | The credential is a bot or bearer token, or the caller does not own the application (`ACCESS_DENIED`) |-| 403 | [error response](/http-api/#error-response) | Sudo mode is required and was not proven (`SUDO_MODE_REQUIRED`) |-| 404 | [error response](/http-api/#error-response) | The application does not exist (`UNKNOWN_APPLICATION`) |--The returned application object has the new `client_secret` and no `bot` member. A caller that needs both reads [Get application](#get-application) afterwards.-### Side effects--Token exchange, introspection, and revocation stop accepting the previous client secret immediately. Existing access and refresh tokens remain valid until they expire or are revoked, and no Gateway Dispatch is emitted.--### Rate limit--10 requests per hour for each authenticated user, on the `oauth_dev:clients:rotate_secret::client_id` bucket, shared with [Reset bot token](#reset-bot-token).+The rate limit is 10 requests per hour, on the `oauth_dev:clients:rotate_secret::client_id` bucket.## Delete application<RouteHeader method="DELETE" path="/v1/oauth2/applications/{id}" mfa />-Deletes one owned application and anonymises its bot account, then returns 204 with an empty body. The caller must own the application and must prove sudo mode.--Removing the bot from its guilds emits one [Guild Member Remove](/gateway/events/#guild-member-remove) Gateway Dispatch per guild, and each removal also delivers [Guild Delete](/gateway/events/#guild-delete) to the bot's own Gateway sessions.+Deletes an application you own. You need [sudo mode](/http-api/users/mfa/#sudo-mode).-:::danger[Deleting an application strips its bot account]-Deletion permanently destroys the application, its client secret, and its bot token, strips the bot account's identity, and removes the bot from every guild.+:::caution[Deletion can't be undone]+The client secret and bot token stop working. The bot leaves every guild, which sends [Guild Member Remove](/gateway/events/#guild-member-remove) in each one, and its account becomes `DeletedUser#0000`.:::-### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| id | snowflake | The ID of the application |-### JSON body-The body is a [sudo verification](/http-api/users/mfa/#sudo-verification-object) object. Its fields are not required when the request already has a valid proof.+The body is a [sudo verification](/http-api/users/mfa/#sudo-verification-object) object.### Response| Status | Body | Condition || --- | --- | --- || 204 | empty | The application was deleted |-| 400 | [error response](/http-api/#error-response) | The path or sudo body fails validation, or the supplied password or MFA code is wrong |-| 403 | [error response](/http-api/#error-response) | The credential is a bot or bearer token, or the caller does not own the application (`ACCESS_DENIED`) |-| 403 | [error response](/http-api/#error-response) | Sudo mode is required and was not proven (`SUDO_MODE_REQUIRED`) |-| 404 | [error response](/http-api/#error-response) | The application does not exist (`UNKNOWN_APPLICATION`) |--A 204 response means the removal has finished. Repeating the request afterwards returns 404 `UNKNOWN_APPLICATION`.--### Side effects--The bot's messages remain attributed to a deleted account, and its tag becomes available for reuse. The bot is removed from every guild and its profile is anonymised as `DeletedUser#0000`, with the global name `Deleted User`.--The bot token and client secret stop working. Token exchange, refresh, introspection, and revocation also fail. An existing access token can still authenticate a scope-gated route until it expires, but [Get current OAuth2 authorisation](/http-api/oauth2/#get-current-oauth2-authorisation) and [Get OAuth2 user information](/http-api/oauth2/#get-oauth2-user-information) return 401 `INVALID_TOKEN`.--### Rate limit-10 requests per hour for each authenticated user, on the `oauth_dev:clients:delete::client_id` bucket.+The rate limit is 10 requests per hour, on the `oauth_dev:clients:delete::client_id` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/authentication.mdx b/fluxer_docs/src/content/docs/http-api/authentication.mdxindex 9f10a24b8..aa705b5a1 100644--- a/fluxer_docs/src/content/docs/http-api/authentication.mdx+++ b/fluxer_docs/src/content/docs/http-api/authentication.mdx@@ -1,252 +1,204 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Authentication resource-description: Registration, login, credentials, sessions, recovery, SSO, IP authorisation, desktop handoff, and origin handoff.+description: Routes for signing up, signing in, recovering an account, managing sessions and moving a session to another device.---import RouteHeader from '@/components/RouteHeader.astro';-The Authentication resource covers signing up, signing in, recovering an account, and moving a session to a new device. Every route on this page is below `/v1/auth`.+These routes create accounts, sign people in and manage their sessions. Every route is under `/v1/auth`, and [Authentication](/authentication/) explains the token formats.-## Shared behaviour+## Shared behavior-[Authentication](/authentication/) and [HTTP authentication](/http-api/#authentication) define credential syntax and the credential namespaces. Changing the credentials of an account that is already signed in is covered by [Email and password changes](/http-api/users/email-and-password/) and [Multi-factor authentication](/http-api/users/mfa/).+Most routes here need no `Authorization` header, because the request has its own ticket, code or credential. The routes that need a user session token, except [log out](#log-out), reject a bot token and an OAuth2 bearer token with 403 `ACCESS_DENIED`.-:::caution[Authentication material is confidential and opaque]-A client MUST treat every session token, one-use token, ticket, SSO state, and handoff code as confidential. It MUST NOT parse one, expose it to untrusted code, or write it to logs, analytics, or a URL the operation did not assign.-:::--Most operations need no `Authorization` credential, because the request has a one-use token, MFA ticket, WebAuthn assertion, or account credential of its own. [List authentication sessions](#list-authentication-sessions), [terminate authentication sessions](#terminate-authentication-sessions), [resend email verification](#resend-email-verification), [log out](#log-out), [complete desktop handoff](#complete-desktop-handoff), and [create origin handoff](#create-origin-handoff) are the only operations on this page that read an `Authorization` credential. Complete desktop handoff reads the header only when its body omits the `token` field. The first three and create origin handoff require an ordinary user session, and each rejects a bot token and an OAuth2 bearer token with 403 `ACCESS_DENIED`.--Every route has a route bucket and is also subject to the [global HTTP limit](/topics/rate-limits/). A route bucket is keyed by the authenticated user when the request has a resolvable credential and by the client IP address otherwise. Bucket or global denial returns 429 `RATE_LIMITED`.--An invalid JSON shape returns 400 `INVALID_FORM_BODY` with [validation error object](/http-api/#validation-error-object) entries in `errors`. An unexpected failure returns 500 `INTERNAL_SERVER_ERROR`. Every enumerated code on this page is registered in [Errors](/http-api/errors/), and every snowflake field is the decimal string form defined by [Snowflakes](/snowflakes/).--When SSO is both enabled and enforced, every local authentication operation returns 403 `SSO_REQUIRED`. The SSO status route, SSO start and completion, logout, both session routes, and every handoff route stay available under enforcement. [Complete login with TOTP](#complete-login-with-totp), [get WebAuthn MFA options](#get-webauthn-mfa-options) and [complete login with WebAuthn MFA](#complete-login-with-webauthn-mfa) stay available for a ticket that [complete SSO](#complete-sso) returned. Every other route on this page is a local authentication operation.--:::caution[SSO enforcement precedes every other check]-An enforced instance returns 403 `SSO_REQUIRED` even for a malformed or unauthenticated local authentication request.-:::+An instance reports how people sign in as `account_identity` in its [instance features](/http-api/instance/#instance-features-object). On a `username` instance, these routes return 400 `EMAIL_UNAVAILABLE_ON_INSTANCE` and send no email.-An instance reports how members sign in as `account_identity` in its [instance features](/http-api/instance/#instance-features-object). On a `username` instance, [verify an email address](#verify-an-email-address), [resend email verification](#resend-email-verification), [request password recovery](#request-password-recovery), [revert an email change](#revert-an-email-change), [authorise an IP address](#authorise-an-ip-address) and [resend IP authorisation](#resend-ip-authorisation) return 400 `EMAIL_UNAVAILABLE_ON_INSTANCE` and send nothing. [Recover an account](#recover-an-account) is the reverse. Only a `username` instance serves it, and an `email` instance returns 400 `USERNAME_SIGN_IN_ONLY`. [Check username availability](#check-username-availability) is served by any instance with the `none` tag style.+- [Verify an email address](#verify-an-email-address)+- [Resend email verification](#resend-email-verification)+- [Request password recovery](#request-password-recovery)+- [Revert an email change](#revert-an-email-change)+- [Authorize an IP address](#authorize-an-ip-address)+- [Resend IP authorization](#resend-ip-authorization)-A successful sign-in creates one authentication session and issues its token. Fluxer sets no ceiling on live sessions and evicts none when a further session starts, so an account holds one session per sign-in until it revokes them through [terminate authentication sessions](#terminate-authentication-sessions).+When the instance enforces SSO, the password, passkey, email code, registration, email verification, password reset, recovery, IP authorization and username routes return 403 `SSO_REQUIRED`. The SSO routes, logout, the session routes, [redeem a sign-in link](#redeem-a-sign-in-link), the desktop and origin handoff routes and the MFA routes for a ticket from [complete SSO](#complete-sso) keep working.-Revoking a session, whether the account revoked it or an administrator terminated it, stops its token authenticating requests. Its main Gateway connection receives [Invalid Session](/gateway/overview/#invalid-session) with `d: false` and stays open, unauthenticated. No Gateway Dispatch is emitted for the revocation itself, so a client learns of it from that frame or from the next request that fails to authenticate.+Each sign-in creates one session, and a session lasts until it is revoked. When a session is revoked, its Gateway connection gets [Invalid Session](/gateway/overview/#invalid-session) with `d: false`.<a id="authentication-token-response"></a>## Authentication token response object-A newly issued session token and the account it belongs to. Password login without a second factor, MFA completion, discoverable WebAuthn authentication, immediate registration, password reset, account recovery, email reversion, SSO completion, IP authorisation polling, sign-in link redemption, and handoff polling all return these fields.+A new session token and the account it belongs to. Every route that signs someone in returns these fields.### Structure| Field | Type | Description || --- | --- | --- |-| token<sup>1</sup> | string | The newly issued user session token |+| token | string | The new user session token, returned only here || user_id | snowflake | The authenticated user ID |-| user | [partial user](/http-api/users/#partial-user-object) object | The public representation of the authenticated account |-| device_proof?<sup>2</sup> | string | A value to keep beside the account and send to [identify an account](#identify-an-account) from this device later |-| entry?<sup>3</sup> | ?[guild entry](/http-api/users/current-user/#guild-entry-object) object | The community to open next, from the invite used at sign-up |--<sup>1</sup> The token is the literal prefix `flx_` followed by exactly 36 base62 characters, and this response is the only way to read it--<sup>2</sup> Returned by sign-in, sign-up and handoff redemption. It is not a credential and signs nothing in on its own+| user | [partial user](/http-api/users/#partial-user-object) object | The authenticated account |+| device_proof? | string | A value to send to [identify an account](#identify-an-account) from this device later |+| entry?<sup>1</sup> | ?[guild entry](/http-api/users/current-user/#guild-entry-object) object | The community to open next, from the invite used at sign-up |-<sup>3</sup> Returned only by registration. Null when no invite applied, or while the account still has to enter a date of birth+<sup>1</sup> Returned only by registration, and null when no invite applied or the account still has to enter a date of birth-:::caution[A session token is returned once]-A lost session token cannot be recovered through any operation. The account MUST authenticate again to obtain a new session.-:::--:::note[The successful result has no discriminator]-Password login, registration, and password reset each return either this object or an alternative shape. The successful shape has no `mfa` or `registration_pending_approval` member of its own, so a client MUST branch on the presence of `token`.-:::+When a route can return this object or another shape, check for `token`.## SSO status object-The public single sign-on state. The same object is embedded by the [instance discovery document](/http-api/instance/#instance-discovery-object).+The public single sign-on state. The [instance discovery document](/http-api/instance/#instance-discovery-object) has the same object.### Structure| Field | Type | Description || --- | --- | --- |-| enabled<sup>1</sup> | boolean | Whether SSO can be started on this instance |-| enforced<sup>2</sup> | boolean | Whether SSO is required for every user |-| display_name | ?string | The configured provider display name, or null when none is set |-| button_label | ?string | The text the operator set for the SSO sign-in button, or null when the client shows its own default label |-| redirect_uri | string | The default OAuth2 redirect URI used for the provider callback |-| available? | boolean | Whether an SSO provider is configured for this instance |--<sup>1</sup> The value is true only when the operator has enabled SSO and the provider has an authorisation URL, a token URL, a client ID, and a JWKS URL or user info URL. Each URL is configured or discovered from the issuer. A provider that lacks any of them reports false--<sup>2</sup> The value is true only when `enabled` is also true, and every local authentication operation then returns 403 `SSO_REQUIRED`+| enabled | boolean | Whether SSO is turned on and its provider is fully configured |+| enforced | boolean | Whether every user has to sign in with SSO |+| display_name | ?string | The provider display name |+| button_label | ?string | The text for the SSO sign-in button, or null to use the app's default |+| redirect_uri | string | The default redirect URI for the provider callback |+| available? | boolean | Not sent by the API, so check `enabled` |## SSO start object-The parameters for sending the user to the identity provider, bound to one new SSO state.+Where to send the user to sign in with the identity provider.### Structure| Field | Type | Description || --- | --- | --- |-| authorization_url | string | The provider authorisation URL with the state, nonce, and PKCE challenge |-| state<sup>1</sup> | string | The one-use CSRF state |-| redirect_uri | string | The callback URI bound to this state |--<sup>1</sup> The first [complete SSO](#complete-sso) request that presents the unexpired state consumes it, whether or not that request then succeeds--A client MUST return the state unchanged and MUST NOT interpret its contents.+| authorization_url | string | The provider URL to send the user to, unchanged |+| state | string | The one-use state to pass to [complete SSO](#complete-sso), valid for 10 minutes |+| redirect_uri | string | The callback URI for this state |## SSO completion response object-The result of [complete SSO](#complete-sso). It extends an [authentication token response](#authentication-token-response) or an [MFA challenge response](#mfa-challenge-response) with the redirect bound to the consumed state.+The result of [complete SSO](#complete-sso). It extends an [authentication token response](#authentication-token-response) or an [MFA challenge response](#mfa-challenge-response) with the redirect bound to the state.### Structure| Field | Type | Description || --- | --- | --- |-| token | string | The newly issued user session token |+| token | string | The new user session token || user_id | snowflake | The authenticated user ID |-| user | [partial user](/http-api/users/#partial-user-object) object | The public representation of the authenticated account |-| redirect_to<sup>1</sup> | string | The sanitised redirect that was bound to the consumed SSO state |--<sup>1</sup> The value is the empty string when [start SSO](#start-sso) received no `redirect_to` or when the supplied value did not survive sanitisation+| user | [partial user](/http-api/users/#partial-user-object) object | The authenticated account |+| redirect_to | string | The `redirect_to` given to [start SSO](#start-sso), or an empty string |-A client MUST branch on the `mfa` member. When it is `true`, the object has the MFA challenge fields and `redirect_to` instead of a session, and the client finishes the sign-in with the ticket the same way as after [password login](#log-in-with-a-password).+When `mfa` is `true`, finish the sign-in with the ticket the same way as after [password login](#log-in-with-a-password).## Registration pending approval response object-The ID of a registration that an administrator has yet to approve. Registration returns this object when the account enters approval.+Registration returns this object when an admin has to approve the account first.### Structure| Field | Type | Description || --- | --- | --- || registration_pending_approval | boolean | Always `true` |-| user_id | snowflake | The registered account ID awaiting approval |+| user_id | snowflake | The ID of the account waiting for approval |## Network block response-A request from a blocked network returns 403 `GLOBAL_IP_BANNED` or `GLOBAL_IP_TEMPORARILY_BANNED`. The [error response](/http-api/#error-response) has these extra fields.+A request from a blocked network returns 403 `GLOBAL_IP_BANNED` or `GLOBAL_IP_TEMPORARILY_BANNED`, and the [error response](/http-api/#error-response) has these extra fields.-- `ip_address` is the normalised client address.-- `appeal_email` is always `null` on a self-hosted instance, and `message` names no address.-- `appeals_supported` is always `false` on a self-hosted instance.-- `ban_kind` is `permanent` or `temporary_24h`. `temporary_24h` covers every ban that records an expiry, whatever its length.-- `expires_at` is an ISO 8601 timestamp when the ban records an expiry, and `null` otherwise, including on every permanent ban.-- `reason` is the rule behind the block, as `title` and `url`, or `null`. It is present only when an account decision placed the block and its rule is one Fluxer names on this screen, such as spam or service abuse. Every other block, including a decision whose rule is withheld, returns a response identical to a plain block of the same kind, so `null` says nothing about why the network was blocked. `url` is `null` when the instance has no policy page for the rule.-- `product_name` is the instance name the server uses in `message`. On a self-hosted instance with no name, or one still named Fluxer, it is the web app host name.+| Field | Description |+| --- | --- |+| `ip_address` | The client IP address |+| `appeal_email` | Always `null` on a self-hosted instance |+| `appeals_supported` | Always `false` on a self-hosted instance |+| `ban_kind` | `permanent`, or `temporary_24h` for any ban with an expiry |+| `expires_at` | When the ban ends as an ISO 8601 timestamp, or `null` |+| `reason` | The rule behind the block as `title` and `url`, or `null` |+| `product_name` | The instance name used in `message` |-`message` starts with the block and its end date. It then tells someone on a shared network, such as a school, a workplace, public Wi-Fi, a mobile carrier or a VPN, that the block may have nothing to do with them and that switching networks is the quickest fix. `GET /.well-known/fluxer` is never blocked, so a client can still discover the instance and show this screen.+A blocked network can still load `GET /.well-known/fluxer`, which the app uses to show the block message. Password, passkey, MFA and SSO sign-in still answer from a blocked network so a suspended or closed account sees its [enforcement notice](#enforcement-notice-object). Every other result is the same network block error.## Enforcement notice object-`ACCOUNT_SUSPENDED_TEMPORARILY` and `ACCOUNT_SUSPENDED_PERMANENTLY` have `notice`, the enforcement notice for the account, in the request locale. It is `null` only for an account its holder deleted.--- `decision_id` is the decision reference, or `null` for a restriction from before decisions.-- `kind` is what the decision did, `suspension` or `closure` on these codes.-- `permanent` is `true` for a suspension with no end date.-- `issued_at`, `ends_at` and `deletion_at` are ISO 8601 timestamps or `null`.-- `summary` is one sentence saying what happened, and `effects` lists what the decision means for the holder.-- `rule` is the rule broken, as `title` and `url`, or `null`.-- `facts` is the finding first, then where and when it happened.-- `statement` is a note from the team, or `null`.-- `how_we_decided` lists how the case reached the team and who decided it.-- `appeal` is `email`, `deadline` and `account_has_email`, or `null` on an instance with no appeal route. `deadline` is already formatted for the reader.-- `redress` lists other ways to challenge the decision.--A line in `effects`, `facts` or `redress` can hold a link written as a Markdown link, `[text](url)`. A client shows the text as a link to the address.--An account with no email address receives its notice here. The first sign-in that shows it records it as received, and the appeal deadline counts from then.--## Partial user object--Every authenticated result on this page embeds the public account representation. The [partial user object](/http-api/users/#partial-user-object) on the Users resource defines it, together with its [reply mention preferences](/http-api/users/#reply-mention-preferences).+`ACCOUNT_SUSPENDED_TEMPORARILY` and `ACCOUNT_SUSPENDED_PERMANENTLY` errors have a `notice` field with the enforcement notice for the account, in the request locale.++| Field | Description |+| --- | --- |+| `decision_id` | The decision reference, or `null` |+| `kind` | `suspension` or `closure` |+| `permanent` | `true` for a suspension with no end date |+| `issued_at` | When the decision was made, or `null` |+| `ends_at` | When the suspension ends, or `null` |+| `deletion_at` | When the account will be deleted, or `null` |+| `summary` | One sentence saying what happened |+| `effects` | What the decision means for the account |+| `rule` | The rule broken as `title` and `url`, or `null` |+| `facts` | The finding, then where and when it happened |+| `statement` | A note from the team, or `null` |+| `how_we_decided` | How the case reached the team and who decided |+| `appeal` | `email`, `deadline` and `account_has_email`, or `null` |+| `redress` | Other ways to challenge the decision |++Lines in `effects`, `facts` and `redress` can have Markdown links, `[text](url)`, which the app shows as links.<a id="mfa-challenge-response"></a>## MFA challenge response object-The ticket and the method list a client needs to finish a login with a second factor. Password login returns this object when the account has one, and [complete SSO](#complete-sso) returns it inside its response before it first links such an account.+Sign-in routes return this object when the account has a second factor. Finish with [complete login with TOTP](#complete-login-with-totp) or [complete login with WebAuthn MFA](#complete-login-with-webauthn-mfa).### Structure| Field | Type | Description || --- | --- | --- || mfa | boolean | Always `true` |-| ticket<sup>1</sup> | string | The ticket consumed by a TOTP or WebAuthn MFA completion |-| allowed_methods<sup>2</sup> | array[string] | The methods available to this account, drawn from `totp`, `webauthn`, and `backup_codes` (max 10 items) |-| totp | boolean | Whether the account holds the time-based one-time password authenticator type |-| webauthn<sup>3</sup> | boolean | Whether passkeys are enabled as a second factor |-| backup_codes | boolean | Whether the account holds at least one unconsumed backup code |--<sup>1</sup> The ticket is retained for five minutes, is destroyed after five failed code attempts, and is consumed by the completion that issues the session--<sup>2</sup> The array lists the account's methods in the fixed order `totp`, `webauthn`, then `backup_codes`, and it omits any value the account cannot use+| ticket | string | The ticket for the MFA route, valid for 5 minutes or until 5 wrong codes |+| allowed_methods | array[string] | The methods the account can use, from `totp`, `webauthn` and `backup_codes` (max 10 items) |+| totp | boolean | Whether the account has an authenticator app |+| webauthn | boolean | Whether passkeys are turned on as a second factor |+| backup_codes | boolean | Whether the account has an unused backup code |-<sup>3</sup> The account holds the WebAuthn [authenticator type](/http-api/users/#authenticator-types), which it takes from [Set WebAuthn two-factor authentication](/http-api/users/mfa/#set-webauthn-two-factor-authentication). A registered credential alone does not set it, except on an account with no password credential, where the passkey is the primary credential and always counts--:::note[Backup codes have no completion route of their own]-[Complete login with TOTP](#complete-login-with-totp) reads a backup code from `code`, which is what `backup_codes` in `allowed_methods` points a client at. An account whose only second factor is passkeys can present one there, so a client offers the code input alongside the passkey prompt.-:::+Backup codes go to [complete login with TOTP](#complete-login-with-totp) as `code`.<a id="webauthn-authentication-options"></a>## WebAuthn authentication options object-Both WebAuthn option operations return a PublicKeyCredential request options object that a browser passes straight to its credential request. The [WebAuthn authentication options object](/http-api/users/mfa/#webauthn-authentication-options-object) on the Multi-factor authentication resource defines its fields, together with its [WebAuthn credential descriptor](/http-api/users/mfa/#webauthn-credential-descriptor-object) and [WebAuthn client extension inputs](/http-api/users/mfa/#webauthn-client-extension-inputs-object) objects.--A challenge issued for MFA completion is also bound to its ticket and account, so it cannot be replayed against discoverable login. The MFA route lists one group of the resolved account's credentials in `allowCredentials`, and the discoverable route omits the member, because discovery happens at the authenticator.+The WebAuthn options routes return a [WebAuthn authentication options object](/http-api/users/mfa/#webauthn-authentication-options-object). Pass it to the browser's credential request.<a id="webauthn-assertion"></a>## WebAuthn assertion object-A WebAuthn authentication request has the browser credential result as `response` and the original server challenge as `challenge`. Fluxer accepts additional WebAuthn fields. The [WebAuthn assertion object](/http-api/users/mfa/#webauthn-assertion-object) on the Multi-factor authentication resource defines the fields, together with its [WebAuthn assertion response](/http-api/users/mfa/#webauthn-assertion-response-object) and [WebAuthn client extension results](/http-api/users/mfa/#webauthn-client-extension-results-object) objects.+WebAuthn sign-in routes take the browser credential result as `response` and the challenge as `challenge`. The [WebAuthn assertion object](/http-api/users/mfa/#webauthn-assertion-object) on the Multi-factor authentication resource has its fields.## Authentication session object-One live session belonging to the authenticated account. The listing is ordered by approximate last activity, newest first.+One active session of the account.### Structure| Field | Type | Description || --- | --- | --- |-| id_hash<sup>1</sup> | string | The base64url SHA-256 digest of the session token |-| client_info? | ?[client info](#client-info-object) object | The parsed client metadata recorded when the session was created |-| masked_ip | ?string | The semi-redacted IP address recorded for the session |-| approx_last_used_at? | ?ISO8601 timestamp | The approximate time of the last request that used this session |-| current<sup>2</sup> | boolean | Whether this session supplied the credential for the current request |--<sup>1</sup> This digest is the only session identifier the API exposes, and it is the exact value accepted by [terminate authentication sessions](#terminate-authentication-sessions)--<sup>2</sup> Exactly one entry is true, the session whose token authenticated the request--A client that needs to identify its own session reads the entry whose `current` is true.+| id_hash | string | The ID of the session, used by [terminate authentication sessions](#terminate-authentication-sessions) |+| client_info? | ?[client info](#client-info-object) object | The device that created the session |+| masked_ip | ?string | The partly hidden IP address of the session |+| approx_last_used_at? | ?ISO8601 timestamp | About when the session was last used |+| current | boolean | Whether this session made the current request |## Client info object-The parsed device metadata recorded for a session or a pending handoff.+The device behind a session or a pending handoff, taken from its request headers.### Structure| Field | Type | Description || --- | --- | --- |-| platform? | ?string | The recorded client platform, resolved from the `User-Agent` |-| os? | ?string | The recorded operating system |-| browser?<sup>1</sup> | ?string | The recorded browser |-| device | string | The device class, either `mobile` or `desktop` |-| location? | ?[client location](#client-location-object) object | The approximate geolocation derived from the recorded IP address |--<sup>1</sup> A native or Electron client reports null, as does a session created by an unparseable request. A handoff omits the member entirely--Device metadata is inferred from the client's request headers. Treat `platform` as a display label, not a stable application identifier. Location is approximate and can be unavailable. A session then reports null `location`, while a handoff reports an object with null members.+| platform? | ?string | The client platform, for display only |+| os? | ?string | The operating system |+| browser? | ?string | The browser, or null for the desktop and mobile apps |+| device | string | `mobile` or `desktop` |+| location? | ?[client location](#client-location-object) object | The approximate location of the IP address |## Client location object-The approximate geolocation Fluxer derives from the IP address recorded for a session or a handoff.+The approximate location of a session or handoff IP address.### Structure@@ -262,37 +214,31 @@ The approximate geolocation Fluxer derives from the IP address recorded for a se| Field | Type | Description || --- | --- | --- |-| valid<sup>1</sup> | boolean | Whether the token is valid and unexpired |--<sup>1</sup> A password reset token expires one hour after it is issued+| valid | boolean | Whether the token is still valid |## Account recovery response object-The result of [recover an account](#recover-an-account). It extends an [authentication token response](#authentication-token-response) or an [MFA challenge response](#mfa-challenge-response) with the two fields below, which are added to either shape.+The result of [recover an account](#recover-an-account), which extends an [authentication token response](#authentication-token-response) or an [MFA challenge response](#mfa-challenge-response) with these fields.### Structure| Field | Type | Description || --- | --- | --- |-| recovery_key<sup>1</sup> | string | The new recovery key, 8 groups of 4 characters joined by `-` |+| recovery_key | string | The new recovery key, 8 groups of 4 characters joined by `-`. Show it to the person, because it is returned only here || recovery_kit_created_at | ISO8601 timestamp | When the new recovery kit was created |-<sup>1</sup> The key replaces the one the request used, and this response is the only way to read it. Next to an MFA ticket the key works only after the MFA completion accepts that ticket+## IP authorization poll object-## IP authorisation poll object--The state of one IP authorisation ticket, as observed by the device whose sign-in was held.+The state of a sign-in that waits for IP authorization.### Structure| Field | Type | Description || --- | --- | --- |-| completed | boolean | Whether the authorisation link has been used and a session has been issued |-| token?<sup>1</sup> | ?string | The newly issued user session token |-| user_id?<sup>1</sup> | ?snowflake | The authenticated user ID |-| user?<sup>1</sup> | ?[partial user](/http-api/users/#partial-user-object) object | The public representation of the authenticated account |--<sup>1</sup> The fields are present together only when `completed` is true, and a still-pending ticket returns `completed` alone+| completed | boolean | Whether the link in the email was used and a session was created |+| token? | ?string | The new user session token, when `completed` is true |+| user_id? | ?snowflake | The authenticated user ID, when `completed` is true |+| user? | ?[partial user](/http-api/users/#partial-user-object) object | The authenticated account, when `completed` is true |## Username suggestions object@@ -300,9 +246,7 @@ The state of one IP authorisation ticket, as observed by the device whose sign-i| Field | Type | Description || --- | --- | --- |-| suggestions<sup>1</sup> | array[string] | The generated username candidates (max 20 items) |--<sup>1</sup> The array has at most one candidate. It is empty when the supplied display name derives no permitted username+| suggestions | array[string] | Usernames made from the display name, currently at most one (max 20 items) |## Username availability object@@ -310,7 +254,7 @@ The state of one IP authorisation ticket, as observed by the device whose sign-i| Field | Type | Description || --- | --- | --- |-| available | boolean | Whether no other account holds the username |+| available | boolean | Whether the username is free |## Identify response object@@ -320,27 +264,19 @@ The next step after [identify an account](#identify-an-account).| Field | Type | Description || --- | --- | --- |-| ticket<sup>1</sup> | string | The ticket the next step sends |+| ticket | string | The ticket for the next step, valid for 15 minutes || account | string | `existing` when an account uses the identifier, `new` otherwise |-| sign_in_method | ?string | `password` when the existing account has a password, `code` when it has none, and null when `account` is `new` |-| registration<sup>2</sup> | ?[identify registration](#identify-registration-object) object | What signing up needs, present when `account` is `new` |--<sup>1</sup> The ticket is valid for 15 minutes and names the identifier only. It holds no credential--<sup>2</sup> Null when `account` is `existing`+| sign_in_method | ?string | `password` or `code` for an existing account, null for a new one |+| registration | ?[identify registration](#identify-registration-object) object | What signing up needs, or null for an existing account |### Identify registration object| Field | Type | Description || --- | --- | --- |-| mode | string | How new accounts are admitted, one of `open`, `approval` or `closed` |+| mode | string | How new accounts are let in, one of `open`, `approval` or `closed` || consent_required | boolean | Whether signing up needs `consent` set to true |-| requires_password | boolean | Whether signing up needs a password, because the instance cannot send email codes |-| instant_account_availability?<sup>1</sup> | string | One of the [instant account availability](/http-api/instance/#instant-account-availability) values |--<sup>1</sup> Whether an account can be created from just a display name, with `registration_url_code` taken into account--An account with a password signs in with its password, and a passkey also works. Only an account without a password signs in with an email code.+| requires_password | boolean | Whether signing up needs a password, because the instance can't send email codes |+| instant_account_availability? | string | One of the [instant account availability](/http-api/instance/#instant-account-availability) values |## Email code send response object@@ -348,9 +284,9 @@ An account with a password signs in with its password, and a passkey also works.| Field | Type | Description || --- | --- | --- |-| purpose | string | `sign_in` when the code signs in to an existing account, `sign_up` when it creates one |-| code_expires_at | ISO8601 timestamp | When the emailed code stops working, 10 minutes after sending |-| resend_available_at | ISO8601 timestamp | When another code can be requested, 30 seconds after sending |+| purpose | string | `sign_in` for an existing account, `sign_up` for a new one |+| code_expires_at | ISO8601 timestamp | When the code stops working, 10 minutes after sending |+| resend_available_at | ISO8601 timestamp | When you can ask for another code, 30 seconds after sending |## Account handoff object@@ -358,7 +294,7 @@ An account with a password signs in with its password, and a passkey also works.| Field | Type | Description || --- | --- | --- |-| handoff_code | string | The code the web app or a native app redeems, 43 URL-safe base64 characters |+| handoff_code | string | The code the web app or a mobile app redeems, 43 URL-safe base64 characters |## CAPTCHA challenge object@@ -366,41 +302,33 @@ An account with a password signs in with its password, and a passkey also works.| Field | Type | Description || --- | --- | --- |-| captcha_provider | string | `altcha` while the check is on and `none` while it is off |-| altcha_challenge? | object | The ALTCHA challenge, present when `captcha_provider` is `altcha` |+| captcha_provider | string | `altcha` when the check is on, `none` when it is off |+| altcha_challenge? | object | The ALTCHA challenge, when `captcha_provider` is `altcha` |## Handoff initiation object-The code that identifies one pending desktop handoff.+A pending desktop handoff. Show `code` only to the person signing in, because anyone with it can see the device details.### Structure| Field | Type | Description || --- | --- | --- |-| code<sup>1</sup> | string | The handoff code to present to the approving device |-| expires_at | ISO8601 timestamp | The time at which the handoff expires, five minutes after creation |-| poll_secret? | string | The secret the initiating device presents to read the issued token |-| return_method? | string | How the approving browser hands the sign-in back, `deep_link` when the request registered a `return_uri` and `code` otherwise |--<sup>1</sup> The code is 12 characters drawn from the alphabet `ABCDEFGHJKMNPQRSTUVWXYZ23456789`, rendered as two groups of six separated by a hyphen--:::caution[The code alone reads the device metadata]-Anyone who learns the code reads the pending device metadata. Reading the token and cancelling the handoff both require `poll_secret`. A client MUST show the code only to the person performing the handoff.-:::+| code | string | The 12-character code to enter on the signed-in device, shown as 2 groups of 6 |+| expires_at | ISO8601 timestamp | When the handoff expires, 5 minutes after creation |+| poll_secret? | string | The secret you need to get the token or cancel the handoff |+| return_method? | string | `deep_link` when the request set a `return_uri`, `code` otherwise |## Handoff information object-The device metadata shown to the approving device before it transfers a session.+The device details the signed-in device shows before it approves.### Structure| Field | Type | Description || --- | --- | --- |-| status | string | The state, either `pending` or `expired` |-| client_info?<sup>1</sup> | ?[client info](#client-info-object) object | The initiating device metadata |-| return_method? | string | How the approving browser hands the sign-in back, either `deep_link` or `code`, present only when the status is `pending` |--<sup>1</sup> The value is null whenever the status is `expired`+| status | string | `pending` or `expired` |+| client_info? | ?[client info](#client-info-object) object | The device that started the handoff, or null when expired |+| return_method? | string | `deep_link` or `code`, when the status is `pending` |## Handoff status object@@ -408,14 +336,12 @@ The device metadata shown to the approving device before it transfers a session.| Field | Type | Description || --- | --- | --- |-| status<sup>1</sup> | string | The state, one of `pending`, `denied`, `expired`, or `completed` |-| token?<sup>2</sup> | ?string | The newly issued user session token |-| user_id?<sup>2</sup> | ?snowflake | The authenticated user ID |-| user?<sup>2</sup> | ?[partial user](/http-api/users/#partial-user-object) object | The public representation of the authenticated account |--<sup>1</sup> An unknown code and an expired code both report `expired`+| status | string | One of `pending`, `denied`, `expired` or `completed` |+| token? | ?string | The new user session token, when the status is `completed` |+| user_id? | ?snowflake | The authenticated user ID, when the status is `completed` |+| user? | ?[partial user](/http-api/users/#partial-user-object) object | The authenticated account, when the status is `completed` |-<sup>2</sup> The fields are present together only when the status is `completed`+An unknown code reports `expired`.## Handoff completion object@@ -423,9 +349,7 @@ The device metadata shown to the approving device before it transfers a session.| Field | Type | Description || --- | --- | --- |-| return_url<sup>1</sup> | string | The registered `return_uri` with the handoff `code` and a one-time `grant` in its query string |--<sup>1</sup> The grant is 32 random bytes as 43 base64url characters, and only the initiating app that receives the link can present it+| return_url | string | The `return_uri` with the handoff `code` and a one-time `grant` in its query string |## Origin handoff object@@ -433,7 +357,7 @@ The device metadata shown to the approving device before it transfers a session.| Field | Type | Description || --- | --- | --- |-| handoff_id | string | The single-use identifier the receiving origin redeems, 32 random bytes as 43 base64url characters |+| handoff_id | string | The one-use ID the other origin redeems, 43 base64url characters |## Origin handoff payload object@@ -441,235 +365,156 @@ The device metadata shown to the approving device before it transfers a session.| Field | Type | Description || --- | --- | --- |-| payload | string | The base64url string stored by [create origin handoff](#create-origin-handoff), returned unchanged |+| payload | string | The string stored by [create origin handoff](#create-origin-handoff), unchanged |## Get SSO status<RouteHeader method="GET" path="/v1/auth/sso/status" unauthenticated />-Reads the public single sign-on state of the instance. Authentication is not required. Returns an [SSO status](#sso-status-object) object.--The operation stays available while SSO is enforced. It shares the `auth:sso:start` bucket, which permits 10 requests per 10 seconds.+Returns the [SSO status](#sso-status-object) of the instance.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [SSO status](#sso-status-object) object | The public SSO state was read |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |+| 200 | [SSO status](#sso-status-object) object | The SSO state was returned |++The rate limit is 10 requests per 10 seconds, on the shared `auth:sso:start` bucket.## Start SSO<RouteHeader method="POST" path="/v1/auth/sso/start" unauthenticated />-Starts a single sign-on flow. Authentication is not required. Returns an [SSO start](#sso-start-object) object. Send the user to `authorization_url` unchanged.+Starts single sign-on and returns an [SSO start](#sso-start-object) object. Send the user to `authorization_url`.### JSON body| Field | Type | Description || --- | --- | --- |-| redirect_to?<sup>1</sup> | ?string | The post-authentication redirect to bind to the state |-| redirect_uri?<sup>2</sup> | ?string | The callback URI the client wants the result delivered to |+| redirect_to?<sup>1</sup> | ?string | The path to open after sign-in |+| redirect_uri?<sup>2</sup> | ?string | The callback URI for the result |-<sup>1</sup> Fluxer sanitises the value before binding it to the state and discards a value that does not survive, which the [SSO completion response](#sso-completion-response-object) reports as the empty string. Sanitisation keeps the trimmed value only when it begins with a single `/`, is at most 2,048 characters, and contains no carriage return or line feed+<sup>1</sup> Kept only when it starts with a single `/` and is at most 2,048 characters-<sup>2</sup> The accepted values are the instance default reported as `redirect_uri` by [get SSO status](#get-sso-status) and the mobile callback `fluxer://auth/sso/callback`, and any other value returns the field code `INVALID_URL_FORMAT`. The provider always receives the instance default. For the mobile callback the state starts with `m.`, and the web callback page forwards the provider's query string to `fluxer://auth/sso/callback` unchanged+<sup>2</sup> Must be the instance default from [get SSO status](#get-sso-status) or `fluxer://auth/sso/callback` for the mobile apps. Any other value returns the field code `INVALID_URL_FORMAT`### Response| Status | Body | Condition || --- | --- | --- || 200 | [SSO start](#sso-start-object) object | The state was created |-| 400 | [error response](/http-api/#error-response) | The body is malformed or the callback URI is not an accepted value |-| 403 | [error response](/http-api/#error-response) | SSO is disabled or its resolved configuration is incomplete, returning `FEATURE_TEMPORARILY_DISABLED` |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--The returned state can be completed once and expires after ten minutes. Starting the flow changes no account state and emits no Gateway Dispatch.+| 403 | [error response](/http-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED` when SSO is off or not fully configured |-### Rate limit--10 requests per 10 seconds, on the `auth:sso:start` bucket.+The rate limit is 10 requests per 10 seconds, on the `auth:sso:start` bucket.## Complete SSO<RouteHeader method="POST" path="/v1/auth/sso/complete" unauthenticated />-Completes a single sign-on flow and signs in or creates the linked account. Authentication is not required. Returns an [SSO completion response](#sso-completion-response-object).+Signs in or creates the account linked to the provider identity and returns an [SSO completion response](#sso-completion-response-object). The state works once, and after any failure you start again with [start SSO](#start-sso).++An unlinked identity is linked to the account with the same verified email, after the second factor if the account has one. A new account has no password and accepts no invite, and it joins the instance's single community when the instance has one. On an `email` instance it gets the provider's verified email, and when SSO is enforced each sign-in sets the account email to it.-When the provider subject is not yet linked and the verified provider email belongs to an account with a second factor, completion returns the MFA challenge shape of that response. The account has a second factor when it has TOTP, passkeys as a second factor, or an unconsumed backup code. Fluxer binds the subject to the account and issues the session only when the ticket completes through [complete login with TOTP](#complete-login-with-totp) or [complete login with WebAuthn MFA](#complete-login-with-webauthn-mfa), and that completion returns an [authentication token response](#authentication-token-response). A ticket that expires leaves the subject unlinked. Later sign-ins with the linked subject return a session directly.+:::caution[A verified provider email takes over a matching account]+Turn on SSO only for a provider that controls the email addresses it asserts.+:::### JSON body| Field | Type | Description || --- | --- | --- |-| code | string | The authorisation code returned by the provider (1-4096 characters) |-| state<sup>1</sup> | string | The state returned by [start SSO](#start-sso) (1-4096 characters) |--<sup>1</sup> The state is consumed on the first call that resolves it, so a repeated request with the same state returns the field code `INVALID_OR_EXPIRED_SSO_STATE`--:::note[Identity binding is one-to-one]-A provider subject is bound to exactly one Fluxer account, and an account accepts exactly one provider subject. A subject already linked to a different account returns the field code `SSO_IDENTITY_LINKED_TO_ANOTHER_ACCOUNT`, and a new subject for an account that already holds a different linked subject returns `SSO_ACCOUNT_LINKED_TO_ANOTHER_IDENTITY`.-:::--:::caution[A verified provider email adopts a local account]-When the subject is not yet linked, Fluxer adopts any existing account holding the verified email address in the provider claim and binds the subject to it, whether or not that account has a password. A provider that asserts an arbitrary verified address therefore takes over a matching local account that has no second factor. An operator MUST enable SSO only for a provider that controls the addresses it asserts.-:::--Fluxer refuses the adoption only when the account already holds a different provider subject.--While the instance enforces single sign-on, a sign-in on an instance where people sign in with an email replaces the account email with a different verified provider email, unless another account already holds it. Deleting an account releases its provider subject, so the next sign-in with that subject provisions a new account. An account closed by an enforcement action keeps its subject, and a sign-in with it returns 403 `ACCOUNT_SUSPENDED_PERMANENTLY`.--The provider exchange and claim resolution can return the field codes `INVALID_SSO_AUTHORIZATION_CODE`, `INVALID_SSO_TOKEN`, `FAILED_TO_FETCH_SSO_USER_INFO`, `FAILED_TO_PARSE_SSO_USER_INFO`, `SSO_PROVIDER_DID_NOT_RETURN_EMAIL`, `SSO_EMAIL_NOT_VERIFIED`, `SSO_IDENTITY_MISMATCH` when the ID token and the user info disagree on the subject or email, `SSO_MISCONFIGURED`, `INVALID_EMAIL_ADDRESS`, `EMAIL_DOMAIN_NOT_ALLOWED_FOR_SSO`, or `SSO_UNABLE_TO_ALLOCATE_DISCRIMINATOR`. A missing provider email returns the field code `SSO_PROVIDER_DID_NOT_RETURN_EMAIL`, and one the provider marks as unverified returns `SSO_EMAIL_NOT_VERIFIED`. On an instance where people sign in with a username, the email claim is optional unless the SSO configuration lists allowed email domains. Without a domain list, such an instance ignores an unverified email and identifies the account by the subject alone.--Closed registration doesn't stop automatic provisioning, because the provider decides who can sign in. A new account on a self-hosted instance that has its first admin account but hasn't finished setup returns 403 `REGISTRATION_CLOSED`. Before that admin account exists, an instance that enforces its setup token returns the field code `SETUP_TOKEN_REQUIRED` for a new account. An unknown account on an instance with automatic provisioning disabled returns 403 `SSO_REQUIRED`, an account awaiting approval returns 403 `REGISTRATION_PENDING_APPROVAL`, and account suspension returns 403 `ACCOUNT_SUSPENDED_TEMPORARILY` or 403 `ACCOUNT_SUSPENDED_PERMANENTLY`. A provisioned username or display name containing a blocked substring returns 403 `CONTENT_BLOCKED`.--A verified provider email that adopts a bot account returns 403 `BOT_USER_AUTH_SESSION_CREATION_DENIED`, and one that adopts a rejected registration returns 403 `REGISTRATION_REJECTED`.+| code | string | The authorization code from the provider (1-4096 characters) |+| state | string | The state from [start SSO](#start-sso) (1-4096 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [SSO completion response](#sso-completion-response-object) | SSO completed and a session was issued, or the account's second factor is needed first |-| 400 | [error response](/http-api/#error-response) | The body, state, provider exchange, claims, or resolved email is invalid |-| 403 | [error response](/http-api/#error-response) | SSO, registration policy, a bot account, or account suspension rejects completion |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | The identity provider exchange could not be completed |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--A failed completion requires a fresh SSO flow. A newly created account has a verified email, no local password or authenticator, and default settings. SSO registration accepts no invite and joins no guild.+| 200 | [SSO completion response](#sso-completion-response-object) | The account was signed in, or its second factor is needed |+| 400 | [error response](/http-api/#error-response) | `INVALID_OR_EXPIRED_SSO_STATE`, `SSO_EMAIL_NOT_VERIFIED` or another provider or linking code |+| 403 | [error response](/http-api/#error-response) | `SSO_REQUIRED` when the account is unknown and new accounts are off |+| 403 | [error response](/http-api/#error-response) | `REGISTRATION_PENDING_APPROVAL`, `REGISTRATION_REJECTED` or a suspension code |-Approval mode registration instead returns 403 `REGISTRATION_PENDING_APPROVAL` and creates no session. An MFA challenge creates no session and links nothing. Otherwise the operation creates one authentication session and clears an expired temporary suspension.--### Rate limit--15 requests per 10 seconds, on the `auth:sso:complete` bucket.+The rate limit is 15 requests per 10 seconds, on the `auth:sso:complete` bucket.## Register an account<RouteHeader method="POST" path="/v1/auth/register" unauthenticated />-Creates an ordinary account, or an account without an email. Returns an [authentication token response](#authentication-token-response) when the instance admits the account immediately and a [registration pending approval response](#registration-pending-approval-response-object) when it does not. Emits a [Guild Member Add](/gateway/events/#guild-member-add) Gateway event for each guild the new account joins through an invite or through the instance's single community guild.+Creates an account and returns an [authentication token response](#authentication-token-response), or a [registration pending approval response](#registration-pending-approval-response-object) when an admin has to approve it. The request needs a [CAPTCHA](/topics/captcha/), and joining a community sends [Guild Member Add](/gateway/events/#guild-member-add).-Registration verifies a [CAPTCHA](/topics/captcha/). It permits 3 attempts per hour for each client IP address and 15 per hour for each client subnet, which is the IPv4 /24 or IPv6 /48 network. A supplied email address permits 3 attempts per 15 minutes of its own, except on a `username` instance, which discards the address. Those allowances are separate from the route bucket, and only a deployment with `dev.relax_registration_rate_limits` set to true disables them.+A body with only `global_name` creates an [instant account](/admin-api/instance/#auth-configuration-object) with a username made from that name. The person keeps it by [claiming it](/http-api/users/current-user/#claim-an-account).-A body with no `password`, and on an `email` instance no `email` either, asks for an account without an email. New clients send only `global_name`, the name the person wants others to see, and the server derives a username from it. With the `random` [tag style](/http-api/instance/#tag-styles) the server allocates a discriminator for that name, and with `none` it makes the derived username unique and gives it the discriminator `0000`. Either way the person never picks a username and nothing is ever taken. The instance must allow these [instant accounts](/admin-api/instance/#auth-configuration-object), and otherwise the request returns 403 `INSTANT_ACCOUNTS_DISABLED`. The person keeps the account by [claiming it](/http-api/users/current-user/#claim-an-account), which adds an email on an `email` instance and sets a password on a `username` instance. The claim result has `next_step`, which is `confirm_email` when a code was emailed to the new address and `none` when the claim is already complete. They replace the allowances above with 5 accounts per hour and 20 per day for each client IP address, and 40 per hour for each subnet. The CAPTCHA cost doubles for each instant account the same IP address created in the last hour, and once more for each block of accounts the whole instance created in the hour, up to 64 times the base cost.+If you lose the response, try to sign in before you retry, because registration isn't idempotent.### Request headers| Field | Type | Description || --- | --- | --- |-| X-Captcha-Token?<sup>1</sup> | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |-| Accept-Language?<sup>2</sup> | string | The language tag that selects the locale stored on the new account |--<sup>1</sup> A missing token returns 400 `CAPTCHA_REQUIRED` and a rejected token returns 400 `INVALID_CAPTCHA`, each with a new challenge. Verification is skipped entirely while the check is off for the instance--<sup>2</sup> The parsed locale becomes the account locale and selects the language of the verification email+| X-Captcha-Token? | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |+| Accept-Language? | string | The language for the account and the verification email |### JSON body| Field | Type | Description || --- | --- | --- || email?<sup>1</sup> | string | The account email address |-| username?<sup>2</sup> | string | The account username (1-32 characters, letters, digits, and underscores) |-| global_name? | string | The display name after normalisation (1-32 characters) |-| password?<sup>3</sup> | string | The account password (8-256 characters) |-| date_of_birth?<sup>4</sup> | string | The date of birth in exact `YYYY-MM-DD` form |-| consent?<sup>5</sup> | boolean | Whether the person submitted the step that says creating the account accepts the terms of service (default false) |-| invite_code? | ?string | The invite accepted immediately after registration (0-256 characters) |-| registration_url_code?<sup>6</sup> | ?string | The administrator-issued registration URL code (1-256 characters) |-| theme? | string | The initial theme preference, one of `dark`, `dark_legacy`, `coal`, `light`, or `system` |+| username?<sup>2</sup> | string | The username (1-32 characters, letters, digits and underscores) |+| global_name? | string | The display name (1-32 characters) |+| password?<sup>3</sup> | string | The password (8-256 characters) |+| date_of_birth?<sup>4</sup> | string | The date of birth as `YYYY-MM-DD` |+| consent?<sup>5</sup> | boolean | Whether the person accepted the terms of service (default false) |+| invite_code? | ?string | An invite to accept after registration (0-256 characters) |+| registration_url_code?<sup>6</sup> | ?string | A registration URL code from an admin (1-256 characters) |+| theme? | string | The starting theme, one of `dark`, `dark_legacy`, `coal`, `light` or `system` || setup_token?<sup>7</sup> | ?string | The setup token of a new self-hosted instance (1-256 characters) |-<sup>1</sup> Omitting the email address creates an unclaimed account, which has no recovery path until it is [claimed](/http-api/users/current-user/#claim-an-account). An address stored on any account is in use, whether or not it is confirmed. An address whose domain has no usable DNS records, or whose top-level domain the instance blocks, returns the field code `INVALID_EMAIL_ADDRESS`, and an address already in use returns `EMAIL_ALREADY_IN_USE`. When the instance lists allowed email domains, an address on any other domain returns the field code `EMAIL_DOMAIN_NOT_ALLOWED`, unless the sign-up uses an admin-issued registration URL. A `username` instance accepts any string of 1-320 characters here, because older apps send one, and discards it. It stores no address and sends no email. It does not check the address against DNS or the blocklists, or whether another account uses it--<sup>2</sup> Omitting the username derives one from `global_name`: the display name is normalised (NFKC), transliterated to Latin letters (so `Åsa Öberg` gives `Asa_Oberg`, `Дмитрий` gives `Dmitriy` and `さくら` gives `sakura`), and reduced to letters, digits and single underscores of at most 32 characters. Reserved terms are dropped, a name that is reserved on its own such as `everyone` gets a few digits, and a name that leaves nothing, such as emoji only, or one with a blocked substring gets a generated username instead. When every discriminator for the derived name is in use, a close variant with a few digits is used, and a generated username after that. Without `global_name` a generated username is allocated. With `random` all of these get a server-allocated discriminator. On a `username` instance a body with `password` and neither `username` nor `email` returns the field code `USERNAME_LENGTH_INVALID`. A body there with `email` and no `username` asks for the part before the `@` as the username when the address is at the [instance host](#log-in-with-a-password), normalised the way a display name is, so `[email protected]` asks for `alex_lee` and `alex#[email protected]` asks for `alex`. A name another account holds then returns `USERNAME_ALREADY_TAKEN` on `username`. A part that cannot be a username returns the field code a `username` value would, such as `USERNAME_RESERVED_VALUE`, on `username`. An address at any other host, a value with no `@` and a value with a second `@` return `INSTANCE_ADDRESS_REQUIRED` on `email`, whose message names the instance host. Only a body without `email` gets a username from `global_name` or the generator. With the `none` [tag style](/http-api/instance/#tag-styles), a username another account holds in any letter case returns `USERNAME_ALREADY_TAKEN`, a derived username is made unique first, and every account gets the discriminator `0000`. With `random`, which only an `email` instance can use, the discriminator is random+<sup>1</sup> An address already used by any account returns the field code `EMAIL_ALREADY_IN_USE`. On a `username` instance, older apps send the username here as `name@` followed by the instance host. Any other address returns the field code `INSTANCE_ADDRESS_REQUIRED`, and the address is never stored-<sup>3</sup> The password is checked against the public breached-password corpus described under [reset a password](#reset-a-password), and a match returns the field code `PASSWORD_IS_TOO_COMMON`+<sup>2</sup> Without it, Fluxer makes one from `global_name`. On a `none` [tag style](/http-api/instance/#tag-styles) instance a taken name returns the field code `USERNAME_ALREADY_TAKEN`-<sup>4</sup> Read only when the instance [collects date of birth](/http-api/instance/#public-registration-fields-object). An absent value creates the account anyway, and the account then has to [set its date of birth](/http-api/users/current-user/#set-date-of-birth) before most other operations. A blank value, or a value in `YYYY-MM-DD` shape that is not a real calendar date, is today or later, or lies more than 120 years before today (UTC), returns the field code `INVALID_DATE_OF_BIRTH_FORMAT`. A value that is not ten characters in `YYYY-MM-DD` shape fails schema validation with the field code `STRING_LENGTH_EXACT` or `INVALID_FORMAT`+<sup>3</sup> A known breached password returns the field code `PASSWORD_IS_TOO_COMMON`-<sup>5</sup> A false or absent value returns the field code `MUST_AGREE_TO_TOS_AND_PRIVACY_POLICY` on an instance that publishes a terms or privacy document+<sup>4</sup> Used when the instance [collects date of birth](/http-api/instance/#public-registration-fields-object). An age under the minimum for the region (13 by default) returns the field code `MUST_BE_MINIMUM_AGE`. Without it, the account joins its invite's community after it [sets one](/http-api/users/current-user/#set-date-of-birth)-<sup>6</sup> A code supplied on an instance with administrator registration URLs disabled, and a code that does not resolve, both return 400 `REGISTRATION_URL_INVALID`. A valid code overrides the closed registration mode and replaces the instance approval mode with its own approval setting+<sup>5</sup> Must be true on an instance with terms or a privacy policy, or you get the field code `MUST_AGREE_TO_TOS_AND_PRIVACY_POLICY`-<sup>7</sup> Required while a self-hosted instance is unconfigured and has no admin account, where an absent or blank value returns the field code `SETUP_TOKEN_REQUIRED`. Accepted until the first admin account exists, and a wrong value returns the field code `SETUP_TOKEN_INVALID`. Ignored afterwards, on a hosted instance, and on a self-hosted instance that does not enforce the token. Surrounding whitespace is trimmed+<sup>6</sup> Lets the person sign up while registration is closed. An unknown code returns 400 `REGISTRATION_URL_INVALID`-Fluxer resolves the region from the client IP address, and an age below the minimum for that region returns the field code `MUST_BE_MINIMUM_AGE`. The age counts whole years up to today's date in UTC. That minimum is 13 years unless the region sets a different minimum, and the applied minimum appears only in the localised message.--Registration returns 403 `REGISTRATION_CLOSED` when the instance is closed and no valid registration URL was supplied. A self-hosted instance also returns it from the moment its first admin account exists until setup finishes, even with a valid registration URL. A registration that would wait for approval, through the approval mode or a registration URL that requires approval, returns 400 `REGISTRATION_CREDENTIALS_REQUIRED` unless it has a `password`, and on an `email` instance also an `email`, because an account without them could never sign in once approved. That refusal counts against no registration allowance and uses no registration URL seat. On an `email` instance that does not send email, a body with an `email` and no `password` returns 400 `REGISTRATION_CREDENTIAL_REQUIRED`, because nobody could confirm the address and the account would have no way to sign in. A username whose discriminator space is exhausted returns the field code `TOO_MANY_USERS_WITH_THIS_USERNAME`. A username or display name containing a blocked substring returns 403 `CONTENT_BLOCKED`.--After the route rate limit, the CAPTCHA and schema validation, the setup token is checked before every other registration rule. A request for an account without an email that sends no token gets `SETUP_TOKEN_REQUIRED` before the CAPTCHA and before the instant account check. A registration that presents the correct token is admitted whatever the registration mode is, is exempt from the registration allowances above, and receives the wildcard [Admin ACL](/admin-api/#acl-registry) when it creates a claimed account, which needs `email` on an `email` instance and `password` on a `username` instance. A client IP address is permitted 10 wrong tokens per 30 minutes, and further requests that present a token from that address return 429 until the window passes, the correct token included. A request with no token does not count.--:::caution[Registration reports an address already in use]-[Log in with a password](#log-in-with-a-password) and [request password recovery](#request-password-recovery) are enumeration-safe and registration is not. An address that already holds an account returns the field code `EMAIL_ALREADY_IN_USE`, so an unauthenticated caller learns from the response whether that address is registered.-:::--:::caution[Registration is not idempotent]-There is no retry key. A repeated request with the same values creates a second account, or fails on the duplicate email address when one was supplied. A client that loses the response MUST resolve the outcome by attempting a login.-:::+<sup>7</sup> Needed until the first admin account exists. A missing value returns the field code `SETUP_TOKEN_REQUIRED`, and the account that uses it gets the full [Admin ACL](/admin-api/#acl-registry)### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [authentication token response](#authentication-token-response) \| [registration pending approval response](#registration-pending-approval-response-object) | Registration completed or entered the approval state |-| 400 | [error response](/http-api/#error-response) | The body, CAPTCHA, account fields, sign-in credentials, registration URL code, or setup token is invalid |-| 403 | [error response](/http-api/#error-response) | SSO enforcement, registration policy, or content moderation rejects the registration |-| 423 | [error response](/http-api/#error-response) | `GENERAL_ERROR`, because a self-hosted instance with no account yet is still settling its [sign-in method](/http-api/instance/#set-the-setup-sign-in-method) after 15 seconds |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | A route, global, email, IP, or subnet bucket denies the request, or the address has used its wrong setup token allowance |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--The operation applies the instance's registration, email-domain, breached-password, and regional policies before creating the account. It records the accepted terms and privacy policy, authorises the registering client IP address, and sends an email verification message when the instance sends email. An instance that sends no email marks the address verified at creation instead.--An account created without a date of birth joins no guild until it sets one. The invite is held for 7 days and accepted then.--Registration accepts the `invite_code` from the body, or the instance's configured auto-join invite when the body has none. On an instance with single-community mode enabled, the account also joins the community guild. Each join emits [Guild Member Add](/gateway/events/#guild-member-add) to the affected guild's sessions.--Approval mode registration creates no guild membership and no authentication session, and the account cannot sign in until an administrator approves it. The pending registration keeps that invite, and [approving it](/admin-api/instance/#update-pending-registration) joins the account to that guild and to the single community guild. Every other successful registration creates one session and returns its token.--### Rate limit+| 200 | [authentication token response](#authentication-token-response) \| [registration pending approval response](#registration-pending-approval-response-object) | The account was created or is waiting for approval |+| 400 | [error response](/http-api/#error-response) | `CAPTCHA_REQUIRED` or `INVALID_CAPTCHA` |+| 400 | [error response](/http-api/#error-response) | `REGISTRATION_CREDENTIALS_REQUIRED` when an account waiting for approval has no password or email |+| 403 | [error response](/http-api/#error-response) | `REGISTRATION_CLOSED`, `INSTANT_ACCOUNTS_DISABLED` or `CONTENT_BLOCKED` |+| 423 | [error response](/http-api/#error-response) | `GENERAL_ERROR` when a new instance is still setting its [sign-in method](/http-api/instance/#set-the-setup-sign-in-method) |-10 requests per 10 seconds, on the `auth:register` bucket.+The rate limit is 10 requests per 10 seconds, on the `auth:register` bucket.## Identify an account<RouteHeader method="POST" path="/v1/auth/identify" unauthenticated />-Starts the email-first sign-in, which serves both signing in and signing up. Authentication is not required. Returns an [identify response](#identify-response-object) object.--The operation is served only while the instance has [identifier-first sign-in](/admin-api/instance/#auth-configuration-object) turned on, and otherwise returns 403 `FEATURE_TEMPORARILY_DISABLED`. A client reads `identifier_first` in the [instance features](/http-api/instance/#instance-features-object) to decide which sign-in screen to show.--Every answer takes at least 300 milliseconds, and an unknown identifier costs the same lookups as a known one.+Starts identifier-first sign-in for an existing or new account and returns an [identify response](#identify-response-object) object. It works only when `identifier_first` is on in the [instance features](/http-api/instance/#instance-features-object), and otherwise returns 403 `FEATURE_TEMPORARILY_DISABLED`.### Request headers| Field | Type | Description || --- | --- | --- |-| X-Captcha-Token?<sup>1</sup> | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |--<sup>1</sup> Asked for only after heavy use. A challenge is asked once the client IP address has made 10 lookups in 10 minutes, its subnet 100 in an hour, or anyone 10 for the same identifier in an hour. Past the identifier allowance the cost doubles with each further lookup. A device that signed in to the account before, shown by `device_proof` or an authorised IP address, has an identifier allowance of its own. While the instance has the check off, no challenge is asked and the client IP address can make 30 lookups in 10 minutes and its subnet, the IPv4 /24 or IPv6 /48, 300 in an hour, after which lookups return 429 `RATE_LIMITED`+| X-Captcha-Token? | string | The solved ALTCHA challenge, asked for only after many lookups |### JSON body| Field | Type | Description || --- | --- | --- |-| email?<sup>1</sup> | string | The email address, on an `email` instance |-| login?<sup>1</sup> | string | The username, on a `username` instance |+| email? | string | The email address, on an `email` instance |+| login? | string | The username, on a `username` instance || device_proof? | string | The `device_proof` from an earlier sign-in on this device (1-128 characters) |-| registration_url_code? | ?string | The administrator-issued registration URL code, for a sign-up (1-256 characters) |--<sup>1</sup> Send the one the instance signs in with. A missing value returns the field code `EMAIL_IS_REQUIRED` on `email` or `USERNAME_LENGTH_INVALID` on `login`+| registration_url_code? | ?string | A registration URL code from an admin, for a sign-up (1-256 characters) |### Response@@ -677,77 +522,43 @@ Every answer takes at least 300 milliseconds, and an unknown identifier costs th| --- | --- | --- || 200 | [identify response](#identify-response-object) object | The identifier was looked up |-### Side effects--The operation stores the ticket for 15 minutes and changes no account. No Gateway Dispatch is emitted.--### Rate limit--10 requests per 10 seconds, on the `auth:identify` bucket.+The rate limit is 10 requests per 10 seconds, on the `auth:identify` bucket.## Send an email code<RouteHeader method="POST" path="/v1/auth/email-code/send" unauthenticated />-Emails a 6-digit code to the address behind an identify ticket. The code signs in to the existing account, or creates a new one. Authentication is not required. Returns an [email code send response](#email-code-send-response-object) object.--An instance that cannot send email, or that has identifier-first sign-in turned off, returns 400 `EMAIL_CODES_UNAVAILABLE`, and so does every `username` instance. An unknown or expired ticket returns 400 `UNKNOWN_SIGN_IN_TICKET`. A ticket for an account that has a password returns 400 `PASSWORD_SIGN_IN_REQUIRED` and sends no email.+Emails a 6-digit code for an identify ticket and returns an [email code send response](#email-code-send-response-object) object. A sign-up needs a [CAPTCHA](/topics/captcha/) and goes through the same checks as [register an account](#register-an-account).### Request headers| Field | Type | Description || --- | --- | --- |-| X-Captcha-Token?<sup>1</sup> | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |--<sup>1</sup> A sign-up always needs one. A sign-in needs one once the address has had 5 codes in an hour, with the cost doubling for each further code, or 5 wrong codes in a day on codes that one subnet asked for the address from devices that never signed in to the account+| X-Captcha-Token? | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |### JSON body| Field | Type | Description || --- | --- | --- || ticket | string | The ticket from [identify an account](#identify-an-account) (1-128 characters) |-| registration_url_code?<sup>1</sup> | ?string | The administrator-issued registration URL code (1-256 characters) |--<sup>1</sup> Read only for a sign-up, with the same rules as in [register an account](#register-an-account)--A sign-up also runs the registration checks of [register an account](#register-an-account): the registration mode, the address checks and the per-address and per-network registration allowances.--While a self-hosted instance still requires its setup token, a sign-up returns the field code `SETUP_TOKEN_REQUIRED` on `setup_token` and no code is sent. Only [register an account](#register-an-account) takes the token, so the first account of an instance is created there. Once the first admin account exists, a sign-up returns 403 `REGISTRATION_CLOSED` until setup finishes.--Asking again for the same ticket within 30 seconds returns 429 `EMAIL_CODE_RESEND_COOLDOWN` with `retry_after`. After 5 codes to one address in an hour, each further code waits twice as long as the one before, up to 15 minutes, and early requests get the same error. Each client IP address can send 20 codes per hour and each subnet 100.--Wrong codes also stop sends until the end of the UTC day, with the same error. Each wrong code counts against the subnet, the IPv4 /24 or IPv6 /48, that asked for the code, wherever the guess comes from. After 30 wrong codes on codes that one subnet asked for an address from devices that never signed in to the account, that subnet gets no more codes for the address, and other networks still do. After 50 wrong codes from the account's own devices, counted with wrong codes in [sudo mode](/http-api/users/mfa/#sudo-mode), the account gets no more sign-in or sudo codes. Password and passkey sign-in keep working.--:::note[A bounced address answers the same]-An account whose address bounced gets the same response and no email, so the answer does not reveal the bounce.-:::+| registration_url_code? | ?string | A registration URL code from an admin, for a sign-up (1-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [email code send response](#email-code-send-response-object) object | The code was sent, or the address bounced |-| 400 | [error response](/http-api/#error-response) | The body, ticket, CAPTCHA, address or registration URL code is invalid, or no code can be sent |-| 403 | [error response](/http-api/#error-response) | Registration policy or SSO enforcement rejects the operation |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | A route, global, address, IP, subnet or wrong-code limit denies the request, or the resend cooldown is running |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects+| 200 | [email code send response](#email-code-send-response-object) object | The code was sent |+| 400 | [error response](/http-api/#error-response) | `EMAIL_CODES_UNAVAILABLE` when the instance can't send codes |+| 400 | [error response](/http-api/#error-response) | `UNKNOWN_SIGN_IN_TICKET`, or `PASSWORD_SIGN_IN_REQUIRED` when the account has a password |+| 429 | [error response](/http-api/#error-response) | `EMAIL_CODE_RESEND_COOLDOWN` before `retry_after` seconds have passed |-The operation stores the code for 10 minutes and emails it with the approximate location and device that asked for it. A new code replaces the previous one for the same ticket. No Gateway Dispatch is emitted.--### Rate limit--5 requests per minute, on the `auth:email_code:send` bucket.+The rate limit is 5 requests per minute, on the `auth:email_code:send` bucket.## Verify an email code<RouteHeader method="POST" path="/v1/auth/email-code/verify" unauthenticated />-Checks the emailed code. Authentication is not required. For an existing account it signs in and returns an [authentication token response](#authentication-token-response), or an [MFA challenge response](#mfa-challenge-response) when the account has a second factor. For a new address it creates the account with a confirmed email and returns what [register an account](#register-an-account) returns.--A wrong code returns 400 `INVALID_SIGN_IN_CODE` and counts toward the wrong-code limits of [send an email code](#send-an-email-code). Each code allows 5 tries, after which, or after it expires, the code returns 400 `SIGN_IN_CODE_EXPIRED`. A correct code uses up the ticket.+Checks the emailed code and signs in to the existing account, or creates the account for a new address the way [register an account](#register-an-account) does, with the email already verified. A code allows 5 tries. When the code confirms an address that was never confirmed, it also ends every other session of the account, forgets its authorized IP addresses and revokes its OAuth2 grants.### JSON body@@ -755,116 +566,71 @@ A wrong code returns 400 `INVALID_SIGN_IN_CODE` and counts toward the wrong-code| --- | --- | --- || ticket | string | The ticket from [identify an account](#identify-an-account) (1-128 characters) || code | string | The 6-digit code from the email |-| consent?<sup>1</sup> | boolean | Whether the person submitted the step that says creating the account accepts the terms of service, for a sign-up |-| registration_url_code? | ?string | The administrator-issued registration URL code, for a sign-up (1-256 characters) |-| invite_code?<sup>2</sup> | ?string | The invite to open after sign-up (0-256 characters) |--<sup>1</sup> Required for a sign-up when the [identify registration](#identify-registration-object) object has `consent_required` set to true. A false or absent value then returns the field code `MUST_AGREE_TO_TOS_AND_PRIVACY_POLICY` before the code is checked, so the same code still works on the next try--<sup>2</sup> An account that still has to enter a date of birth joins the community after that step--A new account gets a username derived from the part of the address before the `@`. A ticket for an account that has a password returns 400 `PASSWORD_SIGN_IN_REQUIRED` before the code is checked. Signing in to an account whose address was never confirmed confirms it, and that ends every other session of the account, forgets its authorised IP addresses and revokes its OAuth2 tokens. An account with a second factor gets an MFA ticket instead, its address stays unconfirmed, and passing the factor authorises the client IP address.+| consent?<sup>1</sup> | boolean | Whether the person accepted the terms of service, for a sign-up |+| registration_url_code? | ?string | A registration URL code from an admin, for a sign-up (1-256 characters) |+| invite_code? | ?string | An invite to open after sign-up (0-256 characters) |-An address that changed owner since the ticket was issued returns 400 `UNKNOWN_SIGN_IN_TICKET`. Account policy can return 403 `REGISTRATION_PENDING_APPROVAL`, 403 `REGISTRATION_REJECTED`, 403 `ACCOUNT_BELOW_MINIMUM_AGE` or a suspension code.--While a self-hosted instance still requires its setup token, a sign-up returns the field code `SETUP_TOKEN_REQUIRED` on `setup_token` before the code is checked, and creates no account. Once the first admin account exists, a sign-up returns 403 `REGISTRATION_CLOSED` until setup finishes.+<sup>1</sup> Needed when `consent_required` is true in the [identify registration](#identify-registration-object) object### Response| Status | Body | Condition || --- | --- | --- || 200 | [authentication token response](#authentication-token-response) \| [MFA challenge response](#mfa-challenge-response) \| [registration pending approval response](#registration-pending-approval-response-object) | The code was accepted |-| 400 | [error response](/http-api/#error-response) | The body, ticket or code is invalid, or the account has a password |-| 403 | [error response](/http-api/#error-response) | Account policy, registration policy or SSO enforcement rejects the operation |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--A sign-in creates one authentication session, authorises the client IP address and returns a `device_proof`. A sign-up creates the account the way [register an account](#register-an-account) does, with the address already confirmed. No Gateway Dispatch is emitted for a sign-in.+| 400 | [error response](/http-api/#error-response) | `INVALID_SIGN_IN_CODE` or `SIGN_IN_CODE_EXPIRED` |-### Rate limit--10 requests per minute, on the `auth:email_code:verify` bucket.+The rate limit is 10 requests per minute, on the `auth:email_code:verify` bucket.## Get the website sign-up challenge<RouteHeader method="GET" path="/v1/auth/register/handoff/challenge" unauthenticated />-Returns the CAPTCHA challenge that [start an account for the website](#start-an-account-for-the-website) needs for one visitor right now. Returns a [CAPTCHA challenge](#captcha-challenge-object) object.--Only a caller holding a trusted caller key for the `auth:register:handoff:challenge` bucket may call it. It sends the key in `X-Fluxer-Internal-Key` and the visitor IP address in `X-Fluxer-Client-IP`, and any other caller gets 403 `MISSING_ACCESS`. An instance with instant accounts turned off returns 403 `INSTANT_ACCOUNTS_DISABLED`.+Returns the [CAPTCHA challenge](#captcha-challenge-object) for [start an account for the website](#start-an-account-for-the-website). Only a trusted caller can use it, with its key in `X-Fluxer-Internal-Key` and the visitor IP address in `X-Fluxer-Client-IP`.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [CAPTCHA challenge](#captcha-challenge-object) object | The challenge was issued |-| 403 | [error response](/http-api/#error-response) | The caller is not trusted, or instant accounts are off |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects+| 200 | [CAPTCHA challenge](#captcha-challenge-object) object | The challenge was returned |+| 403 | [error response](/http-api/#error-response) | `MISSING_ACCESS` for an untrusted caller, or `INSTANT_ACCOUNTS_DISABLED` |-None. The response has `Cache-Control: no-store`. No Gateway Dispatch is emitted.--### Rate limit--20 requests per minute for each visitor IP address, on the `auth:register:handoff:challenge` bucket.+The rate limit is 20 requests per minute, on the `auth:register:handoff:challenge` bucket.## Start an account for the website<RouteHeader method="POST" path="/v1/auth/register/handoff" unauthenticated />-Checks the display name a visitor of the website typed and returns a code the web app redeems. Returns an [account handoff](#account-handoff-object) object. No account exists until [create a website account](#create-a-website-account) redeems the code, because the visitor accepts the terms of service in the web app, where the notice sits next to the create account button.--The same trusted caller rule as [get the website sign-up challenge](#get-the-website-sign-up-challenge) applies, for the `auth:register:handoff` bucket. The operation succeeds only while registration is `open`, and otherwise returns 403 `REGISTRATION_CLOSED`. A display name that breaks the display name rules returns a field code on `global_name` such as `GLOBAL_NAME_LENGTH_INVALID`, and one with a blocked substring returns 403 `CONTENT_BLOCKED`. Nothing about the username is checked here, because the username is derived when the account is created. While a self-hosted instance still requires its setup token, the operation returns the field code `SETUP_TOKEN_REQUIRED` on `setup_token`.+Checks a display name typed on the website and returns an [account handoff](#account-handoff-object) code that the app redeems within 15 minutes. No account exists until [create a website account](#create-a-website-account) runs. Only a trusted caller can use it, as with [get the website sign-up challenge](#get-the-website-sign-up-challenge).### Request headers| Field | Type | Description || --- | --- | --- |-| X-Captcha-Token<sup>1</sup> | string | The visitor's solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |--<sup>1</sup> The cost grows with recent instant account sign-ups, as described under [register an account](#register-an-account)+| X-Captcha-Token | string | The visitor's solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |### JSON body| Field | Type | Description || --- | --- | --- |-| global_name | string | The display name for the new account (1-32 characters after normalisation) |+| global_name | string | The display name for the new account (1-32 characters) || nonce_hash | string | The hex SHA-256 of a random nonce the visitor's browser keeps || locale? | string | The locale of the page the visitor started from (2-16 characters) |-| registration_url_code? | ?string | The administrator-issued registration URL code the visitor arrived with (1-256 characters) |+| registration_url_code? | ?string | A registration URL code from an admin (1-256 characters) |### Response| Status | Body | Condition || --- | --- | --- || 200 | [account handoff](#account-handoff-object) object | The display name is allowed |-| 400 | [error response](/http-api/#error-response) | The body or CAPTCHA is invalid |-| 403 | [error response](/http-api/#error-response) | The caller is not trusted, registration is not open, instant accounts are off, or the display name is blocked |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | A route, global, IP or subnet bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects+| 403 | [error response](/http-api/#error-response) | `REGISTRATION_CLOSED`, `INSTANT_ACCOUNTS_DISABLED` or `CONTENT_BLOCKED` |-The operation stores the display name, the nonce hash and the visitor IP address under the handoff code for 15 minutes. It creates no account and no session, and holds no username. No Gateway Dispatch is emitted.--### Rate limit--10 requests per 10 seconds for each visitor IP address, on the `auth:register:handoff` bucket.+The rate limit is 10 requests per 10 seconds, on the `auth:register:handoff` bucket.## Create a website account<RouteHeader method="POST" path="/v1/auth/register/handoff/redeem" unauthenticated />-Creates the account started by [start an account for the website](#start-an-account-for-the-website) and starts a session for it. Authentication is not required. Returns an [authentication token response](#authentication-token-response) with an optional `entry`, the community to open next.--The web app and the native apps redeem the code, so the request needs no `Origin`.+Creates the account started on the website and returns an [authentication token response](#authentication-token-response). The account follows the instant account rules of [register an account](#register-an-account).### JSON body@@ -872,680 +638,368 @@ The web app and the native apps redeem the code, so the request needs no `Origin| --- | --- | --- || handoff_code | string | The code from the website, 43 URL-safe base64 characters || nonce | string | The nonce whose hash was sent with the handoff (16-256 URL-safe base64 characters) |-| consent?<sup>1</sup> | boolean | Whether the person submitted the step that says creating the account accepts the terms of service |-| global_name?<sup>2</sup> | string | The display name, when the person changed it in the app (1-32 characters after normalisation) |--<sup>1</sup> A false or absent value returns the field code `MUST_AGREE_TO_TOS_AND_PRIVACY_POLICY` on an instance that publishes a terms or privacy document. The code stays usable--<sup>2</sup> Defaults to the display name sent with the handoff. A value that breaks the display name rules returns a field code on `global_name`, and one with a blocked substring returns 403 `CONTENT_BLOCKED`. Both answer before the code is used--While a self-hosted instance still requires its setup token, the operation returns the field code `SETUP_TOKEN_REQUIRED` on `setup_token` before the code is used, and creates no account. Once the first admin account exists, it returns 403 `REGISTRATION_CLOSED` until setup finishes.--A code works once. An unknown, expired or used code returns 400 `UNKNOWN_ACCOUNT_HANDOFF`, and a nonce that does not match returns 400 `INVALID_ACCOUNT_HANDOFF_NONCE` and uses the code up. The account is created with the same rules as [register an account](#register-an-account) for an instant account, using the visitor IP address the website passed. Its username is derived from the display name the same way, so no name can be taken in the meantime. On instances that collect dates of birth the new account then has to [set its date of birth](/http-api/users/current-user/#set-date-of-birth) before anything else.+| consent? | boolean | Whether the person accepted the terms of service |+| global_name? | string | The display name, when the person changed it in the app (1-32 characters) |### Response| Status | Body | Condition || --- | --- | --- || 200 | [authentication token response](#authentication-token-response) | The account was created |-| 400 | [error response](/http-api/#error-response) | The body, code, nonce or agreement is invalid |-| 403 | [error response](/http-api/#error-response) | SSO is enforced, registration or instant accounts are off, or the name is blocked |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--The operation creates the account, records when it accepted the terms of service and was shown the privacy policy, creates one authentication session and returns a `device_proof`. It never ends or replaces another session. No Gateway Dispatch is emitted.+| 400 | [error response](/http-api/#error-response) | `UNKNOWN_ACCOUNT_HANDOFF`, or `INVALID_ACCOUNT_HANDOFF_NONCE`, which uses up the code |-### Rate limit--10 requests per minute, on the `auth:register:handoff:redeem` bucket.+The rate limit is 10 requests per minute, on the `auth:register:handoff:redeem` bucket.## Log in with a password<RouteHeader method="POST" path="/v1/auth/login" unauthenticated />-Validates a local password against an email address or a username. Authentication is not required. Returns an [authentication token response](#authentication-token-response) when no second factor and no IP approval are outstanding, and an [MFA challenge response](#mfa-challenge-response) when the account has a second factor.+Signs in with an email address or username and a password. Returns an [authentication token response](#authentication-token-response), or an [MFA challenge response](#mfa-challenge-response) when the account has a second factor. The request needs a [CAPTCHA](/topics/captcha/).++An unknown account and a wrong password both return the field code `INVALID_EMAIL_OR_PASSWORD`, or `INVALID_LOGIN_OR_PASSWORD` on a `username` instance.++A sign-in from a new IP address on an account without a second factor returns 403 `IP_AUTHORIZATION_REQUIRED` with a `ticket` and sends an email. Poll with [poll IP authorization](#poll-ip-authorization) until the person uses the link. Instances that send no email or turn off new-IP authorization skip this step.-Login verifies a [CAPTCHA](/topics/captcha/). It also permits 10 attempts per client IP address in 30 minutes, keyed by the exact IPv4 address or the IPv6 /64 network, and 5 attempts per sign-in identifier in 15 minutes. The identifier is the email address. On a `username` instance it is the lowercased username together with that same IP key, whichever field and form named it, so one source cannot use up the allowance of another. Every admitted attempt consumes these allowances, whether or not the credentials turn out to be correct, and a successful login clears none of them. Each username also permits 100 failed attempts per hour from all sources together, and only a failed attempt consumes that allowance. Once it runs out, a failed attempt returns 429. A correct password then returns 429 too, unless the request carried a solved CAPTCHA or came from an IP address the account has already authorised.+Signing in turns a disabled account back on and cancels a deletion the person scheduled.### Request headers| Field | Type | Description || --- | --- | --- |-| X-Captcha-Token?<sup>1</sup> | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |-| X-Fluxer-Client-Properties?<sup>2</sup> | string | The base64-encoded JSON with the reporting client's `os` |-| User-Agent?<sup>2</sup> | string | The client string recorded on the created session and shown by [list authentication sessions](#list-authentication-sessions) |--<sup>1</sup> A missing token returns 400 `CAPTCHA_REQUIRED` and a rejected token returns 400 `INVALID_CAPTCHA`, each with a new challenge. Verification is skipped entirely while the check is off for the instance--<sup>2</sup> Both values feed the [client info](#client-info-object) object recorded on the session, and `X-Fluxer-Client-Properties` is read only for a native Fluxer `User-Agent`+| X-Captcha-Token? | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |+| X-Fluxer-Client-Properties? | string | Base64 JSON with the app's `os`, for the [client info](#client-info-object) |+| User-Agent? | string | The client string shown in [list authentication sessions](#list-authentication-sessions) |### JSON body| Field | Type | Description || --- | --- | --- |-| email?<sup>1</sup> | string | The account email address, or the sign-in identifier from older apps on a `username` instance |-| login?<sup>1</sup> | string | The sign-in identifier (1-320 characters) |-| password | string | The account password (8-256 characters) |-| invite_code?<sup>2</sup> | ?string | The invite accepted immediately after a successful login (0-256 characters) |--<sup>1</sup> Send one of the two. Sending neither returns the field code `INVALID_FORMAT` on `email`, and an empty or `null` `login` counts as not sent. A body with both uses `email` and ignores `login`. On an `email` instance `login` is an email address, and a value that is not one returns the field code `INVALID_EMAIL_FORMAT` on `login`. On a `username` instance `login` is a username, and `alex#0` or `alex#0000` reads the same as `alex`. There `email` is any string of 1-320 characters, for older apps that only send `email`. It takes the same forms as `login`, and also `alex@` followed by the instance host. The instance host is the host of the public web app address, of any app origin alias or of the instance domain, in any letter case and with or without a port. A host written in Unicode matches its punycode form. The part before the `@` may also be written the way registration normalises it, so `alex.lee@` reaches `alex_lee`. An address at any other host fails like an unknown username--<sup>2</sup> The invite is accepted only on a login that completes without a second factor, and a failure to accept it does not fail the login. A login held for IP authorisation discards the invite--:::note[Unknown accounts and unknown passwords are indistinguishable]-An unknown email address and an incorrect password both return the same paired field codes `INVALID_EMAIL_OR_PASSWORD` on `password` and on whichever of `email` and `login` the request sent. On a `username` instance an unknown username, an address at another host, and an incorrect password all return `INVALID_LOGIN_OR_PASSWORD` on `password` and on whichever of `email` and `login` the request sent, after the same password hashing work.-:::--A new client IP address on an account that has neither a second factor nor the app store reviewer flag returns 403 `IP_AUTHORIZATION_REQUIRED`. That error body has `ip_authorization_required` set to true, the `ticket` used by the IP authorisation operations, the account `email`, and `resend_available_in` set to 30 seconds.--When the instance has disabled new-IP authorisation or sends no email, Fluxer authorises the client IP address silently and the login continues. A `username` instance never sends email. An account that already has a second factor never enters IP authorisation.--Account policy can return 403 `REGISTRATION_PENDING_APPROVAL`, 403 `REGISTRATION_REJECTED`, 403 `ACCOUNT_SUSPENDED_TEMPORARILY`, or 403 `ACCOUNT_SUSPENDED_PERMANENTLY`. A bot account returns 403 `BOT_USER_AUTH_ENDPOINT_ACCESS_DENIED`.--A suspended or closed account gets its 403 after the last factor. Without a second factor that is the password, so login returns it. With a second factor, login returns the MFA ticket and the second factor returns the 403. Both suspension codes have the account's [enforcement notice](#enforcement-notice-object). A suspension with no end date and a closed account return `ACCOUNT_SUSPENDED_PERMANENTLY`, and a suspension with an end date returns `ACCOUNT_SUSPENDED_TEMPORARILY`. An expired temporary suspension is cleared at the same point.--:::note[Signing in reactivates the account]-On an account the user had disabled, signing in clears the disabled state. It also cancels a self-scheduled deletion if erasure has not started. Both happen when the session is created, after any second factor, without a separate confirmation step. Once erasure starts, login returns `ACCOUNT_SUSPENDED_PERMANENTLY`.-:::+| email?<sup>1</sup> | string | The email address, or the username from older apps on a `username` instance |+| login?<sup>1</sup> | string | The email address or username (1-320 characters) |+| password | string | The password (8-256 characters) |+| invite_code? | ?string | An invite to accept after a sign-in with no second factor (0-256 characters) |-:::note[Signing in from a blocked network]-A [blocked network](#network-block-response) can still reach this operation, the second factor operations, passkey sign-in and SSO, so the holder of a suspended or closed account sees its notice. Every other outcome returns the same `GLOBAL_IP_BANNED` or `GLOBAL_IP_TEMPORARILY_BANNED` body any other request from that network gets. That covers an unknown account, a wrong password, and an account that is not suspended or closed, with or without a second factor. No session, MFA ticket or IP authorisation message is created, and SSO provisions no new account.-:::+<sup>1</sup> Send one of the two. On a `username` instance, `alex`, `alex#0` and `alex@` followed by the instance host all mean the same account### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [authentication token response](#authentication-token-response) \| [MFA challenge response](#mfa-challenge-response) | The credentials are accepted |-| 400 | [error response](/http-api/#error-response) | The body, CAPTCHA, sign-in identifier, or password is invalid |-| 403 | [error response](/http-api/#error-response) | Account policy, SSO enforcement, or IP authorisation prevents the login |-| 409 | [error response](/http-api/#error-response) | `CONFLICT`, because the deletion state changed while cancelling a self-scheduled deletion |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | A route, global, identifier, or IP bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--A successful login on an account with a second factor returns an MFA ticket valid for five minutes and issues no session. When IP approval is required, the authorisation ticket remains valid for 15 minutes and the account receives an authorisation message.--A successful login with no outstanding MFA or IP approval creates one authentication session. It accepts the supplied invite first, which emits [Guild Member Add](/gateway/events/#guild-member-add) to the guild's sessions.--### Rate limit+| 200 | [authentication token response](#authentication-token-response) \| [MFA challenge response](#mfa-challenge-response) | The credentials were accepted |+| 403 | [error response](/http-api/#error-response) | `IP_AUTHORIZATION_REQUIRED` when the IP address is new |+| 403 | [error response](/http-api/#error-response) | A suspension code with an [enforcement notice](#enforcement-notice-object), after the last factor |-10 requests per 10 seconds, on the `auth:login` bucket.+The rate limit is 10 requests per 10 seconds, on the `auth:login` bucket.## Complete login with TOTP<RouteHeader method="POST" path="/v1/auth/login/mfa/totp" unauthenticated />-Consumes an MFA ticket and validates a time-based one-time password or an unconsumed backup code, then creates the session. Authentication is not required. Returns an [authentication token response](#authentication-token-response).--MFA verification also permits 10 failed attempts per account in 15 minutes and destroys the ticket after 5 failed attempts.+Finishes a sign-in with an authenticator code or a backup code and returns an [authentication token response](#authentication-token-response).### JSON body| Field | Type | Description || --- | --- | --- |-| code<sup>1</sup> | string | The authenticator code or an unconsumed backup code |-| ticket | string | The ticket returned by [password login](#log-in-with-a-password) or [complete SSO](#complete-sso) |--<sup>1</sup> A validated authenticator code is claimed for 30 seconds, so the same code cannot be presented twice. A backup code is consumed permanently on the attempt that accepts it--A ticket from [recover an account](#recover-an-account) applies that recovery before the session is created, and returns the field code `INVALID_RECOVERY_KEY` on `recovery_key` when the recovery kit changed in the meantime. An expired or unknown ticket returns the field code `SESSION_TIMEOUT` on `ticket`. An account with no TOTP enrolment reads `code` as a backup code, and it returns the field code `TOTP_NOT_ENABLED` on `code` only when it holds no unconsumed backup code either. Both an incorrect code and any code presented after the per-account or per-ticket attempt allowance is exhausted return the field code `INVALID_CODE` on `code`. A ticket that resolves to a bot account returns 403 `BOT_USER_AUTH_ENDPOINT_ACCESS_DENIED`.+| code | string | The authenticator code or an unused backup code |+| ticket | string | The ticket from [password login](#log-in-with-a-password) or [complete SSO](#complete-sso) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [authentication token response](#authentication-token-response) | The ticket and code are accepted |-| 400 | [error response](/http-api/#error-response) | The body, ticket, or code is invalid |-| 403 | [error response](/http-api/#error-response) | SSO enforcement rejects the operation or the ticket resolves to a bot account |-| 404 | [error response](/http-api/#error-response) | The ticket resolves to an account that no longer exists |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--Success consumes the ticket, clears the per-account and per-ticket failed-attempt counters, and creates one authentication session. A failure consumes one attempt from each counter. No Gateway Dispatch is emitted.--### Rate limit+| 200 | [authentication token response](#authentication-token-response) | The code was accepted |+| 400 | [error response](/http-api/#error-response) | The field code `INVALID_CODE`, or `SESSION_TIMEOUT` for an expired ticket |-5 requests per minute, on the shared `auth:login:mfa` bucket.+The rate limit is 5 requests per minute, on the shared `auth:login:mfa` bucket.## Get WebAuthn MFA options<RouteHeader method="POST" path="/v1/auth/login/mfa/webauthn/authentication-options" unauthenticated />-Resolves the account from an MFA ticket and creates a challenge restricted to that account's registered credentials. Authentication is not required. Returns a [WebAuthn authentication options](#webauthn-authentication-options) object.+Returns [WebAuthn authentication options](#webauthn-authentication-options) for the passkeys of the account behind an MFA ticket. The ticket stays valid.### JSON body| Field | Type | Description || --- | --- | --- |-| ticket<sup>1</sup> | string | The ticket returned by [password login](#log-in-with-a-password) or [complete SSO](#complete-sso) (1-256 characters) |--<sup>1</sup> The ticket is read but not consumed--A client MUST still complete the returned challenge through [complete login with WebAuthn MFA](#complete-login-with-webauthn-mfa) before the ticket expires. An expired or unknown ticket returns the field code `SESSION_TIMEOUT` on `ticket`. An account with no passkey returns 400 `NO_PASSKEYS_REGISTERED`.+| ticket | string | The ticket from [password login](#log-in-with-a-password) or [complete SSO](#complete-sso) (1-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [WebAuthn authentication options](#webauthn-authentication-options) object | The ticket resolves to an account with at least one credential |-| 400 | [error response](/http-api/#error-response) | The body or ticket is invalid, or the account has no registered credential |-| 403 | [error response](/http-api/#error-response) | SSO enforcement rejects the operation |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects+| 200 | [WebAuthn authentication options](#webauthn-authentication-options) object | The challenge was created |+| 400 | [error response](/http-api/#error-response) | `NO_PASSKEYS_REGISTERED` when the account has no passkey |-The operation issues a one-use WebAuthn challenge valid for five minutes and bound to this MFA flow, account, and ticket. It changes no account state. No Gateway Dispatch is emitted.--### Rate limit--5 requests per minute, on the shared `auth:login:mfa` bucket.+The rate limit is 5 requests per minute, on the shared `auth:login:mfa` bucket.## Complete login with WebAuthn MFA<RouteHeader method="POST" path="/v1/auth/login/mfa/webauthn" unauthenticated />-Consumes the MFA ticket, verifies the WebAuthn assertion against the challenge, and creates the session. Authentication is not required. Returns an [authentication token response](#authentication-token-response).+Finishes a sign-in with a passkey and returns an [authentication token response](#authentication-token-response).### JSON body| Field | Type | Description || --- | --- | --- |-| response | [WebAuthn assertion](#webauthn-assertion) object | The browser credential assertion |-| challenge<sup>1</sup> | string | The challenge returned by [get WebAuthn MFA options](#get-webauthn-mfa-options) |-| ticket | string | The ticket returned by [password login](#log-in-with-a-password) or [complete SSO](#complete-sso) |--<sup>1</sup> The challenge is consumed before verification and is accepted only when its bound context, account, and ticket all match this request--A ticket from [recover an account](#recover-an-account) applies that recovery before the session is created, and returns the field code `INVALID_RECOVERY_KEY` on `recovery_key` when the recovery kit changed in the meantime. An expired or unknown ticket returns the field code `SESSION_TIMEOUT` on `ticket`. A ticket for an account that does not count passkeys as its second factor returns 400 `TWO_FACTOR_REQUIRED`, which is what a TOTP account holding registered credentials without [Set WebAuthn two-factor authentication](/http-api/users/mfa/#set-webauthn-two-factor-authentication) receives. A challenge mismatch, an unknown credential, a credential the options did not list, a stored public key that cannot be decoded, a signature counter that the authenticator did not advance, and a failed signature verification all return 401 `PASSKEY_AUTHENTICATION_FAILED`. A verified assertion whose reported signature counter cannot be read returns 500 `INVALID_WEBAUTHN_AUTHENTICATION_COUNTER`.--This operation shares the MFA attempt allowances of [complete login with TOTP](#complete-login-with-totp). It permits 10 failed attempts per account in 15 minutes and destroys the ticket after 5 failed attempts. An exhausted allowance returns the field code `INVALID_CODE` on `ticket`.+| response | [WebAuthn assertion](#webauthn-assertion) object | The browser credential result |+| challenge | string | The challenge from [get WebAuthn MFA options](#get-webauthn-mfa-options) |+| ticket | string | The ticket from [password login](#log-in-with-a-password) or [complete SSO](#complete-sso) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [authentication token response](#authentication-token-response) | The ticket and assertion are accepted |-| 400 | [error response](/http-api/#error-response) | The body or ticket is invalid, or passkeys are not the account's second factor (`TWO_FACTOR_REQUIRED`) |-| 401 | [error response](/http-api/#error-response) | Challenge or assertion verification fails |-| 403 | [error response](/http-api/#error-response) | SSO enforcement rejects the operation or the ticket resolves to a bot account |-| 404 | [error response](/http-api/#error-response) | The ticket resolves to an account that no longer exists |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | The verified assertion reported no readable signature counter, or the request could not be completed |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--Success consumes the challenge and ticket and creates one authentication session. No Gateway Dispatch is emitted.--### Rate limit+| 200 | [authentication token response](#authentication-token-response) | The passkey was accepted |+| 400 | [error response](/http-api/#error-response) | `TWO_FACTOR_REQUIRED` when passkeys aren't the account's second factor |+| 401 | [error response](/http-api/#error-response) | `PASSKEY_AUTHENTICATION_FAILED` when the passkey check fails |-5 requests per minute, on the shared `auth:login:mfa` bucket.+The rate limit is 5 requests per minute, on the shared `auth:login:mfa` bucket.## Get discoverable WebAuthn options<RouteHeader method="POST" path="/v1/auth/webauthn/authentication-options" unauthenticated />-Creates a challenge for passwordless authentication with a discoverable credential. Authentication is not required. Returns a [WebAuthn authentication options](#webauthn-authentication-options) object.--The request has no body. The response omits `allowCredentials` and requests `required` user verification.+Returns [WebAuthn authentication options](#webauthn-authentication-options) for signing in with a passkey and no password. The request has no body.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [WebAuthn authentication options](#webauthn-authentication-options) object | A discoverable challenge was created |-| 403 | [error response](/http-api/#error-response) | SSO enforcement rejects the operation |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--The operation issues a one-use discoverable WebAuthn challenge valid for five minutes and bound to the discoverable context alone. It changes no account state. No Gateway Dispatch is emitted.+| 200 | [WebAuthn authentication options](#webauthn-authentication-options) object | The challenge was created |-### Rate limit--20 requests per 10 seconds, on the `auth:webauthn:options` bucket.+The rate limit is 20 requests per 10 seconds, on the `auth:webauthn:options` bucket.## Authenticate with WebAuthn<RouteHeader method="POST" path="/v1/auth/webauthn/authenticate" unauthenticated />-Resolves the account from the presented credential ID, verifies the assertion with user verification required, applies account suspension policy, and creates the session. Authentication is not required. Returns an [authentication token response](#authentication-token-response).+Signs in with a passkey and returns an [authentication token response](#authentication-token-response).### JSON body| Field | Type | Description || --- | --- | --- |-| response | [WebAuthn assertion](#webauthn-assertion) object | The browser credential assertion |-| challenge<sup>1</sup> | string | The challenge returned by [get discoverable WebAuthn options](#get-discoverable-webauthn-options) |--<sup>1</sup> The challenge is consumed before verification and is accepted only when it was issued for the discoverable context, so a challenge issued for MFA or for sudo mode cannot be used here--An unknown credential ID, a challenge mismatch, a credential for another domain than the challenge, a stored public key that cannot be decoded, a signature counter that the authenticator did not advance, and a failed signature verification all return 401 `PASSKEY_AUTHENTICATION_FAILED`. A verified assertion whose reported signature counter cannot be read returns 500 `INVALID_WEBAUTHN_AUTHENTICATION_COUNTER`. Account suspension returns 403 `ACCOUNT_SUSPENDED_TEMPORARILY` or 403 `ACCOUNT_SUSPENDED_PERMANENTLY`.--A bot account returns 403 `BOT_USER_AUTH_SESSION_CREATION_DENIED`. An account that has not been admitted returns 403 `REGISTRATION_PENDING_APPROVAL` or 403 `REGISTRATION_REJECTED`.+| response | [WebAuthn assertion](#webauthn-assertion) object | The browser credential result |+| challenge | string | The challenge from [get discoverable WebAuthn options](#get-discoverable-webauthn-options) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [authentication token response](#authentication-token-response) | The assertion and account policy are accepted |-| 400 | [error response](/http-api/#error-response) | The body is malformed |-| 401 | [error response](/http-api/#error-response) | Challenge or assertion verification fails |-| 403 | [error response](/http-api/#error-response) | SSO enforcement, account suspension, a bot account, or an unadmitted registration rejects the login |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | The verified assertion reported no readable signature counter, or the request could not be completed |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--Success consumes the challenge, clears an expired temporary suspension, and creates one authentication session. No Gateway Dispatch is emitted.+| 200 | [authentication token response](#authentication-token-response) | The passkey was accepted |+| 401 | [error response](/http-api/#error-response) | `PASSKEY_AUTHENTICATION_FAILED` when the passkey check fails |-### Rate limit--10 requests per 10 seconds, on the `auth:webauthn:authenticate` bucket.+The rate limit is 10 requests per 10 seconds, on the `auth:webauthn:authenticate` bucket.## Log out<RouteHeader method="POST" path="/v1/auth/logout" bot />-Revokes the session identified by the user session token in the `Authorization` header. Returns 204 with no body.--The request has no body. The operation requires a credential that resolves to an account. An absent, malformed, or unknown token returns 401 `UNAUTHORIZED`. An OAuth2 bearer token returns 403 `ACCESS_DENIED`. A bot holds no session, so a bot token is accepted and revokes nothing.--:::note[Logging out revokes exactly the calling session]-The account's other sessions, its OAuth2 grants, and any outstanding MFA ticket, IP authorisation ticket, or desktop handoff all survive. Use [terminate authentication sessions](#terminate-authentication-sessions) to revoke other sessions.-:::+Revokes the session whose token is in the `Authorization` header and returns 204. Other sessions stay signed in. A bot token is accepted and revokes nothing. When the instance [cleans up unclaimed accounts](/admin-api/instance/#unclaimed-account-cleanup-object) on the last sign-out, ending the last session of an account nobody can sign in to again schedules its deletion 24 hours later.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | The session was revoked, or the credential is a bot token |-| 401 | [error response](/http-api/#error-response) | The token is absent, malformed, or names no live session |-| 403 | [error response](/http-api/#error-response) | The credential is an OAuth2 bearer token |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Session revocation fails unexpectedly |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--Revoking this session ends its Gateway session as [shared behaviour](#shared-behaviour) states. No Gateway Dispatch is emitted for the revocation.+| 204 | empty | The session was revoked |-### Rate limit--20 requests per 10 seconds, on the `auth:logout` bucket.+The rate limit is 20 requests per 10 seconds, on the `auth:logout` bucket.## Verify an email address<RouteHeader method="POST" path="/v1/auth/verify" unauthenticated />-Consumes an email verification token and marks the account's current address verified. Authentication is not required. Returns 204 with no body.+Uses the token from a verification email to mark the account's email verified, and returns 204. Fluxer sends [User Update](/gateway/events/#user-update).### JSON body| Field | Type | Description || --- | --- | --- |-| token | string | The token delivered by email, exactly 64 characters |--An unknown, already consumed, or deleted-account token returns the field code `INVALID_OR_EXPIRED_VERIFICATION_TOKEN`.--:::caution[Verification marks the account's current address]-Fluxer never compares the account's address against the one the token was issued for. An account that changes its address while a verification token is outstanding can therefore verify the new address with the old token.-:::+| token | string | The token from the email, 64 characters |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | The address was verified |-| 400 | [error response](/http-api/#error-response) | The body or token is invalid |-| 403 | [error response](/http-api/#error-response) | SSO enforcement rejects the operation, or the token resolves to a bot account |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--The operation marks the current address verified and clears its bounced state. It emits a [User Update](/gateway/events/#user-update) Gateway Dispatch to the account's own sessions.+| 204 | empty | The email was verified |+| 400 | [error response](/http-api/#error-response) | The field code `INVALID_OR_EXPIRED_VERIFICATION_TOKEN` |-### Rate limit--10 requests per minute, on the `auth:verify` bucket.+The rate limit is 10 requests per minute, on the `auth:verify` bucket.## Resend email verification<RouteHeader method="POST" path="/v1/auth/verify/resend" />-Issues and sends a new email verification token for the authenticated account. Requires a user session token for an ordinary user. Returns 204 with no body.--The request has no body. When the current address is already verified, the operation returns 204 and sends nothing.+Sends a new verification email, valid for 24 hours, and returns 204. It sends nothing when the email is already verified.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | A message was sent or verification was already complete |-| 401 | [error response](/http-api/#error-response) | The user session credential is missing or invalid |-| 403 | [error response](/http-api/#error-response) | SSO enforcement rejects the operation, or the credential is a bot token or an OAuth2 bearer token |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | A route, global, or per-address bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |+| 204 | empty | The email was sent or was already verified |-### Side effects--The operation creates one 64-character verification token bound to the account and its current address, valid for 24 hours, and sends the verification message. Previously issued verification tokens remain valid. No Gateway Dispatch is emitted.--### Rate limit--10 requests per minute, on the `auth:verify:resend` bucket, and the target address permits 3 messages in 15 minutes.+The rate limit is 10 requests per minute, on the `auth:verify:resend` bucket.## Request password recovery<RouteHeader method="POST" path="/v1/auth/forgot" unauthenticated />-Accepts a password recovery request for an email address. Authentication is not required. Returns 204 with no body.--Password recovery verifies a [CAPTCHA](/topics/captcha/). Fluxer consumes both the client IP address and email address allowances before it validates the address, and exhausting either returns 429.+Emails a password reset link, valid for 1 hour, and returns 204. The request needs a [CAPTCHA](/topics/captcha/), and the response is the same whether or not an account has the address.### Request headers| Field | Type | Description || --- | --- | --- |-| X-Captcha-Token?<sup>1</sup> | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |--<sup>1</sup> A missing token returns 400 `CAPTCHA_REQUIRED` and a rejected token returns 400 `INVALID_CAPTCHA`, each with a new challenge. Verification is skipped entirely while the check is off for the instance+| X-Captcha-Token? | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |### JSON body| Field | Type | Description || --- | --- | --- |-| email<sup>1</sup> | string | The address that receives the reset link |--<sup>1</sup> An address whose domain has no usable DNS records returns the field code `INVALID_EMAIL_ADDRESS`, while an address that passes DNS validation but belongs to no account returns the ordinary success response--:::note[Account existence is not disclosed]-An address that resolves to no account produces the same 204 response as an address that resolves to an ordinary account. Only a DNS validation failure, the route bucket, the client IP address and email address allowances, and an address belonging to a bot account can produce a different outcome.-:::+| email | string | The address to send the reset link to |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | The request was accepted regardless of whether the account exists |-| 400 | [error response](/http-api/#error-response) | The body, CAPTCHA, or email address is invalid |-| 403 | [error response](/http-api/#error-response) | SSO enforcement rejects the operation, or the address belongs to a bot account |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | A route, global, email, or client IP bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects+| 204 | empty | The request was accepted |-Fluxer sends one 64-character reset token by email to an address that resolves to an account. The token is bound to that account and its current address, and it is valid for one hour. Nothing else changes. No Gateway Dispatch is emitted.--### Rate limit--5 requests per minute, on the `auth:forgot` bucket, and recovery permits 20 attempts per client IP address and 5 attempts per email address in each 30-minute window.+The rate limit is 5 requests per minute, on the `auth:forgot` bucket.## Validate a password reset token<RouteHeader method="GET" path="/v1/auth/reset/{token}" unauthenticated />-Checks a reset token without consuming it. Authentication is not required. Returns a [password reset validity](#password-reset-validity-object) object.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| token | string | The password reset token, exactly 64 characters |--A well-formed token that is unknown, already consumed, or bound to a deleted account returns the same object with `valid` set to false.--:::caution[Validity does not promise the reset succeeds]-The check resolves the token and confirms that its account exists and is not deleted. The reset itself still refuses a valid token for a bot account, for an account under a live temporary suspension, or for a replacement password in the breached-password corpus.-:::+Checks a 64-character reset token without using it and returns a [password reset validity](#password-reset-validity-object) object.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [password reset validity](#password-reset-validity-object) object | The well-formed token was checked |-| 400 | [error response](/http-api/#error-response) | The token path parameter fails validation |-| 403 | [error response](/http-api/#error-response) | SSO enforcement rejects the operation |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |+| 200 | [password reset validity](#password-reset-validity-object) object | The token was checked |-### Side effects--This read does not consume the token or change account state. No Gateway Dispatch is emitted.--:::caution[The token travels in the path]-A token in the path reaches proxy logs, browser history, and referrer headers. A client SHOULD read the token from the recovery link and send it in this one request, and SHOULD NOT route the user's browser to the API path directly.-:::--### Rate limit--20 requests per minute, on the `auth:reset:validate` bucket.+The rate limit is 20 requests per minute, on the `auth:reset:validate` bucket.## Reset a password<RouteHeader method="POST" path="/v1/auth/reset" unauthenticated />-Consumes a valid reset token and replaces the account password, then issues a new session or an MFA challenge. Authentication is not required. Returns an [authentication token response](#authentication-token-response) when the account has no second factor, and an [MFA challenge response](#mfa-challenge-response) when it has one.--On a `username` instance a reset token comes only from an administrator's [password reset link](/admin-api/users/#create-password-reset-link). Validation and the reset itself work the same way there.+Sets a new password with a reset token. Returns an [authentication token response](#authentication-token-response), or an [MFA challenge response](#mfa-challenge-response) when the account has a second factor. On a `username` instance, reset tokens come from an admin's [password reset link](/admin-api/users/#create-password-reset-link).-Fluxer reads the second factor from the account as it stood before the reset. An account that held no password and holds at least one registered WebAuthn credential counts as having one, because the passkey was its primary credential, so it receives an MFA challenge with `webauthn` in `allowed_methods` and MUST prove the passkey before the reset yields a session.+:::caution[Resetting a password signs out every session]+A reset ends every session on the account and then creates one new session.+:::### JSON body| Field | Type | Description || --- | --- | --- |-| token | string | The password reset token, exactly 64 characters |-| password<sup>1</sup> | string | The replacement password (8-256 characters) |--<sup>1</sup> The password is checked against the public breached-password corpus before the token is spent, and a match returns the field code `PASSWORD_IS_TOO_COMMON`--An unknown or already consumed token, and a token bound to a deleted account, return the field code `INVALID_OR_EXPIRED_RESET_TOKEN`. A live temporary suspension returns 403 `ACCOUNT_SUSPENDED_TEMPORARILY`. A permanent suspension returns the field code `INVALID_OR_EXPIRED_RESET_TOKEN` and never 403 `ACCOUNT_SUSPENDED_PERMANENTLY`. A bot account returns 403 `BOT_USER_AUTH_ENDPOINT_ACCESS_DENIED`.--Passwords are checked against a breached-password corpus, as they are during [registration](#register-an-account) and [email reversion](#revert-an-email-change).--:::caution[Resetting a password revokes every existing session]-A successful reset terminates every authentication session on the account, including the one any other device is holding. It then issues one fresh session. An account with a second factor receives an MFA ticket, and completing MFA with that ticket creates the session. Setting a password on an account that had none does not release it from its passkey, so that account still completes MFA.-:::+| token | string | The reset token, 64 characters |+| password | string | The new password (8-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [authentication token response](#authentication-token-response) \| [MFA challenge response](#mfa-challenge-response) | The password was replaced |-| 400 | [error response](/http-api/#error-response) | The body, token, or replacement password is invalid |-| 403 | [error response](/http-api/#error-response) | SSO enforcement, a bot account, or a live temporary suspension rejects the mutation |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |+| 200 | [authentication token response](#authentication-token-response) \| [MFA challenge response](#mfa-challenge-response) | The password was changed |+| 400 | [error response](/http-api/#error-response) | The field code `INVALID_OR_EXPIRED_RESET_TOKEN` or `PASSWORD_IS_TOO_COMMON` |-### Side effects--The operation replaces the password, records the change time, clears an expired temporary suspension, terminates every authentication session on the account, and consumes the presented reset token before it creates a session or an MFA ticket. A failure after that point still leaves the token used. Every terminated session loses its Gateway session as [shared behaviour](#shared-behaviour) states. Other outstanding emailed reset tokens are not invalidated, so a second recovery link issued earlier still works. A token from an administrator's [password reset link](/admin-api/users/#create-password-reset-link) is the exception, and using one invalidates every outstanding reset token on the account.--An account with no second factor then receives one new session and its token. An account with a second factor receives a five-minute MFA ticket instead, and the MFA completion creates the session. An account that had no password and holds a registered WebAuthn credential is one of those, and its ticket is completed through [complete login with WebAuthn MFA](#complete-login-with-webauthn-mfa), or through [complete login with TOTP](#complete-login-with-totp) when `allowed_methods` lists `backup_codes`.--### Rate limit--10 requests per minute, on the `auth:reset` bucket.+The rate limit is 10 requests per minute, on the `auth:reset` bucket.## Recover an account<RouteHeader method="POST" path="/v1/auth/recover" unauthenticated />-Replaces the account password using the recovery key from a recovery kit, then issues a new session or an MFA challenge together with a new recovery key. Authentication is not required. Returns an [account recovery response](#account-recovery-response-object).--Only a `username` instance serves this operation, and an `email` instance returns 400 `USERNAME_SIGN_IN_ONLY`.+Sets a new password with the recovery key from a recovery kit and returns an [account recovery response](#account-recovery-response-object) with a new key. Only a `username` instance has this route, and an `email` instance returns 400 `USERNAME_SIGN_IN_ONLY`. The request needs a [CAPTCHA](/topics/captcha/).-Recovery verifies a [CAPTCHA](/topics/captcha/). It also permits 10 attempts per client IP address and 5 attempts per sign-in identifier from each client IP address in 30 minutes. The identifier is the lowercased `login`, and the IP key is the exact IPv4 address or the IPv6 /64 network. Every admitted attempt consumes both allowances, whether or not the key turns out to be correct.+:::caution[Recovery signs out every session and replaces the key]+The old key stops working and every session is signed out. For an account with a second factor, nothing changes until the MFA route accepts the ticket.+:::### Request headers| Field | Type | Description || --- | --- | --- |-| X-Captcha-Token?<sup>1</sup> | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |--<sup>1</sup> A missing token returns 400 `CAPTCHA_REQUIRED` and a rejected token returns 400 `INVALID_CAPTCHA`, each with a new challenge. Verification is skipped entirely while the check is off for the instance+| X-Captcha-Token? | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |### JSON body| Field | Type | Description || --- | --- | --- |-| login<sup>1</sup> | string | The username (1-320 characters) |-| recovery_key<sup>2</sup> | string | The recovery key from the account's recovery kit (1-128 characters) |-| password<sup>3</sup> | string | The replacement password (8-256 characters) |--<sup>1</sup> `alex#0` and `alex#0000` read the same as `alex`, and any other tag never matches. A bot account never matches--<sup>2</sup> Spaces and dashes are dropped and lowercase letters count as uppercase. `O` reads as `0`, `I` and `L` read as `1`, and a key containing `U` never matches--<sup>3</sup> The password is checked against the public breached-password corpus described under [reset a password](#reset-a-password), and a match returns the field code `PASSWORD_IS_TOO_COMMON`--:::note[Unknown accounts and wrong keys are indistinguishable]-An unknown `login` and an account with no recovery kit return the same field code as a wrong key, `INVALID_RECOVERY_KEY` on `recovery_key`.-:::+| login | string | The username (1-320 characters) |+| recovery_key<sup>1</sup> | string | The recovery key from the recovery kit (1-128 characters) |+| password | string | The new password (8-256 characters) |-A matching key on a deleted account also returns `INVALID_RECOVERY_KEY`. A live temporary suspension returns 403 `ACCOUNT_SUSPENDED_TEMPORARILY`, and a closed account returns 403 `ACCOUNT_SUSPENDED_PERMANENTLY`. An account awaiting approval returns 403 `REGISTRATION_PENDING_APPROVAL`, and a rejected registration returns 403 `REGISTRATION_REJECTED`. Each of these checks runs only after the key matched.--:::caution[Recovery revokes every session and the old key]-A successful recovery terminates every authentication session on the account and replaces the recovery kit. The key the request used stops working. The new key is in the response and nowhere else. A client MUST keep it and show it to the user once the recovery has taken effect.-:::--:::note[An account with a second factor changes only after MFA]-For an account with a second factor this operation writes nothing. It returns an MFA ticket together with the new key. The password, the sessions and the kit change only when [complete login with TOTP](#complete-login-with-totp) or [complete login with WebAuthn MFA](#complete-login-with-webauthn-mfa) accepts that ticket, and the new key works only from then on. A ticket that expires unused leaves the old password, sessions and kit as they were.-:::+<sup>1</sup> Spaces, dashes and letter case are ignored### Response| Status | Body | Condition || --- | --- | --- || 200 | [account recovery response](#account-recovery-response-object) | The password and the recovery kit were replaced |-| 400 | [error response](/http-api/#error-response) | The body, CAPTCHA, recovery key, or replacement password is invalid, or the instance signs members in with email |-| 403 | [error response](/http-api/#error-response) | SSO enforcement, an account suspension, or a registration that is not admitted rejects the recovery |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | A route, global, identifier, or IP bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects+| 400 | [error response](/http-api/#error-response) | The field code `INVALID_RECOVERY_KEY`, also for an unknown username, or `PASSWORD_IS_TOO_COMMON` |-For an account with no second factor the operation swaps the recovery kit for a new one, replaces the password, records the change time, terminates every authentication session on the account, invalidates every outstanding password reset token, and issues one new session. If the password reset fails after the swap, the old kit is put back. Every terminated session loses its Gateway session as [shared behaviour](#shared-behaviour) states.--For an account with a second factor the operation only issues a five-minute MFA ticket. The MFA completion makes the same changes and then creates the session. When the kit changed after the ticket was issued, the completion changes nothing and returns the field code `INVALID_RECOVERY_KEY` on `recovery_key`. The new recovery key is in the response in both cases.--### Rate limit--10 requests per minute, on the `auth:recover` bucket.+The rate limit is 10 requests per minute, on the `auth:recover` bucket.## Revert an email change<RouteHeader method="POST" path="/v1/auth/email-revert" unauthenticated />-Consumes the token delivered to the previous email address, restores that address, replaces the password, terminates every authentication session, and clears every second factor. The requesting IP address becomes the only authorised IP address. Returns an [authentication token response](#authentication-token-response). Emits a [User Update](/gateway/events/#user-update) Gateway event.+Uses the token sent to the old address after an email change to put that address back and set a new password. Returns an [authentication token response](#authentication-token-response) and sends [User Update](/gateway/events/#user-update). The token is valid for 24 hours.-The token is valid for 24 hours after the address change that issued it.+:::danger[Reverting removes every other way in]+It ends every session, removes every second factor and leaves only the current IP address authorized.+:::### JSON body| Field | Type | Description || --- | --- | --- |-| token | string | The email reversion token, exactly 64 characters |-| password<sup>1</sup> | string | The replacement password (8-256 characters) |--<sup>1</sup> The value becomes the account's new password, and Fluxer checks it against the public breached-password corpus, returning the field code `PASSWORD_IS_TOO_COMMON` on a match--:::danger[Reversion destroys every other credential]-Completing a reversion terminates every authentication session and clears the account's entire second-factor enrolment. The authorised IP address set becomes the requesting IP address alone. Any other device, passkey, or backup code held by whoever made the original email change stops working immediately, and none of it can be restored.-:::--An unknown or already consumed token, and a token bound to an account that no longer exists, return the field code `INVALID_OR_EXPIRED_REVERT_TOKEN`. Account suspension returns 403 `ACCOUNT_SUSPENDED_TEMPORARILY` or 403 `ACCOUNT_SUSPENDED_PERMANENTLY`, and a bot account returns 403 `BOT_USER_AUTH_ENDPOINT_ACCESS_DENIED`.--Fluxer checks the replacement password against the same breached-password corpus described under [reset a password](#reset-a-password) before it spends the token.+| token | string | The token from the email, 64 characters |+| password | string | The new password (8-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [authentication token response](#authentication-token-response) | The address and credential recovery completed |-| 400 | [error response](/http-api/#error-response) | The body, token, or replacement password is invalid |-| 403 | [error response](/http-api/#error-response) | SSO enforcement, a bot account, or account suspension rejects the mutation |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--The previous email address becomes verified and the replacement password becomes the account password. All other sessions, second factors and authorised IP addresses are removed. Only the requesting IP address remains authorised.--The account receives [User Update](/gateway/events/#user-update). Existing Gateway sessions end as described under [shared behaviour](#shared-behaviour), and the response returns one new authentication session.+| 200 | [authentication token response](#authentication-token-response) | The email was put back |+| 400 | [error response](/http-api/#error-response) | The field code `INVALID_OR_EXPIRED_REVERT_TOKEN` or `PASSWORD_IS_TOO_COMMON` |-### Rate limit--10 requests per minute, on the `auth:email_revert` bucket.+The rate limit is 10 requests per minute, on the `auth:email_revert` bucket.## List authentication sessions<RouteHeader method="GET" path="/v1/auth/sessions" />-Lists every live authentication session belonging to the authenticated account, newest activity first. Requires a user session token for an ordinary user. Returns an array of [authentication session](#authentication-session-object) objects.--The request has no body and takes no parameters.+Returns the account's active [authentication sessions](#authentication-session-object), most recently used first.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | array[[authentication session](#authentication-session-object) object] | The live sessions were read |-| 401 | [error response](/http-api/#error-response) | The user session credential is missing or invalid |-| 403 | [error response](/http-api/#error-response) | The credential is a bot token or an OAuth2 bearer token |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects+| 200 | array[[authentication session](#authentication-session-object) object] | The sessions were returned |-This read does not change session state. No Gateway Dispatch is emitted.--### Rate limit--40 requests per 10 seconds, on the `auth:sessions` bucket.+The rate limit is 40 requests per 10 seconds, on the `auth:sessions` bucket.## Terminate authentication sessions<RouteHeader method="POST" path="/v1/auth/sessions/logout" mfa />-Deletes the named authentication sessions. Requires a user session token for an ordinary user, and [sudo mode](/http-api/users/mfa/#sudo-mode). Returns 204 with no body.--The caller MUST send a valid sudo token in the `X-Fluxer-Sudo-Mode-JWT` header, or supply a password or MFA proof in the body.+Signs out the sessions you name and returns 204. It needs [sudo mode](/http-api/users/mfa/#sudo-mode), from the `X-Fluxer-Sudo-Mode-JWT` header or a password or MFA proof in the body. Leave out the `id_hash` of the current session to stay signed in.### JSON body| Field | Type | Description || --- | --- | --- |-| session_id_hashes<sup>1</sup> | array[string] | The session digests to delete (max 100 entries) |-| password?<sup>2</sup> | string | The password proof for an account holding no TOTP secret and no registered WebAuthn credential (8-256 characters) |-| mfa_method?<sup>3</sup> | string | The proof method, one of `totp`, `webauthn` or `email_code` |-| mfa_code? | string | The authenticator code or an unconsumed backup code when the method is `totp` (1-32 characters) |-| webauthn_response? | [WebAuthn assertion](#webauthn-assertion) object | The assertion when the method is `webauthn` |-| webauthn_challenge? | string | The challenge bound to the sudo mode assertion |+| session_id_hashes | array[string] | The `id_hash` values of the sessions to sign out (max 100 entries) |+| password? | string | The password, for an account with no authenticator app and no passkey (8-256 characters) |+| mfa_method? | string | The proof method, one of `totp`, `webauthn` or `email_code` |+| mfa_code? | string | The authenticator code or a backup code, for `totp` (1-32 characters) |+| webauthn_response? | [WebAuthn assertion](#webauthn-assertion) object | The passkey result, for `webauthn` |+| webauthn_challenge? | string | The sudo mode challenge, for `webauthn` || email_code_ticket? | string | The ticket from [send a sudo email code](/http-api/users/mfa/#send-a-sudo-email-code) (1-128 characters) || email_code? | string | The 6-digit code from that email |@@ -1553,63 +1007,37 @@ The caller MUST send a valid sudo token in the `X-Fluxer-Sudo-Mode-JWT` header,| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Every named session was absent or deleted |-| 400 | [error response](/http-api/#error-response) | The body or the supplied proof is invalid |-| 401 | [error response](/http-api/#error-response) | The user session credential is missing or invalid |-| 403 | [error response](/http-api/#error-response) | The credential is a bot token or an OAuth2 bearer token, or sudo mode is required |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |+| 204 | empty | The sessions were signed out |+| 403 | [error response](/http-api/#error-response) | `SUDO_MODE_REQUIRED` when proof is missing |-### Side effects+The rate limit is 20 requests per 10 seconds, on the `auth:sessions:logout` bucket.-Each named session is deleted and loses its Gateway session as [shared behaviour](#shared-behaviour) states. A fresh MFA proof issues a new sudo token, while an accepted incoming token is echoed unchanged. Fluxer sets whichever token results in the `X-Fluxer-Sudo-Mode-JWT` response header. A password proof, which only an account holding neither a TOTP secret nor a registered WebAuthn credential can give, issues no token, so the header is not set unless the request already had one. No Gateway Dispatch is emitted.--### Rate limit--20 requests per 10 seconds, on the `auth:sessions:logout` bucket.--## Authorise an IP address+## Authorize an IP address<RouteHeader method="POST" path="/v1/auth/authorize-ip" unauthenticated />-Consumes the authorisation token delivered by email, authorises the pending client IP address, and completes the waiting login. Authentication is not required. Returns 204 with no body.+Uses the token from the IP authorization email to approve the new IP address and returns 204. The waiting device gets its session from [poll IP authorization](#poll-ip-authorization).### JSON body| Field | Type | Description || --- | --- | --- |-| token | string | The authorisation token delivered by email |--An unknown, expired, already consumed, or account-mismatched token returns the field code `INVALID_OR_EXPIRED_AUTHORIZATION_TOKEN`, and so does a token for a sign-in attempt made before the account's password last changed. A token that resolves to an account that no longer exists returns 404 `UNKNOWN_USER`, and one that resolves to a bot account returns 403 `BOT_USER_AUTH_ENDPOINT_ACCESS_DENIED`. Session creation also rejects an account that has not been admitted or is suspended, with the codes listed under [log in with a password](#log-in-with-a-password).+| token | string | The token from the email |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | The IP address was authorised and the new session token is readable through poll IP authorisation |-| 400 | [error response](/http-api/#error-response) | The body or authorisation token is invalid |-| 403 | [error response](/http-api/#error-response) | SSO enforcement rejects the operation or the token resolves to a bot account |-| 404 | [error response](/http-api/#error-response) | The token resolves to an account that no longer exists |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects+| 204 | empty | The IP address was approved |+| 400 | [error response](/http-api/#error-response) | The field code `INVALID_OR_EXPIRED_AUTHORIZATION_TOKEN` |-The operation adds the pending client IP address to the account's authorised set and creates one authentication session. That session takes the IP address, user agent, and reported operating system captured when the login was attempted. It consumes the authorisation token and the ticket for the pending login.--The session token is then published against the ticket and remains readable by [poll IP authorisation](#poll-ip-authorisation) for 60 seconds. The caller of this operation receives 204 and no token of its own. No Gateway Dispatch is emitted.--### Rate limit--5 requests per minute, on the `auth:authorize_ip` bucket.+The rate limit is 5 requests per minute, on the `auth:authorize_ip` bucket.## Redeem a sign-in link<RouteHeader method="POST" path="/v1/auth/sign-in-link" unauthenticated />-Consumes the token from a one-time sign-in link that the instance operator created for an admin account with [create admin sign-in link](/admin-api/users/#create-admin-sign-in-link). Authentication is not required. Returns an [authentication token response](#authentication-token-response).+Signs in with the token from a sign-in link made by [create admin sign-in link](/admin-api/users/#create-admin-sign-in-link) and returns an [authentication token response](#authentication-token-response). The link works once, for 15 minutes.### JSON body@@ -1622,147 +1050,84 @@ Consumes the token from a one-time sign-in link that the instance operator creat| Status | Body | Condition || --- | --- | --- || 200 | [authentication token response](#authentication-token-response) | The account was signed in |-| 400 | [error response](/http-api/#error-response) | The body or token is invalid |-| 403 | [error response](/http-api/#error-response) | The token resolves to a bot account or a suspended account |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--The operation consumes the token, adds the client IP address of the request to the account's authorised set, and creates one authentication session. It records one [Admin audit entry](/admin-api/#admin-audit-entry-object) with action `use_sign_in_link`. No Gateway Dispatch is emitted.--### Rate limit+| 400 | [error response](/http-api/#error-response) | The field code `INVALID_OR_EXPIRED_AUTHORIZATION_TOKEN` |-5 requests per minute, on the `auth:authorize_ip` bucket.+The rate limit is 5 requests per minute, on the shared `auth:authorize_ip` bucket.-## Resend IP authorisation+## Resend IP authorization<RouteHeader method="POST" path="/v1/auth/ip-authorization/resend" unauthenticated />-Sends the authorisation message for an outstanding IP authorisation ticket again. Authentication is not required. Returns 204 with no body.+Sends the IP authorization email again and returns 204. Each ticket allows one resend, 30 seconds or more after the sign-in.### JSON body| Field | Type | Description || --- | --- | --- |-| ticket<sup>1</sup> | string | The ticket returned by the `IP_AUTHORIZATION_REQUIRED` login error |--<sup>1</sup> The resend reuses the authorisation token already bound to the ticket, so a message delivered by an earlier send remains valid--An unknown or expired ticket returns the field code `INVALID_OR_EXPIRED_AUTHORIZATION_TICKET`. A resend less than 30 seconds after the ticket was issued returns 429 `IP_AUTHORIZATION_RESEND_COOLDOWN` with a `Retry-After` header and a top-level `resend_available_in` in seconds. A second resend returns 400 `IP_AUTHORIZATION_RESEND_LIMIT_EXCEEDED`.--:::caution[A lost response still spends the resend]-There is no retry key. A client that loses the response cannot tell whether the message was delivered, and a retry returns 400 `IP_AUTHORIZATION_RESEND_LIMIT_EXCEEDED` once the first request marked the resend used.-:::+| ticket | string | The ticket from the `IP_AUTHORIZATION_REQUIRED` error |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | The message was sent again |-| 400 | [error response](/http-api/#error-response) | The body or ticket is invalid, or the ticket's single resend is already used |-| 403 | [error response](/http-api/#error-response) | SSO enforcement rejects the operation |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | A route or global bucket denies the request, or the resend delay has not elapsed |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--Fluxer sends the authorisation message to the address associated with the login attempt and marks the ticket's single resend used whether or not delivery succeeds. No account state changes. No Gateway Dispatch is emitted.+| 204 | empty | The email was sent again |+| 400 | [error response](/http-api/#error-response) | `IP_AUTHORIZATION_RESEND_LIMIT_EXCEEDED` when the ticket was already resent |+| 429 | [error response](/http-api/#error-response) | `IP_AUTHORIZATION_RESEND_COOLDOWN` with `resend_available_in` |-### Rate limit+The rate limit is 5 requests per minute, on the `auth:ip_authorization_resend` bucket.-5 requests per minute, on the `auth:ip_authorization_resend` bucket, and each ticket permits exactly one resend, no earlier than 30 seconds after the ticket was issued.--## Poll IP authorisation+## Poll IP authorization<RouteHeader method="GET" path="/v1/auth/ip-authorization/poll" unauthenticated />-Reads the login result associated with an IP authorisation ticket. Authentication is not required. Returns an [IP authorisation poll](#ip-authorisation-poll-object) object.+Returns the [IP authorization poll](#ip-authorization-poll-object) state of a waiting sign-in. After the link is used, the token is returned for 60 seconds.### Query parameters| Field | Type | Description || --- | --- | --- |-| ticket | string | The ticket returned by the `IP_AUTHORIZATION_REQUIRED` login error |--An unknown or expired ticket returns the field code `INVALID_OR_EXPIRED_AUTHORIZATION_TICKET`, which is also the outcome once the 60-second result retention has elapsed.--:::note[Reading the completed result does not consume it]-Repeated polling returns the same token, so anyone holding the ticket within the 60-second retention window can read it. A completed token is a live session credential from the moment it first appears.-:::+| ticket | string | The ticket from the `IP_AUTHORIZATION_REQUIRED` error |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [IP authorisation poll](#ip-authorisation-poll-object) object | The ticket was read |-| 400 | [error response](/http-api/#error-response) | The query is malformed or the ticket is unknown or expired |-| 403 | [error response](/http-api/#error-response) | SSO enforcement rejects the operation |-| 404 | [error response](/http-api/#error-response) | The completed result names an account that no longer exists, returning `UNKNOWN_USER` |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Rate limit+| 200 | [IP authorization poll](#ip-authorization-poll-object) object | The state was returned |+| 400 | [error response](/http-api/#error-response) | The field code `INVALID_OR_EXPIRED_AUTHORIZATION_TICKET` |-60 requests per minute, on the `auth:ip_authorization_poll` bucket.+The rate limit is 60 requests per minute, on the `auth:ip_authorization_poll` bucket.## Get username suggestions<RouteHeader method="POST" path="/v1/auth/username-suggestions" unauthenticated />-Derives username candidates from a display name. Authentication is not required. Returns a [username suggestions](#username-suggestions-object) object.--The route shares the `auth:register` bucket, which permits 10 requests per 10 seconds.+Returns [username suggestions](#username-suggestions-object) made from a display name. It doesn't check or reserve the name.### JSON body| Field | Type | Description || --- | --- | --- |-| global_name | string | The display name after normalisation (1-32 characters) |--:::note[A returned candidate can be taken before use]-The operation does no availability check and holds nothing. Registration allocates its own discriminator regardless of the suggestion.-:::+| global_name | string | The display name (1-32 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [username suggestions](#username-suggestions-object) object | Candidates were generated |-| 400 | [error response](/http-api/#error-response) | The body or display name is invalid |-| 403 | [error response](/http-api/#error-response) | SSO enforcement rejects the operation |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects+| 200 | [username suggestions](#username-suggestions-object) object | The suggestions were returned |-This read reserves no username and changes no account state. No Gateway Dispatch is emitted.+The rate limit is 10 requests per 10 seconds, on the shared `auth:register` bucket.## Check username availability<RouteHeader method="GET" path="/v1/auth/username-availability" unauthenticated />-Reports whether a username is free for a new account. Authentication is not required. Returns a [username availability](#username-availability-object) object.--Only an instance with the `none` tag style serves this operation, and any other instance returns 400 `USERNAME_SIGN_IN_ONLY`.+Returns whether a username is free, as a [username availability](#username-availability-object) object. Only an instance with the `none` tag style has this route, and others return 400 `USERNAME_SIGN_IN_ONLY`. It doesn't reserve the name.### Query parameters| Field | Type | Description || --- | --- | --- |-| username<sup>1</sup> | string | The username to check (1-32 characters) |--<sup>1</sup> The value follows the `username` rules of [register an account](#register-an-account). An invalid or reserved value returns 400 `INVALID_FORM_BODY` with the same field code registration would return, not `available` false--A name counts as held when an account that is not a bot and not deleted has it, compared without regard to case.--:::note[An available name can be taken before use]-The operation holds nothing. Registration checks the name again and returns the field code `USERNAME_ALREADY_TAKEN` when another account claimed it first.-:::+| username | string | The username to check (1-32 characters) |### Response@@ -1770,326 +1135,154 @@ The operation holds nothing. Registration checks the name again and returns the| --- | --- | --- || 200 | [username availability](#username-availability-object) object | The username was checked |-### Side effects--This read reserves no username and changes no account state. No Gateway Dispatch is emitted.--### Rate limit--30 requests per minute, on the `auth:username_availability` bucket.+The rate limit is 30 requests per minute, on the `auth:username_availability` bucket.## Initiate desktop handoff<RouteHeader method="POST" path="/v1/auth/handoff/initiate" unauthenticated />-Creates a pending handoff and returns the code the initiating device shows to an already signed-in device. Authentication is not required. Returns a [handoff initiation](#handoff-initiation-object) object.--The body is optional. Fluxer derives the device metadata shown to the approving device from the request itself.+Starts signing in a device from one that is already signed in. Returns a [handoff initiation](#handoff-initiation-object) object with a code that the person enters on the signed-in device.### JSON body| Field | Type | Description || --- | --- | --- |-| return_uri?<sup>1</sup> | string | The deep link the approving browser opens to hand the sign-in back to the initiating desktop app |--<sup>1</sup> The value must be exactly `fluxer://handoff`, `fluxer-canary://handoff` or `fluxer-development://handoff`, and anything else returns 400 with a validation error--### Request headers--| Field | Type | Description |-| --- | --- | --- |-| User-Agent? | string | The client string presented to the approving device and recorded on the session the handoff creates |-| X-Fluxer-Client-Properties? | string | The base64-encoded JSON with the reporting client's `os`, read only for a native Fluxer `User-Agent` |+| return_uri? | string | `fluxer://handoff`, `fluxer-canary://handoff` or `fluxer-development://handoff` |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [handoff initiation](#handoff-initiation-object) object | A handoff request was created |-| 400 | [error response](/http-api/#error-response) | The `return_uri` is not an accepted deep link |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--The handoff remains pending for five minutes and records the initiating device's client IP address, user agent, and reported operating system. Initiation creates no session. No Gateway Dispatch is emitted.+| 200 | [handoff initiation](#handoff-initiation-object) object | The handoff was created |-### Rate limit--10 requests per minute, on the `auth:handoff:initiate` bucket.+The rate limit is 10 requests per minute, on the `auth:handoff:initiate` bucket.## Get desktop handoff information<RouteHeader method="GET" path="/v1/auth/handoff/{code}/info" unauthenticated />-Describes the device that initiated a pending handoff so that the approving device can show it before approving, and marks the code approvable. Authentication is not required. Returns a [handoff information](#handoff-information-object) object.--Fluxer counts failed code attempts against the client IP address and blocks it after 5 failures in 15 minutes. A pending result records no failure, while an unknown or expired code records one.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| code<sup>1</sup> | string | The handoff code |--<sup>1</sup> Fluxer normalises the value by removing hyphens and whitespace and upper-casing the rest, and the normalised result is exactly 12 characters from the handoff alphabet--:::caution[A successful lookup makes the code completable]-Reading the handoff information marks the code as inspected but does not approve the transfer. [Complete desktop handoff](#complete-desktop-handoff) rejects a code that has never been inspected. An approving client MUST show the initiating device information and obtain explicit user confirmation before completion.-:::--Anyone who can reach the API and knows the code can mark it inspected. Declining the request in a client discards only what that client is showing, and the inspected state remains until the handoff is completed or the code expires.--A code that is not exactly 12 characters from the handoff alphabet after hyphens and whitespace are removed returns 400 `INVALID_HANDOFF_CODE`. Both a code whose three lookups are already spent and a request from a client IP address that has exhausted its failed-attempt allowance return the same error code. An unknown or expired code returns 200 with the `expired` status and records one failed attempt.+Returns [handoff information](#handoff-information-object) so the signed-in device can show which device is asking. You have to call this before [complete desktop handoff](#complete-desktop-handoff) or [deny a desktop handoff](#deny-a-desktop-handoff). Hyphens, spaces and letter case in the code are ignored.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [handoff information](#handoff-information-object) object | The pending or expired state was read |-| 400 | [error response](/http-api/#error-response) | The code is malformed, its lookup budget is spent, or the client IP attempt allowance is exhausted |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--A successful lookup consumes one of the code's three lookups and permits [complete desktop handoff](#complete-desktop-handoff). An expired result counts as a failed attempt. No account state changes or Gateway Dispatch occur.--### Rate limit+| 200 | [handoff information](#handoff-information-object) object | The handoff was found or has expired |+| 400 | [error response](/http-api/#error-response) | `INVALID_HANDOFF_CODE` when the code is malformed or was looked up 3 times |-10 requests per minute, on the `auth:handoff:info` bucket, and each code permits at most three successful lookups in total, counted on the code itself.+The rate limit is 10 requests per minute, on the `auth:handoff:info` bucket.## Complete desktop handoff<RouteHeader method="POST" path="/v1/auth/handoff/complete" />-Approves a pending handoff by issuing a new session to the initiating device on the authority of a live one. Requires the approving device's own user session token. Returns a [handoff completion](#handoff-completion-object) object for the `deep_link` return method, otherwise 204 with no body.--Fluxer reads that token from the `Authorization` header, or from the body `token` field when the body supplies one.+Approves a handoff and creates a session for the other device. Send the approving device's session token in the `Authorization` header or as `token`. Returns a [handoff completion](#handoff-completion-object) object for the `deep_link` return method, or 204 for `code`.### JSON body| Field | Type | Description || --- | --- | --- |-| code<sup>1</sup> | string | The handoff code shown by the initiating device |-| token?<sup>2</sup> | string | The approving device's own user session token |-| user_id<sup>3</sup> | snowflake | The account the approving session belongs to |-| return_method?<sup>4</sup> | string | Either `deep_link` or `code`, defaulting to `code` |--<sup>1</sup> The code uses the same normalisation contract as [get desktop handoff information](#get-desktop-handoff-information), and only a code that operation has already inspected is accepted--<sup>2</sup> The body token takes precedence over the `Authorization` header, and a request that supplies neither returns 401 `UNAUTHORIZED`--<sup>3</sup> A supplied token that resolves to a different account returns `SESSION_TOKEN_MISMATCH`--<sup>4</sup> `deep_link` returns 400 `INVALID_HANDOFF_CODE` when the handoff registered no `return_uri`--:::caution[The approving token may travel in the body]-Sending the token in `token` puts a live credential into a JSON payload. A client SHOULD use the `Authorization` header and omit `token`.-:::--A token that resolves to no live session returns 401 `INVALID_TOKEN`. A malformed, unknown, completed or uninspected code returns 400 `INVALID_HANDOFF_CODE`, as does an exhausted failed-attempt allowance. An expired code returns `INVALID_HANDOFF_CODE` or `HANDOFF_CODE_EXPIRED`. Start a new handoff in either case.--Session creation can also return 403 `BOT_USER_AUTH_SESSION_CREATION_DENIED` for a bot account, and 403 `REGISTRATION_PENDING_APPROVAL` or 403 `REGISTRATION_REJECTED` for an account that has not been admitted. A suspended account returns the suspension codes listed under [log in with a password](#log-in-with-a-password).+| code | string | The handoff code |+| token? | string | The approving device's session token, when you don't send `Authorization` |+| user_id | snowflake | The ID of the approving account |+| return_method? | string | `deep_link` or `code` (default `code`) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [handoff completion](#handoff-completion-object) object | The handoff was completed with the `deep_link` return method |-| 204 | empty | The handoff was completed with the `code` return method |-| 400 | [error response](/http-api/#error-response) | The body, code, expiry state, return method, or session ownership is invalid |-| 401 | [error response](/http-api/#error-response) | The approving credential is missing, invalid, or revoked |-| 403 | [error response](/http-api/#error-response) | The approving session belongs to a bot or to an account awaiting approval or rejected |-| 404 | [error response](/http-api/#error-response) | The approving session resolves to an account that no longer exists |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--Completion creates one new authentication session for the initiating device and publishes its token against the code. With the `deep_link` return method, the token also requires the grant from `return_url`. The token stays readable through [get desktop handoff status](#get-desktop-handoff-status) for whatever remains of the handoff's five minutes. Completion also discards the pending handoff, so the code cannot be completed a second time and a later [get desktop handoff information](#get-desktop-handoff-information) reports `expired`.--The approving session remains valid. The new session takes the initiating device's client IP address, user agent, and reported operating system from the handoff record. No Gateway Dispatch is emitted.+| 200 | [handoff completion](#handoff-completion-object) object | The handoff was approved with `deep_link` |+| 204 | empty | The handoff was approved with `code` |+| 400 | [error response](/http-api/#error-response) | `INVALID_HANDOFF_CODE` or `HANDOFF_CODE_EXPIRED` when the code is unknown or expired |+| 401 | [error response](/http-api/#error-response) | `INVALID_TOKEN` when the approving session is not active |-### Rate limit--10 requests per minute, on the `auth:handoff:complete` bucket, and a client IP address is blocked after 5 failed code attempts in 15 minutes.+The rate limit is 10 requests per minute, on the `auth:handoff:complete` bucket.## Deny a desktop handoff<RouteHeader method="POST" path="/v1/auth/handoff/{code}/deny" unauthenticated />-Declines a pending handoff after the approving device has looked it up. Authentication is not required. Returns 204 with no body.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| code | string | The handoff code, using the same normalisation contract as [get desktop handoff information](#get-desktop-handoff-information) |--Only a code that [get desktop handoff information](#get-desktop-handoff-information) has already inspected can be denied. An unknown, expired, or uninspected code returns 400 `INVALID_HANDOFF_CODE` and records a failed attempt. A malformed code and a request from a client IP address that has exhausted its failed-attempt allowance return the same error without recording one.+Declines a handoff and returns 204, and the other device sees `denied`.### Response| Status | Body | Condition || --- | --- | --- || 204 | empty | The handoff was denied |-| 400 | [error response](/http-api/#error-response) | The code is malformed, uninspected or unknown, or the client IP attempt allowance is exhausted |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--The handoff stays stored until it expires, marked denied, and the inspected state is cleared. The initiating device reads the `denied` status, [complete desktop handoff](#complete-desktop-handoff) rejects the code, and [get desktop handoff information](#get-desktop-handoff-information) reports `expired`. No session is created and no Gateway Dispatch is emitted.+| 400 | [error response](/http-api/#error-response) | `INVALID_HANDOFF_CODE` when the code is unknown, expired or not looked up first |-### Rate limit--10 requests per minute, on the `auth:handoff:deny` bucket, and a client IP address is blocked after 5 failed code attempts in 15 minutes.+The rate limit is 10 requests per minute, on the `auth:handoff:deny` bucket.## Get desktop handoff status<RouteHeader method="GET" path="/v1/auth/handoff/{code}/status" unauthenticated />-Reports the state of a handoff to the device that initiated it. Authentication is not required. Returns a [handoff status](#handoff-status-object) object.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| code | string | The handoff code, using the same normalisation contract as [get desktop handoff information](#get-desktop-handoff-information) |--:::note[This route never returns the token]-The token needs `poll_secret`, so a completed handoff reports `pending` here. Read it with [get desktop handoff status with the poll secret](#get-desktop-handoff-status-with-the-poll-secret).-:::--The code is the only credential this route checks. The initiating device MUST poll for the completion itself.+Returns the [handoff status](#handoff-status-object) without the token, and reports a completed handoff as `pending`. To get the token, use [get desktop handoff status with the poll secret](#get-desktop-handoff-status-with-the-poll-secret).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [handoff status](#handoff-status-object) object | The state was read, or an unknown code was reported as expired |-| 400 | [error response](/http-api/#error-response) | The code is malformed, returning `INVALID_HANDOFF_CODE` |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects+| 200 | [handoff status](#handoff-status-object) object | The status was returned |+| 400 | [error response](/http-api/#error-response) | `INVALID_HANDOFF_CODE` when the code is malformed or this IP address has 5 failed handoff attempts |-A poll leaves the handoff unchanged. A poll against a completed handoff records a failed attempt for the polling IP address, because this route presents no `poll_secret`. No account state changes and no Gateway Dispatch is emitted.--### Rate limit--60 requests per minute, on the `auth:handoff:status` bucket.+The rate limit is 60 requests per minute, on the `auth:handoff:status` bucket.## Get desktop handoff status with the poll secret<RouteHeader method="POST" path="/v1/auth/handoff/{code}/status" unauthenticated />-Reports the state of a handoff and delivers the new session token once, to a caller that presents the poll secret issued at initiation. Authentication is not required. Returns a [handoff status](#handoff-status-object) object.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| code | string | The handoff code, using the same normalisation contract as [get desktop handoff information](#get-desktop-handoff-information) |+Returns the [handoff status](#handoff-status-object) and, once, the new session token. Keep the token when you get it, because later polls return `expired`. A wrong secret returns `pending`.### JSON body| Field | Type | Description || --- | --- | --- |-| poll_secret | string | The secret returned by [initiate desktop handoff](#initiate-desktop-handoff) |-| grant?<sup>1</sup> | string | The one-time grant from the [handoff completion](#handoff-completion-object) deep link |--<sup>1</sup> A handoff completed with the `deep_link` return method reports `pending` until the grant is presented, and a wrong grant also records a failed attempt--:::caution[The completed status is delivered exactly once]-The token is returned once. Later polls report `expired`, so the initiating device MUST retain it when first received.-:::--A secret that does not match reports `pending` and records a failed attempt for the polling IP address. The route reports no distinct error for a wrong secret, so a caller cannot tell a wrong secret from a handoff the approving device has not finished.+| poll_secret | string | The secret from [initiate desktop handoff](#initiate-desktop-handoff) |+| grant? | string | The `grant` from the [handoff completion](#handoff-completion-object) link, for `deep_link` |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [handoff status](#handoff-status-object) object | The state was read, or an unknown code was reported as expired |-| 400 | [error response](/http-api/#error-response) | The code is malformed, returning `INVALID_HANDOFF_CODE` |-| 404 | [error response](/http-api/#error-response) | The completed handoff names an account that no longer exists, returning `UNKNOWN_USER` |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects+| 200 | [handoff status](#handoff-status-object) object | The status was returned |+| 400 | [error response](/http-api/#error-response) | `INVALID_HANDOFF_CODE` when the code is malformed or this IP address has 5 failed handoff attempts |-Retrieving the token completes the handoff. Other polls leave it unchanged. No Gateway Dispatch is emitted.--### Rate limit--60 requests per minute, on the `auth:handoff:status` bucket.+The rate limit is 60 requests per minute, on the shared `auth:handoff:status` bucket.## Cancel a desktop handoff<RouteHeader method="DELETE" path="/v1/auth/handoff/{code}" unauthenticated />-Discards a handoff and everything stored against its code. Authentication is not required. Returns 204 with no body.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| code | string | The handoff code, using the same normalisation contract as [get desktop handoff information](#get-desktop-handoff-information) |+Cancels a handoff and returns 204. A session that was already created stays signed in.### JSON body| Field | Type | Description || --- | --- | --- |-| poll_secret | string | The secret returned by [initiate desktop handoff](#initiate-desktop-handoff) |--An unknown or already expired code has no stored secret, so it returns 400 `INVALID_HANDOFF_CODE`.--:::caution[Cancelling requires the poll secret]-The route requires the `poll_secret` that [initiate desktop handoff](#initiate-desktop-handoff) returned, sent in the JSON body. A wrong secret returns 400 `INVALID_HANDOFF_CODE`, so a party that knows only the code cannot cancel the handoff. After a cancellation the initiating device reads the `expired` status.-:::+| poll_secret | string | The secret from [initiate desktop handoff](#initiate-desktop-handoff) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | The handoff was discarded |-| 400 | [error response](/http-api/#error-response) | The code is malformed, or the secret does not match, returning `INVALID_HANDOFF_CODE` |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--Cancelling prevents any further token retrieval but does not revoke a session already created by completion. No Gateway Dispatch is emitted.--### Rate limit+| 204 | empty | The handoff was cancelled |+| 400 | [error response](/http-api/#error-response) | `INVALID_HANDOFF_CODE`, also for a wrong secret |-10 requests per minute, on the `auth:handoff:cancel` bucket.+The rate limit is 10 requests per minute, on the `auth:handoff:cancel` bucket.## Create origin handoff<RouteHeader method="POST" path="/v1/auth/origin-handoff" />-Stores encrypted client state so that another web origin of the same instance can take it over once. Requires a user session token. Returns an [origin handoff](#origin-handoff-object) object.--The sending origin encrypts the state and keeps the key. Fluxer never receives the key and never reads the payload. The receiving origin holds a nonce, and the sender passes only its digest here.+Stores encrypted app state for 2 minutes so another web origin of the same instance can take it once. Returns an [origin handoff](#origin-handoff-object) object. The sender keeps the encryption key, and Fluxer only stores the payload.### JSON body| Field | Type | Description || --- | --- | --- |-| nonce_hash | string | The SHA-256 digest of the receiving origin's nonce, as 64 lowercase hex characters |-| payload | string | The encrypted client state as base64url, 1 to 8388608 characters |--A bot token and an OAuth2 bearer token both return 403 `ACCESS_DENIED`.+| nonce_hash | string | The SHA-256 of the receiving origin's nonce, as 64 lowercase hex characters |+| payload | string | The encrypted state as base64url (1-8,388,608 characters) |### Response@@ -2097,48 +1290,27 @@ A bot token and an OAuth2 bearer token both return 403 `ACCESS_DENIED`.| --- | --- | --- || 200 | [origin handoff](#origin-handoff-object) object | The state was stored |-### Side effects--Fluxer keeps the payload, the nonce digest, and the account ID for two minutes under a key derived from the identifier. Creating a handoff creates no session and changes no account state. No Gateway Dispatch is emitted.--### Rate limit--3 requests per 10 minutes, on the `auth:origin_handoff:create` bucket.+The rate limit is 3 requests per 10 minutes, on the `auth:origin_handoff:create` bucket.## Redeem origin handoff<RouteHeader method="POST" path="/v1/auth/origin-handoff/redeem" unauthenticated />-Releases the client state stored by [create origin handoff](#create-origin-handoff) and deletes it in the same step. Authentication is not required. Returns an [origin handoff payload](#origin-handoff-payload-object) object.+Returns the state stored by [create origin handoff](#create-origin-handoff) as an [origin handoff payload](#origin-handoff-payload-object) object. Every attempt deletes the state, even one with a wrong nonce.### JSON body| Field | Type | Description || --- | --- | --- |-| handoff_id | string | The identifier returned by create origin handoff, 43 base64url characters |-| nonce | string | The nonce whose digest the sender supplied, as base64url, 16 to 256 characters |--An unknown, expired, or already redeemed identifier returns 404 `UNKNOWN_ORIGIN_HANDOFF`. A nonce whose SHA-256 digest does not match returns 400 `INVALID_ORIGIN_HANDOFF_NONCE`.--:::caution[Every attempt consumes the handoff]-Fluxer deletes the stored state before it compares the nonce. A wrong nonce leaves nothing to retry, so the sender MUST create a new handoff.-:::+| handoff_id | string | The ID from create origin handoff, 43 base64url characters |+| nonce | string | The nonce whose SHA-256 was sent, as base64url (16-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [origin handoff payload](#origin-handoff-payload-object) object | The state was released and deleted |-| 400 | [error response](/http-api/#error-response) | The body is invalid, or the nonce does not match |-| 404 | [error response](/http-api/#error-response) | No stored handoff has this identifier, returning `UNKNOWN_ORIGIN_HANDOFF` |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |-| 500 | [error response](/http-api/#error-response) | Unexpected internal failure occurs |-| 503 | [error response](/http-api/#error-response) | The instance is at its in-flight request ceiling |--### Side effects--A redemption that finds the handoff deletes it, whether or not the nonce matches. Redemption creates no session. The payload is all the receiving origin gets. No Gateway Dispatch is emitted.--### Rate limit+| 200 | [origin handoff payload](#origin-handoff-payload-object) object | The state was returned and deleted |+| 400 | [error response](/http-api/#error-response) | `INVALID_ORIGIN_HANDOFF_NONCE` when the nonce does not match |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_ORIGIN_HANDOFF` when the ID is unknown, expired or used |-10 requests per minute, on the `auth:origin_handoff:redeem` bucket.+The rate limit is 10 requests per minute, on the `auth:origin_handoff:redeem` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/billing.mdx b/fluxer_docs/src/content/docs/http-api/billing.mdxindex a3d13bcde..593cebb3f 100644--- a/fluxer_docs/src/content/docs/http-api/billing.mdx+++ b/fluxer_docs/src/content/docs/http-api/billing.mdx@@ -1,30 +1,24 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Billing-description: Checkout, gift purchase, and the Stripe webhook.+description: Start premium and gift checkouts and receive Stripe webhook events.---import RouteHeader from '@/components/RouteHeader.astro';-These routes take payment for premium. Checkout finishes on the payment provider's own pages, so the checkout routes create the provider session and return its URL for the browser to open. [Receive Stripe webhook](#receive-stripe-webhook) takes the signed events the provider sends back. The [Premium resource](/http-api/premium/) owns entitlement state, mirrored billing data and subscription self-service.+These routes start a premium purchase on Stripe and receive Stripe's events. Checkout finishes on Stripe's pages, so the checkout routes return a URL for the browser to open. Entitlement state and subscription self-service are on [Premium](/http-api/premium/).-A self-hosted deployment serves the checkout routes only while billing is active, and serves [receive Stripe webhook](#receive-stripe-webhook) while Stripe is serviceable, as [deployment availability](/http-api/deployment-availability/) describes. All of them are user-only except [receive Stripe webhook](#receive-stripe-webhook).--:::note[Every response is a Fluxer object]-The responses are Fluxer redirect and acknowledgement objects.-:::+The checkout routes only work while [billing is on](/http-api/deployment-availability/), and the webhook only works while Stripe and its webhook secret are set up. Both checkout routes are user-only, so a bot token gets 403 `ACCESS_DENIED`.## Redirect URL object-One absolute URL that completes a billing operation in a browser. [Create subscription checkout](#create-subscription-checkout) and [create gift checkout](#create-gift-checkout) both answer with it. The object has no session identifier, so a client sends the browser to the returned value.+The checkout routes and the billing portal route return this object. Open `url` in the browser.### Structure| Field | Type | Description || --- | --- | --- |-| url<sup>1</sup> | string | Absolute URL that completes the operation in a browser |--<sup>1</sup> Usually an externally hosted payment provider session URL. [Create subscription checkout](#create-subscription-checkout) can answer with the Fluxer premium callback URL instead+| url | string | The URL to open in the browser |### Example@@ -36,7 +30,7 @@ One absolute URL that completes a billing operation in a browser. [Create subscr## Refund eligibility object-The `billing.refund_eligibility` member of [premium state](/http-api/premium/#get-premium-state). A self-hosted deployment offers no self-service refunds, so `eligible` and `cancels_subscription` are false, `reason` is `feature_unavailable`, and every other field is null.+[Premium state](/http-api/premium/#get-premium-state) returns this object as `billing.refund_eligibility`. Self-hosted instances have no self-service refunds and always return the values below.### Structure@@ -55,21 +49,13 @@ The `billing.refund_eligibility` member of [premium state](/http-api/premium/#ge## Webhook received object-The acknowledgement [receive Stripe webhook](#receive-stripe-webhook) returns once it authenticates the event and queues it for asynchronous processing.+The acknowledgement [Receive Stripe webhook](#receive-stripe-webhook) returns.### Structure| Field | Type | Description || --- | --- | --- |-| received | boolean | Always true after the event is authenticated and accepted for processing |--### Example--```json-{- "received": true-}-```+| received | boolean | Always true |## Create subscription checkout@@ -77,153 +63,105 @@ The acknowledgement [receive Stripe webhook](#receive-stripe-webhook) returns onCreates a recurring premium checkout session and returns a [redirect URL](#redirect-url-object) object.-### Limitations--- An unknown price returns 400 `STRIPE_INVALID_PRODUCT`.-- A gift price, a price outside the resolved country catalogue, and an omitted country code for a price that requires one all return 400 `STRIPE_INVALID_PRODUCT_CONFIGURATION`.-- An unclaimed account returns 400 `UNCLAIMED_ACCOUNT_CANNOT_MAKE_PURCHASES`.-- An unverified email address returns 403 `PURCHASE_EMAIL_VERIFICATION_REQUIRED`.-- A verified account with no email address, such as any account on a `username` instance, returns 403 `PURCHASE_RECEIPT_EMAIL_REQUIRED`.-- The purchase-disabled premium flag returns 403 `PREMIUM_PURCHASE_BLOCKED` with the reason `purchase_disabled`.-- An open payment dispute the account made returns 403 `PREMIUM_PURCHASE_BLOCKED` with the reason `payment_dispute_open`, for a subscription and a gift alike.-- A lifetime premium account cannot buy a recurring subscription and returns 403 `PREMIUM_PURCHASE_BLOCKED` with the reason `lifetime`.-- An account whose payment provider customer already holds a subscription in the `active`, `trialing`, `past_due`, `unpaid`, `incomplete` or `paused` state returns the same code with the reason `existing_subscription`, unless Fluxer converts the purchase into a scheduled billing cycle change, as described below.--`reason` is a top-level member of the error response, and an `existing_subscription` refusal also has the blocking status in the top-level `subscription_status` member.--Fluxer evaluates the lifetime refusal before the unclaimed account, unverified email and purchase flag refusals, so a lifetime premium account submitting a recurring price always receives the reason `lifetime` whatever its account state.--An account already holding an `active` or `trialing` subscription can submit a registered recurring non-gift price for the other billing cycle. Fluxer then schedules a billing cycle change to the submitted cycle at the end of the current period. That is exactly what [change subscription billing cycle](/http-api/premium/#change-subscription-billing-cycle) with `effective_at` set to `period_end` does. The response is 200 with `url` set to the Fluxer premium callback URL.--The conversion requires a stored billing cycle on the account that differs from the submitted price's cycle. Any other blocking subscription status, no stored billing cycle, and a matching cycle all still produce 403 `PREMIUM_PURCHASE_BLOCKED`. When scheduling the change fails, the caller receives that failure.+If the account already has an `active` or `trialing` subscription and `price_id` is the price for the other billing cycle, Fluxer schedules the switch for the end of the current period and creates no checkout session. It clears a pending cancellation, sends [User Update](/gateway/events/#user-update) and returns the web app's premium callback URL.### JSON body| Field | Type | Description || --- | --- | --- |-| price_id | string | Registered recurring price ID (1-256 characters) |-| country_code?<sup>1</sup> | string | Two-letter country used to select the regional price catalogue (2 characters) |-| client_geoip_country_code?<sup>2</sup> | string | Two-letter country the client previously observed for itself (2 characters) |-| eu_withdrawal_waiver_accepted?<sup>3</sup> | boolean | Whether the digital content withdrawal waiver was explicitly accepted |-| payment_method?<sup>4</sup> | string | Either `card`, `pix` or `upi` (default `card`) |+| price_id | string | Stripe price ID of a monthly or yearly premium plan (1-256 characters) |+| country_code?<sup>1</sup> | string | Two-letter country code that picks the price catalog (2 characters) |+| client_geoip_country_code? | string | Two-letter country code the client detected, saved with the purchase (2 characters) |+| eu_withdrawal_waiver_accepted? | boolean | Whether the user accepted the EU withdrawal waiver for digital content |+| payment_method?<sup>2</sup> | string | Either `card`, `pix` or `upi` (default `card`) || is_business? | boolean | Whether to require a billing address for tax invoicing (default false) |-<sup>1</sup> Read only when Fluxer cannot geolocate the request, because the request-time geolocation country wins. The resolved country is required whenever the price is not in USD or EUR, and the price is validated against the catalogue for that country, so a client cannot buy outside the catalogue of the country it is browsing from--<sup>2</sup> Read to resolve the effective country for the withdrawal waiver, and recorded with the payment--<sup>3</sup> Considered only when the effective country is inside the European Union or European Economic Area. The effective country is the request-time geolocation country, then the client-observed country, then the pricing country+<sup>1</sup> Fluxer uses this only when it can't find the request's country. With prices set in environment config, a price in a currency other than USD or EUR needs it.-<sup>4</sup> `pix` requires a BRL recurring price and `upi` requires an INR recurring price. Both are rejected for a gift price or a non-recurring price with 400 `STRIPE_INVALID_PRODUCT_CONFIGURATION`.+<sup>2</sup> With prices set in environment config, `pix` needs a BRL price and `upi` needs an INR price. Prices saved in the instance billing settings accept only `card`.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [redirect URL](#redirect-url-object) object | The checkout session was created, or a blocked purchase was converted into a scheduled billing cycle change |-| 400<sup>5</sup> | [error response](/http-api/#error-response) | The price, the account, or the payment provider blocks the checkout |-| 403 | [error response](/http-api/#error-response) | The email address is unverified, or the purchase is blocked |-| 404 | [error response](/http-api/#error-response) | The authenticated account record no longer exists |+| 200 | [redirect URL](#redirect-url-object) object | The session was created or the billing cycle change was scheduled |+| 400 | [error response](/http-api/#error-response) | `STRIPE_INVALID_PRODUCT` for an unknown price |+| 400 | [error response](/http-api/#error-response) | `STRIPE_INVALID_PRODUCT_CONFIGURATION` for a gift price, a wrong catalog or a bad `payment_method` |+| 400 | [error response](/http-api/#error-response) | `UNCLAIMED_ACCOUNT_CANNOT_MAKE_PURCHASES` for an unclaimed account |+| 400 | [error response](/http-api/#error-response) | `STRIPE_ERROR` when Stripe rejects the request |+| 403 | [error response](/http-api/#error-response) | `PURCHASE_EMAIL_VERIFICATION_REQUIRED` for an unverified email address |+| 403 | [error response](/http-api/#error-response) | `PURCHASE_RECEIPT_EMAIL_REQUIRED` for an account with no email address |+| 403 | [error response](/http-api/#error-response) | `PREMIUM_PURCHASE_BLOCKED` with a `reason` in the table below |-<sup>5</sup> The price is unknown or not valid for the resolved catalogue, the account is unclaimed, the payment provider is not configured, or the payment provider rejected the request and returns `STRIPE_ERROR`+A `PREMIUM_PURCHASE_BLOCKED` error has a top-level `reason` field. For `existing_subscription`, it also has `subscription_status` with the status of that subscription.-### Side effects+| Reason | Condition |+| --- | --- |+| purchase_disabled | Purchases are disabled for the account |+| lifetime | The account has lifetime premium |+| existing_subscription | The customer already has a subscription that is `active`, `trialing`, `past_due`, `unpaid`, `incomplete` or `paused` |-Checkout collects the required consent, tax information and any promotion code on the provider's pages.+Premium changes only after [Receive Stripe webhook](#receive-stripe-webhook) gets the matching event.-A converted purchase schedules a billing cycle change instead of opening checkout. It clears pending cancellation and sends [User Update](/gateway/events/#user-update) to every account session.--Premium entitlement otherwise changes only after the matching signed event reaches [receive Stripe webhook](#receive-stripe-webhook).--### Rate limit--3 requests per minute for each authenticated user, on the `stripe:checkout:subscription` bucket.+The rate limit is 3 requests per minute, on the `stripe:checkout:subscription` bucket.## Create gift checkout<RouteHeader method="POST" path="/v1/stripe/checkout/gift" />-Creates a one-off premium gift checkout session and returns a [redirect URL](#redirect-url-object) object.--### Limitations--- The claimed account, verified email, purchase flag and open payment dispute requirements of [create subscription checkout](#create-subscription-checkout) apply unchanged, with the same codes.-- A verified account with no email address can still buy a gift, so `PURCHASE_RECEIPT_EMAIL_REQUIRED` does not apply.-- The submitted price is a registered gift price for the resolved country catalogue, so a recurring price returns 400 `STRIPE_INVALID_PRODUCT_CONFIGURATION`.--Neither the lifetime block nor the existing subscription block applies here, so a lifetime premium account can buy gifts.+Creates a one-time premium gift checkout session and returns a [redirect URL](#redirect-url-object) object. The account checks from [Create subscription checkout](#create-subscription-checkout) apply, but lifetime premium or an existing subscription doesn't block a gift.### JSON body| Field | Type | Description || --- | --- | --- |-| price_id | string | Registered gift price ID (1-256 characters) |-| country_code?<sup>1</sup> | string | Two-letter country used to select the regional gift price catalogue (2 characters) |-| client_geoip_country_code? | string | Two-letter country the client previously observed for itself (2 characters) |-| eu_withdrawal_waiver_accepted? | boolean | Whether the digital content withdrawal waiver was explicitly accepted |+| price_id | string | Stripe price ID of a gift (1-256 characters) |+| country_code?<sup>1</sup> | string | Two-letter country code that picks the price catalog (2 characters) |+| client_geoip_country_code? | string | Two-letter country code the client detected, saved with the purchase (2 characters) |+| eu_withdrawal_waiver_accepted? | boolean | Whether the user accepted the EU withdrawal waiver for digital content || is_business? | boolean | Whether to require a billing address for tax invoicing (default false) |-| payment_method? | string | Either `card`, `pix` or `upi`, which this operation ignores |+| payment_method? | string | Ignored by this route (`card`, `pix` or `upi`) |-<sup>1</sup> Read only when Fluxer cannot geolocate the request, because the request-time geolocation country wins. The resolved country is required whenever the gift price is not in USD or EUR--A submitted `pix` or `upi` is validated against the enum and then discarded. The session restricts no payment method type, so the provider offers whatever the deployment's provider account accepts for the resolved currency.+<sup>1</sup> Fluxer uses this only when it can't find the request's country. With prices set in environment config, a price in a currency other than USD or EUR needs it.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [redirect URL](#redirect-url-object) object | The checkout session was created |-| 400<sup>2</sup> | [error response](/http-api/#error-response) | The price, the account, or the payment provider blocks the checkout |-| 403 | [error response](/http-api/#error-response) | The email address is unverified, or the purchase is blocked |-| 404 | [error response](/http-api/#error-response) | The authenticated account record no longer exists |--<sup>2</sup> The price is unknown or is not a gift price for the resolved catalogue, the account is unclaimed, the payment provider is not configured, or the payment provider rejected the request and returns `STRIPE_ERROR`+| 200 | [redirect URL](#redirect-url-object) object | The session was created |+| 400 | [error response](/http-api/#error-response) | `STRIPE_INVALID_PRODUCT` for an unknown price |+| 400 | [error response](/http-api/#error-response) | `STRIPE_INVALID_PRODUCT_CONFIGURATION` for a recurring price or a wrong catalog |+| 400 | [error response](/http-api/#error-response) | `UNCLAIMED_ACCOUNT_CANNOT_MAKE_PURCHASES` for an unclaimed account |+| 400 | [error response](/http-api/#error-response) | `STRIPE_ERROR` when Stripe rejects the request |+| 403 | [error response](/http-api/#error-response) | `PURCHASE_EMAIL_VERIFICATION_REQUIRED` for an unverified email address |+| 403 | [error response](/http-api/#error-response) | `PURCHASE_RECEIPT_EMAIL_REQUIRED` for an account with no email address |+| 403 | [error response](/http-api/#error-response) | `PREMIUM_PURCHASE_BLOCKED` with `reason` set to `purchase_disabled` |-### Side effects+The [gift](/http-api/gifts/#gift-object) shows up in [List current user gifts](/http-api/users/gifts/#list-current-user-gifts) after Stripe confirms the payment.-The returned URL opens a one-off checkout. The [gift](/http-api/gifts/#gift-object) appears in [List current user gifts](/http-api/users/gifts/#list-current-user-gifts) only after payment is confirmed.--### Rate limit--3 requests per minute for each authenticated user, on the `stripe:checkout:gift` bucket.+The rate limit is 3 requests per minute, on the `stripe:checkout:gift` bucket.## Receive Stripe webhook<RouteHeader method="POST" path="/v1/stripe/webhook" unauthenticated />-Accepts a signed payment provider event for asynchronous processing and returns a [webhook received](#webhook-received-object) object. The signature header is the credential.--### Limitations--- A missing signature header returns 400 `STRIPE_WEBHOOK_SIGNATURE_MISSING`.-- A deployment with no payment provider client or webhook secret configured then returns 400 `STRIPE_WEBHOOK_NOT_AVAILABLE`.-- A signature header that does not verify returns 401 `STRIPE_WEBHOOK_SIGNATURE_INVALID`.--:::caution[The signature covers the exact bytes]-A proxy that re-encodes, reorders or pretty-prints the payload invalidates the signature.-:::+Accepts a signed Stripe event and returns a [webhook received](#webhook-received-object) object. Stripe signs the raw body, and a proxy that changes the body breaks the signature.### Request headers| Field | Type | Description || --- | --- | --- |-| Stripe-Signature | string | Payment provider signature computed over the exact raw request body |+| Stripe-Signature | string | Stripe signature over the raw request body |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [webhook received](#webhook-received-object) object | The event was authenticated and queued |-| 400 | [error response](/http-api/#error-response) | The signature header is missing, or webhook processing is not configured for this deployment |-| 401 | [error response](/http-api/#error-response) | The signature did not verify against the raw body |+| 200 | [webhook received](#webhook-received-object) object | The event was verified and queued |+| 400 | [error response](/http-api/#error-response) | `STRIPE_WEBHOOK_SIGNATURE_MISSING` without the header, `STRIPE_WEBHOOK_NOT_AVAILABLE` when the Stripe client is not set up |+| 401 | [error response](/http-api/#error-response) | `STRIPE_WEBHOOK_SIGNATURE_INVALID` when the signature does not verify || 500 | [error response](/http-api/#error-response) | The event could not be queued |-### Side effects--The response comes before processing, and a redelivered event is applied once.--Accepted events update payment, subscription, gift and dispute results. Resulting account changes reach connected sessions as [User Update](/gateway/events/#user-update).--### Rate limit+Fluxer returns 200 before it processes the event and processes an event Stripe sends twice only once. It sends [User Update](/gateway/events/#user-update) for any account change the event causes.-300 requests per minute for each client IP address, or for the authenticated user when a credential happens to be supplied, on the `stripe:webhook` bucket. The bucket is exempt from the global bucket.+The rate limit is 300 requests per minute, on the `stripe:webhook` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/calls.mdx b/fluxer_docs/src/content/docs/http-api/calls.mdxindex c27fb6637..062c37245 100644--- a/fluxer_docs/src/content/docs/http-api/calls.mdx+++ b/fluxer_docs/src/content/docs/http-api/calls.mdx@@ -1,49 +1,29 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Calls-description: Call eligibility, region selection, ringing, and call session end.+description: How to check call eligibility, ring recipients and change the region of a call in a direct message or group direct message.---import RouteHeader from '@/components/RouteHeader.astro';-A call is the live voice session of a direct message or a group direct message. [Channels](/http-api/channels/) defines the channel itself, its recipient set, and the region list a caller can select.+A call is the live voice session of a direct message or group direct message. You join and leave one by sending [Voice State Update](/gateway/commands/#voice-state-update), and [Call Create](/gateway/events/#call-create), [Call Update](/gateway/events/#call-update) and [Call Delete](/gateway/events/#call-delete) publish its state.-Joining and leaving a call is a main Gateway operation. A client joins or leaves a call by sending [Voice State Update](/gateway/commands/#voice-state-update), and [Call Create](/gateway/events/#call-create), [Call Update](/gateway/events/#call-update), and [Call Delete](/gateway/events/#call-delete) publish the resulting call state.--Every route on this page is user-only. Bot and OAuth2 credentials are rejected.--## Access rules--[Get call eligibility](#get-call-eligibility), [Modify call region](#modify-call-region), [Ring call recipients](#ring-call-recipients), and [Stop ringing call recipients](#stop-ringing-call-recipients) require a direct message or group direct message whose recipients include the caller.--An absent private channel or a caller who is not a recipient returns 404 `UNKNOWN_CHANNEL`. An existing channel of another type returns 400 `INVALID_CHANNEL_TYPE_FOR_CALL`.--[End call session](#end-call-session) applies none of these checks.--## Voice moderation in a private call--A private call has no moderator and no permission overwrites. No account other than the participant itself can change that participant's voice state, and the owner of a group direct message is no exception. The `mute`, `deaf`, and `suppress` fields of a [voice state](/gateway/events/#voice-state-object) that belongs to a call are therefore always false. Only the participant's own [Voice State Update](/gateway/commands/#voice-state-update) changes `self_mute`, `self_deaf`, `self_video`, or `self_stream`.--[Modify guild member](/http-api/guild-members/#modify-guild-member) cannot moderate private calls. A participant leaves at their own request or when their connection ends. No route on this page or Gateway command can disconnect another participant.--Silencing another participant happens in the client. A client MAY mute a participant or change per-participant volume. The client MUST keep each setting local to the listening device, so neither reaches the Gateway or any other participant.--The operations below name another recipient. [Ring call recipients](#ring-call-recipients) adds named recipients to the ringing set of a call, and [Stop ringing call recipients](#stop-ringing-call-recipients) removes them from it. Any current recipient MAY call either one. Neither changes anything for a recipient who has already connected, and neither writes a voice state.+Every route here is user-only and needs a direct message or group direct message that includes you as a recipient. A channel you can't see returns 404 `UNKNOWN_CHANNEL`, and a channel of another type returns 400 `INVALID_CHANNEL_TYPE_FOR_CALL`.## Call eligibility object-Fluxer computes eligibility for one caller against one private channel at the moment of the read. No Gateway event has the result, and neither field reports whether a call is already running in the channel.+Says whether you can ring the other recipients of a channel.### Structure| Field | Type | Description || --- | --- | --- |-| ringable<sup>1</sup> | boolean | Whether the authenticated user can initiate an audible ring in this channel |-| silent<sup>2</sup> | boolean | Whether a newly started call notifies the other recipient without audible ringing |+| ringable<sup>1</sup> | boolean | Whether you can start an audible ring in this channel |+| silent<sup>2</sup> | boolean | Whether a new call notifies the other recipient without ringing |-<sup>1</sup> False when the caller is already connected to the channel's call, when a direct message caller has never claimed its credentials, and when the other recipient's incoming call policy excludes the caller+<sup>1</sup> False when you're already connected to the call, when your [account tier](/http-api/users/#account-tiers) can't make this kind of call, or when the other recipient's [incoming call flags](/http-api/users/#incoming-call-flags) exclude you.-<sup>2</sup> The field is only meaningful for a direct message, and it is `false` for a group direct message and whenever `ringable` is `false`+<sup>2</sup> Always false in a group direct message and whenever `ringable` is false.### Example@@ -58,239 +38,110 @@ Fluxer computes eligibility for one caller against one private channel at the mo<RouteHeader method="GET" path="/v1/channels/{channel_id}/call" />-Returns the [call eligibility object](#call-eligibility-object) for a direct message or group direct message. The caller must satisfy the [access rules](#access-rules).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id<sup>1</sup> | snowflake | The ID of the direct message or group direct message channel |--<sup>1</sup> A guild channel ID is rejected with 400 `INVALID_CHANNEL_TYPE_FOR_CALL`--A direct message reports `ringable` as false when the other recipient's incoming call policy excludes the caller. That policy is the `incoming_call_flags` bitfield of the recipient's [user settings](/http-api/users/settings/). Fluxer checks the policy in this order. The nobody flag rejects every caller. The friends-only flag admits only a friend. Under any other policy a friend is always admitted. A caller who shares a friend with the recipient is admitted when the friends-of-friends flag is set. A caller who shares a guild with the recipient is admitted when the guild-members flag is set. The everyone flag admits every remaining caller. Any other caller is rejected. The silent-everyone flag reports `silent` as true for a caller admitted by the mutual friend, mutual guild, or everyone branch.--For a recipient who has never stored settings, `ringable` is true and `silent` is false. A direct message that has lost its other recipient reports the same pair. In a group direct message `ringable` is true unless the caller is already connected to its call, and `silent` is always false.--Fluxer evaluates the same policy again on a later [Ring call recipients](#ring-call-recipients) request.+Returns a [call eligibility object](#call-eligibility-object). In a direct message, the result follows the other recipient's [incoming call flags](/http-api/users/#incoming-call-flags).### Response| Status | Body | Condition || --- | --- | --- || 200 | [call eligibility](#call-eligibility-object) object | Eligibility was returned |-| 400 | [error response](/http-api/#error-response) | Channel is not a direct message or group direct message and the request returns `INVALID_CHANNEL_TYPE_FOR_CALL` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or the caller is not a recipient, each returning `UNKNOWN_CHANNEL` |--### Rate limit-60 requests per 10 seconds for each authenticated user and channel ID, on the `channel:call:get::channel_id` bucket.+The rate limit is 60 requests per 10 seconds, on the `channel:call:get::channel_id` bucket.## Modify call region<RouteHeader method="PATCH" path="/v1/channels/{channel_id}/call" />-Changes the RTC region of an active direct message or group direct message call. Returns 204 with an empty body. Emits a [Call Update](/gateway/events/#call-update) Gateway event.--### Limitations--- The caller must satisfy the [access rules](#access-rules).-- An active call must exist in the channel.-- A named region must be accessible to the caller.--The caller does not have to be connected to the call.--Supplying `region` on a [peer-to-peer](/gateway/events/#peer-to-peer-voice) call moves the call to a voice server, even when the value names the region the call already has. The move is one way for the life of that call.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the direct message or group direct message channel |+Changes the RTC region of an active call, even if you aren't connected to it. Setting `region` on a [peer-to-peer](/gateway/events/#peer-to-peer-voice) call moves it to a voice server for the rest of the call. Sends [Call Update](/gateway/events/#call-update) when the region changes, and a new [Voice Server Update](/gateway/events/#voice-server-update) to each connected participant.### JSON body| Field | Type | Description || --- | --- | --- |-| region?<sup>1</sup> | ?string | The ID of the [RTC region](/http-api/channels/#rtc-region-object) to select (1 through 64 characters) |-| latitude?<sup>2</sup> | string | The latitude the client reports (1 through 32 characters) |-| longitude?<sup>2</sup> | string | The longitude the client reports (1 through 32 characters) |--<sup>1</sup> An omitted field requests no change, and an explicit null and the exact value `automatic` both select automatic routing and skip the accessibility check+| region?<sup>1</sup> | ?string | The ID of the [RTC region](/http-api/channels/#rtc-region-object) to select (1-64 characters) |+| latitude? | string | Not used, but must be 1-32 characters when sent |+| longitude? | string | Not used, but must be 1-32 characters when sent |-<sup>2</sup> Validated for length and then discarded, so it never affects the selected region--Any other unknown or inaccessible `region` returns 400 `INVALID_FORM_BODY` with the validation code `INVALID_OR_RESTRICTED_RTC_REGION` on the `region` field.--The body can be omitted. Fluxer treats a missing, empty, or whitespace-only body as an empty object, which requests no change. A body that is not valid JSON returns 400 `INVALID_FORM_BODY` with the validation code `INVALID_FORMAT` at the `body` path.--A region identifier is the `id` of an [RTC region object](/http-api/channels/#rtc-region-object). No route returns the regions a call accepts, and [List RTC regions](/http-api/channels/#list-rtc-regions) answers only for a guild voice channel.--A region or voice server is unselectable for a call on any of these grounds:--- It is restricted to named guilds, to a guild feature, or to VIP voice.-- Its user allowlist excludes the caller.--A region whose servers are all inactive or all closed to the caller is unselectable as well. An instance with voice disabled accepts any region string.+<sup>1</sup> Null or `automatic` selects automatic routing. Leave it out to change nothing.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Region was updated, or no change was requested |-| 400 | [error response](/http-api/#error-response) | Channel is not a direct message or group direct message and the request returns `INVALID_CHANNEL_TYPE_FOR_CALL`, or the region is unknown or restricted and the request returns `INVALID_FORM_BODY` with the validation code `INVALID_OR_RESTRICTED_RTC_REGION` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or the caller is not a recipient, each returning `UNKNOWN_CHANNEL`, or no active call exists and the request returns `NO_ACTIVE_CALL` |--### Side effects--Supplying `region` records the new region. When the published call state changes, Fluxer emits [Call Update](/gateway/events/#call-update) to every recipient the call was created with, then issues each connected participant a fresh [Voice Server Update](/gateway/events/#voice-server-update) for the newly selected region. Selecting the region the call already holds emits neither. Omitting `region` changes nothing and emits no Dispatch.--### Rate limit+| 204 | empty | The region was updated, or no change was requested |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` with `INVALID_OR_RESTRICTED_RTC_REGION` when the region is unknown or restricted |+| 404 | [error response](/http-api/#error-response) | `NO_ACTIVE_CALL` when the channel has no call |-10 requests per 10 seconds for each authenticated user and channel ID, on the `channel:call:update::channel_id` bucket.+The rate limit is 10 requests per 10 seconds, on the `channel:call:update::channel_id` bucket.## Ring call recipients<RouteHeader method="POST" path="/v1/channels/{channel_id}/call/ring" />-Starts a direct message or group direct message call, or adds ringing recipients to an existing call. Returns 204 with an empty body. Emits [Message Create](/gateway/events/#message-create), [Call Create](/gateway/events/#call-create), [Channel Create](/gateway/events/#channel-create), and [Call Update](/gateway/events/#call-update) Gateway events.+Starts a call, or adds recipients to the ringing set of an active call. Fluxer rings a recipient only when [Get call eligibility](#get-call-eligibility) would return `ringable` true and `silent` false for them, and it skips the others without an error. In a direct message you can ring only the other recipient.-### Limitations--- The caller must satisfy the [access rules](#access-rules).-- Every explicitly named recipient must be a current recipient other than the caller.-- A direct message also requires that the caller is allowed to send the other recipient a direct message, including the [new conversation limit](/http-api/users/private-channels/#new-conversation-limit).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the direct message or group direct message channel |+A new call sends [Call Create](/gateway/events/#call-create) and [Message Create](/gateway/events/#message-create) for its call message. Ringing into an active call sends [Call Update](/gateway/events/#call-update). Anyone whose channel was closed gets [Channel Create](/gateway/events/#channel-create).### JSON body| Field | Type | Description || --- | --- | --- || recipients?<sup>1</sup> | array[snowflake] | The IDs of the recipients to ring |-| latitude?<sup>2</sup> | string | The latitude the client reports (1 through 32 characters) |-| longitude?<sup>2</sup> | string | The longitude the client reports (1 through 32 characters) |--<sup>1</sup> Omitting the field targets every other current recipient, and an explicit empty array creates the call and reopens the channel for every other recipient while ringing nobody--<sup>2</sup> Validated for length and then discarded, so a new call is always created with automatic routing--The body can be omitted. Fluxer treats a missing, empty, or whitespace-only body as an empty object, which is the same as omitting `recipients`. A body that is not valid JSON returns 400 `INVALID_FORM_BODY` with the validation code `INVALID_FORMAT` at the `body` path.--An identifier that names a non-recipient or the caller itself returns 400 `INVALID_FORM_BODY` with the validation code `USER_NOT_IN_CHANNEL`. A repeated identifier is accepted and rings that recipient once.+| latitude? | string | Not used, but must be 1-32 characters when sent |+| longitude? | string | Not used, but must be 1-32 characters when sent |-A named recipient is only rung when the incoming call policy described by [Get call eligibility](#get-call-eligibility) admits the caller audibly. A recipient admitted only under the silent-everyone flag is notified without being rung. In a direct message Fluxer ignores the named set when choosing whom to ring and always evaluates the policy against the other recipient.+<sup>1</sup> Omit it to ring every other recipient. An empty array starts the call and rings nobody.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Ring operation completed |-| 400 | [error response](/http-api/#error-response) | Channel is not a direct message or group direct message and the request returns `INVALID_CHANNEL_TYPE_FOR_CALL` |-| 400 | [error response](/http-api/#error-response) | A named identifier is not a current recipient and the request returns `INVALID_FORM_BODY` with the validation code `USER_NOT_IN_CHANNEL` |-| 400 | [error response](/http-api/#error-response) | The direct message send policy rejects the caller and the request returns `CANNOT_SEND_MESSAGES_TO_USER` |-| 400 | [error response](/http-api/#error-response) | That same policy rejects a caller who has never claimed its credentials with `UNCLAIMED_ACCOUNT_CANNOT_SEND_DIRECT_MESSAGES` |-| 400 | [error response](/http-api/#error-response) | A concurrent request already created the call and the request returns `CALL_ALREADY_EXISTS` |-| 403 | [error response](/http-api/#error-response) | A limited caller rings an account that has not written in the direct message and the request returns `NEW_CONVERSATIONS_LIMITED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or the caller is not a recipient, each returning `UNKNOWN_CHANNEL` |+| 204 | empty | The ring request was accepted |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` with `USER_NOT_IN_CHANNEL` when a recipient isn't in the channel or is you |+| 400 | [error response](/http-api/#error-response) | `CANNOT_SEND_MESSAGES_TO_USER` when you can't message the other recipient |+| 400 | [error response](/http-api/#error-response) | `CALL_ALREADY_EXISTS` when another request started the call at the same time |+| 403 | [error response](/http-api/#error-response) | `NEW_CONVERSATIONS_LIMITED` under the [new conversation limit](/http-api/users/private-channels/#new-conversation-limit) |+| 403 | [error response](/http-api/#error-response) | `UNCLAIMED_ACCOUNT_CANNOT_SEND_DIRECT_MESSAGES` or `DIRECT_MESSAGE_EMAIL_VERIFICATION_REQUIRED` when your [account tier](/http-api/users/#account-tiers) can't send direct messages |-### Side effects+Each recipient rings for 30 seconds, and a call nobody joins ends when the ringing stops, with [Call Delete](/gateway/events/#call-delete).-The private channel reopens for the caller and notified recipients. An account whose channel was closed receives [Channel Create](/gateway/events/#channel-create).--A new call emits [Call Create](/gateway/events/#call-create) with its ringing set and automatic region, followed by a call system message through [Message Create](/gateway/events/#message-create). The message is read for the caller and increments the unread mention count for other non-bot recipients who have not blocked the caller.--When a call already exists, Fluxer instead extends the ringing set and emits [Call Update](/gateway/events/#call-update) when the set grows. A recipient who is already connected to the call is never added to the ringing set.--Ringing lasts 30 seconds. Its expiry emits [Call Update](/gateway/events/#call-update). If nobody has joined and no recipient remains ringing, the call ends with [Call Delete](/gateway/events/#call-delete).--A call created with an empty ringing set has no ring timer, so it ends on the 120 second idle timer instead. An explicit empty `recipients` array produces such a call, and so does a ring that admits no candidate audibly.--When a call ends, every private-channel recipient receives [Message Update](/gateway/events/#message-update) with the call's end time and participants.--The call's recipient list is fixed when the call is created. Changing the recipient set of a group direct message afterwards neither ends the call nor updates that list. [Add group direct message recipient](/http-api/channels/#add-group-direct-message-recipient), [Remove group direct message recipient](/http-api/channels/#remove-group-direct-message-recipient), and [Delete or leave channel](/http-api/channels/#delete-or-leave-channel) leave a running call in place. A recipient added later receives no Dispatch for it.--### Rate limit--5 requests per 10 seconds for each authenticated user and channel ID, on the `channel:call:ring::channel_id` bucket.+The rate limit is 5 requests per 10 seconds, on the `channel:call:ring::channel_id` bucket.## Stop ringing call recipients<RouteHeader method="POST" path="/v1/channels/{channel_id}/call/stop-ringing" />-Removes recipients from the ringing set of an active direct message or group direct message call. Returns 204 with an empty body. Emits a [Call Update](/gateway/events/#call-update) Gateway event.--### Limitations--- The caller must satisfy the [access rules](#access-rules).-- An active call must exist in the channel.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the direct message or group direct message channel |+Removes recipients from the ringing set of an active call. Sends [Call Update](/gateway/events/#call-update) when the set changes.### JSON body| Field | Type | Description || --- | --- | --- || recipients?<sup>1</sup> | array[snowflake] | The IDs of the recipients to stop ringing |-| latitude?<sup>2</sup> | string | The latitude the client reports (1 through 32 characters) |-| longitude?<sup>2</sup> | string | The longitude the client reports (1 through 32 characters) |+| latitude? | string | Not used, but must be 1-32 characters when sent |+| longitude? | string | Not used, but must be 1-32 characters when sent |-<sup>1</sup> Omitting the field targets the caller alone, which is how a client declines its own incoming call, and an explicit empty array removes nobody--<sup>2</sup> Validated for length and then discarded by this operation--The body can be omitted. Fluxer treats a missing, empty, or whitespace-only body as an empty object, which stops ringing the caller alone. A body that is not valid JSON returns 400 `INVALID_FORM_BODY` with the validation code `INVALID_FORMAT` at the `body` path. An identifier that is not currently ringing is accepted and changes nothing.+<sup>1</sup> Omit it to stop ringing yourself, which declines an incoming call.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Stop-ringing operation completed |-| 400 | [error response](/http-api/#error-response) | Channel is not a direct message or group direct message and the request returns `INVALID_CHANNEL_TYPE_FOR_CALL` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or the caller is not a recipient, each returning `UNKNOWN_CHANNEL`, or no active call exists and the request returns `NO_ACTIVE_CALL` |--### Side effects--When the ringing set changes, every call recipient receives [Call Update](/gateway/events/#call-update). This operation does not end the call immediately. A call with no participants or ringing recipients ends within the existing 120 second idle window and emits [Call Delete](/gateway/events/#call-delete).+| 204 | empty | The ringing set was updated |+| 404 | [error response](/http-api/#error-response) | `NO_ACTIVE_CALL` when the channel has no call |-### Rate limit--20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:call:stop_ringing::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:call:stop_ringing::channel_id` bucket.## End call session<RouteHeader method="POST" path="/v1/channels/{channel_id}/call/end" />-Answers 204 for any well-formed channel ID and takes no body. The route resolves no channel, performs no call operation, and emits no Gateway Dispatch.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id<sup>1</sup> | snowflake | The ID of the direct message or group direct message channel |--<sup>1</sup> The value is only checked for snowflake form, so any well-formed ID is accepted whether or not it names a channel the caller can reach--:::caution[Leaving a call is a Gateway operation]-A participant leaves by sending [Voice State Update](/gateway/commands/#voice-state-update) with a null channel and the `connection_id` to drop.-:::+Does nothing and returns 204 for any channel ID. A call ends when its last participant leaves, and you leave by sending [Voice State Update](/gateway/commands/#voice-state-update) with a null channel.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Request was accepted |--A call ends the moment its last connected participant leaves, whether or not a recipient is still ringing. Fluxer publishes [Call Delete](/gateway/events/#call-delete) at that moment. A call that no participant ever joined ends instead when its last ringing entry expires. A call whose ringing set was emptied by [Stop ringing call recipients](#stop-ringing-call-recipients) ends on the Gateway's 120 second idle timer.--### Rate limit+| 204 | empty | The request was accepted |-10 requests per 10 seconds for each authenticated user and channel ID, on the `channel:call:update::channel_id` bucket, shared with [Modify call region](#modify-call-region).+The rate limit is 10 requests per 10 seconds, on the `channel:call:update::channel_id` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/channels.mdx b/fluxer_docs/src/content/docs/http-api/channels.mdxindex 68e53cfee..63a3de1dd 100644--- a/fluxer_docs/src/content/docs/http-api/channels.mdx+++ b/fluxer_docs/src/content/docs/http-api/channels.mdx@@ -1,18 +1,16 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Channels-description: Channel objects, settings, recipients, permission overwrites, slowmode, and RTC regions.+description: Channel objects and the routes that read, change, delete and follow a channel.---import RouteHeader from '@/components/RouteHeader.astro';-A channel is where a conversation happens, in text or in voice. A [guild](/http-api/guilds/) owns text, announcement, voice, category, link, forum and media channels, and the threads inside them. Outside a guild, a channel is a direct message, a group direct message, or the personal notes channel.--[Messages](/http-api/messages/) defines message content, and [Guild channels](/http-api/guild-channels/) defines guild-scoped listing, creation and reordering. [Threads](/http-api/threads/) defines threads, and [Forums](/http-api/forums/) defines forum and media channels. [Calls](/http-api/calls/) defines ringing, the region of a private call, and ending a call. [Streams](/http-api/streams/) defines the stream keys and previews of a Go Live screen share.+A channel is where people send messages or join a voice call. Guild channels and threads belong to a [guild](/http-api/guilds/), and direct messages, group direct messages and personal notes don't.## Channel object-A channel object always has its identity and type. Every other field is present only for the [channel types](#channel-types) that own it.+Every channel has `id` and `type`, and the other fields are present only on the [channel types](#channel-types) that use them.### Structure@@ -20,92 +18,48 @@ A channel object always has its identity and type. Every other field is present| --- | --- | --- || id | snowflake | The ID of the channel || type | integer | The [type of the channel](#channel-types) |-| guild_id? | snowflake | The ID of the guild, present only for a guild channel |-| name?<sup>1</sup> | string | The name of the channel, present for a guild channel and for a group direct message |-| topic? | ?string | The topic of the channel, or null when none is set, present only for a guild text, announcement, voice, forum, or media channel |-| url? | ?string | The destination URL, present only for a guild link channel |-| icon? | ?string | The icon hash, present only for a group direct message |-| owner_id? | ?snowflake | The ID of the owner, or null when the channel stores none, present only for a group direct message and a thread |-| position?<sup>2</sup> | integer | The sort position, present only for a guild channel other than a thread |-| parent_id?<sup>13</sup> | ?snowflake | The ID of the parent category, null when the channel sits at the top level |-| bitrate?<sup>3</sup> | ?integer | The voice bitrate in bits per second, present only for a guild voice channel |-| user_limit?<sup>4</sup> | ?integer | The configured member occupancy limit, present only for a guild voice channel |-| voice_connection_limit?<sup>5</sup> | ?integer | The number of simultaneous voice connections one user may hold, present only for a guild voice channel |-| rtc_region?<sup>6</sup> | ?string | The ID of the selected RTC region, present only for a guild voice channel |-| rtc_p2p? | boolean | Whether the channel is pinned to [peer-to-peer voice](/gateway/events/#peer-to-peer-voice), present only for a guild voice channel |-| last_message_id? | ?snowflake | The ID of the most recent message, null when the channel has none |-| last_pin_timestamp? | ?ISO8601 timestamp | The time a message was most recently pinned, or null when nothing has ever been pinned |-| permission_overwrites?<sup>7</sup> | array[[permission overwrite](#permission-overwrite-object) object] | The overwrites applied to this channel, present only for a guild channel other than a thread |-| recipients?<sup>8</sup> | array[[partial user](/http-api/users/#partial-user-object) object] | The other recipients of a direct message or group direct message (max 49) |-| nsfw?<sup>9</sup> | boolean | Whether the channel has its own age restriction, present only for a guild channel other than a thread and for a group direct message, where it marks the group for mature content |-| nsfw_override?<sup>9</sup> | ?boolean | Whether this channel overrides the inherited age restriction, or null when it inherits, present only for a guild channel other than a thread |-| content_warning_level?<sup>10</sup> | integer | The [content warning level](#content-warning-levels) stored on this channel, present only for a guild channel other than a thread |-| content_warning_text?<sup>10</sup> | ?string | The content warning text stored on this channel, or null when the channel inherits, present only for a guild channel other than a thread |-| rate_limit_per_user?<sup>11</sup> | integer | The slowmode interval in seconds, present only for a thread and a text, announcement, voice, forum, or media channel |-| nicks?<sup>12</sup> | map[snowflake, string] | The group direct message nicknames keyed by the decimal user ID (each 1-32 characters) |-| flags?<sup>14</sup> | integer | The [channel flags](/http-api/forums/#channel-flags), present only for a forum channel, a media channel, and a thread |-| thread_metadata? | [thread metadata](/http-api/threads/#thread-metadata-object) object | The archive and lock state, present only for a thread |-| message_count? | integer | The number of messages in the thread, present only for a thread |-| total_message_sent? | integer | The number of messages ever sent in the thread, present only for a thread |-| member_count? | integer | The number of thread members, capped at 50, present only for a thread |-| applied_tags?<sup>15</sup> | array[snowflake] | The IDs of the [forum tags](/http-api/forums/#forum-tag-object) applied to a post (max 5) |-| member_ids_preview?<sup>15</sup> | array[snowflake] | The IDs of the most recently joined members of a post, newest first (max 8) |-| member?<sup>16</sup> | [thread member](/http-api/thread-members/#thread-member-object) object | The thread member object of the caller |-| default_auto_archive_duration?<sup>17</sup> | ?integer | The stored default [auto archive duration](/http-api/threads/#auto-archive-durations), which Fluxer does not apply to a new thread, or null when none is set |-| default_thread_rate_limit_per_user?<sup>17</sup> | integer | The slowmode interval in seconds new threads inherit |-| available_tags? | array[[forum tag](/http-api/forums/#forum-tag-object) object] | The tags a post can apply (max 20), present only for a forum or media channel |-| default_reaction_emoji? | ?[default reaction](/http-api/forums/#default-reaction-object) object | The reaction clients show on each post, or null when none is set, present only for a forum or media channel |-| default_sort_order? | ?integer | The default [sort order](/http-api/forums/#forum-sort-orders) of posts, or null when none is set, present only for a forum or media channel |-| default_forum_layout? | integer | The default [layout](/http-api/forums/#forum-layouts) of posts, present only for a forum channel |-| default_tag_setting? | string | The default [tag matching](/http-api/forums/#forum-tag-settings) of a post search, present only for a forum or media channel |--<sup>1</sup> Omitted when a group direct message stores no name, and never present on a direct message or on the personal notes channel--<sup>2</sup> A channel that stores no position reports `0`--<sup>3</sup> A guild voice channel that stores no bitrate reports `0`--<sup>4</sup> The value `0` means no occupancy limit--<sup>5</sup> Defaults to `5` on a guild voice channel that stores no per-user connection limit--<sup>6</sup> Null selects automatic routing. [List RTC regions](#list-rtc-regions) returns the available identifiers--<sup>7</sup> Always present for a guild channel other than a thread, and empty when the channel stores no overwrite--<sup>8</sup> Excludes the authenticated user, omitted entirely when no other recipient remains, and never present on the personal notes channel--<sup>9</sup> A channel with no explicit override reports `nsfw` false and `nsfw_override` null--<sup>10</sup> On a channel that inherits, `content_warning_level` is `0` and `content_warning_text` is null--<sup>11</sup> The interval is `0` when the channel configures no slowmode--<sup>12</sup> Omitted when the group stores no nickname. Clearing a nickname removes its key from the map--<sup>13</sup> On a thread, the ID of the text, announcement, forum, or media channel the thread belongs to--<sup>14</sup> A forum or media channel that stores no flags reports `0`--<sup>15</sup> Present only for a thread whose parent is a forum or media channel--<sup>16</sup> Present only for a thread the caller is a member of, on the operations the [thread object](/http-api/threads/#thread-object) names--<sup>17</sup> Always present for a forum or media channel, where an unset duration is null and an unset interval is `0`. Present for a guild text or announcement channel only when the channel stores a value--A [thread object](/http-api/threads/#thread-object) is a channel object with the thread fields. [Forum channel fields](/http-api/forums/#forum-channel-fields) lists the fields of a forum or media channel.--:::note[Omission and null are distinct]-An absent field is one this channel type does not own. A field present with `null` is one the type owns and that has no value.-:::--A category owns no `parent_id`. A client that reads the absent key as `null` sees a channel whose parent was cleared.--:::caution[Age and warning fields report this channel alone]-The API enforces the value resolved through this channel, then its parent category, then the guild, as described below. A client must resolve the value in the same order before it shows an age restriction or a content warning.-:::--An age restriction and a content warning both resolve through this channel first, then the parent category, and finally the guild. A category has no parent category and resolves through itself and then the guild.+| guild_id? | snowflake | The ID of the guild |+| name? | string | The name of the channel (guild channels, and group direct messages that have one) |+| topic? | ?string | The topic of the channel |+| url? | ?string | The destination URL (link channels) |+| icon? | ?string | The icon hash (group direct messages) |+| owner_id? | ?snowflake | The ID of the owner (group direct messages and threads) |+| position? | integer | The sort position (guild channels other than threads) |+| parent_id? | ?snowflake | The ID of the parent category, or of the parent channel for a thread |+| bitrate? | ?integer | The bitrate in bits per second (voice channels) |+| user_limit? | ?integer | The most members allowed in the channel at once, `0` for no limit (voice channels) |+| voice_connection_limit? | ?integer | The most voice connections one user can have at once (voice channels) |+| rtc_region? | ?string | The ID of the [RTC region](#rtc-region-object), null for automatic (voice channels) |+| rtc_p2p? | boolean | Whether calls use [peer-to-peer voice](/gateway/events/#peer-to-peer-voice) (voice channels) |+| last_message_id? | ?snowflake | The ID of the most recent message |+| last_pin_timestamp? | ?ISO8601 timestamp | When a message was last pinned |+| permission_overwrites? | array[[permission overwrite](#permission-overwrite-object) object] | The permission overwrites (guild channels other than threads) |+| recipients? | array[[partial user](/http-api/users/#partial-user-object) object] | The other recipients of a direct message or group direct message |+| nsfw? | boolean | Whether the channel is age restricted, or a group direct message is marked for mature content |+| nsfw_override? | ?boolean | Whether this channel overrides the inherited age restriction, null when it inherits |+| content_warning_level? | integer | The [content warning level](#content-warning-levels) of this channel |+| content_warning_text? | ?string | The content warning text of this channel |+| rate_limit_per_user? | integer | The slowmode interval in seconds, `0` for none |+| nicks? | map[snowflake, string] | The group direct message nicknames by user ID (1-32 characters each) |+| flags? | integer | The [channel flags](/http-api/forums/#channel-flags) (forum and media channels and threads) |+| thread_metadata? | [thread metadata](/http-api/threads/#thread-metadata-object) object | The archive and lock state (threads) |+| message_count? | integer | The number of messages in the thread |+| total_message_sent? | integer | The number of messages ever sent in the thread |+| member_count? | integer | The number of thread members, counted up to 50 |+| applied_tags? | array[snowflake] | The IDs of the [forum tags](/http-api/forums/#forum-tag-object) on a forum post (max 5) |+| member_ids_preview? | array[snowflake] | The IDs of the latest members to join a forum post, newest first (max 8) |+| member? | [thread member](/http-api/thread-members/#thread-member-object) object | Your thread member object, if you joined the thread |+| default_auto_archive_duration? | ?integer | The default [auto archive duration](/http-api/threads/#auto-archive-durations), stored but not applied to new threads |+| default_thread_rate_limit_per_user? | integer | The slowmode interval in seconds that new threads get |+| available_tags? | array[[forum tag](/http-api/forums/#forum-tag-object) object] | The tags a post can use (max 20, forum and media channels) |+| default_reaction_emoji? | ?[default reaction](/http-api/forums/#default-reaction-object) object | The reaction shown on each post (forum and media channels) |+| default_sort_order? | ?integer | The default [sort order](/http-api/forums/#forum-sort-orders) of posts (forum and media channels) |+| default_forum_layout? | integer | The default [layout](/http-api/forums/#forum-layouts) of posts (forum channels) |+| default_tag_setting? | string | The default [tag matching](/http-api/forums/#forum-tag-settings) of a post search (forum and media channels) |++Threads and forum channels have more fields, described under [thread object](/http-api/threads/#thread-object) and [forum channel fields](/http-api/forums/#forum-channel-fields).++`nsfw`, `nsfw_override` and the content warning fields describe only this channel. To find the setting that applies, use the first one that is set on the channel, then its parent category, then the guild.### Example@@ -134,501 +88,270 @@ An age restriction and a content warning both resolve through this channel first| Value | Name | Description || --- | --- | --- || 0 | GUILD_TEXT | Guild text channel |-| 1 | DM | Direct message channel between exactly two accounts |-| 2 | GUILD_VOICE | Guild voice channel, which also has messages, pins, and slowmode |-| 3 | GROUP_DM | Group direct message channel |-| 4 | GUILD_CATEGORY | Guild category, which owns no parent and no messages |-| 5 | GUILD_ANNOUNCEMENT<sup>2</sup> | Guild text channel whose messages can be published to the channels that follow it |-| 10 | ANNOUNCEMENT_THREAD<sup>3</sup> | A thread in an announcement channel, visible to everyone who can view the parent |-| 11 | PUBLIC_THREAD<sup>3</sup> | A thread visible to everyone who can view the parent |-| 12 | PRIVATE_THREAD<sup>3</sup> | A thread in a guild text channel visible to its members and to thread moderators |-| 15 | GUILD_FORUM<sup>4</sup> | Guild channel that holds posts and no messages of its own |-| 16 | GUILD_MEDIA<sup>4</sup> | Forum channel that can [hide media download options](/http-api/forums/#channel-flags) |-| 998 | GUILD_LINK | Guild link channel, which has a destination URL and no messages |-| 999 | DM_PERSONAL_NOTES<sup>1</sup> | Personal notes channel |--<sup>1</sup> Its channel ID is exactly the owning user ID, and it has no recipient and no name. Fluxer creates it on first authenticated access--<sup>2</sup> It has the fields and the slowmode of a guild text channel. [Announcement channels](/topics/announcement-channels/) describes publishing and following--<sup>3</sup> [Thread types](/http-api/threads/#thread-types) describes each type--<sup>4</sup> [Forums](/http-api/forums/) describes forum and media channels--A thread, a forum channel, and a media channel are visible to a bot and to a user session that declares the [`channel_threads` client capability](/http-api/threads/#client-capability). A route that resolves one by ID returns 404 `UNKNOWN_CHANNEL` to every other caller unless its own entry states another result. [Get channel](#get-channel) and [List guild channels](/http-api/guild-channels/#list-guild-channels) return `default_auto_archive_duration` and `default_thread_rate_limit_per_user` on a guild text or announcement channel to those two callers alone. `channels` on [Get guild](/http-api/guilds/#get-guild) has forum channels, media channels, and both fields for every caller.+| 1 | DM | Direct message between two users |+| 2 | GUILD_VOICE | Guild voice channel, which also has messages |+| 3 | GROUP_DM | Group direct message |+| 4 | GUILD_CATEGORY | Guild category |+| 5 | GUILD_ANNOUNCEMENT | Text channel that other channels can [follow](/topics/announcement-channels/) |+| 10 | ANNOUNCEMENT_THREAD | Thread in an announcement channel |+| 11 | PUBLIC_THREAD | Thread anyone who can view the parent can see |+| 12 | PRIVATE_THREAD | Thread only its members and thread moderators can see |+| 15 | GUILD_FORUM | Channel of posts, with no messages of its own |+| 16 | GUILD_MEDIA | Forum channel that can [hide media download options](/http-api/forums/#channel-flags) |+| 998 | GUILD_LINK | Channel with a destination URL and no messages |+| 999 | DM_PERSONAL_NOTES | Your personal notes, whose ID is your user ID |++A bot always sees threads, forum channels and media channels. A user session sees them only when it declares the [`channel_threads` client capability](/http-api/threads/#client-capability), and an OAuth2 token never does. Other callers get 404 `UNKNOWN_CHANNEL` for them.## Permission overwrite object-A permission overwrite changes the effective guild permissions for one role or one member in one channel. `allow` and `deny` are decimal strings because a permission mask exceeds the range a JSON number preserves. [Permissions](/http-api/permissions/) defines the individual flags.+A permission overwrite changes the permissions of one role or member in one channel. `allow` and `deny` are decimal strings, and [Permissions](/http-api/permissions/) lists the flags.### Structure| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | snowflake | The ID of the role or member |-| type | integer | The [permission overwrite type](#permission-overwrite-types) of the identifier in `id` |-| allow<sup>2</sup> | decimal string | The bitfield of permissions this overwrite allows |-| deny<sup>2</sup> | decimal string | The bitfield of permissions this overwrite denies |--<sup>1</sup> One identifier addresses one overwrite, so storing an overwrite for an identifier that already has one replaces it, even when the two name different types--<sup>2</sup> Every bit outside the defined permission set is discarded on write, and both fields are `0` when the overwrite grants and denies nothing--No route bounds the number of overwrites a channel stores. [Modify channel](#modify-channel) and [Create guild channel](/http-api/guild-channels/#create-guild-channel) accept a `permission_overwrites` array of any length, and no [limit key](/http-api/instance/#limit-keys) caps it.--### Example--```json-{- "id": "1501314428688990000",- "type": 0,- "allow": "3072",- "deny": "0"-}-```+| id | snowflake | The ID of the role or member |+| type | integer | The [permission overwrite type](#permission-overwrite-types) |+| allow | decimal string | The permissions this overwrite allows |+| deny | decimal string | The permissions this overwrite denies |## Permission overwrite types| Value | Name | Description || --- | --- | --- |-| 0 | ROLE | Overwrite applies to a guild role |-| 1 | MEMBER | Overwrite applies to a guild member |+| 0 | ROLE | Overwrite for a role |+| 1 | MEMBER | Overwrite for a member |## Content warning levels| Value | Name | Description || --- | --- | --- |-| 0 | INHERIT | Inherit the content warning of the parent category and then of the guild |-| 1 | CONTENT_WARNING | Apply the content warning stored on this channel |+| 0 | INHERIT | Use the content warning of the parent category, then the guild |+| 1 | CONTENT_WARNING | Use the content warning text of this channel |## Channel slowmode state object-The slowmode state combines the channel's configured interval with the authenticated user's next permitted send time.+This object tells you whether you can send in a channel with slowmode.### Structure| Field | Type | Description || --- | --- | --- |-| rate_limit_per_user | integer | The configured slowmode interval in seconds, or `0` when slowmode is disabled |-| retry_after_ms<sup>1</sup> | integer | The remaining delay in milliseconds before the user can send |-| next_send_allowed_at<sup>1</sup> | ?ISO8601 timestamp | The next permitted send time, or null when no delay applies |-| can_bypass<sup>2</sup> | boolean | Whether the user bypasses slowmode through [BYPASS_SLOWMODE](/http-api/permissions/) |+| rate_limit_per_user | integer | The slowmode interval in seconds, `0` for none |+| retry_after_ms | integer | The milliseconds left before you can send |+| next_send_allowed_at | ?ISO8601 timestamp | When you can send next, null when you can send now |+| can_bypass | boolean | Whether you skip slowmode with [BYPASS_SLOWMODE](/http-api/permissions/) |-<sup>1</sup> Both report no delay in a private channel, for an interval of `0`, for a bot caller, and for a caller holding `BYPASS_SLOWMODE`--<sup>2</sup> True only for a non-bot caller holding `BYPASS_SLOWMODE` in a guild channel with a non-zero interval, so a bot caller and a private channel both report `false` even though neither is delayed--For a forum or media channel the state reports the delay before the user can create a post.--### Example--```json-{- "rate_limit_per_user": 10,- "retry_after_ms": 4200,- "next_send_allowed_at": "2026-08-31T09:14:02.000Z",- "can_bypass": false-}-```+Bots never wait, and direct messages and group direct messages have no slowmode. In a forum or media channel, the state applies to creating a post.## RTC region object-An RTC region names one voice routing target the deployment operates. Its identifier is the value a guild voice channel stores in `rtc_region`, and the name and emoji exist only for display.+An RTC region is a voice region on the instance, and a voice channel stores its `id` in `rtc_region`.### Structure| Field | Type | Description || --- | --- | --- || id | string | The ID of the RTC region |-| name | string | The name shown for the region in a client |-| emoji | string | The emoji the operator configured for the region |--### Example--```json-{- "id": "eu-central",- "name": "Frankfurt",- "emoji": "🇩🇪"-}-```+| name | string | The display name of the region |+| emoji | string | The emoji shown for the region |## Followed channel object-A followed channel object names the announcement channel that was followed and the [channel follower webhook](/http-api/webhooks/#webhook-types) that now delivers its published messages.+Following an announcement channel returns this object.### Structure| Field | Type | Description || --- | --- | --- || channel_id | snowflake | The ID of the followed announcement channel |-| webhook_id | snowflake | The ID of the channel follower webhook created in the target channel |--### Example--```json-{- "channel_id": "1501314428688998182",- "webhook_id": "1501320000000000123"-}-```+| webhook_id | snowflake | The ID of the [channel follower webhook](/http-api/webhooks/#webhook-types) in the target channel |## Channel follower stats object-The follower stats count the channels that follow one announcement channel and the guilds those channels belong to.+This object counts the channels that follow an announcement channel.### Structure| Field | Type | Description || --- | --- | --- |-| channel_count | integer | The number of channels that follow the announcement channel |-| guild_count | integer | The number of distinct guilds those channels belong to |--### Example--```json-{- "channel_count": 12,- "guild_count": 9-}-```+| channel_count | integer | The number of channels that follow it |+| guild_count | integer | The number of guilds those channels are in |## Get channel<RouteHeader method="GET" path="/v1/channels/{channel_id}" bot />-Returns the [channel object](#channel-object) visible to the authenticated user.--### Limitations--- A guild channel requires [VIEW_CHANNEL](/http-api/permissions/), and a satisfied age verification when it resolves to an age restriction.-- A thread requires `VIEW_CHANNEL` in its parent, and a private thread also requires membership or [thread moderator](/http-api/threads/#thread-moderators) status.-- A private channel requires current recipient access.-- The personal notes channel requires ownership.--Fluxer enforces age verification only for a guild text, announcement, voice, link, forum, or media channel, and for a thread through its parent. Fluxer never requires age verification for a guild category, even when the category has the override its children inherit.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel to return |+Returns a [channel object](#channel-object). You need `VIEW_CHANNEL` in a guild channel, and a private thread also needs you to be a member or a [thread moderator](/http-api/threads/#thread-moderators).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [channel](#channel-object) object | Channel was returned |-| 403 | [error response](/http-api/#error-response) | Caller is not a guild member or lacks `VIEW_CHANNEL`, each returning `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` in the parent of a thread, or cannot view a private thread, each returning `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The guild exists but the caller's membership state cannot be resolved and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The resolved age restriction is not satisfied and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist, or the caller is not a recipient of the private channel, each returning `UNKNOWN_CHANNEL`, or the guild that owns the channel does not exist and the request returns `UNKNOWN_GUILD` |--### Side effects--Requesting the personal notes channel of the authenticated user creates it when it does not already exist, and returns it with no [Channel Create](/gateway/events/#channel-create) Dispatch.--### Rate limit+| 200 | [channel](#channel-object) object | The channel was returned |+| 403 | [error response](/http-api/#error-response) | `NSFW_CONTENT_AGE_RESTRICTED` when the channel is age restricted and the age check fails |-100 requests per 10 seconds for each authenticated user and channel ID, on the `channel:read::channel_id` bucket.+The rate limit is 100 requests per 10 seconds, on the `channel:read::channel_id` bucket.## Get channel slowmode state<RouteHeader method="GET" path="/v1/channels/{channel_id}/slowmode" bot />-Returns the authenticated user's [channel slowmode state object](#channel-slowmode-state-object). The caller needs the same access as [Get channel](#get-channel).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel whose slowmode state is returned |+Returns your [channel slowmode state object](#channel-slowmode-state-object). You need the same access as for [Get channel](#get-channel).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [channel slowmode state](#channel-slowmode-state-object) object | State was returned |-| 403 | [error response](/http-api/#error-response) | Caller is not a guild member or lacks `VIEW_CHANNEL`, each returning `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` in the parent of a thread, or cannot view a private thread, each returning `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The guild exists but the caller's membership state cannot be resolved and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The resolved age restriction is not satisfied and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist, or the caller is not a recipient of the private channel, each returning `UNKNOWN_CHANNEL`, or the guild that owns the channel does not exist and the request returns `UNKNOWN_GUILD` |--### Side effects--The read does not advance the caller's slowmode countdown. Requesting the personal notes channel of the authenticated user creates it when it does not already exist, with no [Channel Create](/gateway/events/#channel-create) Dispatch.--### Rate limit+| 200 | [channel slowmode state](#channel-slowmode-state-object) object | The state was returned |-100 requests per 10 seconds for each authenticated user and channel ID, on the `channel:read::channel_id` bucket.+The rate limit is 100 requests per 10 seconds, on the `channel:read::channel_id` bucket.## List RTC regions<RouteHeader method="GET" path="/v1/channels/{channel_id}/rtc-regions" />-Returns the [RTC region objects](#rtc-region-object) the authenticated user can select for a guild voice channel, in ascending display name order. User-only.--### Limitations--- The caller needs the same access as [Get channel](#get-channel).-- The channel must be a guild voice channel.--Only regions available to the caller are returned. The array can be empty.--:::note[An unconfigured deployment skips the channel check]-On a deployment that configures no voice topology, a missing channel, an invisible channel, and a non-voice channel all return 200 with `[]`.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the guild voice channel |+Returns the [RTC regions](#rtc-region-object) you can pick for a guild voice channel, sorted by name. You need the same access as for [Get channel](#get-channel), and bots can't use this route.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | array[[RTC region](#rtc-region-object) object] | Available regions were returned |-| 400 | [error response](/http-api/#error-response) | Channel is not a guild voice channel and the request returns `INVALID_CHANNEL_TYPE` |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or uses an OAuth2 bearer credential, or the guild exists but the caller's membership state cannot be resolved, each returning `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The caller is not a guild member or lacks `VIEW_CHANNEL` and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The resolved age restriction is not satisfied and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist and the request returns `UNKNOWN_CHANNEL`, or the guild that owns the channel does not exist and the request returns `UNKNOWN_GUILD` |+| 200 | array[[RTC region](#rtc-region-object) object] | The regions were returned |+| 400 | [error response](/http-api/#error-response) | `INVALID_CHANNEL_TYPE` when the channel is not a guild voice channel |-### Rate limit--100 requests per 10 seconds for each authenticated user and channel ID, on the `channel:read::channel_id` bucket.+The rate limit is 100 requests per 10 seconds, on the `channel:read::channel_id` bucket.## Modify channel<RouteHeader method="PATCH" path="/v1/channels/{channel_id}" bot auditReason />-Modifies a guild channel or a group direct message and returns the updated [channel object](#channel-object). Emits a [Channel Update](/gateway/events/#channel-update) Gateway event.--[Modify thread](/http-api/threads/#modify-thread) describes this route for a thread.--### Limitations--- A guild channel requires [VIEW_CHANNEL](/http-api/permissions/) and [MANAGE_CHANNELS](/http-api/permissions/) in that channel.-- Supplying `permission_overwrites` also requires [MANAGE_ROLES](/http-api/permissions/) in that channel.-- Supplying `rtc_region` on a guild voice channel also requires [UPDATE_RTC_REGION](/http-api/permissions/).-- A caller who is not the guild owner cannot allow a permission bit outside their own effective permissions in that channel, and cannot remove a denied bit outside them either.-- A group direct message requires the caller to be a current recipient.-- Ownership transfer requires the caller to be the current owner, and so does setting another recipient's nickname or clearing every nickname.--`MANAGE_CHANNELS` and `MANAGE_ROLES` are [elevated permissions](/http-api/permissions/#elevated-permissions). Each also requires an enrolled multi-factor authenticator when the guild [MFA level](/http-api/guilds/#mfa-levels) is elevated and the caller is not the guild owner. A caller who holds the permission without that authenticator receives 400 [`TWO_FACTOR_REQUIRED`](/http-api/errors/).+Changes a guild channel or a group direct message and returns the [channel object](#channel-object). For threads, use [Modify thread](/http-api/threads/#modify-thread). A guild channel needs `VIEW_CHANNEL` and `MANAGE_CHANNELS`. Changing `permission_overwrites` also needs `MANAGE_ROLES`, and changing `rtc_region` also needs `UPDATE_RTC_REGION`. Unless you own the guild, you can only allow, or stop denying, permissions you have yourself.-:::caution[Supplying `permission_overwrites` deletes the absent overwrites]-The submitted array becomes the complete overwrite collection of the channel.+:::caution+`permission_overwrites` replaces every overwrite on the channel, and overwrites you leave out are deleted. Use [Set channel permission overwrite](#set-channel-permission-overwrite) to change one.:::### Request headers| Field | Type | Description || --- | --- | --- |-| X-Fluxer-Features?<sup>1</sup> | string | A comma-separated [feature declaration](/http-api/permissions/#feature-gated-permission-bits) |--<sup>1</sup> Read only when `permission_overwrites` is supplied. A [feature-gated bit](/http-api/permissions/#feature-gated-permission-bits) the declaration does not name is copied from the stored overwrite+| X-Fluxer-Features? | string | The [feature-gated permission bits](/http-api/permissions/#feature-gated-permission-bits) you can set |### JSON body-The stored channel type selects the body variant. A direct message and the personal notes channel match no variant, and Fluxer rejects both with 400 `INVALID_FORM_BODY`. A thread accepts every field of the [Modify thread body](/http-api/threads/#thread-body).+The body depends on the channel type, and a thread accepts every field of the [Modify thread body](/http-api/threads/#thread-body). Sending one for a direct message or personal notes returns 400 `INVALID_FORM_BODY`.#### Guild channel body-Every field is optional, and an omitted field preserves its current value. Every guild channel type other than a thread accepts the fields below, and a field the stored type does not own is accepted and discarded.+Every field is optional, and a field the channel type doesn't use is ignored.| Field | Type | Description || --- | --- | --- |-| name?<sup>1</sup> | ?string | The name of the channel (1-100 characters after normalisation) |-| topic?<sup>2</sup> | ?string | The topic of the channel (1-1,024 characters), or null to clear it |-| url?<sup>3</sup> | ?string | The destination of a guild link channel (1-2,048 characters, `http` or `https`), or null to clear it |-| parent_id?<sup>4</sup> | ?snowflake | The ID of the parent category, where null or the snowflake `0` moves the channel to the top level |-| bitrate?<sup>5</sup><sup>13</sup> | ?integer | The voice bitrate in bits per second (8,000-384,000) |-| user_limit?<sup>5</sup> | ?integer | The voice occupancy limit (0-99, where `0` configures no limit) |-| voice_connection_limit?<sup>5</sup> | ?integer | The number of simultaneous voice connections one user may hold (1-100) |-| permission_overwrites?<sup>6</sup> | array[[permission overwrite](#permission-overwrite-object) object] | The complete overwrite collection that replaces the stored one |-| nsfw_override?<sup>7</sup> | ?boolean | Whether this channel overrides the inherited age restriction |-| nsfw?<sup>8</sup> | ?boolean | Whether the channel is age restricted, a legacy switch superseded by `nsfw_override` |-| content_warning_level?<sup>9</sup> | integer | The [content warning level](#content-warning-levels) to store on this channel |-| content_warning_text?<sup>10</sup> | ?string | The content warning text (max 200 characters) |-| rate_limit_per_user?<sup>11</sup> | ?integer | The slowmode interval in seconds (0-21,600) |-| rtc_region?<sup>12</sup> | ?string | The ID of the RTC region (1-64 characters) for a guild voice channel, where null selects automatic routing |-| rtc_p2p? | boolean | Whether to pin a guild voice channel to [peer-to-peer voice](/gateway/events/#peer-to-peer-voice). Ignored on every other channel type |--<sup>1</sup> An explicit null preserves the current name. In a guild without flexible channel names, Fluxer lowercases a guild text, announcement, forum, or media channel name, replaces its whitespace with hyphens, and removes disallowed punctuation--<sup>2</sup> An explicit null clears the stored topic. A forum or media channel accepts 1-4,096 characters--<sup>3</sup> Applied only to a guild link channel. An explicit null clears the destination--<sup>4</sup> A category rejects any parent with `CATEGORIES_CANNOT_HAVE_PARENTS`--<sup>5</sup> Applied only to a guild voice channel, and an explicit null clears the stored value+| name? | ?string | The name of the channel (1-100 characters) |+| topic? | ?string | The topic (1-1,024 characters, 4,096 in forum and media channels), null to clear it |+| url? | ?string | The `http` or `https` destination of a link channel (1-2,048 characters), null to clear it |+| parent_id? | ?snowflake | The ID of the parent category, null to move the channel to the top level |+| bitrate?<sup>1</sup> | ?integer | The voice bitrate in bits per second (8,000-384,000) |+| user_limit? | ?integer | The most members allowed in a voice channel at once (0-99, `0` for no limit) |+| voice_connection_limit? | ?integer | The most voice connections one user can have at once (1-100) |+| permission_overwrites? | array[[permission overwrite](#permission-overwrite-object) object] | Every overwrite of the channel, replacing the current ones |+| nsfw_override? | ?boolean | Whether this channel overrides the inherited age restriction, null to inherit |+| nsfw? | ?boolean | Whether the channel is age restricted, ignored when you send `nsfw_override` |+| content_warning_level? | integer | The [content warning level](#content-warning-levels) |+| content_warning_text? | ?string | The content warning text (max 200 characters), null to clear it |+| rate_limit_per_user? | ?integer | The slowmode interval in seconds (0-21,600) |+| rtc_region? | ?string | The ID of an [RTC region](#list-rtc-regions), null for automatic |+| rtc_p2p?<sup>2</sup> | boolean | Whether calls in a voice channel use [peer-to-peer voice](/gateway/events/#peer-to-peer-voice) |-<sup>6</sup> Each entry has `id`, `type`, and the optional `allow` and `deny` masks, each defaulting to `0`+<sup>1</sup> Values over the guild's maximum are lowered to it. The maximum is 96,000 unless the guild has an [audio bitrate feature](/http-api/guilds/#guild-features).-<sup>7</sup> An explicit null returns the channel to inheriting from its parent category and then its guild+<sup>2</sup> Turning it on needs peer-to-peer voice enabled on the instance and [for you](/http-api/experiments/#peer-to-peer-voice-assignment-object), or returns 400 `GUILD_FEATURE_NOT_TOGGLEABLE`.-<sup>8</sup> `nsfw_override` wins when both are supplied. Alone, `true` maps to `nsfw_override` `true` and `false` maps to null--<sup>9</sup> Only `0` and `1` are accepted, and `0` returns the channel to inheriting--<sup>10</sup> Trimmed. A value empty after trimming, or an explicit null, clears the stored text--<sup>11</sup> Applied only to a guild text, announcement, voice, forum, or media channel. An explicit null preserves the current interval--<sup>12</sup> Applied only to a guild voice channel. Supplying the field at all, including as null, requires [UPDATE_RTC_REGION](/http-api/permissions/)--<sup>13</sup> The stored value is capped at 96,000 unless the guild holds an [audio bitrate feature](/http-api/guilds/#guild-features). A higher value is stored at the cap--A guild text or announcement channel also accepts `type`, which converts a text channel into an announcement channel or back.+A text or announcement channel also accepts `type` to switch between the two.| Field | Type | Description || --- | --- | --- |-| type?<sup>14</sup> | integer | The [channel type](#channel-types) to convert to, either `0` or `5` |--<sup>14</sup> Absent, null, or equal to the stored type keeps the type. A value other than `0` or `5` returns 400 `CHANNEL_TYPE_CONVERSION_NOT_SUPPORTED`. Every other stored type ignores `type`+| type? | integer | The [channel type](#channel-types) to convert to, `0` or `5` |-Converting a text channel into an announcement channel fails with 400 `CHANNEL_HAS_FOLLOWED_CHANNELS` while the text channel receives messages from any followed announcement channel. Delete its [channel follower webhooks](/http-api/webhooks/#webhook-types) first. The conversion also fails with 400 `CHANNEL_HAS_THREADS` while the text channel holds a private thread. A conversion changes the type of the public threads of the channel as [Thread types](/http-api/threads/#thread-types) describes. Converting an announcement channel back into a text channel needs no preparation, and Fluxer removes every follow of it afterwards.--A guild text, announcement, forum, or media channel also accepts these fields.+A text, announcement, forum or media channel also accepts these fields from a bot or a session with `channel_threads`.| Field | Type | Description || --- | --- | --- |-| default_auto_archive_duration?<sup>15</sup> | ?integer | The stored default [auto archive duration](/http-api/threads/#auto-archive-durations), which Fluxer does not apply to a new thread, or null to clear it |-| default_thread_rate_limit_per_user?<sup>15</sup> | ?integer | The slowmode interval in seconds new threads inherit (0-21,600), or null to clear it |--<sup>15</sup> Fluxer discards both fields from a caller other than a bot or a user session that declares `channel_threads`--A forum channel also accepts every field of the [forum field table](/http-api/forums/#creating-and-modifying-a-forum). A media channel accepts every field of the [forum field table](/http-api/forums/#creating-and-modifying-a-forum) except `default_forum_layout`.--A `url` that is not an absolute `http` or `https` URL with a host returns 400 `INVALID_FORM_BODY` with the code `INVALID_URL_FORMAT` on the path `url`.--A parent that does not exist in the same guild returns 400 `INVALID_FORM_BODY` with the code `INVALID_PARENT_CHANNEL` on the path `parent_id`. A parent that is not a category returns `PARENT_MUST_BE_CATEGORY` the same way.--Naming a category other than the current parent also checks capacity. A full category returns 400 `MAX_CATEGORY_CHANNELS` with the ceiling it reached, which is the deployment's [`max_channels_per_category`](/http-api/instance/#limit-keys) limit and defaults to 50.--Fluxer accepts an overwrite mask as a decimal string or as a JSON integer. The decimal string holds at most 9223372036854775807, and a larger one returns 400 `INVALID_FORM_BODY` with the code `INTEGER_OUT_OF_INT64_RANGE`. The JSON integer holds at most 9007199254740991, and a number outside the safe integer range returns `INVALID_INTEGER_FORMAT`. Every bit outside the defined permission set is discarded.+| default_auto_archive_duration? | ?integer | The default [auto archive duration](/http-api/threads/#auto-archive-durations), null to clear it |+| default_thread_rate_limit_per_user? | ?integer | The slowmode interval in seconds new threads get (0-21,600), null to clear it |-A non-null `rtc_region` names a region [List RTC regions](#list-rtc-regions) returns for this guild. Any other value returns 400 `INVALID_FORM_BODY` with the code `INVALID_OR_RESTRICTED_RTC_REGION` on the path `rtc_region`. A deployment that configures no voice topology validates no region and stores any accepted string.+A forum channel also accepts every field of the [forum field table](/http-api/forums/#creating-and-modifying-a-forum). A media channel accepts every field of the [same table](/http-api/forums/#creating-and-modifying-a-forum) except `default_forum_layout`.#### Group direct message body-Every field is optional, and an omitted field preserves its current value.+Every field is optional. Only the owner can change `owner_id`, `nsfw` or another recipient's nickname.| Field | Type | Description || --- | --- | --- |-| name? | ?string | The name of the group (1-100 characters after normalisation), or null to clear it |-| icon?<sup>1</sup> | ?base64 string | The base64-encoded icon image (at most 139,810,136 encoded characters), or null to clear it |-| owner_id?<sup>2</sup> | ?snowflake | The ID of the new owner |-| nicks?<sup>3</sup> | ?map[snowflake, ?string] | The nicknames keyed by the decimal user ID (each 0-32 characters, or null) |-| nsfw?<sup>4</sup> | ?boolean | Whether the group is marked for mature content |+| name? | ?string | The name of the group (1-100 characters), null to clear it |+| icon? | ?base64 string | The icon image as base64 or a data URL, null to clear it |+| owner_id? | ?snowflake | The ID of the recipient who becomes the owner |+| nicks? | ?map[snowflake, ?string] | Nicknames by user ID (0-32 characters each), null to clear them all |+| nsfw? | ?boolean | Whether the group is marked for mature content |-<sup>1</sup> Raw base64 or a data URL, with 1 through 139,810,136 characters after the prefix--<sup>2</sup> An explicit null requests no transfer. The caller must be the current owner and the target a current recipient--<sup>3</sup> An explicit null clears every nickname and requires ownership. A non-owner may address only their own key--<sup>4</sup> An explicit null leaves the setting unchanged. Changing the value requires ownership--Decoded icon bytes are at most the instance-configured `avatar_max_size` [limit](/http-api/instance/#limit-keys), which defaults to the 10 MiB ceiling of 10485760 bytes. A larger image is rejected on the path `icon` with the code `IMAGE_SIZE_EXCEEDS_LIMIT`. PNG, JPEG, WebP, GIF, APNG, AVIF, HEIC, HEIF, JXL, and SVG are accepted, and an animated AVIF is rejected on the same path with `INVALID_IMAGE_FORMAT`.--An `owner_id` naming an account that is not a current recipient returns 404 `UNKNOWN_USER`. A bot target returns 400 `CANNOT_TRANSFER_OWNERSHIP_TO_BOT`.--Fluxer trims a stored nickname, and a value that is null or empty after trimming clears that one nickname. A `nicks` key that is neither a current recipient nor the caller returns 404 `UNKNOWN_USER`.--A group marked for mature content accepts media the scanner flags as sensitive, like an age-restricted guild channel. Turning `nsfw` on while any recipient fails the age check returns 400 `GROUP_DM_MATURE_CONTENT_INELIGIBLE`, which does not say which recipient. A user who fails the age check cannot be added to a marked group, and the add returns the same 403 `MISSING_ACCESS` as a rejecting admission policy.+The decoded icon can't be larger than the [`avatar_max_size`](/http-api/instance/#limit-keys) limit.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [channel](#channel-object) object | Channel was modified, or the submitted values already matched the stored state |-| 400 | [error response](/http-api/#error-response) | The `type` on a text or announcement channel is neither `0` nor `5`, returning `CHANNEL_TYPE_CONVERSION_NOT_SUPPORTED` |-| 400 | [error response](/http-api/#error-response) | The text channel receives followed channels, returning `CHANNEL_HAS_FOLLOWED_CHANNELS` |-| 400 | [error response](/http-api/#error-response) | The text channel holds a private thread, returning `CHANNEL_HAS_THREADS` |-| 400 | [error response](/http-api/#error-response) | `nsfw` is turned on while a recipient fails the age check, returning `GROUP_DM_MATURE_CONTENT_INELIGIBLE` |-| 403 | [error response](/http-api/#error-response) | A required permission, ownership, or permission bit authority is absent and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | A concurrent change removed the caller from the group direct message and the request returns `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The guild exists but the caller's membership state cannot be resolved and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The resolved age restriction is not satisfied and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist, or the caller is not a recipient of the group direct message, each returning `UNKNOWN_CHANNEL` |-| 404 | [error response](/http-api/#error-response) | The guild that owns the channel does not exist and the request returns `UNKNOWN_GUILD` |-| 404 | [error response](/http-api/#error-response) | A referenced owner or nickname target is not a current recipient and the request returns `UNKNOWN_USER` |-| 429 | [error response](/http-api/#error-response) | A concurrent follow holds the channel, returning `RESOURCE_LOCKED` |+| 200 | [channel](#channel-object) object | The channel was changed |+| 400 | [error response](/http-api/#error-response) | `CHANNEL_TYPE_CONVERSION_NOT_SUPPORTED` when `type` is not `0` or `5` |+| 400 | [error response](/http-api/#error-response) | `CHANNEL_HAS_FOLLOWED_CHANNELS` when converting to announcement while the channel follows an announcement channel |+| 400 | [error response](/http-api/#error-response) | `CHANNEL_HAS_THREADS` when converting to announcement while the channel has a private thread |+| 400 | [error response](/http-api/#error-response) | `MAX_CATEGORY_CHANNELS` when the new parent category is full |+| 400 | [error response](/http-api/#error-response) | `GROUP_DM_MATURE_CONTENT_INELIGIBLE` when a recipient fails the age check |+| 400 | [error response](/http-api/#error-response) | `CANNOT_TRANSFER_OWNERSHIP_TO_BOT` when `owner_id` is a bot |-### Side effects+Converting an announcement channel back to text removes every follow of it.-A guild channel change emits [Channel Update](/gateway/events/#channel-update) to every session subscribed to its guild. For a forum or media channel the event reaches only a session with [thread access](/gateway/threads/#session-flag). Replacing a category's permission overwrites also replaces them on each child whose overwrites still exactly match the category's previous values, with one Dispatch per changed child. A child whose overwrites had differed is left unchanged.+Fluxer sends [Channel Update](/gateway/events/#channel-update) to the guild or the group. When you change the overwrites of a category, every child whose overwrites matched the old ones gets the new ones too. Changing `rate_limit_per_user` resets everyone's slowmode delay in the channel.-Changing `rate_limit_per_user` clears the remaining slowmode delay of every user in the channel. Each user's next message is then checked against the new interval. Changing `rtc_region` on a guild voice channel moves its active voice connections to the selected region. A [peer-to-peer](/gateway/events/#peer-to-peer-voice) call in the channel moves to a voice server with that change, unless the channel stores `rtc_p2p` true. Changing `rtc_p2p` leaves a running call as it is and applies to the next call that starts after the channel empties. Changing it to true fails with the field code `GUILD_FEATURE_NOT_TOGGLEABLE` unless the caller's [peer-to-peer voice assignment](/http-api/experiments/#peer-to-peer-voice-assignment-object) is enabled.--Converting an announcement channel into a text channel deletes every [channel follower webhook](/http-api/webhooks/#webhook-types) that follows it. The deletion runs in the background after the response, emits [Webhooks Update](/gateway/events/#webhooks-update) for each target channel, and writes no audit log entry. Copies already delivered stay in the target channels, and later edits and deletions of the published messages still reach them.--A request that changes at least one field creates a channel update audit log entry with the supplied reason, and a conversion records the `type` change in it. Supplying `permission_overwrites` also creates one overwrite create, update, or delete audit log entry for each overwrite the array adds, changes, or removes.--A group direct message change emits [Channel Update](/gateway/events/#channel-update) to every current recipient. A name or successful icon change creates a system message delivered with [Message Create](/gateway/events/#message-create), and replacing the icon permanently deletes the previous one. Ownership and nickname changes create no system message and no audit entry.--### Rate limit--20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:update::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:update::channel_id` bucket.## Delete or leave channel<RouteHeader method="DELETE" path="/v1/channels/{channel_id}" bot auditReason />-Deletes a guild channel, closes a direct message, or removes the caller from a group direct message. Returns 204 with an empty body. Emits a [Channel Delete](/gateway/events/#channel-delete) Gateway event.--[Delete thread](/http-api/threads/#delete-thread) describes this route for a thread.+Deletes a guild channel, closes a direct message or leaves a group direct message, and returns 204. Deleting a guild channel needs `VIEW_CHANNEL` and `MANAGE_CHANNELS`. [Delete thread](/http-api/threads/#delete-thread) has this route for threads.-### Limitations--- Deleting a guild channel requires [VIEW_CHANNEL](/http-api/permissions/) and [MANAGE_CHANNELS](/http-api/permissions/).-- Closing a direct message or leaving a group direct message requires current recipient access.-- The personal notes channel cannot be deleted, and the request returns 400 `CANNOT_EXECUTE_ON_DM`.-- Setting `delete_messages` also requires [sudo mode](/http-api/users/mfa/#sudo-mode) for a user session, satisfied by a valid sudo proof or by the verification fields in the body. A bot token always satisfies it.--`MANAGE_CHANNELS` is an [elevated permission](/http-api/permissions/#elevated-permissions). It also requires an enrolled multi-factor authenticator when the guild [MFA level](/http-api/guilds/#mfa-levels) is elevated and the caller is not the guild owner. A caller who holds the permission without that authenticator receives 400 [`TWO_FACTOR_REQUIRED`](/http-api/errors/). The sudo requirement on `delete_messages` applies at every guild MFA level.--:::danger[A guild channel deletion is immediate and permanent]-Deleting a guild channel destroys the channel record, every message in it, every stored attachment of those messages, its invites, its webhooks, and every thread in it. There is no pending state, no grace period, and no restore.+:::danger+Deleting a guild channel deletes it right away with its messages, attachments, invites, webhooks and threads, and you can't restore it.:::### Query parameters| Field | Type | Description || --- | --- | --- |-| silent?<sup>1</sup> | boolean | Whether to suppress the leave system message of a group direct message (default false) |-| delete_messages?<sup>1</sup> | boolean | Whether to delete the caller's own messages in this channel and its threads first (default false) |--<sup>1</sup> Only the exact trimmed values `true`, `True`, and `1` are true. An absent parameter and every other value, including `TRUE` and `yes`, are false+| silent? | boolean | Whether to skip the system message when leaving a group direct message (default false) |+| delete_messages? | boolean | Whether to first delete your own messages in this channel and its threads (default false) |### Request headers| Field | Type | Description || --- | --- | --- |-| X-Fluxer-Sudo-Mode-JWT?<sup>1</sup> | string | An existing sudo mode proof, read when `delete_messages` is set |--<sup>1</sup> An accepted proof is echoed back in the same response header, and completing the MFA path issues a fresh one+| X-Fluxer-Sudo-Mode-JWT? | string | A [sudo mode](/http-api/users/mfa/#sudo-mode) token, used when `delete_messages` is set |### JSON body-The body is optional. Fluxer reads it only when `delete_messages` is set and no existing sudo proof satisfies the requirement.+The body is optional. With `delete_messages` set, a user session needs [sudo mode](/http-api/users/mfa/#sudo-mode) and can prove it with these fields when it has no sudo token.<a id="sudo-verification-fields"></a>| Field | Type | Description || --- | --- | --- |-| password?<sup>1</sup> | string | The account password, offered as the sudo proof |-| mfa_method?<sup>2</sup> | string | The verification method, one of `totp`, `webauthn` or `email_code` |-| mfa_code? | string | The authenticator code or an unconsumed backup code (1-32 characters), supplied with the `totp` method |-| webauthn_response? | [WebAuthn assertion](/http-api/authentication/#webauthn-assertion) object | The WebAuthn assertion for sudo verification |-| webauthn_challenge? | string | The challenge (1-256 characters) bound to the sudo mode assertion |+| password? | string | The account password, for an account with no TOTP or WebAuthn |+| mfa_method? | string | The verification method, one of `totp`, `webauthn` or `email_code` |+| mfa_code? | string | The authenticator code or a backup code (1-32 characters) |+| webauthn_response? | [WebAuthn assertion](/http-api/authentication/#webauthn-assertion) object | The WebAuthn assertion |+| webauthn_challenge? | string | The challenge the assertion signed (1-256 characters) || email_code_ticket? | string | The ticket from [send a sudo email code](/http-api/users/mfa/#send-a-sudo-email-code) (1-128 characters) || email_code? | string | The 6-digit code from that email |@@ -636,354 +359,176 @@ The body is optional. Fluxer reads it only when `delete_messages` is set and no| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Channel was deleted, closed, or left |-| 400 | [error response](/http-api/#error-response) | Target is the personal notes channel and the request returns `CANNOT_EXECUTE_ON_DM` |-| 403 | [error response](/http-api/#error-response) | Caller is not a guild member or lacks `VIEW_CHANNEL` or `MANAGE_CHANNELS`, each returning `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | Sudo verification is required and the request returns `SUDO_MODE_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | A concurrent change removed the caller from the group direct message and the request returns `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The guild exists but the caller's membership state cannot be resolved and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The resolved age restriction is not satisfied and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist, or the caller is not a recipient of the private channel, each returning `UNKNOWN_CHANNEL`, or the guild that owns the channel does not exist and the request returns `UNKNOWN_GUILD` |--### Side effects--Deleting a guild category first clears the `parent_id` of every child channel and emits [Channel Update](/gateway/events/#channel-update) for each one. The category itself is then deleted like any other guild channel.+| 204 | empty | The channel was deleted, closed or left |+| 400 | [error response](/http-api/#error-response) | `CANNOT_EXECUTE_ON_DM` for your personal notes channel |+| 403 | [error response](/http-api/#error-response) | `SUDO_MODE_REQUIRED` when `delete_messages` is set without sudo mode |-Deleting a guild channel permanently removes its messages, attachments, invites and webhooks.+Deleting a guild channel sends [Channel Delete](/gateway/events/#channel-delete) to the guild. Fluxer sends no [Thread Delete](/gateway/threads/#thread-delete) for its threads, and you should remove every thread whose `parent_id` is the channel. Deleting a category moves its channels to the top level, with a [Channel Update](/gateway/events/#channel-update) for each.-Deleting a guild text, announcement, forum, or media channel also deletes every thread in it with its messages, attachments, and memberships. The deletion runs in the background after the response. Fluxer emits no [Thread Delete](/gateway/threads/#thread-delete) for those threads and writes no audit log entry for them. A client removes every thread whose `parent_id` is the channel when it receives [Channel Delete](/gateway/events/#channel-delete).+Closing a direct message only hides it for you.-Deleting an announcement channel also deletes every [channel follower webhook](/http-api/webhooks/#webhook-types) that follows it and turns each copy of its published messages into a deleted-source placeholder, both in the background after the response. Guild subscribers receive [Channel Delete](/gateway/events/#channel-delete), and the deletion appears in the audit log. When the deleted channel is the guild's system, rules or AFK channel, Fluxer clears that guild setting and emits [Guild Update](/gateway/events/#guild-update).+Leaving a group direct message sends [Channel Recipient Remove](/gateway/events/#channel-recipient-remove) to the others. If you owned the group, another recipient becomes the owner. To see the new `owner_id`, fetch the channel again, because Fluxer sends no Channel Update for the change. When the last recipient leaves, the group and its messages are deleted.-Closing a direct message marks the channel closed for the caller alone and emits [Channel Delete](/gateway/events/#channel-delete) to that caller. The channel, its messages, and the other recipient's view are untouched.--Leaving a group direct message removes the caller from the recipient set, removes the caller's nickname, and closes the channel for the caller. If the caller owned the group, ownership transfers to one of the remaining recipients chosen at random.--Remaining recipients receive [Channel Recipient Remove](/gateway/events/#channel-recipient-remove), and unless `silent` is true also a removal system message through [Message Create](/gateway/events/#message-create). The leaving caller receives [Channel Delete](/gateway/events/#channel-delete). No [Channel Update](/gateway/events/#channel-update) reports the ownership transfer or the removed nickname, so a client tracking `owner_id` or `nicks` must refetch the channel.--Leaving as the final recipient permanently deletes the channel's messages and the channel record, with no system message.--Setting `delete_messages` deletes the caller's authored messages in this channel and its threads after sudo verification and before the channel operation runs, and the response waits for that deletion to finish.--### Rate limit--20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:delete::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:delete::channel_id` bucket.## Add group direct message recipient<RouteHeader method="PUT" path="/v1/channels/{channel_id}/recipients/{user_id}" bot />-Adds a user to a group direct message and returns 204 with an empty body. Emits a [Channel Recipient Add](/gateway/events/#channel-recipient-add) Gateway event.--### Limitations--- The caller must be a current recipient of the group, and must be friends with the target, including when the caller is a bot.-- The target's group direct message admission policy must allow the caller.-- A solved [CAPTCHA](/topics/captcha/) challenge is required while the instance check is on.--Fluxer evaluates the target's admission policy in this order.--1. A target that has never stored settings admits every caller.-2. The nobody setting rejects every caller, and the everyone setting admits every caller.-3. The friends-only setting admits only a caller the target has as a friend.-4. Otherwise Fluxer admits the caller through an existing friendship, then through a mutual friend when the friends-of-friends setting is enabled, and then through a mutual guild when the guild-members setting is enabled.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the group direct message channel |-| user_id | snowflake | The ID of the user to add |+Adds a user to a group direct message and returns 204. You need to be in the group and friends with the user, and the user's privacy settings have to allow group direct messages from you.### Request headers| Field | Type | Description || --- | --- | --- |-| X-Captcha-Token?<sup>1</sup> | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |--<sup>1</sup> A missing token returns 400 `CAPTCHA_REQUIRED` and a rejected token returns 400 `INVALID_CAPTCHA`, each with a new challenge. [CAPTCHA handling](/topics/captcha/#exemption) states when an instance skips verification+| X-Captcha-Token? | string | The solved CAPTCHA, see [CAPTCHA handling](/topics/captcha/) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Recipient was added, or was already a recipient |-| 400 | [error response](/http-api/#error-response) | CAPTCHA proof is missing or rejected, or the caller and target are not friends and the request returns `NOT_FRIENDS_WITH_USER` |-| 400 | [error response](/http-api/#error-response) | The group is already full and the request returns `MAX_GROUP_DM_RECIPIENTS` |-| 400 | [error response](/http-api/#error-response) | The channel is not a group direct message and the request returns `INVALID_CHANNEL_TYPE` |-| 403 | [error response](/http-api/#error-response) | Caller is not a recipient, the target's admission policy rejects the caller, or the target fails the age check of a group marked for mature content, each returning `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The account is [limited](/http-api/users/#account-limitation) and the request returns `ACCOUNT_LIMITED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist and the request returns `UNKNOWN_CHANNEL` |--The `MAX_GROUP_DM_RECIPIENTS` body has `max_recipients`, the exact ceiling that was reached. That ceiling is the deployment's [`max_group_dm_recipients`](/http-api/instance/#limit-keys) limit resolved for the caller, and it defaults to 50.--### Side effects+| 204 | empty | The user was added, or was already in the group |+| 400 | [error response](/http-api/#error-response) | `CAPTCHA_REQUIRED` or `INVALID_CAPTCHA` when the CAPTCHA is missing or wrong |+| 400 | [error response](/http-api/#error-response) | `NOT_FRIENDS_WITH_USER` when you aren't friends with the user |+| 400 | [error response](/http-api/#error-response) | `MAX_GROUP_DM_RECIPIENTS` when the group is full, with the limit in `max_recipients` |+| 400 | [error response](/http-api/#error-response) | `INVALID_CHANNEL_TYPE` when the channel is not a group direct message |+| 403 | [error response](/http-api/#error-response) | `MISSING_ACCESS` when the user's settings or age don't allow it |+| 403 | [error response](/http-api/#error-response) | `ACCOUNT_LIMITED` when your account is [limited](/http-api/users/#account-limitation) |-The added user receives [Channel Create](/gateway/events/#channel-create), existing recipients receive [Channel Recipient Add](/gateway/events/#channel-recipient-add), and every recipient receives an addition system message through [Message Create](/gateway/events/#message-create). Adding an existing recipient changes nothing and emits no Dispatch.+A group can have at most [`max_group_dm_recipients`](/http-api/instance/#limit-keys) recipients. The added user gets [Channel Create](/gateway/events/#channel-create) and the others get [Channel Recipient Add](/gateway/events/#channel-recipient-add).-### Rate limit--20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:update::channel_id` bucket. The `user:group_dm:recipient:add` protection bucket adds 10 requests per hour for each authenticated user, and does not consume the global limit.+The rate limit is 20 requests per 10 seconds, on the `channel:update::channel_id` bucket. Adding recipients also has a limit of 10 requests per hour, on the `user:group_dm:recipient:add` bucket.## Remove group direct message recipient<RouteHeader method="DELETE" path="/v1/channels/{channel_id}/recipients/{user_id}" bot />-Removes a user from a group direct message and returns 204 with an empty body. Emits a [Channel Recipient Remove](/gateway/events/#channel-recipient-remove) Gateway event.--### Limitations--- The caller must be a current recipient.-- A caller may remove themselves regardless of ownership.-- Removing another recipient requires ownership of the group.-- Setting `delete_messages` takes effect only when `user_id` is the caller, and it then requires sudo verification on the same terms as [Delete or leave channel](#delete-or-leave-channel).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the group direct message channel |-| user_id | snowflake | The ID of the recipient to remove |+Removes a user from a group direct message and returns 204. You can always remove yourself, and only the owner can remove someone else.### Query parameters| Field | Type | Description || --- | --- | --- |-| silent?<sup>1</sup> | boolean | Whether to suppress the recipient removal system message (default false) |-| delete_messages?<sup>1</sup> | boolean | Whether to delete the caller's own messages in this channel before self-removal (default false) |--<sup>1</sup> Only the exact trimmed values `true`, `True`, and `1` are true. An absent parameter and every other value, including `TRUE` and `yes`, are false+| silent? | boolean | Whether to skip the removal system message (default false) |+| delete_messages? | boolean | Whether to first delete your own messages in this channel, only when removing yourself (default false) |### Request headers| Field | Type | Description || --- | --- | --- |-| X-Fluxer-Sudo-Mode-JWT?<sup>1</sup> | string | An existing sudo mode proof, read when `delete_messages` is set for self-removal |--<sup>1</sup> An accepted proof is echoed back in the same response header, and completing the MFA path issues a fresh one+| X-Fluxer-Sudo-Mode-JWT? | string | A [sudo mode](/http-api/users/mfa/#sudo-mode) token, used when `delete_messages` is set |### JSON body-The optional body has the same [sudo verification fields](#sudo-verification-fields) as [Delete or leave channel](#delete-or-leave-channel). Fluxer reads it only when a self-removal sets `delete_messages` and the request has no existing sudo proof.+The optional body has the same [sudo verification fields](#sudo-verification-fields) as [Delete or leave channel](#delete-or-leave-channel).### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Recipient was removed |-| 400 | [error response](/http-api/#error-response) | Channel is not a group direct message and the request returns `INVALID_CHANNEL_TYPE` |-| 400 | [error response](/http-api/#error-response) | The target is not a recipient and the request returns `INVALID_FORM_BODY` with the code `USER_NOT_IN_CHANNEL` |-| 403 | [error response](/http-api/#error-response) | Caller is not a recipient and the request returns `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The caller is not the owner while removing another recipient and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | Sudo verification is required and the request returns `SUDO_MODE_REQUIRED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist and the request returns `UNKNOWN_CHANNEL` |--### Side effects+| 204 | empty | The user was removed |+| 400 | [error response](/http-api/#error-response) | `INVALID_CHANNEL_TYPE` when the channel is not a group direct message |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` with `USER_NOT_IN_CHANNEL` when the user isn't in the group |+| 403 | [error response](/http-api/#error-response) | `SUDO_MODE_REQUIRED` when `delete_messages` is set without sudo mode |-Removal closes the channel for the recipient and clears their nickname. If they owned the group, ownership transfers to a randomly selected remaining recipient, as for [Delete or leave channel](#delete-or-leave-channel).+The removed user gets [Channel Delete](/gateway/events/#channel-delete) and the others get [Channel Recipient Remove](/gateway/events/#channel-recipient-remove). Ownership moves the same way as in [Delete or leave channel](#delete-or-leave-channel).-The removed recipient receives [Channel Delete](/gateway/events/#channel-delete). Remaining recipients receive [Channel Recipient Remove](/gateway/events/#channel-recipient-remove), and the removal system message through [Message Create](/gateway/events/#message-create) unless `silent` is true. No [Channel Update](/gateway/events/#channel-update) reports the ownership transfer or the removed nickname.--Removing the final recipient permanently deletes the channel's messages, removes them from search, and deletes the channel record, with no system message. Setting `delete_messages` on a self-removal deletes the caller's messages in this channel before the removal runs.--### Rate limit--20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:update::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:update::channel_id` bucket.## Set channel permission overwrite<RouteHeader method="PUT" path="/v1/channels/{channel_id}/permissions/{overwrite_id}" bot auditReason />-Creates or replaces one permission overwrite on a guild channel and returns 204 with an empty body. Requires [MANAGE_ROLES](/http-api/permissions/) in that channel. Emits a [Channel Update](/gateway/events/#channel-update) Gateway event.--### Limitations--- A caller without [ADMINISTRATOR](/http-api/permissions/) cannot allow a permission bit outside their own effective permissions in that channel, and cannot remove a denied bit outside them either.-- A thread has no permission overwrites, as [Thread permissions](/http-api/threads/#thread-permissions) describes.--The operation does not require `VIEW_CHANNEL` and never returns `TWO_FACTOR_REQUIRED` or `NSFW_CONTENT_AGE_RESTRICTED`.--:::note[The identifier alone selects the overwrite]-`type` records whether the identifier names a role or a member, and does not change which entry is written. An overwrite can be stored for an identifier that names nothing, and [Delete channel permission overwrite](#delete-channel-permission-overwrite) removes it.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the guild channel |-| overwrite_id | snowflake | The ID of the role or member the overwrite represents |+Creates or replaces the overwrite for one role or member and returns 204. You need `MANAGE_ROLES` in the channel, and unless you have `ADMINISTRATOR` you can only allow, or stop denying, permissions you have yourself.### Request headers| Field | Type | Description || --- | --- | --- |-| X-Fluxer-Features?<sup>1</sup> | string | A comma-separated [feature declaration](/http-api/permissions/#feature-gated-permission-bits) |--<sup>1</sup> A [feature-gated bit](/http-api/permissions/#feature-gated-permission-bits) the declaration does not name is copied from the stored overwrite, so the request can neither set nor clear it+| X-Fluxer-Features? | string | The [feature-gated permission bits](/http-api/permissions/#feature-gated-permission-bits) you can set |### JSON body| Field | Type | Description || --- | --- | --- |-| type<sup>1</sup> | integer | The [permission overwrite type](#permission-overwrite-types) of `overwrite_id` |-| allow?<sup>2</sup> | ?decimal string | The bitfield of permissions to allow (default `0`) |-| deny?<sup>2</sup> | ?decimal string | The bitfield of permissions to deny (default `0`) |--<sup>1</sup> Only `0` and `1` are accepted--<sup>2</sup> A decimal string of at most 9223372036854775807, or a JSON integer of at most 9007199254740991. An omitted or null value is treated as `0`--A larger decimal string returns 400 `INVALID_FORM_BODY` with the code `INTEGER_OUT_OF_INT64_RANGE`. A JSON number outside the safe integer range returns `INVALID_INTEGER_FORMAT`, and so does a string that is not all digits. Every bit outside the defined permission set is discarded before the authority check and before the change is applied.+| type | integer | The [permission overwrite type](#permission-overwrite-types) of `overwrite_id` |+| allow? | ?decimal string | The permissions to allow (default `0`) |+| deny? | ?decimal string | The permissions to deny (default `0`) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Overwrite was created or replaced |-| 400 | [error response](/http-api/#error-response) | Channel is a thread and the request returns `INVALID_CHANNEL_TYPE` |-| 403 | [error response](/http-api/#error-response) | `MANAGE_ROLES` in the channel or permission bit authority is absent, each returning `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist, or is not a guild channel, each returning `UNKNOWN_CHANNEL` |--### Side effects+| 204 | empty | The overwrite was created or replaced |+| 400 | [error response](/http-api/#error-response) | `INVALID_CHANNEL_TYPE` when the channel is a thread |-Fluxer emits [Channel Update](/gateway/events/#channel-update) to every session subscribed to the guild, including when the submitted overwrite exactly matches the stored one. When the channel is a category, every child whose overwrites exactly matched the category's previous values receives a copy of the category's new overwrites and its own Channel Update.+Fluxer sends [Channel Update](/gateway/events/#channel-update) to the guild. On a category, children whose overwrites matched the old ones get the new ones too.-The operation records an overwrite create or update audit entry with the supplied reason. An unchanged overwrite records no audit entry.--### Rate limit--20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:update::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:update::channel_id` bucket.## Delete channel permission overwrite<RouteHeader method="DELETE" path="/v1/channels/{channel_id}/permissions/{overwrite_id}" bot auditReason />-Deletes one permission overwrite from a guild channel and returns 204 with an empty body. Requires [MANAGE_ROLES](/http-api/permissions/) in that channel. Emits a [Channel Update](/gateway/events/#channel-update) Gateway event.--### Limitations+Deletes the overwrite for one role or member and returns 204, even if there was none. You need `MANAGE_ROLES` in the channel, and unless you have `ADMINISTRATOR` you need every permission the overwrite denied.-- A caller without [ADMINISTRATOR](/http-api/permissions/) must already hold every permission bit the removed overwrite denied.-- A thread has no permission overwrites, as [Thread permissions](/http-api/threads/#thread-permissions) describes.--The operation is idempotent, does not require `VIEW_CHANNEL`, and never returns `TWO_FACTOR_REQUIRED` or `NSFW_CONTENT_AGE_RESTRICTED`.--### Path parameters+### Request headers| Field | Type | Description || --- | --- | --- |-| channel_id | snowflake | The ID of the guild channel |-| overwrite_id<sup>1</sup> | snowflake | The ID of the role or member the overwrite represents |--<sup>1</sup> The identifier alone selects the overwrite, and the request has no overwrite type+| X-Fluxer-Features? | string | The [feature-gated permission bits](/http-api/permissions/#feature-gated-permission-bits) you can clear. Gated bits you don't declare stay on the overwrite |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Overwrite was deleted, or no overwrite existed for the identifier |-| 400 | [error response](/http-api/#error-response) | Channel is a thread and the request returns `INVALID_CHANNEL_TYPE` |-| 403 | [error response](/http-api/#error-response) | `MANAGE_ROLES` in the channel or permission bit authority is absent, each returning `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist, or is not a guild channel, each returning `UNKNOWN_CHANNEL` |+| 204 | empty | The overwrite was deleted, or didn't exist |+| 400 | [error response](/http-api/#error-response) | `INVALID_CHANNEL_TYPE` when the channel is a thread |-### Side effects+Fluxer sends [Channel Update](/gateway/events/#channel-update) to the guild, and a category updates matching children as in [Set channel permission overwrite](#set-channel-permission-overwrite).-Fluxer emits [Channel Update](/gateway/events/#channel-update) to every session subscribed to the guild, including when the identifier names no existing overwrite. Removing an overwrite that exists also records an overwrite delete audit entry with the previous overwrite state and the supplied reason. An identifier that names no existing overwrite records no audit entry. When the target channel is a category, each child whose overwrites exactly matched the category's previous overwrites receives a copy of the category's new overwrites and its own Channel Update.--### Rate limit--20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:update::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:update::channel_id` bucket.## Follow announcement channel<RouteHeader method="POST" path="/v1/channels/{channel_id}/followers" bot auditReason />-Follows an announcement channel into a guild text channel and returns a [followed channel object](#followed-channel-object). Fluxer creates a [channel follower webhook](/http-api/webhooks/#webhook-types) in the target channel, and every message later [published](/http-api/messages/#crosspost-message) in the announcement channel is copied into the target through it. [Announcement channels](/topics/announcement-channels/) describes delivery.--### Limitations--- The caller needs [VIEW_CHANNEL](/http-api/permissions/) on the announcement channel, and a satisfied age verification when it resolves to an age restriction.-- The target must be a guild text channel in any guild, including the announcement channel's own guild.-- The caller needs [MANAGE_WEBHOOKS](/http-api/permissions/) at guild level in the target guild, and `VIEW_CHANNEL` and `MANAGE_WEBHOOKS` in the target channel.-- A target channel follows one announcement channel at most once.-- The guild that owns the announcement channel must not have [ANNOUNCEMENT_CHANNELS_DISABLED](/http-api/guilds/#guild-features).--`MANAGE_WEBHOOKS` is an [elevated permission](/http-api/permissions/#elevated-permissions). In a target guild whose [MFA level](/http-api/guilds/#mfa-levels) is elevated, a caller who is neither its owner nor enrolled in multi-factor authentication receives 400 [`TWO_FACTOR_REQUIRED`](/http-api/errors/).--Fluxer resolves the age restriction and the content warning of both channels through the channel, then its parent category, and then its guild. An age-restricted announcement channel can only be followed into an age-restricted target. An announcement channel with a content warning can only be followed into a target that has a content warning or an age restriction.--An announcement channel has no cap on its follows. The follower webhook takes one slot of the target's [`max_webhooks_per_channel`](/http-api/instance/#limit-keys) and `max_webhooks_per_guild` allowances, which default to 15 and 1000.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the announcement channel to follow |+Follows an announcement channel into a guild text channel and returns a [followed channel object](#followed-channel-object). Fluxer creates a [channel follower webhook](/http-api/webhooks/#webhook-types) in the target channel, and [published](/http-api/messages/#crosspost-message) messages are copied into it from then on, as described in [Announcement channels](/topics/announcement-channels/). You need `VIEW_CHANNEL` on the announcement channel and `VIEW_CHANNEL` and `MANAGE_WEBHOOKS` on the target channel.### JSON body| Field | Type | Description || --- | --- | --- |-| webhook_channel_id | snowflake | The ID of the guild text channel that receives published messages |+| webhook_channel_id | snowflake | The ID of the guild text channel that gets the published messages |### Response| Status | Body | Condition || --- | --- | --- || 200 | [followed channel](#followed-channel-object) object | The follow was created |-| 400 | [error response](/http-api/#error-response) | The followed channel is not an announcement channel, returning `ANNOUNCEMENT_CHANNEL_REQUIRED` |-| 400 | [error response](/http-api/#error-response) | The target is not a guild text channel, returning `INVALID_FOLLOW_TARGET_CHANNEL` |-| 400 | [error response](/http-api/#error-response) | The target already follows this announcement channel, returning `CHANNEL_ALREADY_FOLLOWED` |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The target does not meet the age restriction or content warning rule |-| 400<sup>2</sup> | [error response](/http-api/#error-response) | The webhook allowance of the target is already reached |-| 400 | [error response](/http-api/#error-response) | The caller holds `MANAGE_WEBHOOKS` with no enrolled authenticator in an elevated-MFA guild |-| 403 | [error response](/http-api/#error-response) | A permission on either channel is absent, returning `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The resolved age restriction is not satisfied, returning `NSFW_CONTENT_AGE_RESTRICTED` |-| 403 | [error response](/http-api/#error-response) | The source guild has `ANNOUNCEMENT_CHANNELS_DISABLED`, returning `FEATURE_TEMPORARILY_DISABLED` |-| 403 | [error response](/http-api/#error-response) | The generated webhook name is blocked, returning `CONTENT_BLOCKED` |-| 404 | [error response](/http-api/#error-response) | Either channel does not exist, returning `UNKNOWN_CHANNEL` |-| 429 | [error response](/http-api/#error-response) | A concurrent follow or conversion holds the target channel, returning `RESOURCE_LOCKED` |--<sup>1</sup> `FOLLOW_TARGET_NOT_AGE_RESTRICTED` for an age-restricted announcement channel, and `FOLLOW_TARGET_CONTENT_WARNING_REQUIRED` for one with a content warning--<sup>2</sup> `MAX_WEBHOOKS_PER_CHANNEL` or `MAX_WEBHOOKS_PER_GUILD`, each with the allowance that was reached--### Side effects--The follow creates a channel follower webhook in the target channel. Its name is the source guild name and the announcement channel name, as in `Fluxer #updates`, cut to 80 characters. When that name fails validation or the blocklist scan, Fluxer uses the channel name alone. The webhook avatar is a copy of the source guild icon at the time of the follow, or null when the source guild has no icon. It does not change when the source guild icon changes, and [Update webhook](/http-api/webhooks/#update-webhook) cannot replace it. A member who manages the target channel's webhooks can rename it later. Each copy uses the source guild icon at the time of delivery as its author avatar.--It emits [Webhooks Update](/gateway/events/#webhooks-update) for the target channel, records a `WEBHOOK_CREATE` audit log entry in the target guild with the supplied reason, and posts a `CHANNEL_FOLLOW_ADD` [system message](/http-api/messages/#message-types) in the target channel through [Message Create](/gateway/events/#message-create). The follow takes effect for messages published after it, and earlier messages are never copied.--[Delete webhook](/http-api/webhooks/#delete-webhook) on the follower webhook removes the follow.+| 400 | [error response](/http-api/#error-response) | `ANNOUNCEMENT_CHANNEL_REQUIRED` when the channel is not an announcement channel |+| 400 | [error response](/http-api/#error-response) | `INVALID_FOLLOW_TARGET_CHANNEL` when the target is not a guild text channel |+| 400 | [error response](/http-api/#error-response) | `CHANNEL_ALREADY_FOLLOWED` when the target already follows this channel |+| 400 | [error response](/http-api/#error-response) | `FOLLOW_TARGET_NOT_AGE_RESTRICTED` when the channel is age restricted and the target isn't |+| 400 | [error response](/http-api/#error-response) | `FOLLOW_TARGET_CONTENT_WARNING_REQUIRED` when the channel has a content warning and the target doesn't |+| 400 | [error response](/http-api/#error-response) | `MAX_WEBHOOKS_PER_CHANNEL` or `MAX_WEBHOOKS_PER_GUILD` when the target has no room for the webhook |+| 403 | [error response](/http-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED` when the guild has `ANNOUNCEMENT_CHANNELS_DISABLED` |-### Rate limit+An age-restricted target doesn't need its own content warning. Fluxer sends [Webhooks Update](/gateway/events/#webhooks-update) for the target channel and posts a `CHANNEL_FOLLOW_ADD` system message in it. [Delete webhook](/http-api/webhooks/#delete-webhook) on the follower webhook stops the follow.-5 requests per 10 seconds for each authenticated user and channel ID, on the `channel:follow::channel_id` bucket.+The rate limit is 5 requests per 10 seconds, on the `channel:follow::channel_id` bucket.## Get channel follower stats<RouteHeader method="GET" path="/v1/channels/{channel_id}/follower-stats" bot />-Returns the [channel follower stats object](#channel-follower-stats-object) of an announcement channel. The caller needs the same access as [Get channel](#get-channel).--The counts are cached for 60 seconds, so a follow or unfollow can take up to a minute to show.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the announcement channel |+Returns the [channel follower stats object](#channel-follower-stats-object) of an announcement channel. You need the same access as for [Get channel](#get-channel), and the counts can be up to 60 seconds old.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [channel follower stats](#channel-follower-stats-object) object | Counts were returned |-| 400 | [error response](/http-api/#error-response) | The channel is not an announcement channel, returning `ANNOUNCEMENT_CHANNEL_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Caller is not a guild member or lacks `VIEW_CHANNEL`, each returning `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The resolved age restriction is not satisfied, returning `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist, returning `UNKNOWN_CHANNEL` |--### Rate limit+| 200 | [channel follower stats](#channel-follower-stats-object) object | The counts were returned |+| 400 | [error response](/http-api/#error-response) | `ANNOUNCEMENT_CHANNEL_REQUIRED` when the channel is not an announcement channel |-10 requests per 10 seconds for each authenticated user and channel ID, on the `channel:follower_stats::channel_id` bucket.+The rate limit is 10 requests per 10 seconds, on the `channel:follower_stats::channel_id` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/connections.mdx b/fluxer_docs/src/content/docs/http-api/connections.mdxindex fe206013b..d64d9817c 100644--- a/fluxer_docs/src/content/docs/http-api/connections.mdx+++ b/fluxer_docs/src/content/docs/http-api/connections.mdx@@ -1,234 +1,149 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Connections-description: External account connections, domain ownership proof, Bluesky authorisation, visibility flags, and display ordering.+description: Domain and Bluesky connections that appear on a user profile.---import RouteHeader from '@/components/RouteHeader.astro';-A connection links a Fluxer account to a verified domain or Bluesky account. Visible connections appear in `connected_accounts` on the [full user profile object](/http-api/users/#full-user-profile-object).+A connection links an account to a verified domain or Bluesky account. Visible connections appear in `connected_accounts` on the [full user profile object](/http-api/users/#full-user-profile-object).-Connection routes require a user token. Bot tokens and OAuth2 bearers receive 403 `ACCESS_DENIED`, except that [List connections](#list-connections) accepts a bearer with the `connections` [scope](/http-api/oauth2/#oauth2-scopes). Connection IDs are not snowflakes.+Connection routes need a user token, and bot tokens and OAuth2 bearers get 403 `ACCESS_DENIED`. The one exception is [List connections](#list-connections), which accepts a bearer with the `connections` [scope](/http-api/oauth2/#oauth2-scopes).-[Bluesky client metadata](#get-bluesky-client-metadata) and [JWKS](#get-bluesky-jwks) are public and contain no account data.--## Account connection limit--An account can have at most 20 connections across all types. Exceeding this limit returns 400 `CONNECTION_LIMIT_REACHED`.--[Initiate connection](#initiate-connection), [Verify and create connection](#verify-and-create-connection), and the provider callback that completes the [Bluesky authorisation flow](#start-bluesky-authorisation) each enforce the ceiling. [Start Bluesky authorisation](#start-bluesky-authorisation) does not.+An account can have up to 20 connections, and adding more returns 400 `CONNECTION_LIMIT_REACHED`.## Connection object-The pair of [type](#connection-types) and `id` identifies a connection. Both values appear in the path of every per-connection operation. A connection exists only after its external proof has succeeded once.+A connection's [type](#connection-types) and `id` together identify it.### Structure| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | string | The ID of the connection, unique within its [connection type](#connection-types) |+| id | string | The ID of the connection, unique within its type || type | string | [Connection type](#connection-types) |-| name<sup>2</sup> | string | The domain or Bluesky handle shown for the connection |-| verified<sup>3</sup> | boolean | Whether the most recent proof succeeded |-| visibility_flags<sup>4</sup> | integer | [Connection visibility flags](#connection-visibility-flags) |-| sort_order<sup>5</sup> | integer | The display order within the account's connection list (0-2147483647) |--<sup>1</sup> A `domain` identifier is 64 lowercase hexadecimal characters and stays the same when the account recreates that domain connection. A `bsky` identifier is a UUID assigned at creation--<sup>2</sup> For a `domain` connection the name is the submitted domain. For a `bsky` connection it is the Bluesky handle, refreshed by completing the [authorisation flow](#start-bluesky-authorisation)--<sup>3</sup> Fluxer sets it to true when the proof succeeds and again each time a Bluesky authorisation completes. No later check sets it to false--<sup>4</sup> The stored value is the integer the client supplied and is not masked against the defined bits--<sup>5</sup> Initially the number of existing connections. Use [Update connection](#update-connection) or [Reorder connections](#reorder-connections) to change it+| name | string | The domain or Bluesky handle |+| verified | boolean | Whether the connection is verified |+| visibility_flags | integer | [Connection visibility flags](#connection-visibility-flags) |+| sort_order | integer | The display order (0-2147483647) |## Connection types| Value | Name | Description || --- | --- | --- |-| bsky<sup>1</sup> | BLUESKY | A Bluesky account authorised through atproto OAuth |+| bsky | BLUESKY | A Bluesky account authorized through atproto OAuth || domain | DOMAIN | A domain the account has proved it controls |-<sup>1</sup> Use [Start Bluesky authorisation](#start-bluesky-authorisation). The domain initiation route rejects this type with 400 `BLUESKY_OAUTH_NOT_ENABLED`-## Connection visibility flags-A connection's flags decide which viewers of the owner's profile see it. Fluxer evaluates them against a viewer with the same rule as the [profile field privacy flags](/http-api/users/#profile-field-privacy-flags).+The flags decide which viewers see the connection on the owner's profile, using the same rule as the [profile field privacy flags](/http-api/users/#profile-field-privacy-flags). A new connection gets EVERYONE, and `0` hides it from every viewer. [List connections](#list-connections) ignores the flags.| Value | Name | Description || --- | --- | --- |-| 1 << 0 | EVERYONE | Anyone permitted to view the profile can see the connection |-| 1 << 1 | FRIENDS | Friends can see the connection |-| 1 << 2 | MUTUAL_GUILDS | Members of a mutual guild can see the connection |--A connection created without an explicit value receives EVERYONE. A value of `0` hides the connection from every viewer, including the owner's read of their own profile. A client MUST ignore a bit it does not recognise.--An unverified connection is never rendered on a profile, whatever its flags. A viewer who is not permitted to see the full profile sees no connections at all. [List connections](#list-connections) ignores the flags and returns every connection the account holds.+| 1 << 0 | EVERYONE | Anyone who can view the profile |+| 1 << 1 | FRIENDS | Friends |+| 1 << 2 | MUTUAL_GUILDS | Members of a mutual guild |## Connection verification object-Returned by [Initiate connection](#initiate-connection). No connection exists until [Verify and create connection](#verify-and-create-connection) succeeds.+[Initiate connection](#initiate-connection) returns this object.### Structure| Field | Type | Description || --- | --- | --- |-| token<sup>1</sup> | string | The value to publish at the domain as proof of ownership |+| token | string | The value to publish at the domain as proof || type | string | [Connection type](#connection-types) |-| id<sup>2</sup> | string | The domain being verified |-| instructions<sup>3</sup> | string | The human-readable instructions for placing the token |-| initiation_token<sup>4</sup> | string | The signed token accepted by [Verify and create connection](#verify-and-create-connection) |--<sup>1</sup> The token is 64 lowercase hexadecimal characters. Repeating the operation for the same target returns the same token, so a client MAY leave a published record in place across attempts--<sup>2</sup> The value is the `identifier` exactly as submitted, with no trimming, lowercasing, or other normalisation--<sup>3</sup> The instructions name both the DNS TXT record and the well-known path described under [Domain ownership proof](#domain-ownership-proof)--<sup>4</sup> An opaque credential that expires 30 minutes after issue and can be used only by the initiating account--:::caution[Protect the initiation token]-Do not log or forward it. Publish only the verification token used by the ownership proof.-:::+| id | string | The domain being verified |+| instructions | string | Instructions for placing the token |+| initiation_token | string | The signed token for [Verify and create connection](#verify-and-create-connection), valid for 30 minutes |## Domain ownership proof-Submit the domain exactly as it should be verified. A malformed domain can pass initiation but fail ownership verification.--Publish a TXT record at `_fluxer.<domain>` whose value is exactly `fluxer-verification=<token>`. If the record has multiple strings, their concatenation must match that value. Allow time for DNS changes to propagate before verifying.--Alternatively, serve the token at `https://<domain>/.well-known/fluxer-verification`. The response must have a 2xx status and a body that matches the token after trimming whitespace. The body must not exceed 16384 bytes. Up to 5 HTTP or HTTPS redirects are accepted.+Fluxer checks the proof once, when the connection is created. Use either method.-The HTTPS URL and every redirect must use a valid fully qualified domain name or public IP address. All resolved addresses must be publicly reachable and permitted by the instance's outbound URL policy. Private and reserved networks cannot be verified this way.+- Publish a TXT record at `_fluxer.<domain>` with the value `fluxer-verification=<token>`.+- Serve the token alone, without the prefix, at `https://<domain>/.well-known/fluxer-verification` with a 2xx status. Redirects are not followed.-Fluxer checks the proof once, when the connection is created. There is no later recheck.+## Bluesky authorization object-:::note[Only the DNS record has the prefix]-The DNS record value has the `fluxer-verification=` prefix and the well-known document does not. A document that contains the prefixed form fails the HTTPS proof.-:::--## Bluesky authorisation object--Returned by [Start Bluesky authorisation](#start-bluesky-authorisation).+[Start Bluesky authorization](#start-bluesky-authorization) returns this object.### Structure| Field | Type | Description || --- | --- | --- |-| authorize_url | string | URL to open for authorisation. Its origin depends on the submitted `handle` |+| authorize_url | string | The URL to open for authorization |## List connections<RouteHeader method="GET" path="/v1/users/@me/connections" oauth2="connections" />-Returns every [connection object](#connection-object) the authenticated account holds, in ascending `sort_order`.<sup>1</sup> An account with no connections returns an empty array.--A bearer without `connections` receives 403 `MISSING_OAUTH_SCOPE`.--<sup>1</sup> The sort is stable and has no secondary key, so two connections sharing a `sort_order` are returned in stored order, ascending by [connection type](#connection-types) and then descending by `id`+Returns every [connection object](#connection-object) the account has, in ascending `sort_order`.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | array[[connection](#connection-object) object] | Collection was returned, possibly as an empty array |-| 403 | [error response](/http-api/#error-response) | The bearer token lacks the `connections` scope and the request returns `MISSING_OAUTH_SCOPE` |--:::caution[The Gateway array is not sorted]-Every [User Connections Update](/gateway/events/#user-connections-update) Dispatch has the complete connection list in stored order, so a client MUST sort it by `sort_order` itself.-:::+| 200 | array[[connection](#connection-object) object] | The connections were returned |+| 403 | [error response](/http-api/#error-response) | `MISSING_OAUTH_SCOPE` when the bearer lacks the `connections` scope |-### Rate limit--60 requests per minute for each authenticated user, on the `connection:list` bucket.+The rate limit is 60 requests per minute, on the `connection:list` bucket.## Initiate connection<RouteHeader method="POST" path="/v1/users/@me/connections" />-Begins domain ownership verification and returns a [connection verification object](#connection-verification-object). This operation creates no connection.--Only the `domain` type is accepted. A Bluesky connection is created through [Start Bluesky authorisation](#start-bluesky-authorisation).+Starts domain verification and returns a [connection verification object](#connection-verification-object), without creating a connection.### JSON body| Field | Type | Description || --- | --- | --- |-| type | string | [Connection type](#connection-types), which must be domain |-| identifier | string | The domain to prove ownership of (1-253 characters) |-| visibility_flags?<sup>1</sup> | integer | [Connection visibility flags](#connection-visibility-flags) (0-2147483647) |--<sup>1</sup> Ignored here. Set visibility in [Verify and create connection](#verify-and-create-connection)+| type | string | [Connection type](#connection-types), always `domain` |+| identifier | string | The domain to prove (1-253 characters) |+| visibility_flags? | integer | Ignored. Pass it to [Verify and create connection](#verify-and-create-connection) instead |### Response| Status | Body | Condition || --- | --- | --- || 201 | [connection verification](#connection-verification-object) object | Verification was started |-| 400 | [error response](/http-api/#error-response) | The requested type is bsky and the request returns `BLUESKY_OAUTH_NOT_ENABLED` |-| 403 | [error response](/http-api/#error-response) | The account is [limited](/http-api/users/#account-limitation) and the request returns `ACCOUNT_LIMITED` |-| 409 | [error response](/http-api/#error-response) | A connection of the same type already exists for that identifier, compared case-insensitively, and the request returns `CONNECTION_ALREADY_EXISTS` |--### Side effects+| 400 | [error response](/http-api/#error-response) | `BLUESKY_OAUTH_NOT_ENABLED` when the type is bsky |+| 403 | [error response](/http-api/#error-response) | `ACCOUNT_LIMITED` when the account is [limited](/http-api/users/#account-limitation) |+| 409 | [error response](/http-api/#error-response) | `CONNECTION_ALREADY_EXISTS` when the identifier is already linked |-No Gateway event is emitted. Publish the verification token at the domain, then call [Verify and create connection](#verify-and-create-connection) before the initiation token expires.--### Rate limit--5 requests per minute for each authenticated user, on the `connection:create` bucket, which is shared with [Start Bluesky authorisation](#start-bluesky-authorisation).+The rate limit is 5 requests per minute, on the `connection:create` bucket.## Verify and create connection<RouteHeader method="POST" path="/v1/users/@me/connections/verify" />-Checks the [domain ownership proof](#domain-ownership-proof) described by a signed initiation token. Creates and returns the [connection object](#connection-object) on success.--Use the initiation token returned for this domain and account. The connection limit and duplicate checks still apply when verification completes.+Checks the [domain ownership proof](#domain-ownership-proof) and creates the connection. Fluxer sends [User Connections Update](/gateway/events/#user-connections-update).### JSON body| Field | Type | Description || --- | --- | --- |-| initiation_token | string | The signed initiation token returned by [Initiate connection](#initiate-connection) |-| visibility_flags?<sup>1</sup> | integer | [Connection visibility flags](#connection-visibility-flags) (0-2147483647) |--<sup>1</sup> An omitted value stores EVERYONE+| initiation_token | string | The token from [Initiate connection](#initiate-connection) |+| visibility_flags? | integer | [Connection visibility flags](#connection-visibility-flags) (0-2147483647) |### Response| Status | Body | Condition || --- | --- | --- |-| 201 | [connection](#connection-object) object | Proof succeeded and the connection was created |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The initiation token is not usable and the request returns `CONNECTION_INITIATION_TOKEN_INVALID` |-| 403 | [error response](/http-api/#error-response) | The proof failed and the request returns `CONNECTION_VERIFICATION_FAILED` |-| 403 | [error response](/http-api/#error-response) | The account is [limited](/http-api/users/#account-limitation) and the request returns `ACCOUNT_LIMITED` |-| 409 | [error response](/http-api/#error-response) | The identifier is already linked (`CONNECTION_ALREADY_EXISTS`), or the connection list changed during the request (`CONFLICT`). Fetch the list before retrying |--<sup>1</sup> Invalid, expired or wrong-account initiation tokens return the same code--### Side effects--Success creates the connection and sends the complete list to the caller's sessions in [User Connections Update](/gateway/events/#user-connections-update). A failed proof creates no connection and emits no event.--The initiation token stays usable until it expires, so a caller that publishes its proof late can retry with the same token.+| 201 | [connection](#connection-object) object | The connection was created |+| 400 | [error response](/http-api/#error-response) | `CONNECTION_INITIATION_TOKEN_INVALID` when the token is invalid, expired or from another account |+| 403 | [error response](/http-api/#error-response) | `CONNECTION_VERIFICATION_FAILED` when the proof failed, or `ACCOUNT_LIMITED` |+| 409 | [error response](/http-api/#error-response) | `CONNECTION_ALREADY_EXISTS` when the domain is already linked, or `CONFLICT` on a concurrent change |-### Rate limit--5 requests per minute for each authenticated user, on the `connection:verify_and_create` bucket.+The rate limit is 5 requests per minute, on the `connection:verify_and_create` bucket.## Update connection<RouteHeader method="PATCH" path="/v1/users/@me/connections/{type}/{connection_id}" />-Updates the visibility or display order of one existing connection and returns 204 with an empty body. Omitting a field leaves the stored value unchanged.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| type | string | [Connection type](#connection-types) |-| connection_id | string | The ID of the connection, unique within its [connection type](#connection-types) |+Updates the visibility or display order of a connection. Fluxer sends [User Connections Update](/gateway/events/#user-connections-update).### JSON body@@ -241,98 +156,54 @@ Updates the visibility or display order of one existing connection and returns 2| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Connection was updated |-| 404<sup>1</sup> | [error response](/http-api/#error-response) | No connection of that type and identifier is owned by the caller and the request returns `CONNECTION_NOT_FOUND` |-| 409 | [error response](/http-api/#error-response) | The connection changed during the request (`CONFLICT`). Fetch it again before retrying |--<sup>1</sup> Both path parameters must name the same connection, so a correct identifier under the wrong type does not match--### Side effects--Sends the complete list to the caller's sessions in [User Connections Update](/gateway/events/#user-connections-update), even if no values changed or the body was empty.+| 204 | empty | The connection was updated |+| 404 | [error response](/http-api/#error-response) | `CONNECTION_NOT_FOUND` when you have no such connection |+| 409 | [error response](/http-api/#error-response) | `CONFLICT` when the connection changed during the request |-Assigning a `sort_order` that another connection already holds is permitted. [List connections](#list-connections) then resolves the tie by stored order.--### Rate limit--30 requests per minute for each authenticated user, on the `connection:update` bucket, which is shared with [Reorder connections](#reorder-connections).+The rate limit is 30 requests per minute, on the `connection:update` bucket.## Delete connection<RouteHeader method="DELETE" path="/v1/users/@me/connections/{type}/{connection_id}" />-Permanently removes one connection and returns 204 with an empty body.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| type | string | [Connection type](#connection-types) |-| connection_id | string | The ID of the connection, unique within its [connection type](#connection-types) |+Deletes a connection and sends [User Connections Update](/gateway/events/#user-connections-update). Deleting a bsky connection does not revoke Fluxer's access on Bluesky.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Connection was deleted |-| 404 | [error response](/http-api/#error-response) | No connection of that type and identifier is owned by the caller and the request returns `CONNECTION_NOT_FOUND` |-| 409 | [error response](/http-api/#error-response) | The connection or connection list changed during the request (`CONFLICT`). Fetch the list before retrying |--### Side effects--Sends the remaining list to the caller's sessions in [User Connections Update](/gateway/events/#user-connections-update). Other connections keep their `sort_order` values.+| 204 | empty | The connection was deleted |+| 404 | [error response](/http-api/#error-response) | `CONNECTION_NOT_FOUND` when you have no such connection |+| 409 | [error response](/http-api/#error-response) | `CONFLICT` when the connection list changed during the request |-Deleting a `bsky` connection removes it from Fluxer but does not revoke authorisation on Bluesky.--:::caution[Deletion is immediate]-There is no grace period or restore operation. To recreate a `domain` connection, [initiate a new connection](#initiate-connection) and verify the ownership proof. To recreate a `bsky` connection, complete the OAuth flow again.-:::--### Rate limit--10 requests per minute for each authenticated user, on the `connection:delete` bucket.+The rate limit is 10 requests per minute, on the `connection:delete` bucket.## Reorder connections<RouteHeader method="PATCH" path="/v1/users/@me/connections/reorder" />-Assigns the display order of the listed connections from their position in the array and returns 204 with an empty body.+Sets each listed connection's `sort_order` to its position in the array. Unknown IDs are ignored and omitted connections keep their order. Fluxer sends [User Connections Update](/gateway/events/#user-connections-update).### JSON body| Field | Type | Description || --- | --- | --- |-| connection_ids<sup>1</sup> <sup>2</sup> | array[string] | The connection IDs in their new display order (1-20 entries) |--<sup>1</sup> Unknown IDs are ignored. Omitted connections keep their current order--<sup>2</sup> Connections are matched by `id` alone. For repeated IDs, the last position wins+| connection_ids | array[string] | The connection IDs in their new order (1-20 entries) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Connections were reordered |-| 409 | [error response](/http-api/#error-response) | A connection changed during the request (`CONFLICT`). Fetch the list again before retrying |--### Side effects--Each named connection receives its zero-based array index as `sort_order`. The complete list is sent to the caller's sessions in [User Connections Update](/gateway/events/#user-connections-update), even if the order did not change.--The reorder is atomic. A request that returns 409 `CONFLICT` changes no order and emits no event. When Fluxer saves the order and then fails to send [User Connections Update](/gateway/events/#user-connections-update), the request returns an error and the new order stays saved.--A partial array can leave two connections sharing a `sort_order`, which [List connections](#list-connections) resolves by stored order.+| 204 | empty | The connections were reordered |+| 409 | [error response](/http-api/#error-response) | `CONFLICT` when a connection changed during the request |-### Rate limit+The rate limit is 30 requests per minute, on the `connection:update` bucket.-30 requests per minute for each authenticated user, on the `connection:update` bucket, which is shared with [Update connection](#update-connection).--## Start Bluesky authorisation+## Start Bluesky authorization<RouteHeader method="POST" path="/v1/users/@me/connections/bluesky/authorize" />-Starts or renews a Bluesky connection. Bluesky must be enabled on the instance. Use this flow again when authorisation expires or the connection needs reauthorising.-+Starts or renews a Bluesky connection. Send the user to `authorize_url`, and Bluesky then returns them through `/connections/bluesky/callback`, which clients never call directly.### JSON body| Field | Type | Description |@@ -343,59 +214,47 @@ Starts or renews a Bluesky connection. Bluesky must be enabled on the instance.| Status | Body | Condition || --- | --- | --- |-| 200 | [Bluesky authorisation](#bluesky-authorisation-object) object | Send the user to `authorize_url` |-| 400 | [error response](/http-api/#error-response) | Unavailable (`BLUESKY_OAUTH_NOT_ENABLED`) or failed (`BLUESKY_OAUTH_AUTHORIZATION_FAILED`) |-| 403 | [error response](/http-api/#error-response) | The account is [limited](/http-api/users/#account-limitation) and the request returns `ACCOUNT_LIMITED` |--### Completing the flow--Send the user to `authorize_url`. Bluesky returns them through `/connections/bluesky/callback`. Clients must not call that route directly.+| 200 | [Bluesky authorization](#bluesky-authorization-object) object | Authorization was started |+| 400 | [error response](/http-api/#error-response) | `BLUESKY_OAUTH_NOT_ENABLED` or `BLUESKY_OAUTH_AUTHORIZATION_FAILED` |+| 403 | [error response](/http-api/#error-response) | `ACCOUNT_LIMITED` when the account is [limited](/http-api/users/#account-limitation) |-The browser then reaches `/connection-callback` on the web app with `status=connected`, or `status=error` and one of these reasons:+After authorization, the browser ends on `/connection-callback` in the web app with `status=connected`, or with `status=error` and one of these `reason` values. Success creates or refreshes the connection and sends [User Connections Update](/gateway/events/#user-connections-update).| Value | Description || --- | --- |-| not_enabled | Bluesky connections are unavailable |-| state_invalid | Invalid authorisation state. Start a new flow |-| callback_failed | Authorisation could not be completed. Start a new flow |+| not_enabled | Bluesky connections are not enabled on the instance |+| state_invalid | The authorization state is invalid |+| callback_failed | Authorization could not be completed || unknown | The connection could not be saved |-Success creates or refreshes the verified connection and publishes [User Connections Update](/gateway/events/#user-connections-update). Completing the flow again also refreshes the displayed Bluesky handle.--### Rate limit--5 requests per minute for each authenticated user, on the `connection:create` bucket, shared with [Initiate connection](#initiate-connection).+The rate limit is 5 requests per minute, on the `connection:create` bucket.## Get Bluesky client metadata<RouteHeader method="GET" path="/connections/bluesky/client-metadata.json" unauthenticated />-Returns the instance's atproto OAuth client metadata as JSON. This endpoint must be publicly reachable for Bluesky authorisation.+Returns the instance's atproto OAuth client metadata. Bluesky fetches this document during authorization, so it has to be publicly reachable.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | client metadata document | Bluesky is configured |-| 404 | `{"error": "Bluesky OAuth is not enabled"}` | Bluesky is unavailable |+| 200 | client metadata document | Bluesky connections are enabled |+| 404 | `{"error": "Bluesky OAuth is not enabled"}` | Bluesky connections are not enabled on the instance |-### Rate limit--60 requests per minute for each client IP address, on the `connection:bluesky:client_document` bucket, shared with [Get Bluesky JWKS](#get-bluesky-jwks).+The rate limit is 60 requests per minute, on the `connection:bluesky:client_document` bucket.## Get Bluesky JWKS<RouteHeader method="GET" path="/connections/bluesky/jwks.json" unauthenticated />-Returns the instance's public OAuth signing keys as a JSON Web Key Set. This endpoint must be publicly reachable for Bluesky authorisation.+Returns the instance's public OAuth signing keys as a JSON Web Key Set.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | JSON Web Key Set | Bluesky is configured |-| 404 | `{"error": "Bluesky OAuth is not enabled"}` | Bluesky is unavailable |--### Rate limit+| 200 | JSON Web Key Set | Bluesky connections are enabled |+| 404 | `{"error": "Bluesky OAuth is not enabled"}` | Bluesky connections are not enabled on the instance |-60 requests per minute for each client IP address, on the `connection:bluesky:client_document` bucket, shared with [Get Bluesky client metadata](#get-bluesky-client-metadata).+The rate limit is 60 requests per minute, on the `connection:bluesky:client_document` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/deployment-availability.md b/fluxer_docs/src/content/docs/http-api/deployment-availability.mdindex 39630fca0..126a821e8 100644--- a/fluxer_docs/src/content/docs/http-api/deployment-availability.md+++ b/fluxer_docs/src/content/docs/http-api/deployment-availability.md@@ -1,43 +1,39 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Deployment availability-description: The routes a self-hosted deployment serves only while premium or billing is on, and the instance flags that decide them.+description: The routes a self-hosted instance serves only while premium or billing is on, and the flags that decide them.----The routes listed under [Conditional routes](#conditional-routes) depend on the instance. A self-hosted deployment serves them only while its operator runs a premium tier or sells it.+A self-hosted instance serves the routes below only while its premium mode is `mirror` or Stripe is set up. When the instance doesn't serve one, the API returns 404 `NOT_FOUND`, the same as for an unknown path.-When a deployment does not serve one of these routes, a request to it returns 404 `NOT_FOUND` with no feature-specific code, so a caller cannot tell an unavailable route from an unrecognised path.+## Flags-Credentials, permissions, premium state and OAuth2 scopes do not change route availability. Read the deployment kind and the premium flags from instance discovery.+Three flags in the [instance features object](/http-api/instance/#instance-features-object) of the unauthenticated [instance discovery document](/http-api/instance/#get-instance-discovery) decide which of these routes an instance serves. A change to them applies without a restart, and both Stripe flags also need `premium_enabled`.-## Deployment kind+| Flag | True when |+| --- | --- |+| `premium_enabled` | The instance [premium mode](/admin-api/instance/#premium-modes) is `mirror` |+| `stripe_enabled` | Billing is switched on, a Stripe secret key is set and at least one currency has monthly and yearly prices |+| `stripe_serviceable` | A Stripe secret key is set |-Every deployment reports its kind in `self_hosted` on the [instance features object](/http-api/instance/#instance-features-object). The unauthenticated [instance discovery document](/http-api/instance/#get-instance-discovery) publishes it before a client holds any credential.--On a self-hosted deployment, three flags on the same object decide which routes below are served. All three are computed on each request, so an operator's change applies without a restart.--- `premium_enabled` is true while the instance [premium mode](/admin-api/instance/#premium-modes) is `mirror`. The routes under [Served in the mirror premium mode](#served-in-the-mirror-premium-mode) are served only then.-- `stripe_enabled` is true while billing is active. Billing is active when the operator has switched it on, set a Stripe secret key, and set a monthly and a yearly price for at least one currency, and `premium_enabled` is true. The routes under [Served while billing is active](#served-while-billing-is-active) are served only then.-- `stripe_serviceable` is true while a Stripe secret key is set and `premium_enabled` is true. The routes under [Served while Stripe is serviceable](#served-while-stripe-is-serviceable) are served only then, so existing subscriptions can still be managed after the operator stops sales.--[Receive Stripe webhook](/http-api/billing/#receive-stripe-webhook) also needs a Stripe webhook secret.--:::caution[Read `self_hosted` for the deployment kind]-`stripe_enabled`, `stripe_serviceable` and `premium_enabled` do not promise that a provider-dependent operation succeeds.-:::+When billing is switched off, `stripe_serviceable` stays true and people can still manage their existing subscriptions.## Conditional routes### Served in the mirror premium mode+These routes need `premium_enabled`.+| Method | Route | Operation || --- | --- | --- || GET | /v1/gifts/{code} | [Get gift](/http-api/gifts/#get-gift) || POST | /v1/gifts/{code}/redeem | [Redeem gift](/http-api/gifts/#redeem-gift) |-| GET | /v1/users/@me/gifts<sup>1</sup> | [List current user gifts](/http-api/users/gifts/#list-current-user-gifts) |+| GET | /v1/users/@me/gifts | [List current user gifts](/http-api/users/gifts/#list-current-user-gifts) |### Served while billing is active+These routes need `stripe_enabled`.+| Method | Route | Operation || --- | --- | --- || POST | /v1/stripe/checkout/subscription | [Create subscription checkout](/http-api/billing/#create-subscription-checkout) |@@ -46,10 +42,12 @@ On a self-hosted deployment, three flags on the same object decide which routes### Served while Stripe is serviceable+These routes need `stripe_serviceable`. [Receive Stripe webhook](/http-api/billing/#receive-stripe-webhook) also needs a Stripe webhook secret.+| Method | Route | Operation || --- | --- | --- |-| POST | /v1/stripe/webhook<sup>2</sup> | [Receive Stripe webhook](/http-api/billing/#receive-stripe-webhook) |-| GET | /v1/premium/current-subscription-price<sup>3</sup> | [Get current subscription price](/http-api/premium/#get-current-subscription-price) |+| POST | /v1/stripe/webhook | [Receive Stripe webhook](/http-api/billing/#receive-stripe-webhook) |+| GET | /v1/premium/current-subscription-price | [Get current subscription price](/http-api/premium/#get-current-subscription-price) || POST | /v1/premium/customer-portal | [Create customer portal](/http-api/premium/#create-customer-portal) || POST | /v1/premium/grace/end | [End premium grace period](/http-api/premium/#end-premium-grace-period) || POST | /v1/premium/cancel-subscription | [Cancel subscription](/http-api/premium/#cancel-subscription) |@@ -57,18 +55,8 @@ On a self-hosted deployment, three flags on the same object decide which routes| POST | /v1/premium/change-subscription | [Change subscription billing cycle](/http-api/premium/#change-subscription-billing-cycle) || POST | /v1/premium/cancel-pending-subscription-change | [Cancel pending subscription change](/http-api/premium/#cancel-pending-subscription-change) |-<sup>1</sup> This is the only `/users/@me` route a self-hosted deployment may not serve--<sup>2</sup> The webhook takes no credential and is authenticated by the provider signature header alone--<sup>3</sup> The same object appears as `billing.current_subscription_price` on [Get premium state](/http-api/premium/#get-premium-state), which every deployment serves--## Registered routes that resolve differently--A route every deployment registers can still produce a different answer on a self-hosted instance. Each operation page documents that difference.--Premium state is the clearest case. Every deployment registers [Get premium state](/http-api/premium/#get-premium-state) and [Set premium perks disabled](/http-api/premium/#set-premium-perks-disabled). A self-hosted instance still reports premium state and still records the perks-disabled flag. The response repeats the deployment kind in `self_hosted` on the [effective premium state object](/http-api/premium/#effective-premium-state-object). That flag alone does not make `is_premium` true. A self-hosted deployment grants premium to every account only while its instance [premium mode](/admin-api/instance/#premium-modes) is `everyone`. That mode also overrides the perks-disabled flag, so `is_premium` stays true while `premium_perks_disabled` is true.+## Routes every instance serves-The other instance feature flags published by [instance discovery](/http-api/instance/#instance-features-object) work the same way. `voice_enabled`, `presigned_attachment_uploads`, `emails_enabled`, and `discovery_enabled` each report whether a capability is switched on. The routes for that capability stay registered when the flag is false, so a client reads the flag before it uses them.+Every instance serves [Get premium state](/http-api/premium/#get-premium-state) and [Set premium perks disabled](/http-api/premium/#set-premium-perks-disabled). In the `everyone` premium mode, every account on a self-hosted instance has premium, and `is_premium` stays true even when `premium_perks_disabled` is true.-`account_identity` is the same kind of flag. Every deployment registers the email routes and the username-only routes alike. A `username` deployment answers the email routes with 400 `EMAIL_UNAVAILABLE_ON_INSTANCE`, and an `email` deployment answers the username-only routes with 400 `USERNAME_SIGN_IN_ONLY`.+Other flags in instance discovery, such as `voice_enabled`, `emails_enabled` and `discovery_enabled`, don't remove routes.diff --git a/fluxer_docs/src/content/docs/http-api/discovery.mdx b/fluxer_docs/src/content/docs/http-api/discovery.mdxindex 37cd63785..cbd409e61 100644--- a/fluxer_docs/src/content/docs/http-api/discovery.mdx+++ b/fluxer_docs/src/content/docs/http-api/discovery.mdx@@ -1,58 +1,36 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Discovery-description: Guild discovery listings, the application lifecycle, and joining an approved guild.+description: How to search the guild directory, preview, visit or join a listed guild, and manage a guild's discovery application.---import RouteHeader from '@/components/RouteHeader.astro';-Discovery is the public directory of guilds any account can browse and join. A guild manager applies to have a guild listed, and an operator reviews that application through the [Admin Discovery API](/admin-api/discovery/). People see this feature as "Explore" in the Fluxer apps. The API calls it discovery.+Discovery is the public directory of guilds that any account can browse and join, shown as "Explore" in the Fluxer apps. Someone with `MANAGE_GUILD` applies to list a guild, and an instance admin reviews the application through the [Admin Discovery API](/admin-api/discovery/).-[Preview discovery channel](#preview-discovery-channel) and [Join discovery guild](#join-discovery-guild) are user-only and reject a bot token with 403 `ACCESS_DENIED`. Every other route accepts a user session token or a bot token. Besides that rejection, a bearer credential is the only credential that produces `ACCESS_DENIED` on any route here. Where a response table below pairs a revoked account with `ACCESS_DENIED`, a session, bot, or bearer token that no longer resolves to an account returns 401 `UNAUTHORIZED` instead.--On a guild an operator has marked unavailable, Fluxer refuses [Apply for discovery](#apply-for-discovery), [Edit discovery application](#edit-discovery-application), [Withdraw discovery application](#withdraw-discovery-application), and [Get discovery status](#get-discovery-status) with 403 `MISSING_ACCESS` before the route runs. The gate does not cover [Preview discovery channel](#preview-discovery-channel) or [Join discovery guild](#join-discovery-guild).--The routes under `/v1/guilds/{guild_id}/discovery` require [MANAGE_GUILD](/http-api/permissions/), which is an [elevated permission](/http-api/permissions/#elevated-permissions). While the guild [MFA level](/http-api/guilds/#mfa-levels) is elevated, a caller other than the owner also needs an enrolled authenticator, and receives 400 `TWO_FACTOR_REQUIRED` without one. A guild that does not exist returns 404 `UNKNOWN_GUILD`. Both a non-member and a member without the permission return 403 `MISSING_PERMISSIONS`. The routes answer 503 `SERVICE_UNAVAILABLE` when the check cannot be admitted, and 504 `GATEWAY_TIMEOUT` when it does not answer in time.--:::note[Discovery is an optional instance capability]-Searching, previewing a channel, applying, editing, withdrawing, and joining fail with 400 `DISCOVERY_DISABLED` while an operator has it disabled. [List discovery categories](#list-discovery-categories) and [Get discovery status](#get-discovery-status) keep answering.-:::+When discovery is turned off for the instance, every route except [List discovery categories](#list-discovery-categories) and [Get discovery status](#get-discovery-status) returns 400 `DISCOVERY_DISABLED`.## Discovery guild object-One public guild listing.+An approved guild listing as search returns it.### Structure| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the guild |-| name | string | The name of the guild at index time |-| icon<sup>3</sup> | ?string | The icon hash of the guild, or null when it stores none |-| banner<sup>3</sup> | ?string | The banner hash of the guild, or null when it stores none |-| description<sup>1</sup> | ?string | The description supplied on the application, or null |-| category_type<sup>1</sup> | integer | The [discovery category](#discovery-categories) the listing is filed under |-| primary_language<sup>1</sup> | ?string | The [supported primary language](#supported-primary-languages) code of the listing, or null |-| custom_tags<sup>1</sup> | array[string] | The normalised [custom tags](#custom-tags) of the listing |-| member_count<sup>2</sup> | integer | The current member count of the guild |-| online_count<sup>2</sup> | integer | The current online member count of the guild |-| features | array[string] | The [guild features](/http-api/guilds/#guild-features) the guild has |-| verification_level<sup>4</sup> | integer | The effective [verification level](/http-api/guilds/#verification-levels) of the guild |-| visits_enabled?<sup>5</sup> | boolean | Whether the caller can [visit](/http-api/guilds/#visiting-guilds) the guild before joining |--<sup>1</sup> These fields describe the approved application. An unspecified category is reported as `0`--<sup>2</sup> Counts are approximate. When live counts are unavailable, `member_count` can be stale and `online_count` is `0`--<sup>3</sup> An animated hash retains its `a_` prefix, which is the animation indicator for this object--<sup>4</sup> A listed guild is reported at least at level `1`, so a guild that stores level `0` is reported as `1` while it remains discoverable--<sup>5</sup> Present only for a caller with the `guild_visits` assignment. True when the guild holds `VISITS_ENABLED` and invites are not disabled--:::note[Listing updates can take time]-Changes to a guild's name, icon, banner, features or verification level can take up to 15 minutes to appear.-:::+| name | string | The name of the guild |+| icon | ?string | The icon hash of the guild |+| banner | ?string | The banner hash of the guild |+| description | ?string | The description from the application |+| category_type | integer | The [discovery category](#discovery-categories) of the listing |+| primary_language | ?string | The [primary language](#supported-primary-languages) of the listing |+| custom_tags | array[string] | The [custom tags](#custom-tags) of the listing |+| member_count | integer | The approximate member count of the guild |+| online_count | integer | The approximate online member count of the guild |+| features | array[string] | The [guild features](/http-api/guilds/#guild-features) of the guild |+| verification_level | integer | The [verification level](/http-api/guilds/#verification-levels) of the guild (at least `1`) |+| visits_enabled? | boolean | Whether you can [visit](/http-api/guilds/#visiting-guilds) the guild before joining |### Example@@ -75,61 +53,47 @@ Changes to a guild's name, icon, banner, features or verification level can take## Discovery search result object-One page of matching listings, together with the total and the per-category counts.+The search results for one page.### Structure| Field | Type | Description || --- | --- | --- |-| guilds | array[[discovery guild](#discovery-guild-object) object] | The matching approved guilds on this page of results |-| total<sup>1</sup> | integer | The total number of guilds matching the query |-| category_counts<sup>2</sup> | array[[discovery category count](#discovery-category-count-object) object] | The match count for each category under the current filters |--<sup>1</sup> The count covers every match on every page. A client pages with `offset` until `offset` reaches `total`--<sup>2</sup> Computed with the `category` filter removed and every other filter applied, so the counts describe what selecting a different category would return. A category with no match is omitted, and the array is ordered by ascending category+| guilds | array[[discovery guild](#discovery-guild-object) object] | The matching guilds on this page |+| total | integer | The number of matching guilds across all pages |+| category_counts | array[[discovery category count](#discovery-category-count-object) object] | The match count for each category, ignoring the `category` filter |## Discovery category count object-One category and the number of listings it holds under the current filters.+The number of matches in one category.### Structure| Field | Type | Description || --- | --- | --- |-| category_type | integer | The [discovery category](#discovery-categories) counted |-| count | integer | The number of matching guilds in that category |+| category_type | integer | The [discovery category](#discovery-categories) |+| count | integer | The number of matching guilds in the category |## Discovery application object-One guild's discovery listing and review state. A guild has at most one application. A rejected or removed application remains readable with its outcome and reason until the guild applies again or withdraws it.+The discovery listing of one guild and its review state. A guild has at most one application.### Structure| Field | Type | Description || --- | --- | --- || guild_id | snowflake | The ID of the guild |-| guild_nsfw_level?<sup>1</sup> | ?integer | The [NSFW level](/http-api/guilds/#nsfw-levels) of the guild |-| status | string | The [application status](#discovery-application-statuses) of the listing |+| guild_nsfw_level? | ?integer | The [NSFW level](/http-api/guilds/#nsfw-levels) of the guild, set only in [Admin Discovery API](/admin-api/discovery/) responses |+| status | string | The [application status](#discovery-application-statuses) || description | string | The description shown on the listing |-| category_type | integer | The [discovery category](#discovery-categories) the listing is filed under |-| primary_language<sup>2</sup> | ?string | The [supported primary language](#supported-primary-languages) code of the listing, or null |-| custom_tags | array[string] | The normalised [custom tags](#custom-tags) of the listing |-| applied_at | ISO8601 timestamp | The time at which the application was submitted |-| reviewed_at<sup>3</sup> | ?ISO8601 timestamp | The time at which the application was approved or rejected, or null |-| review_reason<sup>4</sup> | ?string | The reason recorded with the approval or rejection, or null |-| removed_at<sup>5</sup> | ?ISO8601 timestamp | The time at which an approved listing was removed, or null |-| removal_reason<sup>5</sup> | ?string | The reason recorded with the removal, or null |--<sup>1</sup> No route here populates the field. The [guild object](/http-api/guilds/#guild-object) has the guild's NSFW level--<sup>2</sup> An application that supplies no language is stored with the default `en-US`, so the public routes never produce the null form--<sup>3</sup> Set at review time. An application approved automatically on submission has its submission time here--<sup>4</sup> Always null for an automatic approval--<sup>5</sup> Set only when an operator removes an approved listing. A guild that withdraws its own application deletes the record+| category_type | integer | The [discovery category](#discovery-categories) of the listing |+| primary_language | ?string | The [primary language](#supported-primary-languages) of the listing |+| custom_tags | array[string] | The [custom tags](#custom-tags) of the listing |+| applied_at | ISO8601 timestamp | When the application was submitted |+| reviewed_at | ?ISO8601 timestamp | When the application was approved or rejected |+| review_reason | ?string | The reason given with the approval or rejection |+| removed_at | ?ISO8601 timestamp | When an instance admin removed the approved listing |+| removal_reason | ?string | The reason given with the removal |### Example@@ -151,33 +115,19 @@ One guild's discovery listing and review state. A guild has at most one applicat## Discovery status object-The application state of one guild and its current eligibility to apply.+The discovery state of a guild and whether it can apply.### Structure| Field | Type | Description || --- | --- | --- |-| application | ?[discovery application](#discovery-application-object) object | The current application of the guild, or null when it has never applied or has withdrawn |-| eligible<sup>1</sup> | boolean | Whether the guild meets the requirement to apply |-| min_member_count<sup>2</sup> | integer | The number of members the instance requires |--<sup>1</sup> False whenever discovery is disabled for the instance, whatever the guild would otherwise satisfy--<sup>2</sup> Read from instance configuration, so it is identical for every guild and defaults to `1`--### Example--```json-{- "application": null,- "eligible": true,- "min_member_count": 1-}-```+| application | ?[discovery application](#discovery-application-object) object | The current application of the guild |+| eligible | boolean | Whether the guild has enough members to apply, always false while discovery is off |+| min_member_count | integer | The minimum number of members a guild needs to apply |## Discovery category object-One entry of the fixed category registry, as [List discovery categories](#list-discovery-categories) returns it.+A category a listing can use.### Structure@@ -188,51 +138,38 @@ One entry of the fixed category registry, as [List discovery categories](#list-d## Discovery channel preview object-The guild and channel behind a channel or message link, as [Preview discovery channel](#preview-discovery-channel) returns them.+A channel in a listed guild that you can view before joining.### Structure| Field | Type | Description || --- | --- | --- |-| guild | [discovery preview guild](#discovery-preview-guild-object) object | The discoverable guild the channel belongs to |-| channel | [discovery preview channel](#discovery-preview-channel-object) object | The channel new members can read |--### Example--```json-{- "guild": {- "id": "1489002177550843904",- "name": "Example guild",- "icon": "a_9f1c2d3e4b5a60718293a4b5c6d7e8f9"- },- "channel": {- "id": "1489002177550843907",- "name": "general",- "type": 0- }-}-```+| guild | [discovery preview guild](#discovery-preview-guild-object) object | The guild the channel is in |+| channel | [discovery preview channel](#discovery-preview-channel-object) object | The channel |## Discovery preview guild object+The guild in a channel preview.+### Structure| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the guild |-| name | string | The current name of the guild |-| icon | ?string | The icon hash of the guild, or null when it stores none |+| name | string | The name of the guild |+| icon | ?string | The icon hash of the guild |## Discovery preview channel object+The channel in a channel preview.+### Structure| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the channel |-| name | ?string | The name of the channel, or null when it stores none |-| type | integer | The [channel type](/http-api/channels/#channel-types) of the channel |+| name | ?string | The name of the channel |+| type | integer | The [channel type](/http-api/channels/#channel-types) |## Discovery categories@@ -252,16 +189,14 @@ The guild and channel behind a channel or message link, as [Preview discovery ch| Value | Description || --- | --- |-| pending | Application has been submitted and awaits an operator decision |-| approved | Guild is listed and has the discoverable feature |-| rejected | Application was refused, and the guild can submit a new one |-| removed | Approved listing was withdrawn by an operator, and the guild can submit a new one |--A guild holding a pending or approved application cannot submit another. A guild whose application is rejected or removed can apply again, and the new submission replaces the previous record entirely.+| pending | Waiting for an instance admin to review it |+| approved | Listed, and the guild has the `DISCOVERABLE` feature |+| rejected | Refused, and the guild can apply again |+| removed | Taken down by an instance admin, and the guild can apply again |## Supported primary languages-Fluxer stores one primary language on each listing, drawn from the closed set below. The set is specific to discovery, and the client [locale registry](/topics/locales/#supported-locales) does not apply here. An application that supplies no language is stored as `en-US`.+Discovery has its own set of languages, separate from the [client locales](/topics/locales/#supported-locales). A listing with no language gets `en-US`.| Value | Name | Native name || --- | --- | --- |@@ -301,365 +236,180 @@ Fluxer stores one primary language on each listing, drawn from the closed set be## Custom tags-A listing has up to ten custom tags. Fluxer normalises a tag by trimming it, lowercasing it, and collapsing each run of whitespace to one space. Both the submitted string and its normalised form must be 2 through 30 characters, so a submitted string longer than 30 characters is rejected even when trimming would bring it inside the bound. The normalised form must begin with a letter or digit and otherwise contain only letters, digits, spaces, hyphens, underscores, plus signs, and ampersands.--Duplicate normalised values collapse to the first occurrence. A submitted array longer than ten entries fails body validation. An entry that fails these constraints is rejected against its own index.+A listing can have up to 10 custom tags of 2-30 characters each. A tag must start with a letter or digit and can only have letters, digits, spaces, hyphens, underscores, plus signs and ampersands. Fluxer lowercases and trims each tag and drops duplicates.## Search discovery guilds<RouteHeader method="GET" path="/v1/discovery/guilds" bot />-Searches the approved discovery listings and returns a [discovery search result object](#discovery-search-result-object).--The caller needs no permission and no relationship to the matched guilds.+Searches the approved listings and returns a [discovery search result object](#discovery-search-result-object). Leave out `query` to browse every listing.### Query parameters| Field | Type | Description || --- | --- | --- |-| query?<sup>1</sup> | string | The free-text query (at most 100 characters) |-| category?<sup>2</sup> | integer | The single [discovery category](#discovery-categories) results are restricted to (0-8) |-| language?<sup>3</sup> | string | The single [supported primary language](#supported-primary-languages) results are restricted to |-| tag?<sup>4</sup> | string | The single [custom tag](#custom-tags) results are restricted to (at most 30 characters) |-| sort_by?<sup>5</sup> | string | The result ordering, one of `member_count`, `online_count`, or `relevance` |+| query? | string | The search text (at most 100 characters) |+| category? | integer | The [discovery category](#discovery-categories) to filter by |+| language? | string | The [primary language](#supported-primary-languages) to filter by |+| tag? | string | The [custom tag](#custom-tags) to filter by (at most 30 characters) |+| sort_by? | string | `relevance` sorts by match quality, and `member_count` and `online_count` sort by member count (default `member_count`) || limit? | integer | The number of results per page (1-48, default 24) |-| offset? | integer | The number of matches to skip (at least 0, default 0) |--<sup>1</sup> An omitted query matches every approved listing, so the operation doubles as a browse of the complete directory--<sup>2</sup> A value outside 0 through 8 is rejected by query validation--<sup>3</sup> A language outside the [supported set](#supported-primary-languages) is rejected by query validation--<sup>4</sup> Trimmed, lowercased, and whitespace-normalised like a [custom tag](#custom-tags), so equivalent spellings match and a value empty after trimming applies no filter--<sup>5</sup> Only `member_count` selects a distinct ordering. `online_count`, `relevance`, and an omitted field all order by relevance. Both orderings are descending+| offset? | integer | The number of results to skip (default 0) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [discovery search result](#discovery-search-result-object) object | Search completed, possibly with no match |-| 400 | [error response](/http-api/#error-response) | Discovery is disabled for the instance and the request returns `DISCOVERY_DISABLED` |-| 403 | [error response](/http-api/#error-response) | Caller presents a bearer credential or a revoked account and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | No search backend is configured for the instance and the request returns `FEATURE_TEMPORARILY_DISABLED` |--### Rate limit+| 200 | [discovery search result](#discovery-search-result-object) object | The results were returned, even when nothing matched |+| 403 | [error response](/http-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED` when the instance has no search backend |-30 requests per 10 seconds for each authenticated user, on the `discovery:search` bucket, which is not partitioned by query.+The rate limit is 30 requests per 10 seconds, on the `discovery:search` bucket.## List discovery categories<RouteHeader method="GET" path="/v1/discovery/categories" bot />-Returns an array of every [discovery category object](#discovery-category-object) in ascending `id` order, which is also the intended display order. The caller needs no permission.--The route answers even while discovery is disabled for the instance.--A client that wants a translated label supplies its own translation keyed on `id`, and MUST NOT invent a label for an ID this response does not have.+Returns every [discovery category object](#discovery-category-object) in display order.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | array[[discovery category](#discovery-category-object) object] | Categories were returned |-| 403 | [error response](/http-api/#error-response) | Caller presents a bearer credential or a revoked account and the request returns `ACCESS_DENIED` |--### Rate limit+| 200 | array[[discovery category](#discovery-category-object) object] | The categories were returned |-60 requests per 10 seconds for each authenticated user, on the `discovery:categories` bucket.+The rate limit is 60 requests per 10 seconds, on the `discovery:categories` bucket.## Preview discovery channel<RouteHeader method="GET" path="/v1/discovery/guilds/{guild_id}/channels/{channel_id}" />-Returns the [discovery channel preview object](#discovery-channel-preview-object) for a channel or message link that points into a discoverable guild, so a client can show the guild and channel before the account joins. The caller needs no permission and no membership.--The route answers only when the guild holds an approved discovery application, the guild does not have the invites-disabled feature, the channel belongs to that guild, and the `@everyone` role can read the channel. Reading means `@everyone` holds both [VIEW_CHANNEL](/http-api/permissions/) and [READ_MESSAGE_HISTORY](/http-api/permissions/) after the channel's `@everyone` overwrite is applied. A guild whose `@everyone` role has [ADMINISTRATOR](/http-api/permissions/) passes regardless of overwrites. Role and member overwrites are not considered. A thread returns 400 `DISCOVERY_NOT_DISCOVERABLE`. A forum or media channel returns the same code to a caller without the [`channel_threads` client capability](/http-api/threads/#client-capability). Every other channel type can pass.--:::note[Every refusal returns the same error]-A guild that does not exist, a guild without an approved listing, a channel that does not exist, a channel in another guild, and a channel `@everyone` cannot read all return 400 `DISCOVERY_NOT_DISCOVERABLE`. The response does not reveal which condition failed.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the discoverable guild |-| channel_id | snowflake | The ID of the channel to preview |+Returns a [discovery channel preview object](#discovery-channel-preview-object) for a channel in a listed guild, which a client can show before you join. The guild needs an approved listing and invites turned on, and `@everyone` needs `VIEW_CHANNEL` and `READ_MESSAGE_HISTORY` in the channel. Threads can't be previewed, and forum and media channels need the [`channel_threads` client capability](/http-api/threads/#client-capability).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [discovery channel preview](#discovery-channel-preview-object) object | Guild is listed in discovery and new members can read the channel |-| 400 | [error response](/http-api/#error-response) | A path parameter is not a valid snowflake and the request returns `INVALID_FORM_BODY` |-| 400 | [error response](/http-api/#error-response) | Discovery is disabled for the instance and the request returns `DISCOVERY_DISABLED` |-| 400 | [error response](/http-api/#error-response) | The guild is not discoverable or `@everyone` cannot read the channel, and the request returns `DISCOVERY_NOT_DISCOVERABLE` |-| 400 | [error response](/http-api/#error-response) | A thread, or a forum or media channel for a caller without the capability, returns `DISCOVERY_NOT_DISCOVERABLE` |-| 403 | [error response](/http-api/#error-response) | Caller is a bot, presents a bearer credential, or holds a revoked account and the request returns `ACCESS_DENIED` |--### Side effects--None. The route reads stored records only and emits no Gateway Dispatch.--### Rate limit+| 200 | [discovery channel preview](#discovery-channel-preview-object) object | The channel can be previewed |+| 400 | [error response](/http-api/#error-response) | `DISCOVERY_NOT_DISCOVERABLE` for any failed check, including a guild or channel that doesn't exist |-60 requests per 10 seconds for each authenticated user, on the `discovery:channel_preview` bucket, which is not partitioned by guild or channel.+The rate limit is 60 requests per 10 seconds, on the `discovery:channel_preview` bucket.## Visit discovery guild<RouteHeader method="POST" path="/v1/discovery/guilds/{guild_id}/visit" />-Starts a [visit](/http-api/guilds/#visiting-guilds) to an approved discovery guild and returns the [guild visit start object](/http-api/guilds/#guild-visit-start-object). It works like [Visit invite guild](/http-api/invites/#visit-invite-guild) without an invite. A caller who is already a member receives `member: true` and no visit.--### Limitations--- User-only, so a bot token is rejected with 403 `ACCESS_DENIED`.-- Needs the `guild_visits` [experiment assignment](/http-api/experiments/#guild-visits-assignment-object), otherwise the route returns 404 `UNKNOWN_GUILD`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the approved guild to visit |+Starts a [visit](/http-api/guilds/#visiting-guilds) to a listed guild without an invite and returns a [guild visit start object](/http-api/guilds/#guild-visit-start-object), like [Visit invite guild](/http-api/invites/#visit-invite-guild). You need the `guild_visits` [experiment assignment](/http-api/experiments/#guild-visits-assignment-object).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [guild visit start](/http-api/guilds/#guild-visit-start-object) object | Visit started, was already open, or the caller is a member |-| 400 | [error response](/http-api/#error-response) | Discovery is disabled for the instance and the request returns `DISCOVERY_DISABLED` |-| 403 | [error response](/http-api/#error-response) | The guild does not accept visitors and the request returns `GUILD_VISITS_DISABLED` |-| 403 | [error response](/http-api/#error-response) | The guild is for adults and the caller may not see adult content, returning `GUILD_VISIT_AGE_RESTRICTED` |-| 403 | [error response](/http-api/#error-response) | Invites are disabled for the guild and the request returns `INVITES_DISABLED` |-| 403 | [error response](/http-api/#error-response) | The caller is banned from the guild and the request returns `USER_BANNED_FROM_GUILD` or `USER_IP_BANNED_FROM_GUILD` |-| 404 | [error response](/http-api/#error-response) | The guild has no approved listing, is unavailable, or visits are off for the caller, returning `UNKNOWN_GUILD` |--### Rate limit+| 200 | [guild visit start](/http-api/guilds/#guild-visit-start-object) object | The visit started, was already open or you're a member (`member: true`) |+| 403 | [error response](/http-api/#error-response) | `GUILD_VISITS_DISABLED` when the guild doesn't accept visitors |+| 403 | [error response](/http-api/#error-response) | `GUILD_VISIT_AGE_RESTRICTED` when the guild is for adults and you can't see adult content |+| 403 | [error response](/http-api/#error-response) | `INVITES_DISABLED` when the guild has invites turned off |+| 403 | [error response](/http-api/#error-response) | `USER_BANNED_FROM_GUILD` or `USER_IP_BANNED_FROM_GUILD` when you're banned |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_GUILD` when the guild isn't listed or you don't have the assignment |-10 requests per 60 seconds for each authenticated user, on the `guild:visit:start` bucket. Each address can also start 30 visits per 60 seconds.+The rate limit is 10 requests per 60 seconds, on the `guild:visit:start` bucket.## Join discovery guild<RouteHeader method="POST" path="/v1/discovery/guilds/{guild_id}/join" />-Admits the authenticated account into an approved discovery guild and returns 204 with an empty body. Emits [Guild Create](/gateway/events/#guild-create), [Guild Member Add](/gateway/events/#guild-member-add), [User Settings Update](/gateway/events/#user-settings-update), [User Guild Settings Update](/gateway/events/#user-guild-settings-update), and [Message Create](/gateway/events/#message-create) Gateway events.--The caller needs no invite and no permission.--:::caution[Only an approved listing admits]-A pending, rejected, removed, or absent application fails with 400 `DISCOVERY_NOT_DISCOVERABLE`, even when the guild has the discoverable feature for another reason. A guild with invites disabled refuses admission with 403 `INVITES_DISABLED`.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the approved guild to join |+Adds you to a guild with an approved listing, without an invite, and returns 204. Fluxer sends [Guild Create](/gateway/events/#guild-create) to your sessions and [Guild Member Add](/gateway/events/#guild-member-add) to the guild.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Account was admitted, or was already a member of the guild |-| 400 | [error response](/http-api/#error-response) | Discovery is disabled for the instance and the request returns `DISCOVERY_DISABLED` |-| 400 | [error response](/http-api/#error-response) | The guild has no approved application and the request returns `DISCOVERY_NOT_DISCOVERABLE` |-| 400 | [error response](/http-api/#error-response) | The caller already holds the maximum number of guilds and the request returns `MAX_GUILDS` |-| 400 | [error response](/http-api/#error-response) | The guild is full and the request returns `MAX_GUILD_MEMBERS` |-| 403 | [error response](/http-api/#error-response) | Caller is a bot, presents a bearer credential, or holds a revoked account and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The account is limited and not already a member, and the request returns `ACCOUNT_LIMITED` |-| 403 | [error response](/http-api/#error-response) | The guild has the invites-disabled feature and the request returns `INVITES_DISABLED` |-| 403 | [error response](/http-api/#error-response) | The caller is banned from the guild directly or by address and the request returns `USER_BANNED_FROM_GUILD` or `USER_IP_BANNED_FROM_GUILD` |-| 404 | [error response](/http-api/#error-response) | The approved application names a guild whose record no longer exists and the request returns `UNKNOWN_GUILD` |--:::note[A guild that never existed returns 400, not 404]-A guild with no approved listing returns `DISCOVERY_NOT_DISCOVERABLE`.-:::--### Side effects--An account that is already a member receives the same 204 response with no Dispatch. Otherwise the operation creates the membership, records discovery as its join source, and adds the guild to the caller's settings and folder layout.--The joining account's sessions receive [Guild Create](/gateway/events/#guild-create). [Guild Member Add](/gateway/events/#guild-member-add) is dispatched guild-wide and reaches whichever sessions [event filtering](/gateway/event-filtering/) selects. A bot session always receives it, and a passive user session in a guild with more than 250 members does not receive it until [Lazy Request](/gateway/commands/#lazy-request) marks that guild active. The joining account receives [User Settings Update](/gateway/events/#user-settings-update) when the join adds the guild to `restricted_guilds` in its [user settings](/http-api/users/settings/) or changes its folder layout, and [User Guild Settings Update](/gateway/events/#user-guild-settings-update) when its account default hides muted channels.--Unless the guild sets the `SUPPRESS_JOIN_NOTIFICATIONS` [system channel flag](/http-api/guilds/#system-channel-flags) or has no system channel, the join emits a [USER_JOIN](/http-api/messages/#message-types) system message through [Message Create](/gateway/events/#message-create). No invite use is consumed.+| 204 | empty | You joined, or were already a member |+| 400 | [error response](/http-api/#error-response) | `DISCOVERY_NOT_DISCOVERABLE` when the guild has no approved listing |+| 400 | [error response](/http-api/#error-response) | `MAX_GUILDS` when you're in the maximum number of guilds |+| 400 | [error response](/http-api/#error-response) | `MAX_GUILD_MEMBERS` when the guild is full |+| 403 | [error response](/http-api/#error-response) | `ACCOUNT_LIMITED` when your account is limited |+| 403 | [error response](/http-api/#error-response) | `INVITES_DISABLED` when the guild has invites turned off |+| 403 | [error response](/http-api/#error-response) | `USER_BANNED_FROM_GUILD` or `USER_IP_BANNED_FROM_GUILD` when you're banned |-### Rate limit--10 requests per minute for each authenticated user, on the `discovery:join` bucket, which is not partitioned by guild.+The rate limit is 10 requests per minute, on the `discovery:join` bucket.## Apply for discovery<RouteHeader method="POST" path="/v1/guilds/{guild_id}/discovery" bot />-Submits the discovery listing application of a guild and returns the resulting [discovery application object](#discovery-application-object). Requires [MANAGE_GUILD](/http-api/permissions/). An automatic approval emits a [Guild Update](/gateway/events/#guild-update) Gateway event.--:::note[A verified or partnered guild is approved immediately]-Its submission time is also its review time, it gains the discoverable feature, and it appears in search. Every other application stays pending until an operator approves it through the [Admin Discovery API](/admin-api/discovery/).-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Submits a discovery application and returns the [discovery application object](#discovery-application-object). You need [`MANAGE_GUILD`](/http-api/permissions/). Applications stay pending until an instance admin reviews them, but a verified or partnered guild is approved right away and Fluxer sends [Guild Update](/gateway/events/#guild-update).### JSON body| Field | Type | Description || --- | --- | --- |-| description<sup>1</sup> | string | The listing description (10-300 characters) |-| category_type<sup>2</sup> | integer | The [discovery category](#discovery-categories) to file the listing under (0-8) |-| primary_language?<sup>3</sup> | string | The [supported primary language](#supported-primary-languages) code of the listing (default en-US) |-| custom_tags?<sup>4</sup> | array[string] | The [custom tags](#custom-tags) to store (at most 10) |--<sup>1</sup> A value blocked by instance content policy returns 403 `CONTENT_BLOCKED`--<sup>2</sup> A value outside 0 through 8, a negative value, or a non-integer value is rejected by body validation--<sup>3</sup> A code outside the supported set is rejected by body validation, and an omitted field stores `en-US`--<sup>4</sup> Each entry is normalised and validated as described by [custom tags](#custom-tags), and an omitted field stores an empty array+| description | string | The listing description (10-300 characters) |+| category_type | integer | The [discovery category](#discovery-categories) |+| primary_language? | string | The [primary language](#supported-primary-languages) (default `en-US`) |+| custom_tags? | array[string] | The [custom tags](#custom-tags) (at most 10) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [discovery application](#discovery-application-object) object | Application was stored as pending, or was approved immediately |-| 400 | [error response](/http-api/#error-response) | Discovery is disabled for the instance and the request returns `DISCOVERY_DISABLED`, or the guild has fewer members than the instance requires and the request returns `DISCOVERY_INSUFFICIENT_MEMBERS` |-| 400 | [error response](/http-api/#error-response) | The caller cannot use [MANAGE_GUILD](/http-api/permissions/) because of the guild MFA level and the request returns `TWO_FACTOR_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Caller presents a bearer credential or a revoked account and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The guild is marked unavailable and the request returns `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The description matches a content blocklist and the request returns `CONTENT_BLOCKED` |-| 403 | [error response](/http-api/#error-response) | The caller lacks [MANAGE_GUILD](/http-api/permissions/) and the request returns `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |-| 409 | [error response](/http-api/#error-response) | The guild already holds a pending or approved application and the request returns `DISCOVERY_ALREADY_APPLIED` |--### Side effects--The submitted listing replaces a previous rejected or removed application.--A pending application stays out of search and emits no Dispatch. Automatic approval makes the guild discoverable and sends [Guild Update](/gateway/events/#guild-update) to every session that can see it.+| 200 | [discovery application](#discovery-application-object) object | The application is pending or was approved |+| 400 | [error response](/http-api/#error-response) | `DISCOVERY_INSUFFICIENT_MEMBERS` when the guild has fewer members than the instance needs |+| 403 | [error response](/http-api/#error-response) | `CONTENT_BLOCKED` when the description is blocked by content policy |+| 409 | [error response](/http-api/#error-response) | `DISCOVERY_ALREADY_APPLIED` when the guild has an approved application, or a pending one and isn't verified or partnered |-### Rate limit--5 requests per minute for each authenticated user and guild ID, on the `discovery:apply::guild_id` bucket, which is shared with [Edit discovery application](#edit-discovery-application) and [Withdraw discovery application](#withdraw-discovery-application).+The rate limit is 5 requests per minute, on the `discovery:apply::guild_id` bucket, which it shares with editing and withdrawing.## Edit discovery application<RouteHeader method="PATCH" path="/v1/guilds/{guild_id}/discovery" bot />-Updates the stored listing of a guild and returns the updated [discovery application object](#discovery-application-object). Requires [MANAGE_GUILD](/http-api/permissions/). The operation emits no Gateway Dispatch.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Updates a pending or approved application without changing its status and returns the [discovery application object](#discovery-application-object). You need [`MANAGE_GUILD`](/http-api/permissions/).### JSON body| Field | Type | Description || --- | --- | --- |-| description?<sup>1</sup> | string | The listing description (10-300 characters) |-| category_type?<sup>2</sup> | integer | The [discovery category](#discovery-categories) to file the listing under (0-8) |-| primary_language?<sup>3</sup> | string | The [supported primary language](#supported-primary-languages) code of the listing |-| custom_tags?<sup>4</sup> | array[string] | The [custom tags](#custom-tags) to store (at most 10) |--<sup>1</sup> A value blocked by instance content policy returns 403 `CONTENT_BLOCKED`--<sup>2</sup> A value outside 0 through 8 is rejected by body validation--<sup>3</sup> A supplied code replaces the stored one. A listing always stores a language, so no update clears it--<sup>4</sup> A supplied array becomes the complete stored tag list, so an empty array clears every tag+| description? | string | The listing description (10-300 characters) |+| category_type? | integer | The [discovery category](#discovery-categories) |+| primary_language? | string | The [primary language](#supported-primary-languages) |+| custom_tags? | array[string] | The full list of [custom tags](#custom-tags) (at most 10) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [discovery application](#discovery-application-object) object | Listing was updated, or the submitted values already matched the stored ones |-| 400 | [error response](/http-api/#error-response) | Discovery is disabled for the instance and the request returns `DISCOVERY_DISABLED` |-| 400 | [error response](/http-api/#error-response) | The caller cannot use [MANAGE_GUILD](/http-api/permissions/) because of the guild MFA level and the request returns `TWO_FACTOR_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Caller presents a bearer credential or a revoked account and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The guild is marked unavailable and the request returns `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The description matches a content blocklist and the request returns `CONTENT_BLOCKED` |-| 403 | [error response](/http-api/#error-response) | The caller lacks [MANAGE_GUILD](/http-api/permissions/) and the request returns `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |-| 404 | [error response](/http-api/#error-response) | The guild exists but holds no application, and the request returns `DISCOVERY_APPLICATION_NOT_FOUND` |-| 409 | [error response](/http-api/#error-response) | The stored application is rejected or removed and the request returns `DISCOVERY_APPLICATION_ALREADY_REVIEWED` |--### Side effects--Editing preserves the listing's status and review details. Changes to an approved listing appear in [Search discovery guilds](#search-discovery-guilds). A pending listing stays absent from search. No guild feature changes.+| 200 | [discovery application](#discovery-application-object) object | The application was updated |+| 403 | [error response](/http-api/#error-response) | `CONTENT_BLOCKED` when the description is blocked by content policy |+| 404 | [error response](/http-api/#error-response) | `DISCOVERY_APPLICATION_NOT_FOUND` when the guild has no application |+| 409 | [error response](/http-api/#error-response) | `DISCOVERY_APPLICATION_ALREADY_REVIEWED` when the application was rejected or removed |-### Rate limit--5 requests per minute for each authenticated user and guild ID, on the `discovery:apply::guild_id` bucket, which is shared with [Apply for discovery](#apply-for-discovery) and [Withdraw discovery application](#withdraw-discovery-application).+The rate limit is 5 requests per minute, on the `discovery:apply::guild_id` bucket.## Withdraw discovery application<RouteHeader method="DELETE" path="/v1/guilds/{guild_id}/discovery" bot />-Deletes the application record of a guild and returns 204 with an empty body. Requires [MANAGE_GUILD](/http-api/permissions/). Withdrawing an approved listing emits a [Guild Update](/gateway/events/#guild-update) Gateway event.--:::caution[Withdrawal destroys the application and review history]-The stored review time, review reason, removal time, and removal reason are deleted with the application. A guild that applies again is treated as a new applicant.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Deletes the application with its review history and returns 204. You need [`MANAGE_GUILD`](/http-api/permissions/). Withdrawing an approved listing removes the guild from search and sends [Guild Update](/gateway/events/#guild-update).### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Application was deleted |-| 400 | [error response](/http-api/#error-response) | Discovery is disabled for the instance and the request returns `DISCOVERY_DISABLED` |-| 400 | [error response](/http-api/#error-response) | The caller cannot use [MANAGE_GUILD](/http-api/permissions/) because of the guild MFA level and the request returns `TWO_FACTOR_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Caller presents a bearer credential or a revoked account and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The guild is marked unavailable and the request returns `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The caller lacks [MANAGE_GUILD](/http-api/permissions/) and the request returns `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |-| 404 | [error response](/http-api/#error-response) | The guild exists but holds no application, and the request returns `DISCOVERY_APPLICATION_NOT_FOUND` |--### Side effects--The application is permanently deleted. Withdrawing an approved listing also removes the discoverable feature, removes the listing from the discovery index, and delivers [Guild Update](/gateway/events/#guild-update) to every session that can see the guild. Withdrawing a pending, rejected, or removed application changes no guild feature and emits no Dispatch. Existing members are unaffected.--### Rate limit+| 204 | empty | The application was deleted |+| 404 | [error response](/http-api/#error-response) | `DISCOVERY_APPLICATION_NOT_FOUND` when the guild has no application |-5 requests per minute for each authenticated user and guild ID, on the `discovery:apply::guild_id` bucket, which is shared with [Apply for discovery](#apply-for-discovery) and [Edit discovery application](#edit-discovery-application).+The rate limit is 5 requests per minute, on the `discovery:apply::guild_id` bucket.## Get discovery status<RouteHeader method="GET" path="/v1/guilds/{guild_id}/discovery" bot />-Returns the [discovery status object](#discovery-status-object) of one guild, including for a guild that has never applied. Requires [MANAGE_GUILD](/http-api/permissions/).--The route answers even while discovery is disabled for the instance, reporting `eligible` as false in that case. It computes `eligible` from the current member count.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns the [discovery status object](#discovery-status-object) of a guild, including one that has never applied. You need [`MANAGE_GUILD`](/http-api/permissions/).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [discovery status](#discovery-status-object) object | Status was returned |-| 400 | [error response](/http-api/#error-response) | The caller cannot use [MANAGE_GUILD](/http-api/permissions/) because of the guild MFA level and the request returns `TWO_FACTOR_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Caller presents a bearer credential or a revoked account and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The guild is marked unavailable and the request returns `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The caller lacks [MANAGE_GUILD](/http-api/permissions/) and the request returns `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |--### Rate limit+| 200 | [discovery status](#discovery-status-object) object | The status was returned |-30 requests per 10 seconds for each authenticated user and guild ID, on the `discovery:status::guild_id` bucket.+The rate limit is 30 requests per 10 seconds, on the `discovery:status::guild_id` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/entrance-sounds.mdx b/fluxer_docs/src/content/docs/http-api/entrance-sounds.mdxindex e48278507..d9e5244da 100644--- a/fluxer_docs/src/content/docs/http-api/entrance-sounds.mdx+++ b/fluxer_docs/src/content/docs/http-api/entrance-sounds.mdx@@ -1,80 +1,56 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Entrance sounds-description: Personal entrance sound library, per-scope selections, upload validation, and playback.+description: Upload entrance sounds, assign them to scopes and play them in voice channels.---import RouteHeader from '@/components/RouteHeader.astro';-An entrance sound is a short audio clip an account plays while it is connected to a voice channel. An account uploads a clip once into its own library, then assigns it to a scope: globally, in guild voice channels, in private calls, or in one named guild. [Voice](/voice/) defines voice state and placement.--Every route on this page is user-only, requires no permission, and acts on the caller's own library.+An entrance sound is a short audio clip that plays for everyone else in a voice channel when you join it. You upload clips into your own library, assign one to each scope, and ask Fluxer to [play](#play-entrance-sound) the chosen clip after you connect. Bot tokens can't call these routes.## Clip limits-Every bound below is a fixed constant of the instance, and none is resolved from an account [limit rule](/http-api/instance/#limit-rule-object).-| Bound | Value || --- | --- || Clips per account | 8 |-| Decoded clip size<sup>1</sup> | 1048576 bytes |-| Encoded upload payload<sup>1</sup> | 1398134 characters |-| Clip duration<sup>2</sup> | 100 through 5200 milliseconds |-| Display name | 1 through 32 characters after normalisation |--<sup>1</sup> The character bound is the 1 MiB decoded ceiling expressed in base64 with 32 characters of slack, so it is the bound an oversized payload reaches first--<sup>2</sup> Only [Upload entrance sound](#upload-entrance-sound) applies the lower bound+| Decoded clip size | 1048576 bytes |+| Encoded upload size | 1398134 characters |+| Clip duration | 100 through 5200 milliseconds |+| Display name | 1 through 32 characters |-The [instance discovery](/http-api/instance/#limit-keys) document publishes a `feature_voice_entrance_sounds` limit key. The Fluxer client reads that key to decide whether it opens the clip upload dialog and whether it calls [Play entrance sound](#play-entrance-sound) after it connects to a voice channel. No route on this page checks it, so a library can be read, written, and played back regardless of its resolved value.+The `feature_voice_entrance_sounds` [limit key](/http-api/instance/#limit-keys) tells the Fluxer app whether to show entrance sounds, but these routes don't check it.## Supported containers-Fluxer detects the container from the decoded bytes, so a filename, a `data:` media type, or any other declared type has no effect on the result. The detected container resolves to a stored extension, and every other input fails with `ENTRANCE_SOUND_INVALID_FORMAT`.+Fluxer detects the container from the audio bytes and ignores the type in a `data:` URI prefix.-| Detected container | Stored extension | Stored content type |+| Detected container | Extension | Content type || --- | --- | --- |-| MP3, MPEG<sup>1</sup> | mp3 | audio/mpeg |-| Ogg<sup>2</sup> | ogg | audio/ogg |-| MP4, QuickTime, AAC<sup>3</sup> | m4a | audio/mp4 |+| MP3, MPEG | mp3 | audio/mpeg |+| Ogg | ogg | audio/ogg |+| MP4, QuickTime, AAC in MP4 | m4a | audio/mp4 || WAV | wav | audio/wav |-<sup>1</sup> An MPEG program stream resolves here as well as bare MPEG audio--<sup>2</sup> An audio Ogg and a video Ogg both resolve here--<sup>3</sup> The container alone decides this row, so an MP4 or QuickTime file with a video stream is accepted as long as a duration can be measured from it. A bare AAC stream outside an MP4 container is not detected and is rejected--FLAC, WebM, Matroska, AIFF, 3GPP, AVI, FLV, WMV, MPEG-TS, and every image type resolve to no extension and are rejected.--:::caution[The uploaded bytes are stored verbatim]-The decoded bytes are written exactly as they arrived, under the extension and content type the table assigns. A QuickTime upload stays a QuickTime file, and Fluxer serves it as `audio/mp4` under an `m4a` extension.-:::+Fluxer stores the bytes as uploaded and doesn't transcode them.## Entrance sound object-One stored audio clip owned by one account. Every field except `name` is fixed at upload, and `id` is the only handle the other routes accept.+One audio clip in an account's library.### Structure| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the sound |-| name | string | The display label shown for the clip (1-32 characters) |-| hash<sup>1</sup> | string | The content digest of the stored audio, 16 hexadecimal characters |-| extension | string | The stored extension, one of `mp3`, `ogg`, `m4a`, and `wav`, chosen by the [detected container](#supported-containers) |-| content_type | string | The MIME type the clip is stored and served with, derived from `extension` |-| duration_ms<sup>2</sup> | integer | The measured duration in milliseconds (0-5200) |+| name | string | The display name of the clip (1-32 characters) |+| hash | string | The content hash of the audio (16 hexadecimal characters) |+| extension | string | The stored extension, one of `mp3`, `ogg`, `m4a` and `wav` |+| content_type | string | The MIME type the clip is served with |+| duration_ms | integer | The duration in milliseconds (0-5200) || size_bytes | integer | The decoded size in bytes (0-1048576) |-| url<sup>3</sup> | string | The absolute CDN URL the clip is fetched from |+| url | string | The CDN URL of the clip (no authentication needed) || created_at | ISO8601 timestamp | The time the clip was uploaded |-<sup>1</sup> A content hash. Clips with identical audio have the same `hash`--<sup>2</sup> Measured from the decoded audio and rounded to the nearest millisecond--<sup>3</sup> Built as `/entrance-sounds/{user_id}/{hash}.{extension}` on the instance's media endpoint. The [route that serves it](/media-proxy/routes/#get-entrance-sound) accepts no credential, so anyone holding the URL can fetch the audio-### Example```json@@ -93,26 +69,15 @@ One stored audio clip owned by one account. Every field except `name` is fixed a## Entrance sound selection object-One scope and the clip assigned to it.+The clip assigned to one scope. A scope with no clip has no selection.### Structure| Field | Type | Description || --- | --- | --- |-| scope_id | string | [Entrance sound scope](#entrance-sound-scopes) the selection applies to |+| scope_id | string | The [scope](#entrance-sound-scopes) the selection applies to || sound_id | snowflake | The clip assigned to that scope |-A scope with no assigned sound has no selection object. Clearing a scope deletes its entry.--### Example--```json-{- "scope_id": "guild:1490000000000000123",- "sound_id": "1501314428688998182"-}-```-## Entrance sound scopes| Value | Description |@@ -120,239 +85,147 @@ A scope with no assigned sound has no selection object. Clearing a scope deletes| global | Applies wherever no narrower scope is selected || guilds | Applies in guild voice channels || dms | Applies in direct message and group calls |-| `guild:{guild_id}` | Applies in one named guild, where the ID is 1 through 20 digits |--`scope_id` must match one of these forms exactly. Any other value fails with the validation code `INVALID_FORMAT` at the `scope_id` path.+| `guild:{guild_id}` | Applies in one guild |-:::note[Clients select the sound to play]-Use the scope selections to choose a clip, then pass its ID to [Play entrance sound](#play-entrance-sound).-:::+Your client picks the selection that fits the channel and sends its `sound_id` to [Play entrance sound](#play-entrance-sound).## List entrance sounds<RouteHeader method="GET" path="/v1/users/@me/entrance-sounds" />-Returns the current account's complete entrance sound library together with its per-scope selections.+Returns your library and its selections.### Response body| Field | Type | Description || --- | --- | --- |-| sounds | array[[entrance sound](#entrance-sound-object) object] | Every clip the account owns, at most 8 |-| selections | array[[entrance sound selection](#entrance-sound-selection-object) object] | Every scope with a sound assigned |--Both members are always present and both arrays are empty for an account that has uploaded nothing. A selection always names a sound present in `sounds`.+| sounds | array[[entrance sound](#entrance-sound-object) object] | The clips the account owns |+| selections | array[[entrance sound selection](#entrance-sound-selection-object) object] | The scopes that have a clip assigned |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Library was returned |--### Rate limit+| 200 | response body | The library was returned |-30 requests per minute for each authenticated user, on the `user:entrance_sound:list` bucket.+The rate limit is 30 requests per minute, on the `user:entrance_sound:list` bucket.## Upload entrance sound<RouteHeader method="POST" path="/v1/users/@me/entrance-sounds" />-Decodes, validates, and stores one audio clip in the current account's library, and returns the created [entrance sound object](#entrance-sound-object).+Stores one clip in your library and returns the [entrance sound object](#entrance-sound-object). Assign it to a scope with [Set entrance sound selection](#set-entrance-sound-selection).### JSON body| Field | Type | Description || --- | --- | --- |-| name<sup>1</sup> | string | The display label shown for the clip (1-32 characters) |-| audio<sup>2</sup> | base64 string | The audio bytes of the clip, base64 encoded (1-1398134 characters) |--<sup>1</sup> Trimmed before its length is measured--<sup>2</sup> A `data:` URI prefix is accepted and discarded, and only the part after the first comma is measured and decoded+| name | string | The display name of the clip (1-32 characters) |+| audio | base64 string | The audio bytes, base64 encoded (1-1398134 characters) |-Invisible characters in `name` are not stripped and count towards the 32 character bound.+A `data:` URI prefix on `audio` is accepted and ignored.### Validation-Every failure below returns 400 `INVALID_FORM_BODY`. A response can contain more than one field error.+Every failure returns 400 `INVALID_FORM_BODY` with these codes.-| Failure | Validation code | Path |+| Failure | Code | Path || --- | --- | --- |-| The field is absent or is a literal empty string<sup>1</sup> | `INVALID_FORMAT` | name or audio |-| The normalised name is empty or longer than 32 characters | `STRING_LENGTH_INVALID` | name |-| The encoded payload is empty or longer than 1398134 characters<sup>2</sup> | `BASE64_LENGTH_INVALID` | audio |+| The field is missing or an empty string | `INVALID_FORMAT` | name or audio |+| The name is blank after trimming or over 32 characters | `STRING_LENGTH_INVALID` | name |+| The encoded payload is empty or over 1398134 characters | `BASE64_LENGTH_INVALID` | audio || The payload is not valid base64 | `INVALID_BASE64_FORMAT` | audio |-| The library already holds 8 clips | `ENTRANCE_SOUND_QUOTA_REACHED` | audio |-| The decoded bytes exceed 1048576 bytes | `ENTRANCE_SOUND_SIZE_EXCEEDS_LIMIT` | audio |-| The bytes resolve to no [supported container](#supported-containers), or their duration cannot be measured | `ENTRANCE_SOUND_INVALID_FORMAT` | audio |-| The measured duration is above 5200 ms or below 100 ms | `ENTRANCE_SOUND_DURATION_EXCEEDS_LIMIT` | audio |-| The validated clip could not be written to storage | `FAILED_TO_UPLOAD_IMAGE` | audio |--<sup>1</sup> An empty string is read as null under [input normalisation](/http-api/#input-normalisation), and neither field accepts null--<sup>2</sup> Measured after any `data:` prefix is discarded, so a value that is whitespace only, or that ends at its first comma, has zero payload characters and fails here--Fluxer checks the first four rows before the quota, so an account already holding 8 clips receives `BASE64_LENGTH_INVALID` or `INVALID_BASE64_FORMAT` for a malformed or too-long payload.--The validation entry has no member naming which duration bound the clip crossed.+| The library already has 8 clips | `ENTRANCE_SOUND_QUOTA_REACHED` | audio |+| The decoded bytes are over 1048576 bytes | `ENTRANCE_SOUND_SIZE_EXCEEDS_LIMIT` | audio |+| The container is not [supported](#supported-containers) or the duration can't be measured | `ENTRANCE_SOUND_INVALID_FORMAT` | audio |+| The duration is under 100 or over 5200 milliseconds | `ENTRANCE_SOUND_DURATION_EXCEEDS_LIMIT` | audio |+| The clip could not be stored | `FAILED_TO_UPLOAD_IMAGE` | audio |### Response| Status | Body | Condition || --- | --- | --- |-| 201 | [entrance sound](#entrance-sound-object) object | Clip was stored |-| 400 | [error response](/http-api/#error-response) | Name or audio fails [validation](#validation) |-| 403 | [error response](/http-api/#error-response) | The account is [limited](/http-api/users/#account-limitation) and the request returns `ACCOUNT_LIMITED` |--### Side effects--The operation assigns no scope and emits no Gateway Dispatch.--:::note[Duplicate audio can share a URL]-Uploading the same bytes twice creates distinct library entries with the same `hash` and `url`. Deleting one leaves the other usable.-:::--### Rate limit+| 201 | [entrance sound](#entrance-sound-object) object | The clip was stored |+| 400 | [error response](/http-api/#error-response) | The name or audio fails [validation](#validation) |+| 403 | [error response](/http-api/#error-response) | `ACCOUNT_LIMITED` when the account is [limited](/http-api/users/#account-limitation) |-5 requests per 5 minutes for each authenticated user, on the `user:entrance_sound:upload` bucket.+The rate limit is 5 requests per 5 minutes, on the `user:entrance_sound:upload` bucket.## Rename entrance sound<RouteHeader method="PATCH" path="/v1/users/@me/entrance-sounds/{sound_id}" />-Changes the display label of one clip and returns the updated [entrance sound object](#entrance-sound-object).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| sound_id | snowflake | The ID of the sound |+Changes the display name of a clip and returns the updated [entrance sound object](#entrance-sound-object).### JSON body| Field | Type | Description || --- | --- | --- |-| name<sup>1</sup> | string | Replacement display label (1-32 characters) |--<sup>1</sup> Required, and normalised and bounded exactly as the `name` of [Upload entrance sound](#upload-entrance-sound)+| name | string | The new display name (1-32 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [entrance sound](#entrance-sound-object) object | Clip was renamed |-| 400 | [error response](/http-api/#error-response) | Name normalises to the empty string or exceeds 32 characters and the request returns `STRING_LENGTH_INVALID` at the `name` path, or the account owns no such clip and the request returns `ENTRANCE_SOUND_NOT_FOUND` at the `sound_id` path |--:::note[An unknown clip returns 400, not 404]-Fluxer reports a clip owned by another account exactly like one that never existed, so a caller cannot tell ownership from existence. [Set entrance sound selection](#set-entrance-sound-selection) and [Play entrance sound](#play-entrance-sound) report an unknown clip the same way.-:::--### Side effects--Only the label changes. The stored audio is untouched, and every selection pointing at the clip keeps pointing at it. Fluxer emits no Gateway Dispatch.+| 200 | [entrance sound](#entrance-sound-object) object | The clip was renamed |+| 400 | [error response](/http-api/#error-response) | `STRING_LENGTH_INVALID` for a bad name, or `ENTRANCE_SOUND_NOT_FOUND` when you don't own the clip |-### Rate limit--20 requests per minute for each authenticated user, on the `user:entrance_sound:mutate` bucket, which is shared with [Delete entrance sound](#delete-entrance-sound) and [Set entrance sound selection](#set-entrance-sound-selection).+The rate limit is 20 requests per minute, on the `user:entrance_sound:mutate` bucket.## Delete entrance sound<RouteHeader method="DELETE" path="/v1/users/@me/entrance-sounds/{sound_id}" />-Deletes one clip from the current account's library, clears every scope selection that pointed at it, and returns 204 with an empty body. An unknown clip, or a clip owned by another account, is a successful no-op.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| sound_id | snowflake | The ID of the sound |+Deletes a clip and clears every selection that pointed at it.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Clip was deleted, or no owned clip existed |--### Side effects--The clip and every selection naming it are removed from the library. No Gateway Dispatch is emitted.--### Rate limit+| 204 | empty | The clip was deleted or didn't exist |-20 requests per minute for each authenticated user, on the shared `user:entrance_sound:mutate` bucket.+The rate limit is 20 requests per minute, on the `user:entrance_sound:mutate` bucket.## Set entrance sound selection<RouteHeader method="PUT" path="/v1/users/@me/entrance-sound-selections" />-Assigns one of the account's clips to one [scope](#entrance-sound-scopes), or clears that scope, and returns 204 with an empty body. Each call addresses exactly one scope, and a scope that already has a sound is overwritten.+Assigns one of your clips to a [scope](#entrance-sound-scopes) and replaces any earlier selection for that scope.### JSON body| Field | Type | Description || --- | --- | --- |-| scope_id | string | [Entrance sound scope](#entrance-sound-scopes) to write (1-32 characters) |-| sound_id<sup>1</sup> | ?snowflake | The clip to assign, or null to clear the scope |--<sup>1</sup> Required. An explicit null clears the scope, succeeds even when the scope had no selection, and looks up no clip--A `guild:{guild_id}` scope does not require current guild membership. A non-null `sound_id` must name a clip the account owns.+| scope_id | string | The [scope](#entrance-sound-scopes) to write (1-32 characters) |+| sound_id | ?snowflake | The clip to assign, or null to clear the scope |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Selection was written or cleared |-| 400 | [error response](/http-api/#error-response) | Scope is unrecognised and the request returns `INVALID_FORMAT` at the `scope_id` path, or the account owns no such clip and the request returns `ENTRANCE_SOUND_NOT_FOUND` at the `sound_id` path |-| 403 | [error response](/http-api/#error-response) | The account is [limited](/http-api/users/#account-limitation) and the request returns `ACCOUNT_LIMITED` |--### Side effects--Fluxer writes or removes the scope's selection. One clip can be selected in any number of scopes at once. The operation emits no Gateway Dispatch, so the caller's other sessions learn about the change only by listing the library again.+| 204 | empty | The selection was written or cleared |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORMAT` for an unknown scope, or `ENTRANCE_SOUND_NOT_FOUND` when you don't own the clip |+| 403 | [error response](/http-api/#error-response) | `ACCOUNT_LIMITED` when a [limited](/http-api/users/#account-limitation) account assigns a clip |-### Rate limit--20 requests per minute for each authenticated user, on the shared `user:entrance_sound:mutate` bucket.+The rate limit is 20 requests per minute, on the `user:entrance_sound:mutate` bucket.## Play entrance sound<RouteHeader method="POST" path="/v1/voice/channels/{channel_id}/entrance-sound" />-Tells every other account connected to a voice channel to play the caller's chosen clip and returns 204 with an empty body. The caller must already hold a voice state in that channel and must own the clip. Emits an [ENTRANCE_SOUND_PLAY](/gateway/events/#entrance-sound-play) Gateway event.--Recipients fetch and play the clip locally from the URL in the event.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the voice channel the clip is played in |+Sends an [ENTRANCE_SOUND_PLAY](/gateway/events/#entrance-sound-play) event to everyone else connected to the voice channel, and their apps play the clip from the URL in the event. You need to be connected to the channel.### JSON body| Field | Type | Description || --- | --- | --- |-| sound_id | snowflake | The clip to play, drawn from the caller's own library |+| sound_id | snowflake | The clip to play, from your own library |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Fluxer attempted a Dispatch to every other connected account |-| 400 | [error response](/http-api/#error-response) | Caller holds no voice state in the channel, including when the channel does not exist, and the request returns `ENTRANCE_SOUND_INVALID_SCOPE` at the `channel_id` path, or the account owns no such clip and the request returns `ENTRANCE_SOUND_NOT_FOUND` at the `sound_id` path |--:::caution[Connection is the only authorisation]-Fluxer evaluates no channel permission and checks no guild membership.-:::--An ID naming no channel is refused exactly like a channel the caller is not connected to. The connection check runs before the clip is looked up, so a caller who is not connected never learns whether the named clip exists.--### Side effects--Fluxer sends one [ENTRANCE_SOUND_PLAY](/gateway/events/#entrance-sound-play) Dispatch to every other account holding a voice state in the channel, at most once for each account, and never to the caller. A recipient whose Dispatch fails is skipped, and the request still returns 204.--Fluxer addresses the Dispatch to the account, so every session that account holds receives it, including sessions that are not in the channel. A client filters on `channel_id`.--### Rate limit+| 204 | empty | The event was sent |+| 400 | [error response](/http-api/#error-response) | `ENTRANCE_SOUND_INVALID_SCOPE` when you aren't connected to the channel, or `ENTRANCE_SOUND_NOT_FOUND` when you don't own the clip |-3 requests per 30 seconds for each authenticated user and channel ID, on the `voice:entrance_sound:play::user_id::channel_id` bucket.+The rate limit is 3 requests per 30 seconds, on the `voice:entrance_sound:play::user_id::channel_id` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/experiments.mdx b/fluxer_docs/src/content/docs/http-api/experiments.mdxindex c01f5b1f4..6b284450d 100644--- a/fluxer_docs/src/content/docs/http-api/experiments.mdx+++ b/fluxer_docs/src/content/docs/http-api/experiments.mdx@@ -1,14 +1,12 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Experiments-description: The experiment assignments envelope, the revalidation and polling contract, and the experiments this server defines.+description: The experiment assignments object, how to poll for it and the experiments an instance defines.---import RouteHeader from '@/components/RouteHeader.astro';-An experiment is an instance-wide rollout. For each account, Fluxer works out whether the account is in the rollout and which settings the account receives. The single route on this page resolves every experiment the server defines and returns them in one envelope, together with the polling cadence they share. This server defines `plutonium_page`, `channel_threads`, `voice_p2p`, and `guild_visits`. Only `voice_p2p` and `guild_visits` are configured by an operator. `plutonium_page` and `channel_threads` are on for every account.--Every assignment is advice. A client that ignores one behaves as it does with the rollout off, and no route and no Gateway event reports what a client actually ran.+An experiment is an instance-wide rollout that decides whether an account gets a feature. One request returns every experiment for the caller, along with how often to poll for changes. Ignore experiments you don't know and treat a missing one as off.## Experiment assignments object@@ -16,11 +14,9 @@ Every assignment is advice. A client that ignores one behaves as it does with th| Field | Type | Description || --- | --- | --- |-| poll_interval_seconds | integer | Seconds to wait before revalidating, from 60 through 86400 |-| poll_jitter_percent | integer | The largest random offset added to or subtracted from the wait, as a percentage of the wait, from 0 through 50 |-| assignments | [assignment map](#assignment-map-object) object | One entry for each experiment the server defines |--Every account on the instance receives the same `poll_interval_seconds` and `poll_jitter_percent`. One request refreshes every experiment.+| poll_interval_seconds | integer | Seconds to wait before the next poll (60-86400) |+| poll_jitter_percent | integer | The largest random offset to the wait, as a percentage of it (0-50) |+| assignments | [assignment map](#assignment-map-object) object | One entry per experiment |## Assignment map object@@ -39,57 +35,51 @@ Every account on the instance receives the same `poll_interval_seconds` and `pol| Field | Type | Description || --- | --- | --- |-| enabled | boolean | Whether the caller's client shows the full Plutonium page in place of the Plutonium settings tab, always true |--The rollout is complete and has no operator setting. The key stays for clients that still read it.--The assignment only changes what the client shows. An enabled client replaces the Plutonium settings tab with a full Plutonium page, makes app pages linkable in chat, and uses a minimal gift purchase modal. The server applies no part of it on its own.+| enabled | boolean | Always true |## Channel threads assignment object-The channel threads state for one account. This server version writes the key on every response.+Threads, forum channels and media channels also need the [`channel_threads` client capability](/http-api/threads/#client-capability).### Structure| Field | Type | Description || --- | --- | --- |-| active | boolean | Always true, whatever client capability the caller declares |-| config_version | integer | A non-negative version number, the same for every account |+| active | boolean | Always true |+| config_version | integer | The instance's threads configuration version, the same for every account |-The key stays for clients that still read it. Threads, forum channels, and media channels need the [`channel_threads` client capability](/http-api/threads/#client-capability).--## Guild visits assignment object--Whether the caller may look around a community before joining it. This server version writes the key on every response.+## Peer-to-peer voice assignment object### Structure| Field | Type | Description || --- | --- | --- |-| enabled | boolean | Whether the caller is in the [guild visits rollout](/admin-api/instance/#guild-visits-configuration-object) |+| enabled | boolean | Whether the caller can start a peer-to-peer voice call |+| max_participants | integer | The most participants a peer-to-peer call allows (2-4) |-## Peer-to-peer voice assignment object+The instance admin sets the rollout in the [peer-to-peer voice configuration](/admin-api/instance/#peer-to-peer-voice-configuration-object). If it lists rollout countries, the sampled share of accounts only includes requests from those countries, based on the request's IP address, so the same account can get a different answer on another network. A join to a peer-to-peer call that already has `max_participants` people is [refused as full](/gateway/events/#peer-to-peer-voice).++## Guild visits assignment object### Structure| Field | Type | Description || --- | --- | --- |-| enabled | boolean | Whether the caller may start a peer-to-peer voice call |-| max_participants | integer | Most participants a peer-to-peer call holds (2-4) |--A caller is drawn by the operator's account or guild allowlist, by having premium when the operator includes premium users, or by the sampled share of the account population. When the operator lists rollout countries, the sampled share only draws a caller whose request comes from a listed country. `enabled` is false in every other case, the rollout being off included.+| enabled | boolean | Whether the caller can [visit](/http-api/guilds/#visiting-guilds) a guild before joining it |-A selected client may ask for a peer-to-peer connection when it starts a voice call, and shows the peer-to-peer setting of a guild voice channel. It offers a peer-to-peer call in a direct message or group direct message only when the channel has at most `max_participants` members, the caller included. `max_participants` is the same for every account, selected or not, and a join past it is [refused as full](/gateway/events/#peer-to-peer-voice). The assignment does not decide who joins. While the rollout is on, any account that agrees to a direct connection may join a peer-to-peer call that is already running. The server checks the rollout again when a call starts, so a client that ignores this assignment gains nothing.--## Request country--Fluxer resolves the country of each request to this route from the client address. An account can receive a different assignment from another network when an operator lists rollout countries. A request whose country is unknown matches no listed country.+The instance admin sets the rollout in the [guild visits configuration](/admin-api/instance/#guild-visits-configuration-object).## Get experiment assignments<RouteHeader method="GET" path="/v1/experiments" bot />-Resolves every defined experiment for the caller and returns an [experiment assignments](#experiment-assignments-object) object. The response is derived per account, so it is never shared between accounts.+Returns an [experiment assignments](#experiment-assignments-object) object for the caller.++### Request headers++| Field | Type | Description |+| --- | --- | --- |+| If-None-Match? | string | The `ETag` from your last response |### Response body@@ -99,35 +89,17 @@ Resolves every defined experiment for the caller and returns an [experiment assi| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The envelope was resolved |-| 304 | empty | The request sent a matching `If-None-Match` |--### Request headers--| Field | Type | Description |-| --- | --- | --- |-| If-None-Match? | string | An `ETag` from an earlier response to this route |+| 200 | response body | The assignments were returned |+| 304 | empty | `If-None-Match` matched the current `ETag` |-A client sends the `ETag` it last received. Fluxer compares it against the tag of the envelope it just resolved and answers 304 with no body on a match. `*` matches any current tag. A weak comparison is used, so a `W/` prefix on either side does not defeat the match.+The rate limit is 60 requests per 10 seconds, on the `default` bucket.### Response headers| Field | Type | Description || --- | --- | --- |-| ETag | string | A strong tag over the envelope body, sent on 200 and on 304 |-| Cache-Control | string | The literal value `private, no-cache` |-| Vary | string | The literal value `Authorization`, replaced by `Origin` where the [cross-origin policy](/http-api/#cross-origin-requests) echoed an allowed origin |--The `ETag` changes when the response changes, which includes a change of [request country](#request-country). Treat it as an opaque value.--`ETag` is listed in `Access-Control-Expose-Headers` and `If-None-Match` in `Access-Control-Allow-Headers`, so a cross-origin client reads the tag and revalidates with it.+| ETag | string | A tag for the response body, sent on 200 and 304 |### Polling-A client reads this route once per session and then again every `poll_interval_seconds`, offset by a random amount up to `poll_jitter_percent` of that interval in either direction. It sends the last `ETag` on every request after the first. A client MUST NOT poll faster than the lower end of that jitter range.--Until the first successful response, use 300 seconds with 15 per cent jitter.--### Rate limit--60 requests per 10 seconds for each authenticated user, on the `default` bucket.+Call this route when a session starts and again every `poll_interval_seconds`, with a random offset of up to `poll_jitter_percent` either way. Send the last `ETag` in `If-None-Match`, and keep your current assignments when you get a 304. Until you get a 200, use 300 seconds with 15 percent jitter.diff --git a/fluxer_docs/src/content/docs/http-api/expressions.mdx b/fluxer_docs/src/content/docs/http-api/expressions.mdxindex b8bbcbd1c..3a86d341e 100644--- a/fluxer_docs/src/content/docs/http-api/expressions.mdx+++ b/fluxer_docs/src/content/docs/http-api/expressions.mdx@@ -1,52 +1,26 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Expressions-description: Cross-guild lookup of a custom emoji or sticker by its own ID.+description: Look up a custom emoji or sticker, and the guild that owns it, by the emoji or sticker ID.---import RouteHeader from '@/components/RouteHeader.astro';-An expression is a custom emoji or a sticker that one guild owns. The metadata routes resolve an expression from its own identifier, without membership of the owning guild. The source routes name the owning guild only to a caller who may see it.--| Object | Route | Owning resource |-| --- | --- | --- |-| [Emoji metadata](#emoji-metadata-object) | [Get emoji metadata](#get-emoji-metadata) | [Guild emojis](/http-api/guild-emojis/) |-| [Sticker metadata](#sticker-metadata-object) | [Get sticker metadata](#get-sticker-metadata) | [Guild stickers](/http-api/guild-stickers/) |-| [Expression source guild](#expression-source-guild-object) | [Get emoji source guild](#get-emoji-source-guild), [Get sticker source guild](#get-sticker-source-guild) | [Guilds](/http-api/guilds/) |--Every route here is read-only, and none writes an audit entry or emits a [Gateway Dispatch](/gateway/events/). The metadata routes return the metadata even when the owning guild has [UNAVAILABLE_FOR_EVERYONE](/http-api/guilds/#guild-features).--When an identifier names no stored expression, Fluxer returns 404 `UNKNOWN_EMOJI` or 404 `UNKNOWN_STICKER`. A stored expression whose guild no longer exists returns 404 `UNKNOWN_GUILD`.--:::note[Tags and the uploader need a guild-scoped operation]-Tags, the uploader, and the adult content classification come from the guild-scoped operations, which require membership of the owning guild.-:::+An expression is a custom emoji or sticker that one guild owns. The metadata routes find one by its ID, even when you aren't in the guild that owns it. The source routes return that guild only when it is discoverable or you are a member. For the uploader, and for a sticker's description and tags, use the routes in [Guild emojis](/http-api/guild-emojis/) and [Guild stickers](/http-api/guild-stickers/).## Emoji metadata object-One custom emoji, readable from outside its guild. It adds the owning guild to the [guild emoji object](/http-api/guild-emojis/#guild-emoji-object) and drops the adult content classification and the uploader.+The basic fields of a custom emoji and the ID of the guild that owns it.### Structure| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | snowflake | The ID of the emoji |-| guild_id<sup>2</sup> | snowflake | The ID of the guild that owns the emoji |-| name<sup>3</sup> | string | The name of the emoji (2-32 characters) |-| animated<sup>4</sup> | boolean | Whether the stored image is animated |-| allow_cloning<sup>5</sup> | boolean | Whether the owning guild permits the emoji to be copied |--<sup>1</sup> Unique across every guild, so the emoji is addressable without its guild--<sup>2</sup> This resource has no guild name and no guild icon--<sup>3</sup> [Create guild emoji](/http-api/guild-emojis/#create-guild-emoji) restricts the value to ASCII letters, digits, and underscore, and cloning copies it unchanged--<sup>4</sup> Fluxer detects this from the submitted image at creation, and the value never changes--<sup>5</sup> True exactly when the owning guild has [CLONE_EMOJI_ENABLED](/http-api/guilds/#guild-features), and false for every other guild--Every member is always present, and no member is nullable.+| id | snowflake | The ID of the emoji |+| guild_id | snowflake | The ID of the guild that owns the emoji |+| name | string | The name of the emoji (2-32 characters) |+| animated | boolean | Whether the image is animated |+| allow_cloning | boolean | Whether the guild lets people copy the emoji to their own guild ([CLONE_EMOJI_ENABLED](/http-api/guilds/#guild-features)) |### Example@@ -62,45 +36,21 @@ Every member is always present, and no member is nullable.## Sticker metadata object-One sticker, readable from outside its guild. It adds the owning guild to the [guild sticker object](/http-api/guild-stickers/#guild-sticker-object) and drops the description, the tags, the adult content classification, and the uploader.+The basic fields of a sticker and the ID of the guild that owns it.### Structure| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | snowflake | The ID of the sticker |-| guild_id<sup>2</sup> | snowflake | The ID of the guild that owns the sticker |-| name<sup>3</sup> | string | The name of the sticker (2-30 characters) |-| animated<sup>4</sup> | boolean | Whether the stored image is animated |-| allow_cloning<sup>5</sup> | boolean | Whether the owning guild permits the sticker to be copied |--<sup>1</sup> Unique across every guild, so the sticker is addressable without its guild--<sup>2</sup> This resource has no guild name and no guild icon--<sup>3</sup> The value accepts any character--<sup>4</sup> Fluxer detects this from the submitted image at creation, and the value never changes--<sup>5</sup> True exactly when the owning guild has [CLONE_STICKER_ENABLED](/http-api/guilds/#guild-features), and false for every other guild--Every member is always present, and no member is nullable.--### Example--```json-{- "id": "1501314428688998183",- "guild_id": "1489002177550843904",- "name": "shipit",- "animated": false,- "allow_cloning": false-}-```+| id | snowflake | The ID of the sticker |+| guild_id | snowflake | The ID of the guild that owns the sticker |+| name | string | The name of the sticker (2-30 characters) |+| animated | boolean | Whether the image is animated |+| allow_cloning | boolean | Whether the guild lets people copy the sticker to their own guild ([CLONE_STICKER_ENABLED](/http-api/guilds/#guild-features)) |## Expression source guild object-The guild that owns an expression, reduced to what is needed to name it and show its badge. It is smaller than the [partial guild object](/http-api/guilds/#partial-guild-object) and has no banner, splash, or embedded splash fields.+A short view of the guild that owns an emoji or sticker, with its name, icon and badge features.### Structure@@ -108,130 +58,63 @@ The guild that owns an expression, reduced to what is needed to name it and show| --- | --- | --- || id | snowflake | The ID of the guild || name | string | The name of the guild |-| icon<sup>1</sup> | ?string | Guild icon hash, or null when the guild stores none |-| features<sup>2</sup> | array[string] | The badge [guild features](/http-api/guilds/#guild-features) the guild has |--<sup>1</sup> An animated icon hash has the `a_` prefix, and that prefix is removed from the returned value while the guild lacks `ANIMATED_ICON`--<sup>2</sup> Only `VERIFIED`, `PARTNERED`, and `DISCOVERABLE` can appear, each at most once and in that order, and every other feature the guild has is left out--Every member is always present, and only `icon` is nullable.--### Example--```json-{- "id": "1489002177550843904",- "name": "Ada's Workshop",- "icon": "a_9f2c1d4e",- "features": ["VERIFIED", "DISCOVERABLE"]-}-```+| icon | ?string | The guild icon hash |+| features | array[string] | Which of `VERIFIED`, `PARTNERED` and `DISCOVERABLE` the guild has, from its [guild features](/http-api/guilds/#guild-features) |## Get emoji metadata<RouteHeader method="GET" path="/v1/emojis/{emoji_id}/metadata" bot />-Returns the [emoji metadata object](#emoji-metadata-object) of any guild emoji. The route requires no membership of the owning guild and evaluates no permission.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| emoji_id | snowflake | The ID of the emoji |+Returns the [emoji metadata object](#emoji-metadata-object) of any guild emoji. You don't need to be in the guild that owns it.### Response| Status | Body | Condition || --- | --- | --- || 200 | [emoji metadata](#emoji-metadata-object) object | Metadata was returned |-| 404<sup>1</sup> | [error response](/http-api/#error-response) | Emoji does not exist, or its owning guild no longer exists |-<sup>1</sup> The [error code](/http-api/errors/) is `UNKNOWN_EMOJI` for a missing emoji and `UNKNOWN_GUILD` when the emoji record survives but its guild does not--:::caution[Cloning permission can change]-[Clone guild emoji](/http-api/guild-emojis/#clone-guild-emoji) returns 403 `MISSING_ACCESS` if the source guild no longer allows cloning.-:::--### Rate limit--60 requests per 10 seconds for each authenticated user, on the `guild:emoji:metadata::user_id` bucket, and every emoji the account looks up draws on that one budget.+The rate limit is 60 requests per 10 seconds, on the `guild:emoji:metadata::user_id` bucket.## Get sticker metadata<RouteHeader method="GET" path="/v1/stickers/{sticker_id}/metadata" bot />-Returns the [sticker metadata object](#sticker-metadata-object) of any guild sticker. The route requires no membership of the owning guild and evaluates no permission.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| sticker_id | snowflake | The ID of the sticker |+Returns the [sticker metadata object](#sticker-metadata-object) of any guild sticker. You don't need to be in the guild that owns it.### Response| Status | Body | Condition || --- | --- | --- || 200 | [sticker metadata](#sticker-metadata-object) object | Metadata was returned |-| 404<sup>1</sup> | [error response](/http-api/#error-response) | Sticker does not exist, or its owning guild no longer exists |-<sup>1</sup> The [error code](/http-api/errors/) is `UNKNOWN_STICKER` for a missing sticker and `UNKNOWN_GUILD` when the sticker record survives but its guild does not--:::caution[Cloning permission can change]-[Clone guild sticker](/http-api/guild-stickers/#clone-guild-sticker) returns 403 `MISSING_ACCESS` if the source guild no longer allows cloning.-:::--### Rate limit--60 requests per 10 seconds for each authenticated user, on the `guild:sticker:metadata::user_id` bucket, and every sticker the account looks up draws on that one budget.+The rate limit is 60 requests per 10 seconds, on the `guild:sticker:metadata::user_id` bucket.## Get emoji source guild<RouteHeader method="GET" path="/v1/emojis/{emoji_id}/source" bot />-Returns the [expression source guild object](#expression-source-guild-object) of the guild that owns a emoji. Fluxer reads the guild from the gateway, not from storage. The guild is returned when it is discoverable, or when the caller is a member of it.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| emoji_id | snowflake | The ID of the emoji |+Returns the [guild that owns the emoji](#expression-source-guild-object) when the guild is discoverable or you are a member of it.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [expression source guild](#expression-source-guild-object) object | The caller may see the owning guild |-| 404<sup>1</sup> | [error response](/http-api/#error-response) | Emoji does not exist, or the owning guild is private to the caller or unavailable |--<sup>1</sup> The [error code](/http-api/errors/) is `UNKNOWN_EMOJI` for a missing emoji, and `UNKNOWN_GUILD` when the owning guild is not discoverable and the caller is not a member of it, or when the gateway cannot reach it.+| 200 | [expression source guild](#expression-source-guild-object) object | You can see the owning guild |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_GUILD` when the guild isn't discoverable and you aren't a member |-### Rate limit--60 requests per 10 seconds for each authenticated user, on the `guild:emoji:source::user_id` bucket, and every emoji the account looks up draws on that one budget.+The rate limit is 60 requests per 10 seconds, on the `guild:emoji:source::user_id` bucket.## Get sticker source guild<RouteHeader method="GET" path="/v1/stickers/{sticker_id}/source" bot />-Returns the [expression source guild object](#expression-source-guild-object) of the guild that owns a sticker. Fluxer reads the guild from the gateway, not from storage. The guild is returned when it is discoverable, or when the caller is a member of it.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| sticker_id | snowflake | The ID of the sticker |+Returns the [guild that owns the sticker](#expression-source-guild-object) when the guild is discoverable or you are a member of it.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [expression source guild](#expression-source-guild-object) object | The caller may see the owning guild |-| 404<sup>1</sup> | [error response](/http-api/#error-response) | Sticker does not exist, or the owning guild is private to the caller or unavailable |--<sup>1</sup> The [error code](/http-api/errors/) is `UNKNOWN_STICKER` for a missing sticker, and `UNKNOWN_GUILD` when the owning guild is not discoverable and the caller is not a member of it, or when the gateway cannot reach it.--### Rate limit+| 200 | [expression source guild](#expression-source-guild-object) object | You can see the owning guild |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_GUILD` when the guild isn't discoverable and you aren't a member |-60 requests per 10 seconds for each authenticated user, on the `guild:sticker:source::user_id` bucket, and every sticker the account looks up draws on that one budget.+The rate limit is 60 requests per 10 seconds, on the `guild:sticker:source::user_id` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/forums.mdx b/fluxer_docs/src/content/docs/http-api/forums.mdxindex 2ff055b7b..5c48f6762 100644--- a/fluxer_docs/src/content/docs/http-api/forums.mdx+++ b/fluxer_docs/src/content/docs/http-api/forums.mdx@@ -6,44 +6,42 @@ description: Forum and media channels, forum tags, post data, and webhooks thatimport RouteHeader from '@/components/RouteHeader.astro';-A forum channel holds posts, and every post is a public [thread](/http-api/threads/) with its own first message. A media channel is a forum channel that can hide media download options. Neither accepts a message of its own.+A forum channel has posts, and every post is a public [thread](/http-api/threads/) with its own first message. A media channel is a forum channel that can hide media download options.-:::note[User requests need the `channel_threads` client capability]-A route with a route header on this page returns 404 `NOT_FOUND` to a user request without the [`channel_threads` client capability](/http-api/threads/#client-capability). A `channel_id` that does not exist or names a channel outside a guild returns the same 404.-:::+Neither channel type has messages of its own. Creating a message, adding a reaction or pinning a message in the channel itself returns 400 `CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL`. Listing messages or pins and the typing indicator return 400 `INVALID_CHANNEL_TYPE`.++A user request to a route below without the [`channel_threads` client capability](/http-api/threads/#client-capability) gets 404 `NOT_FOUND`. A `channel_id` that does not exist or is outside a guild gets the same 404.## Forum channel fields-A forum or media channel is a [channel object](/http-api/channels/#channel-object) of type `15` or `16` with the fields below.+A forum or media channel is a [channel object](/http-api/channels/#channel-object) of type `15` or `16` with these fields.### Structure| Field | Type | Description || --- | --- | --- |-| topic | ?string | The guidelines of the channel (1-4,096 characters), or null when none are set |-| last_message_id<sup>1</sup> | ?snowflake | The ID of the newest post, or null when the channel has never had one |+| topic | ?string | The guidelines of the channel (1-4,096 characters) |+| last_message_id<sup>1</sup> | ?snowflake | The ID of the newest post || flags | integer | The [channel flags](#channel-flags) of the channel || available_tags | array[[forum tag](#forum-tag-object) object] | The tags a post can apply (max 20) |-| default_reaction_emoji | ?[default reaction](#default-reaction-object) object | The reaction clients show on each post, or null when none is set |-| default_sort_order | ?integer | The default [sort order](#forum-sort-orders) of posts, or null when none is set |+| default_reaction_emoji | ?[default reaction](#default-reaction-object) object | The reaction clients show on each post |+| default_sort_order | ?integer | The default [sort order](#forum-sort-orders) of posts || default_forum_layout?<sup>2</sup> | integer | The default [layout](#forum-layouts) of posts || default_tag_setting<sup>3</sup> | string | The default [tag matching](#forum-tag-settings) of a post search |-| default_auto_archive_duration<sup>4</sup> | ?integer | The stored default [auto archive duration](/http-api/threads/#auto-archive-durations), or null when none is set |+| default_auto_archive_duration<sup>4</sup> | ?integer | The default [auto archive duration](/http-api/threads/#auto-archive-durations), which new posts don't use || default_thread_rate_limit_per_user<sup>5</sup> | integer | The slowmode interval in seconds new threads inherit |-<sup>1</sup> A new post sets it to the post ID and emits no [Channel Update](/gateway/events/#channel-update)--<sup>2</sup> Present only on a forum channel. A forum channel that stores no layout reports `0`+<sup>1</sup> Creating a post updates it without sending a [Channel Update](/gateway/events/#channel-update) event-<sup>3</sup> A channel that stores no value reports `match_some`+<sup>2</sup> Only on a forum channel, and `0` when none is stored-<sup>4</sup> Fluxer does not apply it to a new post. A create request that omits `auto_archive_duration` gets 4320, as [Auto archive durations](/http-api/threads/#auto-archive-durations) states+<sup>3</sup> `match_some` when none is stored-<sup>5</sup> Applies when the request sets no `rate_limit_per_user`. A channel that stores no value reports `0`+<sup>4</sup> A post created with no `auto_archive_duration` archives after 4320 minutes-`rate_limit_per_user` on the channel limits how often one member creates a post. A bot and a member with `BYPASS_SLOWMODE` are exempt, and a denied post returns 400 `SLOWMODE_RATE_LIMITED`.+<sup>5</sup> A new post gets it when [Start thread](/http-api/threads/#start-thread) sets no `rate_limit_per_user`, and it is `0` when none is set-[Create message](/http-api/messages/#create-message) to the channel itself returns 400 `CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL`. Adding a reaction and pinning a message return the same code. [List channel messages](/http-api/messages/#list-channel-messages), listing pins, and the typing indicator return 400 `INVALID_CHANNEL_TYPE`.+In a forum, `rate_limit_per_user` limits how often one member creates a post. Bots and members with `BYPASS_SLOWMODE` are exempt.### Example@@ -85,13 +83,13 @@ A forum or media channel is a [channel object](/http-api/channels/#channel-objec| Field | Type | Description || --- | --- | --- |-| message | [message](/http-api/messages/#message-object) object | The first message of the post, which has the ID of the post |+| message | [message](/http-api/messages/#message-object) object | The first message of the post, with the same ID as the post |## Channel types| Value | Name | Description || --- | --- | --- |-| 15 | GUILD_FORUM | Guild channel that holds posts and no messages of its own |+| 15 | GUILD_FORUM | Guild channel that has posts || 16 | GUILD_MEDIA | Forum channel that can [hide media download options](#channel-flags) |## Channel flags@@ -102,14 +100,12 @@ A forum or media channel is a [channel object](/http-api/channels/#channel-objec| 1 << 4 | REQUIRE_TAG | A new post, or a change to the tags of a post, needs at least one tag || 1 << 15 | HIDE_MEDIA_DOWNLOAD_OPTIONS | Clients hide the media download options of the channel |-`PINNED` is set on a post. A channel holds at most one pinned post, and pinning a second returns 400 `MAX_PINNED_THREADS_IN_FORUM`. Archiving a post clears `PINNED`.--`REQUIRE_TAG` is set on a forum or media channel. A new post with no tag returns 400 `FORUM_TAG_REQUIRED`. [Modify thread](/http-api/threads/#modify-thread) with an empty `applied_tags` on a post returns the same code.--`HIDE_MEDIA_DOWNLOAD_OPTIONS` is set on a media channel. On a forum channel it returns 400 `HIDE_MEDIA_DOWNLOAD_OPTION_MEDIA_ONLY`. Any other bit on a forum or media channel returns 400 `INVALID_FORM_BODY`.+Pinning a second post in a channel returns 400 `MAX_PINNED_THREADS_IN_FORUM`, and archiving a post unpins it. A post with no tag in a `REQUIRE_TAG` channel returns 400 `FORUM_TAG_REQUIRED`. Setting `HIDE_MEDIA_DOWNLOAD_OPTIONS` on a forum channel returns 400 `HIDE_MEDIA_DOWNLOAD_OPTION_MEDIA_ONLY`, and setting any other bit outside this table on a channel or post returns 400 `INVALID_FORM_BODY`.## Forum tag object+A post lists the IDs of its tags in `applied_tags`.+### Structure| Field | Type | Description |@@ -117,15 +113,15 @@ A forum or media channel is a [channel object](/http-api/channels/#channel-objec| id | snowflake | The ID of the tag || name | string | The name of the tag (1-50 characters) || moderated | boolean | Whether only thread moderators can apply or remove the tag |-| emoji_id | ?snowflake | The ID of a custom emoji of this guild, or null when the tag has none |-| emoji_name | ?string | A single Unicode emoji, or null when the tag has none |+| emoji_id | ?snowflake | The ID of a custom emoji of this guild |+| emoji_name | ?string | A single Unicode emoji |-At most one of `emoji_id` and `emoji_name` is set. A tag name is unique within its channel, and the comparison is case-sensitive.--A member who is not a thread moderator and adds or removes a moderated tag on a post gets 403 `MISSING_PERMISSIONS`.+At most one of `emoji_id` and `emoji_name` is set. Tag names are unique within a channel, and the check is case-sensitive. Only a [thread moderator](/http-api/threads/#thread-moderators) can apply or remove a moderated tag.## Default reaction object+The reaction clients show on each post.+### Structure| Field | Type | Description |@@ -157,45 +153,41 @@ A member who is not a thread moderator and adds or removes a moderated tag on a## Creating and modifying a forum-[Create guild channel](/http-api/guild-channels/#create-guild-channel) with `type` `15` or `16`, and [Modify channel](/http-api/channels/#modify-channel) on a forum or media channel, accept these fields beside the common guild channel fields.+[Create guild channel](/http-api/guild-channels/#create-guild-channel) with `type` `15` or `16` and [Modify channel](/http-api/channels/#modify-channel) on a forum or media channel accept these fields in addition to the common guild channel fields.| Field | Type | Description || --- | --- | --- |-| topic? | ?string | The guidelines of the channel (1-4,096 characters), or null to clear them |+| topic? | ?string | The guidelines of the channel (1-4,096 characters) || available_tags?<sup>1</sup> | array[[forum tag](#forum-tag-object) object] | The complete tag set (max 20) |-| default_reaction_emoji? | ?[default reaction](#default-reaction-object) object | The default reaction, or null to clear it |-| default_sort_order? | ?integer | The [sort order](#forum-sort-orders), or null to clear it |-| default_forum_layout?<sup>2</sup> | ?integer | The [layout](#forum-layouts), or null to reset it to `0` |-| default_tag_setting? | ?string | The [tag matching](#forum-tag-settings) default, or null to reset it to `match_some` |-| default_auto_archive_duration? | ?integer | The stored default [auto archive duration](/http-api/threads/#auto-archive-durations), which Fluxer does not apply to a new thread, or null to clear it |-| default_thread_rate_limit_per_user? | ?integer | The slowmode interval in seconds new threads inherit (0-21,600), or null to clear it |+| default_reaction_emoji? | ?[default reaction](#default-reaction-object) object | The default reaction |+| default_sort_order? | ?integer | The [sort order](#forum-sort-orders) |+| default_forum_layout?<sup>2</sup> | ?integer | The [layout](#forum-layouts), where null resets it to `0` |+| default_tag_setting? | ?string | The [tag matching](#forum-tag-settings) default, where null resets it to `match_some` |+| default_auto_archive_duration? | ?integer | The default [auto archive duration](/http-api/threads/#auto-archive-durations), which new posts don't use |+| default_thread_rate_limit_per_user? | ?integer | The slowmode interval in seconds new threads inherit (0-21,600) || flags? | integer | The [channel flags](#channel-flags) of the channel |-<sup>1</sup> An entry with `id` keeps that tag, and an entry without one creates a tag. A stored tag missing from the array is deleted--<sup>2</sup> Accepted only on a forum channel. A media channel ignores it--A guild text or announcement channel accepts `default_auto_archive_duration` and `default_thread_rate_limit_per_user` as well.--`available_tags` with more than 20 entries returns 400 `MAX_FORUM_TAGS`, and a repeated name returns 400 `FORUM_TAG_NAMES_MUST_BE_UNIQUE`. An `id` the channel does not hold returns 404 `UNKNOWN_FORUM_TAG`. An `emoji_id` that is not an emoji of this guild returns 404 `UNKNOWN_EMOJI`, except on a kept tag whose `emoji_id` is unchanged. A tag or default reaction with both `emoji_id` and `emoji_name`, or with an `emoji_name` that is not a single Unicode emoji, returns 400 `INVALID_FORM_BODY`. While another tag change holds the channel, a request with `available_tags` returns 429 `RESOURCE_LOCKED`.+<sup>1</sup> An entry with `id` keeps that tag, an entry without one creates a tag, and a stored tag missing from the array is deleted-Fluxer rejects a change that leaves `REQUIRE_TAG` set with no unmoderated tag with 400 `NO_TAGS_AVAILABLE_TO_NON_MODERATORS`. Two concurrent [Modify channel](/http-api/channels/#modify-channel) requests, one setting `REQUIRE_TAG` and one replacing `available_tags`, can each pass that check and together store that state. A post that names no tag then returns the same code to a caller who is not a thread moderator.+<sup>2</sup> A media channel ignores it-For a user request without the [`channel_threads` client capability](/http-api/threads/#client-capability), [Modify channel](/http-api/channels/#modify-channel) on a forum or media channel returns 404 `UNKNOWN_CHANNEL`. [Create guild channel](/http-api/guild-channels/#create-guild-channel) with `type` `15` or `16` returns 400 `INVALID_FORM_BODY`.+Null clears a field unless its description says otherwise. A request that sets these fields can fail with these errors.-[Create channel invite](/http-api/invites/#create-channel-invite) on a thread, a forum channel, or a media channel the caller can view returns 400 `INVALID_CHANNEL_TYPE`.+| Status | Code | Condition |+| --- | --- | --- |+| 400 | `MAX_FORUM_TAGS` | `available_tags` has more than 20 tags |+| 400 | `FORUM_TAG_NAMES_MUST_BE_UNIQUE` | Two tags have the same name |+| 400 | `INVALID_FORM_BODY` | A tag or the default reaction sets both emoji fields, or an `emoji_name` that isn't one Unicode emoji |+| 400 | `NO_TAGS_AVAILABLE_TO_NON_MODERATORS` | `REQUIRE_TAG` is set and no unmoderated tag is left |+| 404 | `UNKNOWN_FORUM_TAG` | A tag has an `id` the channel doesn't have |+| 404 | `UNKNOWN_EMOJI` | An `emoji_id` is not an emoji of this guild |+| 429 | `RESOURCE_LOCKED` | Another tag change is running |## Create forum tag<RouteHeader method="POST" path="/v1/channels/{channel_id}/tags" bot auditReason />-Adds a tag to a forum or media channel. Requires `MANAGE_CHANNELS`. Returns the updated [channel object](/http-api/channels/#channel-object) on success. Emits a [Channel Update](/gateway/events/#channel-update) Gateway event.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the forum or media channel |+Adds a tag to a forum or media channel and sends a [Channel Update](/gateway/events/#channel-update) event. You need `MANAGE_CHANNELS`.### JSON body@@ -210,38 +202,20 @@ Adds a tag to a forum or media channel. Requires `MANAGE_CHANNELS`. Returns the| Status | Body | Condition || --- | --- | --- |-| 200 | [channel](/http-api/channels/#channel-object) object | Tag was added |-| 400 | [error response](/http-api/#error-response) | Channel is a guild channel other than a forum or media channel and the request returns `INVALID_CHANNEL_TYPE` |-| 400 | [error response](/http-api/#error-response) | Channel has 20 tags and the request returns `MAX_FORUM_TAGS` |-| 400 | [error response](/http-api/#error-response) | Channel has a tag with the name and the request returns `FORUM_TAG_NAMES_MUST_BE_UNIQUE` |-| 400 | [error response](/http-api/#error-response) | The new tag leaves `REQUIRE_TAG` with no unmoderated tag, returning `NO_TAGS_AVAILABLE_TO_NON_MODERATORS` |-| 400 | [error response](/http-api/#error-response) | Body sets both emoji fields or an invalid emoji, returning `INVALID_FORM_BODY` |-| 400 | [error response](/http-api/#error-response) | Caller needs an authenticator and the request returns `TWO_FACTOR_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` or `MANAGE_CHANNELS` and the request returns `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or is outside a guild, and the request returns `NOT_FOUND` |-| 404 | [error response](/http-api/#error-response) | Emoji is not an emoji of this guild and the request returns `UNKNOWN_EMOJI` |-| 429 | [error response](/http-api/#error-response) | Another tag change holds the channel, returning `RESOURCE_LOCKED` |+| 200 | [channel](/http-api/channels/#channel-object) object | The tag was added |+| 400 | [error response](/http-api/#error-response) | The channel has 20 tags, with `MAX_FORUM_TAGS` |+| 400 | [error response](/http-api/#error-response) | The name is taken, with `FORUM_TAG_NAMES_MUST_BE_UNIQUE` |+| 400 | [error response](/http-api/#error-response) | No unmoderated tag would be left, with `NO_TAGS_AVAILABLE_TO_NON_MODERATORS` |+| 404 | [error response](/http-api/#error-response) | The emoji is not an emoji of this guild, with `UNKNOWN_EMOJI` |+| 429 | [error response](/http-api/#error-response) | Another tag change is running, with `RESOURCE_LOCKED` |-The body is the forum or media channel with its [forum channel fields](#forum-channel-fields). It has no `thread_metadata`, `message_count`, `total_message_sent`, `member_count`, `applied_tags`, `member_ids_preview`, or `member`.--### Rate limit--10 requests per 10 seconds for each authenticated user and channel ID, on the `channel:forum_tags::channel_id` bucket.+The rate limit is 10 requests per 10 seconds, on the `channel:forum_tags::channel_id` bucket.## Modify forum tag<RouteHeader method="PUT" path="/v1/channels/{channel_id}/tags/{tag_id}" bot auditReason />-Replaces a tag of a forum or media channel. Requires `MANAGE_CHANNELS`. Returns the updated [channel object](/http-api/channels/#channel-object) on success. Emits a [Channel Update](/gateway/events/#channel-update) Gateway event.--An omitted `moderated` is stored as false, and an omitted emoji field is stored as null.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the forum or media channel |-| tag_id | snowflake | The ID of the tag |+Replaces a tag and sends a [Channel Update](/gateway/events/#channel-update) event, and any field you omit resets to its default. You need `MANAGE_CHANNELS`.### JSON body@@ -256,69 +230,36 @@ An omitted `moderated` is stored as false, and an omitted emoji field is stored| Status | Body | Condition || --- | --- | --- |-| 200 | [channel](/http-api/channels/#channel-object) object | Tag was replaced |-| 400 | [error response](/http-api/#error-response) | Channel is a guild channel other than a forum or media channel and the request returns `INVALID_CHANNEL_TYPE` |-| 400 | [error response](/http-api/#error-response) | Another tag has the name and the request returns `FORUM_TAG_NAMES_MUST_BE_UNIQUE` |-| 400 | [error response](/http-api/#error-response) | The change leaves `REQUIRE_TAG` with no unmoderated tag, returning `NO_TAGS_AVAILABLE_TO_NON_MODERATORS` |-| 400 | [error response](/http-api/#error-response) | Body sets both emoji fields or an invalid emoji, returning `INVALID_FORM_BODY` |-| 400 | [error response](/http-api/#error-response) | Caller needs an authenticator and the request returns `TWO_FACTOR_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` or `MANAGE_CHANNELS` and the request returns `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or is outside a guild, and the request returns `NOT_FOUND` |-| 404 | [error response](/http-api/#error-response) | Channel holds no tag with `tag_id` and the request returns `UNKNOWN_FORUM_TAG` |-| 404 | [error response](/http-api/#error-response) | The new `emoji_id` is not an emoji of this guild and the request returns `UNKNOWN_EMOJI` |-| 429 | [error response](/http-api/#error-response) | Another tag change holds the channel, returning `RESOURCE_LOCKED` |--The body is the forum or media channel with its [forum channel fields](#forum-channel-fields). It has no `thread_metadata`, `message_count`, `total_message_sent`, `member_count`, `applied_tags`, `member_ids_preview`, or `member`.--### Rate limit+| 200 | [channel](/http-api/channels/#channel-object) object | The tag was replaced |+| 400 | [error response](/http-api/#error-response) | The name is taken, with `FORUM_TAG_NAMES_MUST_BE_UNIQUE` |+| 400 | [error response](/http-api/#error-response) | No unmoderated tag would be left, with `NO_TAGS_AVAILABLE_TO_NON_MODERATORS` |+| 404 | [error response](/http-api/#error-response) | The tag or emoji is unknown, with `UNKNOWN_FORUM_TAG` or `UNKNOWN_EMOJI` |+| 429 | [error response](/http-api/#error-response) | Another tag change is running, with `RESOURCE_LOCKED` |-10 requests per 10 seconds for each authenticated user and channel ID, on the `channel:forum_tags::channel_id` bucket.+The rate limit is 10 requests per 10 seconds, on the `channel:forum_tags::channel_id` bucket.## Delete forum tag<RouteHeader method="DELETE" path="/v1/channels/{channel_id}/tags/{tag_id}" bot auditReason />-Removes a tag from a forum or media channel. Requires `MANAGE_CHANNELS`. Returns the updated [channel object](/http-api/channels/#channel-object) on success. Emits a [Channel Update](/gateway/events/#channel-update) Gateway event.--Every thread object an HTTP route returns afterwards leaves the deleted tag out of `applied_tags`, except in the `threads` array of the [guild audit log](/http-api/guild-audit-logs/). A Gateway thread payload can keep the ID until the post next changes. A post drops the stored ID the next time its tags change.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the forum or media channel |-| tag_id | snowflake | The ID of the tag |+Removes a tag and sends a [Channel Update](/gateway/events/#channel-update) event, and HTTP responses leave it out of each post's `applied_tags`. You need `MANAGE_CHANNELS`.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [channel](/http-api/channels/#channel-object) object | Tag was removed |-| 400 | [error response](/http-api/#error-response) | Channel is a guild channel other than a forum or media channel and the request returns `INVALID_CHANNEL_TYPE` |-| 400 | [error response](/http-api/#error-response) | The removal leaves `REQUIRE_TAG` with no unmoderated tag, returning `NO_TAGS_AVAILABLE_TO_NON_MODERATORS` |-| 400 | [error response](/http-api/#error-response) | Caller needs an authenticator and the request returns `TWO_FACTOR_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` or `MANAGE_CHANNELS` and the request returns `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or is outside a guild, and the request returns `NOT_FOUND` |-| 404 | [error response](/http-api/#error-response) | Channel holds no tag with `tag_id` and the request returns `UNKNOWN_FORUM_TAG` |-| 429 | [error response](/http-api/#error-response) | Another tag change holds the channel, returning `RESOURCE_LOCKED` |--The body is the forum or media channel with its [forum channel fields](#forum-channel-fields). It has no `thread_metadata`, `message_count`, `total_message_sent`, `member_count`, `applied_tags`, `member_ids_preview`, or `member`.--### Rate limit+| 200 | [channel](/http-api/channels/#channel-object) object | The tag was removed |+| 400 | [error response](/http-api/#error-response) | The removal leaves `REQUIRE_TAG` with no unmoderated tag, with `NO_TAGS_AVAILABLE_TO_NON_MODERATORS` |+| 404 | [error response](/http-api/#error-response) | The channel has no such tag, with `UNKNOWN_FORUM_TAG` |+| 429 | [error response](/http-api/#error-response) | Another tag change is running, with `RESOURCE_LOCKED` |-10 requests per 10 seconds for each authenticated user and channel ID, on the `channel:forum_tags::channel_id` bucket.+The rate limit is 10 requests per 10 seconds, on the `channel:forum_tags::channel_id` bucket.## Get forum post data<RouteHeader method="POST" path="/v1/channels/{channel_id}/post-data" bot />-Returns the owner and first message of each requested post in a forum or media channel. Requires `READ_MESSAGE_HISTORY`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the forum or media channel |+Returns the owner and first message of each requested post. You need `READ_MESSAGE_HISTORY`.### JSON body@@ -332,46 +273,39 @@ Returns the owner and first message of each requested post in a forum or media c| --- | --- | --- || threads<sup>1</sup> | map[snowflake, [post data](#post-data-object) object] | The post data keyed by post ID |-<sup>1</sup> Has one key for each distinct requested ID. An ID that is not a post of this channel maps to null `owner` and null `first_message`+<sup>1</sup> An ID that isn't a post in this channel maps to an object with null `owner` and `first_message`#### Post data object| Field | Type | Description || --- | --- | --- |-| owner<sup>1</sup> | ?[guild member](/http-api/guild-members/#guild-member-object) object | The guild member who created the post |-| first_message<sup>2</sup> | ?[message](/http-api/messages/#message-object) object | The first message of the post |+| owner<sup>2</sup> | ?[guild member](/http-api/guild-members/#guild-member-object) object | The guild member who created the post |+| first_message<sup>3</sup> | ?[message](/http-api/messages/#message-object) object | The first message of the post |-<sup>1</sup> Null when the creator is no longer a member of the guild, and for a post a webhook created+<sup>2</sup> Null for a post a webhook created, or when the creator left the guild-<sup>2</sup> Null when the first message was deleted+<sup>3</sup> Null when the first message was deleted### Response| Status | Body | Condition || --- | --- | --- || 200 | [post data](#response-body) map | Post data was returned |-| 400 | [error response](/http-api/#error-response) | Channel is a guild channel other than a forum or media channel and the request returns `INVALID_CHANNEL_TYPE` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` or `READ_MESSAGE_HISTORY` and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The resolved age restriction is not satisfied and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or is outside a guild, and the request returns `NOT_FOUND` |+| 403 | [error response](/http-api/#error-response) | The age check fails, with `NSFW_CONTENT_AGE_RESTRICTED` |-### Rate limit--20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:post_data::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:post_data::channel_id` bucket.## Webhooks in forums-A webhook whose channel is a forum or media channel creates a post, or posts into an existing one. [Execute webhook](/http-api/webhooks/#execute-webhook) lists the `thread_id`, `thread_name`, and `applied_tags` fields and their error codes.--A locked thread refuses a webhook message with 400 `THREAD_LOCKED`. An archived thread that is not locked is unarchived by it, and Fluxer emits a [Thread Update](/gateway/threads/#thread-update) Gateway event. When the guild already has 1,000 active threads, the message returns 400 `MAX_ACTIVE_THREADS` and the thread stays archived. Editing a webhook message in an archived thread returns 400 `THREAD_ARCHIVED`, and in a locked thread 400 `THREAD_LOCKED`.+A webhook in a forum or media channel creates a post with `thread_name` and `applied_tags`, or posts in an existing one with `thread_id`, through [Execute webhook](/http-api/webhooks/#execute-webhook). Posting in an archived post that isn't locked unarchives it and sends a [Thread Update](/gateway/threads/#thread-update) event.## New post notifications-A [channel notification override](/http-api/users/settings/#channel-notification-override-object) has `flags`, and only these two bits are stored.+A [channel notification override](/http-api/users/settings/#channel-notification-override-object) stores these two `flags` bits.| Value | Name | Description || --- | --- | --- || 1 << 13 | NEW_FORUM_THREADS_OFF | No push notification for a new post in the channel |-| 1 << 14 | NEW_FORUM_THREADS_ON | A value Fluxer stores and does not read |+| 1 << 14 | NEW_FORUM_THREADS_ON | Fluxer stores it but doesn't use it |-A new post sends a push notification to a member when the channel resolves to the all messages notification level. A mute on the guild, on the parent category, or on the channel suppresses it, and so does `NEW_FORUM_THREADS_OFF`. Fluxer ignores `flags` in a user request without the [`channel_threads` client capability](/http-api/threads/#client-capability), and the stored value stays.+A new post sends a push notification when the channel's notification level is all messages. A mute on the guild, category or channel stops it, and so does `NEW_FORUM_THREADS_OFF`.diff --git a/fluxer_docs/src/content/docs/http-api/gateway.mdx b/fluxer_docs/src/content/docs/http-api/gateway.mdxindex 36890da34..3e2eb33fc 100644--- a/fluxer_docs/src/content/docs/http-api/gateway.mdx+++ b/fluxer_docs/src/content/docs/http-api/gateway.mdx@@ -1,14 +1,12 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Gateway-description: Bot discovery of the main Gateway endpoint, shard count, and session start limit.+description: The bot endpoint that returns the Gateway URL, shard count and session start limit.---import RouteHeader from '@/components/RouteHeader.astro';-This endpoint returns the bot Gateway URL, recommended shard count and advertised session start limits. See the [Gateway overview](/gateway/overview/) for the WebSocket protocol.--Use a [bot token](/authentication/#bot-tokens). User clients read `endpoints.gateway` from [instance discovery](/http-api/instance/#instance-endpoints-object) and send their session token in [Identify](/gateway/commands/#identify).+Bots call this endpoint to get the URL for the [Gateway](/gateway/overview/) WebSocket. User clients get the same URL from `endpoints.gateway` in [instance discovery](/http-api/instance/#instance-endpoints-object).## Gateway information object@@ -16,11 +14,11 @@ Use a [bot token](/authentication/#bot-tokens). User clients read `endpoints.gat| Field | Type | Description || --- | --- | --- |-| url | string | The `ws` or `wss` URL, identical to `endpoints.gateway` in [instance discovery](/http-api/instance/#instance-endpoints-object) |+| url | string | The `ws` or `wss` Gateway URL || shards | integer | Recommended shard count, always `1` |-| session_start_limit | [session start limit](#session-start-limit-object) object | Fixed session start values |+| session_start_limit | [session start limit](#session-start-limit-object) object | Session start values, the same on every call |-Fluxer appends no query string, so a client appends the [connection parameters](/gateway/overview/#connection-parameters) itself. A client MUST NOT rewrite a published `ws` value to `wss`, because a deployment that deliberately serves plain HTTP advertises a `ws` value.+Add the [connection parameters](/gateway/overview/#connection-parameters) to `url` before you connect. To split a bot across more than one shard, follow [sharding](/gateway/overview/#sharding).### Example@@ -39,54 +37,28 @@ Fluxer appends no query string, so a client appends the [connection parameters](## Session start limit object-These are fixed compatibility values, not live usage counters.+The API returns the same values on every call, and the Gateway doesn't use them. The limits it enforces are under [Session lifecycle](/gateway/limits-and-rate-limits/#session-lifecycle).### Structure| Field | Type | Description || --- | --- | --- |-| total | integer | Reported session starts allowed, always `1000` |-| remaining | integer | Reported session starts remaining, always `999` |-| reset_after | integer | Reported reset interval in milliseconds, always `14400000` (four hours) |-| max_concurrency<sup>1</sup> | integer | Reported concurrent [Identify](/gateway/commands/#identify) buckets, always `1` |--<sup>1</sup> A bot does not need to pace Identify requests against this value--The limits the Gateway enforces are in [Session lifecycle](/gateway/limits-and-rate-limits/#session-lifecycle). Fluxer rate limits Identify per source address and limits a user account to a fixed number of concurrent sessions. Neither bound is reported here.--:::caution[A remaining session start does not guarantee admission]-These values reserve no capacity. [Session admission](/gateway/limits-and-rate-limits/#session-lifecycle) can still hold or reject a connection.-:::+| total | integer | Always `1000` |+| remaining | integer | Always `999` |+| reset_after | integer | Always `14400000` (four hours, in milliseconds) |+| max_concurrency | integer | Always `1` |## Get Gateway information<RouteHeader method="GET" path="/v1/gateway/bot" bot />-Returns a [Gateway information object](#gateway-information-object).--Accepted forms are `Bot <token>`, `Bearer <token>` and `<token>`. Prefixes ignore case and surrounding token whitespace is trimmed. The token must contain a full stop with decimal digits before it and at least one character after it, and must not start with `flx_`.--:::caution[Only the token form is enforced]-The route checks the shape of the credential only. A well-formed value naming no live application receives the same 200 as a real bot token.-:::--Validate a token with [Identify](/gateway/commands/#identify) or [Get bot application](/http-api/applications/#get-bot-application) instead.--A 200 has the informational [rate limit headers](/topics/rate-limits/#rate-limit-headers) only for the `Bot ` prefix. For the bare form and the `Bearer ` form, Fluxer keys the rate limit bucket on the client IP address.+Returns a [Gateway information object](#gateway-information-object). The `Authorization` header takes `Bot <token>`, `Bearer <token>` or the bare token. The API only checks that the token looks like a [bot token](/authentication/#bot-tokens), and it returns 200 for a revoked or wrong one. To test whether a token works, call [Get bot application](/http-api/applications/#get-bot-application).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [Gateway information](#gateway-information-object) object | The credential is in bot token form |-| 401<sup>1</sup> | [error response](/http-api/#error-response) | The credential is absent, is empty after its scheme prefix, or is not in bot token form |--<sup>1</sup> An absent or empty credential uses `MISSING_AUTHORIZATION`, and every other rejected value uses `INVALID_AUTH_TOKEN`--### Side effects--Use the `Bot ` authorisation prefix. Repeated invalid authentication can trigger the [abuse protections](/http-api/errors/#status-codes).--### Rate limit+| 200 | [Gateway information](#gateway-information-object) object | The token looks like a bot token |+| 401 | [error response](/http-api/#error-response) | `MISSING_AUTHORIZATION` with no token, `INVALID_AUTH_TOKEN` when the token doesn't look like a bot token |-60 requests per minute for each authenticated account, or for each client IP address when no account resolved, on the `gateway:bot_info` bucket.+The rate limit is 60 requests per minute for each bot, or for each client IP address when the request has no working `Bot ` token, on the `gateway:bot_info` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/gifs.mdx b/fluxer_docs/src/content/docs/http-api/gifs.mdxindex 2644ebfc4..b179c6831 100644--- a/fluxer_docs/src/content/docs/http-api/gifs.mdx+++ b/fluxer_docs/src/content/docs/http-api/gifs.mdx@@ -1,72 +1,50 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: GIFs-description: Provider-backed GIF search, featured and trending listings, search suggestions, and share registration.+description: GIF search, featured and trending listings, search suggestions and share registration.---import RouteHeader from '@/components/RouteHeader.astro';-A GIF is an animated media item from the instance's active provider. Results include provider URLs and [Media Proxy](/media-proxy/overview/) URLs.+These routes search the instance's GIF provider. They need a session token. A bot token or OAuth2 bearer token gets 403 `ACCESS_DENIED`.-Every route requires a session credential. A bot token and an OAuth2 bearer credential are both refused with 403 `ACCESS_DENIED`. [Save meme from URL](/http-api/memes/#save-meme-from-url) saves a result into the account's own collection.--## Provider availability--`klipy` is the only provider name a deployment binds. [Get instance discovery](/http-api/instance/#get-instance-discovery) publishes it as the [GIF provider](/http-api/instance/#gif-provider-object) object. An instance that has bound no provider key refuses every route on this page with 403 `FEATURE_TEMPORARILY_DISABLED`. `gif_enabled` in [service availability](/http-api/instance/#service-availability-object) reports whether that key is bound, unless an operator has set the flag by hand. A client that reads `gif_enabled` as true can therefore still receive the 403.--A provider outage, a request past its deadline, and an unreadable provider payload all return 503 `SERVICE_UNAVAILABLE`. The deadline is 12 seconds everywhere except [Register a GIF share](#register-a-gif-share), which uses 3 seconds. An operator can change both.--## Locale and country--Every route takes an optional `locale` drawn from the [supported locale registry](/topics/locales/#supported-locales), in the query string on the GET routes and in the body of [Register a GIF share](#register-a-gif-share). It defaults to `en-US`. A tag outside the registry fails with 400 `INVALID_FORM_BODY`.--Fluxer also derives a two-letter country from the requesting address by geolocation, and uses `US` when geolocation resolves none. No route accepts the country as a parameter, so a client cannot override it. [Get GIF search suggestions](#get-gif-search-suggestions) is the one route that ignores it.+[Get instance discovery](/http-api/instance/#gif-provider-object) has a `gif` object that says whether the instance has a GIF provider.## Provider headers-Every response under `/gifs`, `/tenor`, and `/klipy` has these headers, including error responses and responses to a path no route claims. The values repeat the [GIF provider](/http-api/instance/#gif-provider-object) object, so a client follows a provider change without refetching `/.well-known/fluxer`.+Every response from these routes has these headers when the instance has a GIF provider.| Field | Type | Description || --- | --- | --- |-| X-Fluxer-GIF-Provider<sup>1</sup> | string | The machine name of the active provider, which is `klipy` on every deployment today |-| X-Fluxer-GIF-Provider-Display-Name<sup>1</sup> | string | The provider name a client displays |-| X-Fluxer-GIF-Provider-Attribution-Required<sup>1</sup> | string | The literal `true` or `false`, stating whether a client shows the provider attribution mark |--<sup>1</sup> All are absent together while the instance has bound no provider key, which is the same condition that answers 403 `FEATURE_TEMPORARILY_DISABLED`--## Result freshness--Fluxer caches results, so a result can lag behind the provider. Repeating a request does not force a refresh.+| X-Fluxer-GIF-Provider | string | The provider ID, such as `klipy` |+| X-Fluxer-GIF-Provider-Display-Name | string | The provider name to show |+| X-Fluxer-GIF-Provider-Attribution-Required | string | `true` when you must show the provider's attribution |## GIF object-A GIF object is one media item the active provider owns. Every URL in it resolves to bytes the provider hosts.+A GIF object is one result from the provider. [Save meme from URL](/http-api/memes/#save-meme-from-url) saves one to your collection.### Structure| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | string | The provider-stable identifier of the GIF |-| slug<sup>1</sup> | string | The canonical slug used to share the GIF or resolve it again |-| provider | string | The name of the provider that produced the GIF (1-32 characters) |-| title | string | The title the provider gives the GIF |-| url | string | The provider page URL for the GIF |-| src<sup>2</sup> | string | The direct media URL of the format the server chose |-| proxy_src<sup>2</sup> | string | The [Media Proxy](/media-proxy/overview/) URL of that same format |-| width<sup>2</sup> | integer | The width of the chosen format in pixels |-| height<sup>2</sup> | integer | The height of the chosen format in pixels |-| media<sup>3</sup> | map[string, [GIF media format](/http-api/memes/#gif-media-format-object) object] | The formats keyed by [GIF media format name](/http-api/memes/#gif-media-format-names) |-| placeholder?<sup>4</sup> | ?string | The compact thumbhash placeholder rendered while the GIF loads |--<sup>1</sup> The active provider writes the same slug into both, so `id` is the value [Register a GIF share](#register-a-gif-share) takes+| id<sup>1</sup> | string | The provider's identifier of the GIF |+| slug<sup>1</sup> | string | The canonical slug of the GIF |+| provider | string | The name of the provider (1-32 characters) |+| title | string | The title of the GIF |+| url | string | The provider page URL |+| src<sup>2</sup> | string | The direct media URL |+| proxy_src<sup>2</sup> | string | The [Media Proxy](/media-proxy/overview/) URL |+| width<sup>2</sup> | integer | The width in pixels |+| height<sup>2</sup> | integer | The height in pixels |+| media | map[string, [GIF media format](/http-api/memes/#gif-media-format-object) object] | The formats keyed by [format name](/http-api/memes/#gif-media-format-names) |+| placeholder?<sup>3</sup> | ?string | The thumbhash placeholder |-<sup>2</sup> Copied from the `webm` entry of `media` when the provider returned one, and from the first entry it returned otherwise+<sup>1</sup> Both have the same value-<sup>3</sup> Empty when no format the provider returned could be proxied. No key is guaranteed, so a client checks the format names it prefers in order and uses the first one present+<sup>2</sup> From the `webm` entry of `media` when there is one, and from the first entry otherwise-<sup>4</sup> The active provider emits none, so the field is absent from every GIF these routes return. [Resolve GIF URLs](/http-api/memes/#resolve-gif-urls) is the operation that produces one--A GIF has no snowflake and no creation timestamp. `id` is the provider's own identifier, so it does not sort by time, and no other Fluxer route resolves it.+<sup>3</sup> Always absent from the GIFs these routes return### Example@@ -100,24 +78,22 @@ A GIF has no snowflake and no creation timestamp. `id` is the provider's own ide## GIF category object-A GIF category object pairs a category search term with a preview GIF for that term.+A category is a search term with a preview GIF. Send `name` as the `q` of [Search GIFs](#search-gifs) to get its GIFs.### Structure| Field | Type | Description || --- | --- | --- |-| name | string | The search term the category stands for, translated for the requested locale |-| src<sup>1</sup> | string | The direct media URL of the preview GIF |-| proxy_src<sup>1</sup> | string | The [Media Proxy](/media-proxy/overview/) URL of the preview GIF |-| gif | ?[GIF](#gif-object) object | The preview GIF, or null when the preview lookup returned nothing |--<sup>1</sup> Copied from the same field of `gif`, and the empty string when `gif` is null+| name | string | The search term, translated for the locale |+| src<sup>1</sup> | string | The direct media URL of the preview |+| proxy_src<sup>1</sup> | string | The [Media Proxy](/media-proxy/overview/) URL of the preview |+| gif | ?[GIF](#gif-object) object | The preview GIF |-To open the category, a client sends `name` as the `q` of [Search GIFs](#search-gifs).+<sup>1</sup> The empty string when `gif` is null## Deprecated vendor paths-The vendor-named prefixes serve the same handlers as `/gifs`. Each answers exactly as its successor does and has the same [provider headers](#provider-headers).+These paths work like their successors and add `Deprecation`, `Link` and `Warning` headers.| Method | Deprecated path | Successor || --- | --- | --- |@@ -132,27 +108,11 @@ The vendor-named prefixes serve the same handlers as `/gifs`. Each answers exact| GET | `/v1/klipy/suggest` | [Get GIF search suggestions](#get-gif-search-suggestions) || POST | `/v1/klipy/register-share` | [Register a GIF share](#register-a-gif-share) |-:::caution[The vendor prefixes spell trending differently]-Trending is `/trending` under `/gifs` and `/trending-gifs` under both vendor prefixes. The other paths keep the same last segment on all prefixes.-:::--A response from a deprecated path has these further headers.--| Field | Type | Description |-| --- | --- | --- |-| Deprecation | string | The literal value `true` |-| Link | string | The literal value `</gifs>; rel="successor-version"` |-| Warning<sup>1</sup> | string | A 299 warning naming the successor prefix |--<sup>1</sup> The exact value is `299 - "Use /gifs/* instead - these vendor-specific paths are deprecated and will be removed."`--The vendor name in the path selects nothing. A request to `/v1/tenor/search` reaches the same active provider as `/v1/gifs/search`, and the `provider` field of every GIF it returns names that provider.-## Search GIFs<RouteHeader method="GET" path="/v1/gifs/search" />-Searches the active provider for GIFs matching a query. Returns at most 50 [GIF objects](#gif-object) in the order the provider returned them.+Returns at most 50 [GIF objects](#gif-object) matching a search term.### Query parameters@@ -161,27 +121,21 @@ Searches the active provider for GIFs matching a query. Returns at most 50 [GIF| q | string | The search term (1-256 characters) || locale? | string | A [supported locale](/topics/locales/#supported-locales), default `en-US` |-Fluxer does not stem, expand, or spell-correct the term. A term that matches nothing returns 200 with an empty array.-### Response| Status | Body | Condition || --- | --- | --- |-| 200 | array[[GIF](#gif-object) object] | Results were returned, possibly as an empty array |-| 400 | [error response](/http-api/#error-response) | `q` is absent, empty, or longer than 256 characters, or `locale` is outside the registry, each returning `INVALID_FORM_BODY` |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The instance has bound no provider key and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 503 | [error response](/http-api/#error-response) | The provider failed, the request outlived its deadline, or the `gifs` service answered with a payload the API could not read, each returning `SERVICE_UNAVAILABLE` |--### Rate limit+| 200 | array[[GIF](#gif-object) object] | The matches |+| 403 | [error response](/http-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED` when the instance has no GIF provider |+| 503 | [error response](/http-api/#error-response) | `SERVICE_UNAVAILABLE` when the provider fails or times out |-40 requests per 10 seconds for each authenticated user, on the `gif:search` bucket.+The rate limit is 40 requests per 10 seconds, on the `gif:search` bucket.## Get featured GIFs<RouteHeader method="GET" path="/v1/gifs/featured" />-Returns the provider's featured GIFs and the category terms offered alongside them.+Returns a featured GIF and a list of category terms.### Query parameters@@ -193,36 +147,24 @@ Returns the provider's featured GIFs and the category terms offered alongside th| Field | Type | Description || --- | --- | --- |-| gifs<sup>1</sup> | array[[GIF](#gif-object) object] | The featured GIFs for the resolved locale and country |-| categories<sup>2</sup> | array[[GIF category](#gif-category-object) object] | The category terms offered for the resolved locale |--<sup>1</sup> At most one entry. [Get trending GIFs](#get-trending-gifs) is the route that returns a full listing--<sup>2</sup> At most 50 entries, deduplicated by search term and kept in the order the provider returned them--Fluxer resolves the category list against the country `US` for every request, whatever country geolocation produced, so two callers in different countries receive the same `categories` and different `gifs`. A category whose preview lookup returned nothing is still listed, with `gif` null and both URLs empty.+| gifs | array[[GIF](#gif-object) object] | The featured GIF (0 or 1 items) |+| categories | array[[GIF category](#gif-category-object) object] | The categories (at most 50) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Featured GIFs and categories were returned |-| 400 | [error response](/http-api/#error-response) | `locale` is outside the registry and the request returns `INVALID_FORM_BODY` |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The instance has bound no provider key and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 503 | [error response](/http-api/#error-response) | The provider failed, the request outlived its deadline, or the `gifs` service answered with a payload the API could not read, each returning `SERVICE_UNAVAILABLE` |+| 200 | response body | The featured GIFs and categories |+| 403 | [error response](/http-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED` when the instance has no GIF provider |+| 503 | [error response](/http-api/#error-response) | `SERVICE_UNAVAILABLE` when the provider fails or times out |-Fluxer fetches both halves in one operation. A failure on either `gifs` or `categories` fails the whole request and returns no partial body.--### Rate limit--40 requests per 10 seconds for each authenticated user, on the `gif:featured` bucket.+The rate limit is 40 requests per 10 seconds, on the `gif:featured` bucket.## Get trending GIFs<RouteHeader method="GET" path="/v1/gifs/trending" />-Returns at most 50 trending [GIF objects](#gif-object) for the resolved locale and country.+Returns at most 50 trending [GIF objects](#gif-object).### Query parameters@@ -234,23 +176,17 @@ Returns at most 50 trending [GIF objects](#gif-object) for the resolved locale a| Status | Body | Condition || --- | --- | --- |-| 200 | array[[GIF](#gif-object) object] | Trending GIFs were returned, possibly as an empty array |-| 400 | [error response](/http-api/#error-response) | `locale` is outside the registry and the request returns `INVALID_FORM_BODY` |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The instance has bound no provider key and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 503 | [error response](/http-api/#error-response) | The provider failed, the request outlived its deadline, or the `gifs` service answered with a payload the API could not read, each returning `SERVICE_UNAVAILABLE` |--The [featured](#get-featured-gifs) GIF is not guaranteed to match the first trending result.+| 200 | array[[GIF](#gif-object) object] | The trending GIFs |+| 403 | [error response](/http-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED` when the instance has no GIF provider |+| 503 | [error response](/http-api/#error-response) | `SERVICE_UNAVAILABLE` when the provider fails or times out |-### Rate limit--40 requests per 10 seconds for each authenticated user, on the `gif:trending` bucket.+The rate limit is 40 requests per 10 seconds, on the `gif:trending` bucket.## Get GIF search suggestions<RouteHeader method="GET" path="/v1/gifs/suggest" />-Returns search-term suggestions for a partial query, as an array of strings.+Returns search term suggestions for a partial query.### Query parameters@@ -259,60 +195,36 @@ Returns search-term suggestions for a partial query, as an array of strings.| q | string | The partial search term (1-256 characters) || locale? | string | A [supported locale](/topics/locales/#supported-locales), default `en-US` |-Suggestions depend on the locale and query, not the requesting address.-### Response| Status | Body | Condition || --- | --- | --- |-| 200 | array[string] | Suggestions were returned, possibly as an empty array |-| 400 | [error response](/http-api/#error-response) | `q` is absent, empty, or longer than 256 characters, or `locale` is outside the registry, each returning `INVALID_FORM_BODY` |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The instance has bound no provider key and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 503 | [error response](/http-api/#error-response) | The provider failed, the request outlived its deadline, or the `gifs` service answered with a payload the API could not read, each returning `SERVICE_UNAVAILABLE` |+| 200 | array[string] | The suggestions |+| 403 | [error response](/http-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED` when the instance has no GIF provider |+| 503 | [error response](/http-api/#error-response) | `SERVICE_UNAVAILABLE` when the provider fails or times out |-Each suggestion is a term a client sends back as the `q` of [Search GIFs](#search-gifs).--### Rate limit--40 requests per 10 seconds for each authenticated user, on the `gif:suggest` bucket.+The rate limit is 40 requests per 10 seconds, on the `gif:suggest` bucket.## Register a GIF share<RouteHeader method="POST" path="/v1/gifs/register-share" />-Tells the active provider that the caller is sharing one of its GIFs, and returns 204 with an empty body.+Tells the provider that a user sent one of its GIFs. Fluxer stores nothing.### JSON body| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | string | The `id` of the shared [GIF object](#gif-object) (1-300 characters) |-| q?<sup>2</sup> | ?string | The search term that produced the GIF (0-256 characters) |+| id | string | The `id` of the shared [GIF object](#gif-object) (1-300 characters) |+| q? | ?string | The search term that found the GIF (0-256 characters) || locale? | string | A [supported locale](/topics/locales/#supported-locales), default `en-US` |-<sup>1</sup> The provider reads it as a slug or a slug-id token. Fluxer does not check it against a GIF it has returned, so an identifier the provider does not recognise fails at the provider--<sup>2</sup> An omitted or null value is sent to the provider as the empty string--The deadline on this route is 3 seconds.-### Response| Status | Body | Condition || --- | --- | --- || 204 | empty | The provider accepted the registration |-| 400 | [error response](/http-api/#error-response) | `id` is absent, empty, or longer than 300 characters, `q` is longer than 256 characters, or `locale` is outside the registry, each returning `INVALID_FORM_BODY` |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The instance has bound no provider key and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 503 | [error response](/http-api/#error-response) | The provider rejected the registration, the `gifs` service did not answer within the deadline, or it answered with something other than an acknowledgement, each returning `SERVICE_UNAVAILABLE` |--### Side effects--The registration reaches the provider and changes no Fluxer state, so it emits no Gateway Dispatch and does not add the GIF to the account's [memes](/http-api/memes/).--Each request registers a separate share, including repeated requests for the same `id`.--### Rate limit+| 403 | [error response](/http-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED` when the instance has no GIF provider |+| 503 | [error response](/http-api/#error-response) | `SERVICE_UNAVAILABLE` when the provider fails or times out |-60 requests per 10 seconds for each authenticated user, on the `gif:register_share` bucket.+The rate limit is 60 requests per 10 seconds, on the `gif:register_share` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/gifts.mdx b/fluxer_docs/src/content/docs/http-api/gifts.mdxindex 984c13817..7da1efe52 100644--- a/fluxer_docs/src/content/docs/http-api/gifts.mdx+++ b/fluxer_docs/src/content/docs/http-api/gifts.mdx@@ -1,42 +1,34 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Gifts-description: Gift code objects, duration units, public lookup, and one-time redemption.+description: Gift code objects, duration units, public lookup and redemption.---import RouteHeader from '@/components/RouteHeader.astro';-A gift is a code that grants premium to the account that redeems it. Until then it belongs to no account. [Create gift checkout](/http-api/billing/#create-gift-checkout) defines how one is bought.+A gift is a code that grants premium to the account that redeems it. [Create gift checkout](/http-api/billing/#create-gift-checkout) buys one. The routes on this page work only while the instance [premium mode](/admin-api/instance/#premium-modes) is `mirror`.-A self-hosted deployment serves both routes only while its [premium mode](/admin-api/instance/#premium-modes) is `mirror`, as [deployment availability](/http-api/deployment-availability/) describes. [Redeem gift](#redeem-gift) is user-only.--:::caution[A code is a bearer credential]-A gift records no recipient, so Fluxer binds the code to whichever eligible account presents it first. [Get gift](#get-gift) takes no credential and returns the full public record for any code. Treat an unredeemed code as a secret.-:::+Anyone who has an unredeemed code can look it up and redeem it. Keep the code secret until you give it away.## Gift object-A gift records a duration. Fluxer computes the entitlement window at redemption time. For a positive quantity, the entitlement anchor is the latest of the current time, the redeemer's current premium end and their existing gift extension end.--Both creation paths record a creator. A completed gift checkout records the purchaser. An Admin API gift records the system account with ID `0`, and no field names the administrator that requested it. No operation unredeems a code.+A gift grants premium for a set duration.### Structure| Field | Type | Description || --- | --- | --- |-| code<sup>1</sup> | string | The code presented to [Redeem gift](#redeem-gift) |-| duration_type | string | The [gift duration unit](#gift-duration-units) that `duration_quantity` is measured in |-| duration_quantity<sup>2</sup> | integer | The number of `duration_type` units the gift grants |-| redeemed<sup>3</sup> | boolean | Whether the code has already been redeemed |-| created_by?<sup>4</sup> | ?[partial user](/http-api/users/#partial-user-object) object | The account that created the gift |+| code<sup>1</sup> | string | The code to pass to [Redeem gift](#redeem-gift) |+| duration_type | string | The [duration unit](#gift-duration-units) of `duration_quantity` |+| duration_quantity<sup>2</sup> | integer | The number of units the gift grants |+| redeemed | boolean | Whether the code has been redeemed |+| created_by?<sup>3</sup> | ?[partial user](/http-api/users/#partial-user-object) object | The account that created the gift |-<sup>1</sup> Exactly 32 case-sensitive letters and digits+<sup>1</sup> 32 case-sensitive letters and digits-<sup>2</sup> Non-negative. The exact value `0` means lifetime premium+<sup>2</sup> A value of `0` grants lifetime premium-<sup>3</sup> Neither the redemption time nor the redeeming account appears in this object--<sup>4</sup> Always present and non-null on this route. A creator ID that resolves to no account becomes a placeholder partial with the unresolved ID, `DeletedUser`, `0000` and `Deleted User`+<sup>3</sup> For a gift created through the Admin API, `created_by` is the administrator who created it### Example@@ -60,100 +52,56 @@ Both creation paths record a creator. A completed gift checkout records the purc## Gift duration units-A purchased gift is always whole months or whole years, because a purchase of twelve months is normalised to one year. The day and week units exist for codes created through the Admin API.+Bought gifts use months or years, and only gifts created through the Admin API use days or weeks.| Value | Description || --- | --- |-| days | The quantity counts days added to the entitlement anchor |-| weeks | The quantity counts weeks added to the entitlement anchor |-| months<sup>1</sup> | The quantity counts calendar months added to the entitlement anchor |-| years<sup>1</sup> | The quantity counts calendar years, applied as twelve calendar months each |--<sup>1</sup> A calendar month is added in UTC and clamped to the last day of the target month, so 31 January extended by one month lands on 28 or 29 February+| days | Periods of 24 hours |+| weeks | Periods of seven 24-hour days |+| months | Calendar months, clamped to the last day of the target month |+| years | 12 calendar months |## Get gift<RouteHeader method="GET" path="/v1/gifts/{code}" unauthenticated />-Reads a gift by its code. Returns the [gift](#gift-object) object on success.--A code that does not exist and one that has been revoked both return 404 `UNKNOWN_GIFT_CODE`, so a revoked code is never distinguishable from one that was never issued.--A chargeback or a refund for the purchase revokes the gift when [Receive Stripe webhook](/http-api/billing/#receive-stripe-webhook) processes it and the gift is still unredeemed. The gift also leaves [List current user gifts](/http-api/users/gifts/#list-current-user-gifts), so the buyer has no route that reports the reversal. A gift that was already redeemed when the same event arrives stays readable, and Fluxer recomputes the redeemer's entitlement from their remaining redeemed gifts.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| code | string | The code to look up (1-32 characters) |+Returns a [gift](#gift-object).### Response| Status | Body | Condition || --- | --- | --- || 200 | [gift](#gift-object) object | The gift was returned |-| 404 | [error response](/http-api/#error-response) | No gift exists for the code, or the gift was revoked, and the request returns `UNKNOWN_GIFT_CODE` |--### Rate limit+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_GIFT_CODE` when the code does not exist or was revoked after a refund |-60 requests per 10 seconds for each authenticated user or client IP address, on the `gift:get` bucket. A supplied credential only keys the bucket. A credential that does not resolve leaves the bucket keyed by the client IP address, and the request still succeeds.+The rate limit is 60 requests per 10 seconds, on the `gift:get` bucket.## Redeem gift<RouteHeader method="POST" path="/v1/gifts/{code}/redeem" />-Redeems a gift for the authenticated account and returns 204 with an empty body. User-only. Emits a [User Update](/gateway/events/#user-update) Gateway event.--### Limitations--- The redeeming account must be claimed, and an unclaimed account returns 400 `UNCLAIMED_ACCOUNT_CANNOT_MAKE_PURCHASES`.-- The account must have a verified email address, and an unverified address returns 403 `PURCHASE_EMAIL_VERIFICATION_REQUIRED`.-- The account must not have the purchase-disabled premium flag, and the flag returns 403 `PREMIUM_PURCHASE_BLOCKED` with a top-level `reason` member set to `purchase_disabled`.-- An account already holding lifetime premium receives 400 `CANNOT_REDEEM_PLUTONIUM_WITH_VISIONARY`.--A consumed code receives 400 `GIFT_CODE_ALREADY_REDEEMED`. A code another request is redeeming receives 400 `STRIPE_GIFT_REDEMPTION_IN_PROGRESS`. A code that does not exist or has been revoked receives 404 `UNKNOWN_GIFT_CODE`.+Redeems a gift for the current user and sends a [User Update](/gateway/events/#user-update) Gateway event. You need a claimed account with a verified email address.-:::note[The refusal order differs from checkout]-The claimed account, verified email and purchase flag refusals are evaluated before the lifetime refusal here. [Create subscription checkout](/http-api/billing/#create-subscription-checkout) evaluates the same groups in the opposite order.-:::--:::caution[Redemption is single-use per code]-One redemption can be in flight for a code across the whole deployment, and a second concurrent request is refused at once.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| code | string | The code to redeem (1-32 characters) |+A gift adds its duration after any premium the account already has and pushes back the next charge of an active subscription. A lifetime gift (`duration_quantity` of `0`) cancels an active subscription.### Request headers| Field | Type | Description || --- | --- | --- |-| X-Captcha-Token?<sup>1</sup> | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |--<sup>1</sup> A missing token returns 400 `CAPTCHA_REQUIRED` and a rejected token returns 400 `INVALID_CAPTCHA`, each with a new challenge. Verification is skipped when the check is off for the instance, when the account has the exemption flag, or when the account's email address is on an exempt domain+| X-Captcha-Token? | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | The gift was redeemed and the entitlement was applied |-| 400 | [error response](/http-api/#error-response) | CAPTCHA failed, the code is redeemed or a redemption is in flight, the account is unclaimed or holds lifetime entitlement, or the payment provider rejected the change to the active subscription |-| 403 | [error response](/http-api/#error-response) | The email address is unverified, or purchases are disabled for the account |-| 404 | [error response](/http-api/#error-response) | No gift exists for the code, the gift was revoked, or the authenticated account record no longer exists |--### Side effects--The gift becomes redeemed, so [Get gift](#get-gift) reports `redeemed` as true and [List current user gifts](/http-api/users/gifts/#list-current-user-gifts) shows the redemption time and the redeemer to the buyer.--A positive quantity extends premium from the latest of the current time, the current premium end and the existing gift extension end. When the account has a subscription with the payment provider and its subscription premium has not ended, Fluxer also extends that subscription's trial or billing period without proration. A provider failure can return 400 `STRIPE_ERROR` and leave the code unredeemed.--A quantity of `0` grants lifetime premium and immediately cancels an active subscription without proration or a final invoice.--Entitlement changes send [User Update](/gateway/events/#user-update) to the redeemer's sessions.--### Rate limit--10 requests per minute for each authenticated user, on the `gift:redeem` bucket.+| 204 | empty | The gift was redeemed |+| 400 | [error response](/http-api/#error-response) | `GIFT_CODE_ALREADY_REDEEMED` when the code was already redeemed |+| 400 | [error response](/http-api/#error-response) | `STRIPE_GIFT_REDEMPTION_IN_PROGRESS` when the same code is being redeemed at the same time |+| 400 | [error response](/http-api/#error-response) | `STRIPE_ERROR` when the payment provider rejects the change to an active subscription. The code stays unredeemed |+| 400 | [error response](/http-api/#error-response) | `CANNOT_REDEEM_PLUTONIUM_WITH_VISIONARY` when the account has lifetime premium |+| 403 | [error response](/http-api/#error-response) | `ACCOUNT_VERIFICATION_REQUIRED` for an unclaimed account |+| 403 | [error response](/http-api/#error-response) | `PURCHASE_EMAIL_VERIFICATION_REQUIRED` when the email address is not verified |+| 403 | [error response](/http-api/#error-response) | `PREMIUM_PURCHASE_BLOCKED` when purchases are blocked for the account |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_GIFT_CODE` when the code does not exist or was revoked |++The rate limit is 10 requests per minute, on the `gift:redeem` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/guild-audit-logs.mdx b/fluxer_docs/src/content/docs/http-api/guild-audit-logs.mdxindex 9fb5c89dd..14251c61a 100644--- a/fluxer_docs/src/content/docs/http-api/guild-audit-logs.mdx+++ b/fluxer_docs/src/content/docs/http-api/guild-audit-logs.mdx@@ -1,95 +1,57 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Guild audit logs-description: Guild audit log entries, their action registry, and the audit reason contract.+description: Guild audit log entries, audit actions, change fields and the audit log reason header.---import RouteHeader from '@/components/RouteHeader.astro';-An audit log entry records one change made to a guild and the account that made it. Only [List guild audit logs](#list-guild-audit-logs) and its [Admin API counterpart](/admin-api/guilds/#list-guild-audit-logs) read them.+An audit log entry records one change to a guild and who made it. You get entries with [List guild audit logs](#list-guild-audit-logs) or its [Admin API counterpart](/admin-api/guilds/#list-guild-audit-logs). Entries are kept for 45 days.-## Audit log reason--A route marked Audit reason accepts the `X-Audit-Log-Reason` request header, listed with the other [standard request headers](/http-api/#standard-request-headers). Fluxer reads the value verbatim and never percent-decodes it, so a caller that percent-encodes the reason stores and reads back the percent-encoded form.--Fluxer trims the value. A value that is blank before trimming, empty after it, or longer than 512 characters after it counts as no reason at all. None of those values fails the request, so a reason that misses the bound is dropped and the operation still succeeds.--[Modify channel](/http-api/channels/#modify-channel), [Delete or leave channel](/http-api/channels/#delete-or-leave-channel), [Set channel permission overwrite](/http-api/channels/#set-channel-permission-overwrite), [Delete channel permission overwrite](/http-api/channels/#delete-channel-permission-overwrite), [Delete message](/http-api/messages/#delete-message), [Bulk delete messages](/http-api/messages/#bulk-delete-messages), [Pin message](/http-api/messages/#pin-message), and [Unpin message](/http-api/messages/#unpin-message) record the header as well. [Start thread from message](/http-api/threads/#start-thread-from-message) and [Start thread](/http-api/threads/#start-thread) record it on their thread entries. [Create forum tag](/http-api/forums/#create-forum-tag), [Modify forum tag](/http-api/forums/#modify-forum-tag), and [Delete forum tag](/http-api/forums/#delete-forum-tag) record it on their channel update entries.+Each new entry is also sent as [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create) to sessions with `VIEW_AUDIT_LOG`.-Two operations use a reason from the request body when the header supplies none:--- [Create or replace guild ban](/http-api/guild-moderation/#create-or-replace-guild-ban) uses the body `reason`.-- [Modify guild member](/http-api/guild-members/#modify-guild-member) uses the trimmed `timeout_reason` when the body also has `communication_disabled_until`.--Fluxer never percent-decodes a body reason either. The operation writes the accepted reason onto its entry, returns it as the entry `reason` field, and sends it in the [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create) Dispatch.+## Audit log reason-Fluxer resolves the reason again when it reads an entry. A [MEMBER_BAN_ADD](#audit-actions) entry with a blank stored reason returns the ban `reason` from its change list, and a [MEMBER_UPDATE](#audit-actions) entry with a blank stored reason returns the timeout reason stored with it, when it has one. The result is trimmed, and a blank result is omitted.+A route marked Audit reason accepts the `X-Audit-Log-Reason` header, listed with the [standard request headers](/http-api/#standard-request-headers). The value is trimmed and used as sent, with no percent-decoding. A blank value or one over 512 characters is dropped and the request still succeeds.-:::note[Some operations record no reason at all]-Bot addition, the role Fluxer creates and assigns to a bot it adds with permissions, a message deletion made by [Delete message attachment](/http-api/messages/#delete-message-attachment), and a consolidated bulk deletion entry never have one.-:::+When the header is absent, [Create or replace guild ban](/http-api/guild-moderation/#create-or-replace-guild-ban) uses the body `reason`, and [Modify guild member](/http-api/guild-members/#modify-guild-member) uses `timeout_reason` if the body sets `communication_disabled_until`. Bot additions, message deletions made by [Delete message attachment](/http-api/messages/#delete-message-attachment) and entries made by [message deletion consolidation](#list-guild-audit-logs) never have a reason.## Guild audit log response object-One page of audit history together with the accounts and webhooks it references. Only `audit_log_entries` is paginated.+One page of entries with the users, webhooks and threads they reference.### Structure| Field | Type | Description || --- | --- | --- |-| audit_log_entries<sup>1</sup> | array[[guild audit log entry](#guild-audit-log-entry-object) object] | The page of entries this request returned |-| users<sup>2</sup> | array[[partial user](/http-api/users/#partial-user-object) object] | The accounts the returned entries name |-| webhooks<sup>3</sup> | array[[audit log webhook](#audit-log-webhook-object) object] | The webhooks a returned webhook action targets |-| threads?<sup>4</sup> | array[[thread](/http-api/threads/#thread-object) object] | The threads a returned thread action targets |+| audit_log_entries | array[[guild audit log entry](#guild-audit-log-entry-object) object] | The page of entries |+| users | array[[partial user](/http-api/users/#partial-user-object) object] | The users the entries reference |+| webhooks | array[[audit log webhook](#audit-log-webhook-object) object] | The webhooks that webhook entries target and that still exist |+| threads?<sup>1</sup> | array[[thread](/http-api/threads/#thread-object) object] | The threads that thread entries target and that still exist |-<sup>1</sup> The page ordering is defined by the [query parameters](#query-parameters) of the request that produced it+<sup>1</sup> Present only for a bot and for a user session that declares the [`channel_threads` client capability](/http-api/threads/#client-capability)-<sup>2</sup> Deduplicated by user ID, and a referenced value that is not a snowflake names no account--<sup>3</sup> One object for each distinct webhook that a returned webhook action targets and that still exists, so a deleted webhook resolves to no object--<sup>4</sup> Present only for a bot and for a user session that declares the [`channel_threads` client capability](/http-api/threads/#client-capability). One object for each distinct thread that a returned [thread action](#audit-actions) targets and that still exists--`users` has the actor of every returned entry and each account the entry references:--- `target_id` of every action from [MEMBER_KICK](#audit-actions) through [MEMBER_DISCONNECT](#audit-actions), and of [BOT_ADD](#audit-actions)-- `target_id` of a [channel overwrite action](#audit-actions) whose `options.type` is `1`-- the `owner_id` change `new_value` of [GUILD_UPDATE](#audit-actions)-- the `moderator_id` change `old_value` of [MEMBER_BAN_REMOVE](#audit-actions)-- `options.inviter_id` of [INVITE_DELETE](#audit-actions)-- the `creator_id` change `old_value` of [WEBHOOK_DELETE](#audit-actions), [EMOJI_DELETE](#audit-actions), and [STICKER_DELETE](#audit-actions)--An account that can no longer be resolved is still returned, as the deleted-account representation with the username `DeletedUser`, the discriminator `0000`, the global name `Deleted User`, a null avatar, a null avatar colour, and `flags` of `0`.+`users` has every user an entry was made by or refers to. A deleted user is returned as `DeletedUser`.## Guild audit log entry object-One recorded guild change. An entry is immutable once written, except for a run of message deletion entries, which [List guild audit logs](#list-guild-audit-logs) can replace with a single consolidated entry.+One change to the guild.### Structure| Field | Type | Description || --- | --- | --- |-| id | snowflake | The ID of the entry, whose [snowflake](/snowflakes/) timestamp is the time it was written |-| action_type | integer | [Audit action](#audit-actions) value that identifies the recorded operation |+| id | snowflake | The ID of the entry |+| action_type | integer | The [audit action](#audit-actions) || user_id<sup>1</sup> | snowflake | The ID of the user that did the action || target_id<sup>2</sup> | ?string | The ID of the affected entity |-| reason?<sup>3</sup> | string | The [audit log reason](#audit-log-reason) recorded with the operation |-| options?<sup>4</sup> | [audit log options](#audit-log-options-object) object | The context fields this [audit action](#audit-actions) records |-| changes?<sup>5</sup> | array[[audit log change](#audit-log-change-object) object] | The fields the mutation changed |--<sup>1</sup> Every entry has the acting user ID, and an entry produced by consolidation has the actor of the consolidated run. An entry for a member removal, ban or ban removal made by Fluxer staff has `0`, the Fluxer system user+| reason? | string | The [audit log reason](#audit-log-reason) |+| options? | [audit log options](#audit-log-options-object) object | The options the action records |+| changes? | array[[audit log change](#audit-log-change-object) object] | The fields the action changed |-<sup>2</sup> A decimal snowflake string for every action except [INVITE_CREATE](#audit-actions) and [INVITE_DELETE](#audit-actions), where it is the invite code, and null for [MESSAGE_BULK_DELETE](#audit-actions)+<sup>1</sup> `0`, the system user, when Fluxer made the change itself. That covers a member removal, ban or unban by an instance admin through the [Admin API](/admin-api/), an automatic invite pause and a managed role update-<sup>3</sup> The field is omitted when no non-blank reason resolves as described under [audit log reason](#audit-log-reason), so an entry written by consolidation never has one--<sup>4</sup> The field is omitted when the action recorded no option key that this registry publishes--<sup>5</sup> The field is omitted when the action records no field change, so it is never returned as an empty array--:::note[An entry expires 45 days after the write]-Entries remain available for 45 days. A consolidated entry starts a new 45-day period.-:::+<sup>2</sup> The invite code for [INVITE_CREATE](#audit-actions) and [INVITE_DELETE](#audit-actions), and null for [MESSAGE_BULK_DELETE](#audit-actions)### Example@@ -106,138 +68,102 @@ Entries remain available for 45 days. A consolidated entry starts a new 45-day p## Audit actions-The Value column is the numeric `action_type`, which is also the value the `action_type` query filter accepts. Each description names what `target_id` identifies and which [audit log options](#audit-log-options-object) the action records. The overwrite options are `id`, `type`, `channel_id`, and `role_name`<sup>10</sup>. The invite options are `max_age`, `max_uses`, `temporary`, `channel_id`<sup>7</sup>, and `inviter_id`<sup>7</sup>.+Each value is an `action_type`, and the `action_type` query filter takes the same values. An update or a member move records an entry only when something changed. For GUILD_UPDATE, a change to only `guild_id`, `member_count` or an image width or height records nothing.| Value | Name | Description || --- | --- | --- |-| 1 | GUILD_UPDATE<sup>1</sup> | Guild settings or ownership were changed. `target_id` is the guild, and the action records no options |-| 10 | CHANNEL_CREATE | Guild channel was created. `target_id` is the channel, and the action records `type` |-| 11 | CHANNEL_UPDATE | Guild channel was changed. `target_id` is the channel, and the action records `type` |-| 12 | CHANNEL_DELETE | Guild channel was deleted. `target_id` is the channel, and the action records `type` |-| 13 | CHANNEL_OVERWRITE_CREATE | Channel permission overwrite was created. `target_id` is the role or member, and the action records the overwrite options |-| 14 | CHANNEL_OVERWRITE_UPDATE | Channel permission overwrite was changed. `target_id` is the role or member, and the action records the overwrite options |-| 15 | CHANNEL_OVERWRITE_DELETE | Channel permission overwrite was deleted. `target_id` is the role or member, and the action records the overwrite options |-| 20 | MEMBER_KICK<sup>2</sup> | Member was removed by a moderator. `target_id` is the user, and the action records no options |-| 21 | MEMBER_PRUNE<sup>3</sup> | Inactive members were pruned. `target_id` is nothing, and the action records no options |-| 22 | MEMBER_BAN_ADD | Guild ban was created or replaced. `target_id` is the user, and the action records `delete_message_seconds`<sup>4</sup> |-| 23 | MEMBER_BAN_REMOVE | Guild ban was removed. `target_id` is the user, and the action records no options |-| 24 | MEMBER_UPDATE | Guild member state was changed. `target_id` is the user, and the action records no options |-| 25 | MEMBER_ROLE_UPDATE | One role was added to or removed from a member. `target_id` is the user, and the action records `role_name`<sup>5</sup> |-| 26 | MEMBER_MOVE<sup>6</sup> | Member voice session was moved to another channel. `target_id` is the user, and the action records `channel_id` and `count` |-| 27 | MEMBER_DISCONNECT<sup>6</sup> | Member voice session was disconnected. `target_id` is the user, and the action records `channel_id` and `count` |-| 28 | BOT_ADD | Bot was added to the guild. `target_id` is the user, and the action records `temporary` |-| 30 | ROLE_CREATE | Role was created. `target_id` is the role, and the action records no options |-| 31 | ROLE_UPDATE | Role was changed. `target_id` is the role, and the action records `role_name` |-| 32 | ROLE_DELETE | Role was deleted. `target_id` is the role, and the action records no options |-| 40 | INVITE_CREATE | Invite was created. `target_id` is the invite code, and the action records the invite options |-| 41 | INVITE_UPDATE<sup>8</sup> | Invite was changed. `target_id` is the invite code, and the action records no options |-| 42 | INVITE_DELETE | Invite was deleted. `target_id` is the invite code, and the action records the invite options |-| 50 | WEBHOOK_CREATE<sup>11</sup> | Webhook was created. `target_id` is the webhook, and the action records `channel_id` and `type`<sup>7</sup> |-| 51 | WEBHOOK_UPDATE | Webhook was changed. `target_id` is the webhook, and the action records `channel_id` and `type`<sup>7</sup> |-| 52 | WEBHOOK_DELETE<sup>11</sup> | Webhook was deleted. `target_id` is the webhook, and the action records `channel_id` and `type`<sup>7</sup> |-| 60 | EMOJI_CREATE | Emoji was created. `target_id` is the emoji, and the action records no options |-| 61 | EMOJI_UPDATE | Emoji was changed. `target_id` is the emoji, and the action records no options |-| 62 | EMOJI_DELETE | Emoji was deleted. `target_id` is the emoji, and the action records no options |-| 72 | MESSAGE_DELETE | Single message was deleted. `target_id` is the message, and the action records `channel_id` |-| 73 | MESSAGE_BULK_DELETE<sup>9</sup> | Several messages were deleted in one operation. `target_id` is nothing, and the action records `channel_id` and `count` |-| 74 | MESSAGE_PIN | Message was pinned. `target_id` is the message, and the action records `channel_id` and `message_id` |-| 75 | MESSAGE_UNPIN | Message was unpinned. `target_id` is the message, and the action records `channel_id` and `message_id` |-| 90 | STICKER_CREATE | Sticker was created. `target_id` is the sticker, and the action records no options |-| 91 | STICKER_UPDATE | Sticker was changed. `target_id` is the sticker, and the action records no options |-| 92 | STICKER_DELETE | Sticker was deleted. `target_id` is the sticker, and the action records no options |-| 110 | THREAD_CREATE | Thread was created. `target_id` is the thread, and the action records no options |-| 111 | THREAD_UPDATE | Thread was changed. `target_id` is the thread, and the action records `type` |-| 112 | THREAD_DELETE | Thread was deleted. `target_id` is the thread, and the action records `type` |--<sup>1</sup> Recorded by [Modify guild](/http-api/guilds/#modify-guild), by [Modify guild custom invite URL](/http-api/guilds/#modify-guild-custom-invite-url), and by [Transfer guild ownership](/http-api/guild-members/#transfer-guild-ownership), and `target_id` is the guild in every case--<sup>2</sup> A kick entry is always recorded with no change list, so the removed membership state is not published through the entry--<sup>3</sup> The value is defined by the wire contract and is accepted by the `action_type` filter, and no current guild operation records it--<sup>4</sup> The option is recorded when the resolved message deletion window of the ban is positive. An older ban entry can have the deprecated `delete_member_days` option--<sup>5</sup> Recorded when the role exists at the write. The role ID is the difference between the `roles` change values in the [guild member change fields](#guild-member-change-fields)--<sup>6</sup> `count` is always `1`, and `channel_id` is the destination channel for a move and the vacated channel for a disconnect. A move into the channel the session already occupies records no entry--<sup>7</sup> The option is recorded only when the recorded entity has that value, so an invite with no channel or no inviter records neither, and a webhook with no channel records no option at all--<sup>8</sup> The filter accepts this value, and no current guild operation records this action--<sup>9</sup> A bulk deletion entry is recorded either by a bulk message deletion operation or by the consolidation described under [List guild audit logs](#list-guild-audit-logs)--<sup>10</sup> Recorded for an overwrite whose target is a role other than `@everyone`, when that role exists at the write--<sup>11</sup> [Follow announcement channel](/http-api/channels/#follow-announcement-channel) records `WEBHOOK_CREATE` in the following guild with `type` `2`, and deleting that webhook records `WEBHOOK_DELETE` the same way. Follower webhooks that Fluxer removes because the announcement channel was deleted or converted record no entry--Deleting a text, announcement, forum, or media channel deletes its threads and records only [CHANNEL_DELETE](#audit-actions). [Delete thread](/http-api/threads/#delete-thread) records `THREAD_DELETE`. Fluxer records [THREAD_UPDATE](#audit-actions) only when a [thread change field](#thread-change-fields) differs.--:::note[An update that changes nothing records no entry]-GUILD_UPDATE, CHANNEL_UPDATE, CHANNEL_OVERWRITE_UPDATE, MEMBER_UPDATE, MEMBER_ROLE_UPDATE, MEMBER_MOVE, ROLE_UPDATE, WEBHOOK_UPDATE, EMOJI_UPDATE, and STICKER_UPDATE need a change other than `ip`. GUILD_UPDATE also ignores `guild_id`, `member_count`, and the image width and height fields. A reason alone records nothing.-:::+| 1 | GUILD_UPDATE | Guild settings, custom invite URL or ownership changed. `target_id` is the guild |+| 10 | CHANNEL_CREATE | Channel created. `target_id` is the channel and the option is `type` |+| 11 | CHANNEL_UPDATE | Channel changed. `target_id` is the channel and the option is `type` |+| 12 | CHANNEL_DELETE | Channel deleted. `target_id` is the channel and the option is `type` |+| 13 | CHANNEL_OVERWRITE_CREATE<sup>1</sup> | Permission overwrite created. `target_id` is the role or member |+| 14 | CHANNEL_OVERWRITE_UPDATE<sup>1</sup> | Permission overwrite changed. `target_id` is the role or member |+| 15 | CHANNEL_OVERWRITE_DELETE<sup>1</sup> | Permission overwrite deleted. `target_id` is the role or member |+| 20 | MEMBER_KICK | Member removed by a moderator. `target_id` is the user |+| 21 | MEMBER_PRUNE<sup>2</sup> | Inactive members pruned |+| 22 | MEMBER_BAN_ADD | Ban created or replaced. `target_id` is the user and the option is `delete_message_seconds` |+| 23 | MEMBER_BAN_REMOVE | Ban removed. `target_id` is the user |+| 24 | MEMBER_UPDATE | Member changed. `target_id` is the user |+| 25 | MEMBER_ROLE_UPDATE | One role added to or removed from a member. `target_id` is the user and the option is `role_name` |+| 26 | MEMBER_MOVE<sup>3</sup> | Member moved to another voice channel. `target_id` is the user |+| 27 | MEMBER_DISCONNECT<sup>3</sup> | Member disconnected from voice. `target_id` is the user |+| 28 | BOT_ADD | Bot added. `target_id` is the user and the option is `temporary` |+| 30 | ROLE_CREATE | Role created. `target_id` is the role |+| 31 | ROLE_UPDATE | Role changed. `target_id` is the role and the option is `role_name` |+| 32 | ROLE_DELETE | Role deleted. `target_id` is the role |+| 40 | INVITE_CREATE<sup>4</sup> | Invite created. `target_id` is the invite code |+| 41 | INVITE_UPDATE<sup>2</sup> | Invite changed. `target_id` is the invite code |+| 42 | INVITE_DELETE<sup>4</sup> | Invite deleted. `target_id` is the invite code |+| 50 | WEBHOOK_CREATE<sup>5</sup> | Webhook created. `target_id` is the webhook and the options are `channel_id` and `type` |+| 51 | WEBHOOK_UPDATE | Webhook changed. `target_id` is the webhook and the options are `channel_id` and `type` |+| 52 | WEBHOOK_DELETE<sup>5</sup> | Webhook deleted. `target_id` is the webhook and the options are `channel_id` and `type` |+| 60 | EMOJI_CREATE | Emoji created. `target_id` is the emoji |+| 61 | EMOJI_UPDATE | Emoji changed. `target_id` is the emoji |+| 62 | EMOJI_DELETE | Emoji deleted. `target_id` is the emoji |+| 72 | MESSAGE_DELETE | Message deleted. `target_id` is the message and the option is `channel_id` |+| 73 | MESSAGE_BULK_DELETE | Messages deleted together. `target_id` is null and the options are `channel_id` and `count` |+| 74 | MESSAGE_PIN | Message pinned. `target_id` is the message and the options are `channel_id` and `message_id` |+| 75 | MESSAGE_UNPIN | Message unpinned. `target_id` is the message and the options are `channel_id` and `message_id` |+| 90 | STICKER_CREATE | Sticker created. `target_id` is the sticker |+| 91 | STICKER_UPDATE | Sticker changed. `target_id` is the sticker |+| 92 | STICKER_DELETE | Sticker deleted. `target_id` is the sticker |+| 110 | THREAD_CREATE | Thread created. `target_id` is the thread |+| 111 | THREAD_UPDATE | Thread changed. `target_id` is the thread and the option is `type` |+| 112 | THREAD_DELETE | Thread deleted. `target_id` is the thread and the option is `type` |++<sup>1</sup> The options are `id`, `type`, `channel_id` and `role_name`, and `role_name` is recorded only for a role other than `@everyone`++<sup>2</sup> Never recorded. The filter still accepts it++<sup>3</sup> The options are `channel_id` and `count`, and `count` is always `1`. `channel_id` is the new channel for a move and the channel the member left for a disconnect++<sup>4</sup> The options are `max_age`, `max_uses`, `temporary`, `channel_id` and `inviter_id`, and the last two are recorded only when the invite has them++<sup>5</sup> [Follow announcement channel](/http-api/channels/#follow-announcement-channel) records these in the guild that follows the channel, with `type` `2`++Deleting a channel deletes its threads and records only CHANNEL_DELETE.## Audit log options object-Every field is present only for the actions listed against it in the [audit actions](#audit-actions) registry. Only the keys in this registry are published, and the response omits `options` entirely when an entry recorded none of them.+An action records only the options listed for it in [audit actions](#audit-actions), and `options` is omitted when it has none.### Structure| Field | Type | Description || --- | --- | --- |-| channel_id | string | The decimal ID of the channel the action concerns |-| count<sup>1</sup> | number | The number of entities the action affected |-| delete_member_days<sup>2</sup> | string | The whole days of the banned member's messages the ban deleted |-| delete_message_seconds<sup>3</sup> | number | The seconds of the banned member's messages the ban deleted |-| id | string | The decimal ID of the role or member an overwrite applies to |-| integration_type<sup>4</sup> | number | The type of the integration the entry names |-| message_id | string | The decimal ID of the single message the action concerns |-| members_removed<sup>4</sup> | number | The number of memberships the action removed |-| role_name<sup>5</sup> | string | The name of the role the action concerns, as it was when the entry was written |-| type<sup>6</sup> | number | The channel type, the permission overwrite type, or the webhook type |-| inviter_id | string | The decimal ID of the user that created the invite |-| max_age | number | The configured invite lifetime in seconds |-| max_uses | number | The configured maximum use count |-| temporary | boolean | Whether the recorded entity is temporary |-| uses<sup>4</sup> | number | The invite use count recorded with the action |--<sup>1</sup> The value is the length of the consolidated run for [MESSAGE_BULK_DELETE](#audit-actions) and is always `1` for the voice actions--<sup>2</sup> Deprecated, and present only on a ban entry recorded before `delete_message_seconds`. Its value is the legacy `delete_message_days` body field of [Create or replace guild ban](/http-api/guild-moderation/#create-or-replace-guild-ban), so a ban that sent only `delete_message_seconds` has `"0"`--<sup>3</sup> Present when the resolved deletion window of [Create or replace guild ban](/http-api/guild-moderation/#create-or-replace-guild-ban) is positive, whichever body field set it--<sup>4</sup> The field is defined by the wire contract and no current guild operation records it--<sup>5</sup> Recorded by [MEMBER_ROLE_UPDATE](#audit-actions), [ROLE_UPDATE](#audit-actions), and an overwrite action whose target is a role other than `@everyone`--<sup>6</sup> The value is a [channel type](/http-api/channels/#channel-types) for the channel and thread actions, a [permission overwrite type](/http-api/channels/#permission-overwrite-types) for the overwrite actions, and a [webhook type](/http-api/webhooks/#webhook-types) for the webhook actions+| channel_id | string | The ID of the channel the action concerns |+| count | number | The number of entities the action affected |+| delete_member_days<sup>1</sup> | string | The whole days of messages a ban deleted |+| delete_message_seconds | number | The seconds of messages a ban deleted, present when positive |+| id | string | The ID of the role or member an overwrite applies to |+| integration_type<sup>2</sup> | number | The type of the integration |+| inviter_id | string | The ID of the user that created the invite |+| max_age | number | The invite lifetime in seconds |+| max_uses | number | The maximum use count of the invite |+| members_removed<sup>2</sup> | number | The number of memberships the action removed |+| message_id | string | The ID of the message the action concerns |+| role_name | string | The name of the role when the entry was written |+| temporary | boolean | Whether the invite or bot membership is temporary |+| type | number | The channel type, permission overwrite type or webhook type |+| uses<sup>2</sup> | number | The use count of the invite |++<sup>1</sup> Present only on older ban entries, which have no `delete_message_seconds`++<sup>2</sup> Never recorded## Audit log change object-One field a mutation changed, with the value on each side of the change.+One field an action changed. A creation has only `new_value`, a deletion has only `old_value`, and a modification has both.### Structure| Field | Type | Description || --- | --- | --- |-| key<sup>1</sup> | string | The name of the field that changed, drawn from the [change fields](#change-fields) of the entity the action targets |-| old_value?<sup>2</sup> | audit log change value | The value the field held before the mutation |-| new_value?<sup>2</sup> | audit log change value | The value the field holds after the mutation |--<sup>1</sup> A change whose key is `ip` is never published through this resource, and `changes` is omitted entirely when no other change remains--<sup>2</sup> A creation has only `new_value`, a deletion has only `old_value`, and a modification has both, so a change object always has at least one of the two--A change value is a string, a JSON number, a boolean, `null`, an array of strings, an array of numbers, or an object with `added` and `removed` string arrays. The last shape comes only from the [permissions_diff](#guild-role-change-fields) key of a role modification. The `available_tags` and `default_reaction_emoji` [channel change fields](#channel-change-fields) record an array of objects and an object.--:::note[A 64-bit domain value is a decimal string]-Fluxer serialises a permission mask or a snowflake as a decimal string. A bounded number such as a position or a colour remains a JSON number.-:::+| key | string | The name of the field that changed, from the [change fields](#change-fields) of the target |+| old_value? | audit log change value | The value before the change |+| new_value? | audit log change value | The value after the change |-:::caution[A change list holds only the differing fields]-An update records one change object per differing field, so an unchanged field is absent. The field that holds the entity's own ID, such as `channel_id` or `role_id`, never appears in an update change list, though it does appear in a creation or deletion list, where only one side of the comparison exists.-:::+A change value is a string, number, boolean, null, an array of strings or numbers, or an object with `added` and `removed` string arrays. Permission masks and snowflakes are decimal strings. An update lists only the fields that differ.### Change fields@@ -247,66 +173,60 @@ Recorded by [GUILD_UPDATE](#audit-actions).| Field | Type | Description || --- | --- | --- |-| guild_id<sup>1</sup> | string | The decimal ID of the guild itself |-| name | string | The name the guild was given by this change (1-100 characters) |-| owner_id | string | The decimal ID of the guild owner |-| vanity_url_code | ?string | The configured custom invite code, or null when the guild has none |-| icon_hash | ?string | The guild icon hash, or null when the guild has no icon |-| banner_hash | ?string | The guild banner hash, or null when the guild has no banner |-| banner_width | ?number | The guild banner width in pixels, or null when the guild has no banner |-| banner_height | ?number | The guild banner height in pixels, or null when the guild has no banner |-| splash_hash | ?string | The guild splash hash, or null when the guild has no splash |-| splash_width | ?number | The guild splash width in pixels, or null when the guild has no splash |-| splash_height | ?number | The guild splash height in pixels, or null when the guild has no splash |-| splash_card_alignment | number | The [splash card alignment](/http-api/guilds/#splash-card-alignments) recorded with the change |-| embed_splash_hash | ?string | The guild embed splash hash, or null when the guild has no embed splash |-| embed_splash_width | ?number | The guild embed splash width in pixels, or null when the guild has no embed splash |-| embed_splash_height | ?number | The guild embed splash height in pixels, or null when the guild has no embed splash |-| features<sup>2</sup> | array[string] | The [guild features](/http-api/guilds/#guild-features) held at this side of the change, in ascending order |-| verification_level | number | The [verification level](/http-api/guilds/#verification-levels) recorded with the change |-| mfa_level | number | The [MFA level](/http-api/guilds/#mfa-levels) recorded with the change |-| nsfw_level | number | The [NSFW level](/http-api/guilds/#nsfw-levels) recorded with the change |+| guild_id | string | The ID of the guild |+| name | string | The name of the guild (1-100 characters) |+| owner_id | string | The ID of the guild owner |+| vanity_url_code | ?string | The custom invite code |+| icon_hash | ?string | The guild icon hash |+| banner_hash | ?string | The guild banner hash |+| banner_width | ?number | The guild banner width in pixels |+| banner_height | ?number | The guild banner height in pixels |+| splash_hash | ?string | The guild splash hash |+| splash_width | ?number | The guild splash width in pixels |+| splash_height | ?number | The guild splash height in pixels |+| splash_card_alignment | number | The [splash card alignment](/http-api/guilds/#splash-card-alignments) |+| embed_splash_hash | ?string | The guild embed splash hash |+| embed_splash_width | ?number | The guild embed splash width in pixels |+| embed_splash_height | ?number | The guild embed splash height in pixels |+| features | array[string] | The [guild features](/http-api/guilds/#guild-features) sorted |+| verification_level | number | The [verification level](/http-api/guilds/#verification-levels) |+| mfa_level | number | The [MFA level](/http-api/guilds/#mfa-levels) |+| nsfw_level | number | The [NSFW level](/http-api/guilds/#nsfw-levels) || nsfw | boolean | Whether the guild is marked age restricted |-| content_warning_level | number | The [guild content warning level](/http-api/guilds/#guild-content-warning-levels) recorded with the change |-| content_warning_text | ?string | The configured content warning text, or null when the guild sets none |-| explicit_content_filter | number | The [guild explicit content filter level](/http-api/guilds/#guild-explicit-content-filter-levels) recorded with the change |-| default_message_notifications | number | The [default message notification level](/http-api/guilds/#default-message-notification-levels) recorded with the change |-| system_channel_id | ?string | The decimal ID of the configured system channel, or null when the guild sets none |-| system_channel_flags | number | The [system channel flags](/http-api/guilds/#system-channel-flags) mask recorded with the change |-| rules_channel_id<sup>3</sup> | ?string | The decimal ID of the configured rules channel, or null when the guild sets none |-| afk_channel_id | ?string | The decimal ID of the configured AFK voice channel, or null when the guild sets none |+| content_warning_level | number | The [guild content warning level](/http-api/guilds/#guild-content-warning-levels) |+| content_warning_text | ?string | The content warning text |+| explicit_content_filter | number | The [guild explicit content filter level](/http-api/guilds/#guild-explicit-content-filter-levels) |+| default_message_notifications | number | The [default message notification level](/http-api/guilds/#default-message-notification-levels) |+| system_channel_id | ?string | The ID of the system channel |+| system_channel_flags | number | The [system channel flags](/http-api/guilds/#system-channel-flags) mask |+| rules_channel_id<sup>1</sup> | ?string | The ID of the rules channel |+| afk_channel_id | ?string | The ID of the AFK voice channel || afk_timeout | number | The AFK timeout in seconds |-| disabled_operations<sup>3</sup> | number | The [disabled guild operations](/http-api/guilds/#disabled-guild-operations) mask recorded with the change |-| member_count<sup>3</sup> | number | The member count recorded with the mutation |-| message_history_cutoff | ?ISO8601 timestamp | The configured message history cutoff, or null when the guild sets none |+| disabled_operations<sup>1</sup> | number | The [disabled guild operations](/http-api/guilds/#disabled-guild-operations) mask |+| member_count<sup>1</sup> | number | The member count |+| message_history_cutoff | ?ISO8601 timestamp | The message history cutoff |-<sup>1</sup> The field holds the same value on both sides of every guild action, so it never produces a change object--<sup>2</sup> A change object appears only when a feature was added or removed--<sup>3</sup> No current guild operation records the field--[Modify guild](/http-api/guilds/#modify-guild) records every field in this table except `guild_id`, `owner_id`, `vanity_url_code`, `rules_channel_id`, `disabled_operations`, and `member_count`. [Transfer guild ownership](/http-api/guild-members/#transfer-guild-ownership) records only `owner_id`, and [Modify guild custom invite URL](/http-api/guilds/#modify-guild-custom-invite-url) records only `vanity_url_code`.+<sup>1</sup> Never recorded#### Channel change fields-Recorded by [CHANNEL_CREATE](#audit-actions), [CHANNEL_UPDATE](#audit-actions), and [CHANNEL_DELETE](#audit-actions).+Recorded by [CHANNEL_CREATE](#audit-actions), [CHANNEL_UPDATE](#audit-actions) and [CHANNEL_DELETE](#audit-actions).| Field | Type | Description || --- | --- | --- |-| channel_id | string | The decimal ID of the channel itself |-| type | number | The [channel type](/http-api/channels/#channel-types) recorded with the change |-| name | ?string | The name the channel was given by this change |-| topic | ?string | The topic the channel was given by this change, or null when it has none |-| url<sup>1</sup> | ?string | The destination URL of the channel, or null when it has none |-| parent_id | ?string | The decimal ID of the parent category, or null when the channel sits at the top level |+| channel_id | string | The ID of the channel |+| type | number | The [channel type](/http-api/channels/#channel-types) |+| name | ?string | The name of the channel |+| topic | ?string | The topic of the channel |+| url<sup>1</sup> | ?string | The destination URL of the channel |+| parent_id | ?string | The ID of the parent category, or null for a top-level channel || position | number | The position of the channel among its siblings || nsfw | ?boolean | Whether the channel is marked age restricted, or null when it has no override |-| content_warning_level | number | The [content warning level](/http-api/channels/#content-warning-levels) recorded with the change |-| content_warning_text | ?string | The configured content warning text, or null when the channel sets none |+| content_warning_level | number | The [content warning level](/http-api/channels/#content-warning-levels) |+| content_warning_text | ?string | The content warning text || rate_limit_per_user | number | The slowmode interval in seconds |-| user_limit | ?number | The configured voice occupancy limit |-| voice_connection_limit | ?number | The configured per-user voice connection limit |+| user_limit | ?number | The voice occupancy limit |+| voice_connection_limit | ?number | The per-user voice connection limit || bitrate | ?number | The voice bitrate in bits per second || rtc_region | ?string | The pinned voice region, or null when the channel is routed automatically || rtc_p2p | boolean | Whether the channel is pinned to peer-to-peer voice |@@ -322,17 +242,13 @@ Recorded by [CHANNEL_CREATE](#audit-actions), [CHANNEL_UPDATE](#audit-actions),<sup>1</sup> Recorded only for a `GUILD_LINK` [channel type](/http-api/channels/#channel-types)-<sup>2</sup> No current channel operation records the field. An individual overwrite mutation records its own [permission overwrite](#permission-overwrite-change-fields) entry--<sup>3</sup> Recorded only by [CHANNEL_CREATE](#audit-actions) and [CHANNEL_UPDATE](#audit-actions), and only for a channel that stores thread or forum settings. No value is null+<sup>2</sup> Never recorded. Each overwrite change gets its own [permission overwrite](#permission-overwrite-change-fields) entry-`default_auto_archive_duration` and `default_thread_rate_limit_per_user` apply to a guild text, announcement, forum, or media channel. `default_forum_layout` applies to a forum channel. `flags`, `available_tags`, `default_reaction_emoji`, `default_sort_order`, and `default_tag_setting` apply to a forum or media channel.--Changing `permission_overwrites` through [Modify channel](/http-api/channels/#modify-channel) records overwrite entries and adds no change to the [CHANNEL_UPDATE](#audit-actions) entry.+<sup>3</sup> Recorded only by [CHANNEL_CREATE](#audit-actions) and [CHANNEL_UPDATE](#audit-actions), for channels with thread or forum settings#### Thread change fields-Recorded by [THREAD_CREATE](#audit-actions), [THREAD_UPDATE](#audit-actions), and [THREAD_DELETE](#audit-actions).+Recorded by [THREAD_CREATE](#audit-actions), [THREAD_UPDATE](#audit-actions) and [THREAD_DELETE](#audit-actions).| Field | Type | Description || --- | --- | --- |@@ -343,8 +259,8 @@ Recorded by [THREAD_CREATE](#audit-actions), [THREAD_UPDATE](#audit-actions), an| auto_archive_duration | number | The [auto archive duration](/http-api/threads/#auto-archive-durations) in minutes || rate_limit_per_user | number | The slowmode interval in seconds || flags | number | The [channel flags](/http-api/forums/#channel-flags) of the thread |-| invitable<sup>1</sup> | boolean | Whether a member who is not a thread moderator can add members who are not thread moderators |-| applied_tags<sup>2</sup> | array[string] | The decimal IDs of the applied [forum tags](/http-api/forums/#forum-tag-object) |+| invitable<sup>1</sup> | boolean | Whether members who are not thread moderators can add people to the thread |+| applied_tags<sup>2</sup> | array[string] | The IDs of the applied [forum tags](/http-api/forums/#forum-tag-object) |<sup>1</sup> Recorded only for a private thread@@ -352,14 +268,14 @@ Recorded by [THREAD_CREATE](#audit-actions), [THREAD_UPDATE](#audit-actions), an#### Permission overwrite change fields-Recorded by the [channel overwrite actions](#audit-actions). Every value in this family is a string.+Recorded by [CHANNEL_OVERWRITE_CREATE](#audit-actions), [CHANNEL_OVERWRITE_UPDATE](#audit-actions) and [CHANNEL_OVERWRITE_DELETE](#audit-actions), and every value is a string.| Field | Type | Description || --- | --- | --- |-| id | string | The decimal ID of the role or member the overwrite applies to |-| type | string | The decimal [permission overwrite type](/http-api/channels/#permission-overwrite-types) |-| allow | string | The decimal [permission](/http-api/permissions/) mask the overwrite grants |-| deny | string | The decimal [permission](/http-api/permissions/) mask the overwrite denies |+| id | string | The ID of the role or member the overwrite applies to |+| type | string | The [permission overwrite type](/http-api/channels/#permission-overwrite-types) |+| allow | string | The [permission](/http-api/permissions/) mask the overwrite grants |+| deny | string | The [permission](/http-api/permissions/) mask the overwrite denies |#### Guild member change fields@@ -367,14 +283,14 @@ Recorded by [MEMBER_UPDATE](#audit-actions) and [MEMBER_ROLE_UPDATE](#audit-acti| Field | Type | Description || --- | --- | --- |-| user_id | string | The decimal ID of the member itself |-| nick | ?string | The nickname the member holds in this guild, or null when none is set |-| roles | array[string] | The assigned role IDs as decimal strings, in ascending string order |-| avatar_hash | ?string | The guild avatar hash, or null when the member has no guild avatar |-| banner_hash | ?string | The guild banner hash, or null when the member has no guild banner |-| bio | ?string | The guild profile bio, or null when none is set |-| pronouns | ?string | The guild profile pronouns, or null when none is set |-| accent_color | ?number | The guild profile accent colour, or null when none is set |+| user_id | string | The ID of the member |+| nick | ?string | The member's nickname in this guild |+| roles | array[string] | The role IDs of the member, sorted |+| avatar_hash | ?string | The guild avatar hash |+| banner_hash | ?string | The guild banner hash |+| bio | ?string | The guild profile bio |+| pronouns | ?string | The guild profile pronouns |+| accent_color | ?number | The guild profile accent color || deaf | boolean | Whether a moderator has deafened the member || mute | boolean | Whether a moderator has muted the member || communication_disabled_until | ?ISO8601 timestamp | The time the communication restriction expires, or null when the member is not restricted |@@ -386,9 +302,9 @@ Recorded by [MEMBER_MOVE](#audit-actions) and [MEMBER_DISCONNECT](#audit-actions| Field | Type | Description || --- | --- | --- |-| channel_id<sup>1</sup> | string | The decimal ID of the voice channel the session occupied |+| channel_id<sup>1</sup> | string | The ID of the voice channel |-<sup>1</sup> A move records the previous channel as `old_value` and the destination as `new_value`, while a disconnect records only `old_value`+<sup>1</sup> A move has the previous channel as `old_value` and the destination as `new_value`, and a disconnect has only `old_value`#### Guild ban change fields@@ -396,39 +312,33 @@ Recorded by [MEMBER_BAN_ADD](#audit-actions) and [MEMBER_BAN_REMOVE](#audit-acti| Field | Type | Description || --- | --- | --- |-| user_id | string | The decimal ID of the banned user |-| moderator_id | string | The decimal ID of the user that issued the ban |+| user_id | string | The ID of the banned user |+| moderator_id | string | The ID of the user that issued the ban || banned_at | ISO8601 timestamp | The time the ban was issued || expires_at | ?ISO8601 timestamp | The expiry of a temporary ban, or null for a permanent ban || reason<sup>1</sup> | ?string | The stored [ban](/http-api/guild-moderation/#guild-ban-object) reason |-<sup>1</sup> The body `reason` when the request sent one, and the `X-Audit-Log-Reason` value otherwise. The entry `reason` is the header when one was sent, so the two differ when a request sends both with different values+<sup>1</sup> The reason stored on the ban, which is the body `reason` or, without one, the `X-Audit-Log-Reason` value#### Guild role change fields-Recorded by [ROLE_CREATE](#audit-actions), [ROLE_UPDATE](#audit-actions), and [ROLE_DELETE](#audit-actions).+Recorded by [ROLE_CREATE](#audit-actions), [ROLE_UPDATE](#audit-actions) and [ROLE_DELETE](#audit-actions).| Field | Type | Description || --- | --- | --- |-| role_id | string | The decimal ID of the role itself |-| name | string | The name the role was given by this change (1-100 characters) |-| permissions | string | The decimal [permission](/http-api/permissions/) mask the role grants |+| role_id | string | The ID of the role |+| name | string | The name of the role (1-100 characters) |+| permissions | string | The [permission](/http-api/permissions/) mask the role grants || position | number | The position of the role in the guild hierarchy |-| hoist_position | ?number | The separate hoisting position, or null when the role has none |-| color | number | The colour recorded for the role |-| icon_hash | ?string | The role icon hash, or null when the role has no icon |-| unicode_emoji | ?string | The role Unicode emoji, or null when the role has none |+| hoist_position | ?number | The member list position of the role, or null when it uses `position` |+| color | number | The role color as an integer |+| icon_hash | ?string | The role icon hash |+| unicode_emoji | ?string | The role Unicode emoji || hoist | boolean | Whether the role is displayed separately || mentionable | boolean | Whether the role is mentionable || permissions_diff<sup>1</sup> | object | The permission names this change added and removed |-<sup>1</sup> Recorded only by [Modify guild role](/http-api/permissions/#modify-guild-role), and only when the mask changed. The value is an object with `added` and `removed` string arrays of permission names--`permissions_diff` arrives as `new_value` with no `old_value`, and the same change list still has the `permissions` change.--[Modify guild role positions](/http-api/permissions/#modify-guild-role-positions) records one [ROLE_UPDATE](#audit-actions) entry for each role that moved, with only the `position` change. Fluxer orders the roles other than `@everyone` by `position` descending, then by ID ascending, before and after the write. The largest set of roles that keep their relative order counts as unmoved, and where several sets qualify, the set whose roles come earliest in the new order is used. A request that only renumbers positions records no entry.--[Modify role hoist positions](/http-api/permissions/#modify-role-hoist-positions) and [Reset role hoist positions](/http-api/permissions/#reset-role-hoist-positions) apply the same rule to the member list order, with only the `hoist_position` change in each entry. That order is the hoisted roles other than `@everyone`, by `hoist_position` descending with `position` used when a role has no hoist position, then by ID ascending. A role that is not hoisted has an entry whenever its `hoist_position` changed.+<sup>1</sup> Recorded only by [Modify guild role](/http-api/permissions/#modify-guild-role) when the mask changed, as `new_value` with no `old_value`#### Invite change fields@@ -437,130 +347,94 @@ Recorded by [INVITE_CREATE](#audit-actions) and [INVITE_DELETE](#audit-actions).| Field | Type | Description || --- | --- | --- || code | string | The code that identifies the invite |-| channel_id | ?string | The decimal ID of the channel the invite points at |-| guild_id | ?string | The decimal ID of the guild the invite belongs to |-| inviter_id | ?string | The decimal ID of the user that created the invite |-| uses | number | The use count recorded with the change |-| max_uses | number | The configured maximum use count |-| max_age | number | The configured invite lifetime in seconds |+| channel_id | ?string | The ID of the channel the invite points at |+| guild_id | ?string | The ID of the guild the invite belongs to |+| inviter_id | ?string | The ID of the user that created the invite |+| uses | number | The use count |+| max_uses | number | The maximum use count |+| max_age | number | The invite lifetime in seconds || temporary | boolean | Whether accepting the invite grants a temporary membership || created_at | ISO8601 timestamp | The time the invite was created |#### Webhook change fields-Recorded by [WEBHOOK_CREATE](#audit-actions), [WEBHOOK_UPDATE](#audit-actions), and [WEBHOOK_DELETE](#audit-actions).+Recorded by [WEBHOOK_CREATE](#audit-actions), [WEBHOOK_UPDATE](#audit-actions) and [WEBHOOK_DELETE](#audit-actions).| Field | Type | Description || --- | --- | --- |-| id | string | The decimal ID of the webhook itself |-| guild_id | ?string | The decimal ID of the guild the webhook belongs to |-| channel_id | ?string | The decimal ID of the channel the webhook posts to |+| id | string | The ID of the webhook |+| guild_id | ?string | The ID of the guild the webhook belongs to |+| channel_id | ?string | The ID of the channel the webhook posts to || name | string | The name the webhook posts under (1-80 characters) |-| creator_id | ?string | The decimal ID of the user that created the webhook |-| avatar_hash | ?string | The webhook avatar hash, or null when no avatar is set |-| type<sup>1</sup> | number | The kind of webhook the change recorded |--<sup>1</sup> The value is 1 for an incoming webhook and 2 for a channel follower webhook+| creator_id | ?string | The ID of the user that created the webhook |+| avatar_hash | ?string | The webhook avatar hash |+| type | number | The [webhook type](/http-api/webhooks/#webhook-types) |#### Emoji change fields-Recorded by [EMOJI_CREATE](#audit-actions), [EMOJI_UPDATE](#audit-actions), and [EMOJI_DELETE](#audit-actions).+Recorded by [EMOJI_CREATE](#audit-actions), [EMOJI_UPDATE](#audit-actions) and [EMOJI_DELETE](#audit-actions).| Field | Type | Description || --- | --- | --- |-| emoji_id | string | The decimal ID of the emoji itself |-| name | string | The name the emoji was given by this change (2-32 characters) |+| emoji_id | string | The ID of the emoji |+| name | string | The name of the emoji (2-32 characters) || animated | boolean | Whether the emoji is animated |-| creator_id | string | The decimal ID of the user that created the emoji |+| creator_id | string | The ID of the user that created the emoji |#### Sticker change fields-Recorded by [STICKER_CREATE](#audit-actions), [STICKER_UPDATE](#audit-actions), and [STICKER_DELETE](#audit-actions).+Recorded by [STICKER_CREATE](#audit-actions), [STICKER_UPDATE](#audit-actions) and [STICKER_DELETE](#audit-actions).| Field | Type | Description || --- | --- | --- |-| sticker_id | string | The decimal ID of the sticker itself |-| name | string | The name the sticker was given by this change (2-30 characters) |-| description | ?string | The sticker description, or null when it has none |+| sticker_id | string | The ID of the sticker |+| name | string | The name of the sticker (2-30 characters) |+| description | ?string | The sticker description || animated | boolean | Whether the sticker is animated |-| creator_id | string | The decimal ID of the user that created the sticker |+| creator_id | string | The ID of the user that created the sticker |## Audit log webhook object-A reduced [webhook object](/http-api/webhooks/#webhook-object). It omits the execution token, application ID, and creating user, and it names the avatar hash `avatar_hash` where the full object names it `avatar`.+A reduced [webhook object](/http-api/webhooks/#webhook-object) without the token, application ID and creator, and with `avatar_hash` in place of `avatar`.### Structure| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the webhook |-| type<sup>1</sup> | integer | The kind of webhook this record describes |+| type | integer | The [webhook type](/http-api/webhooks/#webhook-types) || guild_id | ?snowflake | The ID of the guild containing the webhook || channel_id | ?snowflake | The ID of the channel the webhook sends messages to || name | string | The name the webhook posts under |-| avatar_hash | ?string | The avatar hash of the webhook, or null when no avatar is set |--<sup>1</sup> The value is 1 for an incoming webhook and 2 for a channel follower webhook+| avatar_hash | ?string | The avatar hash of the webhook |## List guild audit logs<RouteHeader method="GET" path="/v1/guilds/{guild_id}/audit-logs" bot />-Returns one page of guild audit history as a [guild audit log response](#guild-audit-log-response-object) object. Requires [VIEW_AUDIT_LOG](/http-api/permissions/) in the target guild, and no MFA elevation applies.--A guild ID that names no guild returns 404 `UNKNOWN_GUILD`. A non-member of an existing guild returns 403 `MISSING_PERMISSIONS`, so guild existence is visible to any authenticated caller.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild whose audit log is read |+Returns one page of audit history as a [guild audit log response](#guild-audit-log-response-object) object, newest first. You need `VIEW_AUDIT_LOG`.### Query parameters| Field | Type | Description || --- | --- | --- |-| limit?<sup>1</sup> | integer | The maximum number of entries to return (0-100, default 50) |-| before?<sup>2</sup> | snowflake | The cursor selecting entries older than this audit entry ID |-| after?<sup>2</sup> | snowflake | The cursor selecting entries newer than this audit entry ID |-| user_id?<sup>3</sup> | snowflake | The acting user ID the page is filtered by |-| action_type?<sup>3</sup> <sup>4</sup> | integer | The [audit action](#audit-actions) value the page is filtered by |--<sup>1</sup> A negative value and a value above 100 are both rejected, and the accepted value `0` is processed as `1`--<sup>2</sup> The cursors are mutually exclusive, and supplying both returns 400 `INVALID_FORM_BODY` with [`CANNOT_SPECIFY_BOTH_BEFORE_AND_AFTER`](/http-api/errors/#validation-error-codes) against `before`--<sup>3</sup> Supplying either filter disables message deletion consolidation for the request, so a page filtered by actor or action returns the unconsolidated entries--<sup>4</sup> A caller other than a bot or a user session that declares `channel_threads` receives 400 `INVALID_FORM_BODY` for 110, 111, or 112--The read is ordered from newest to oldest by entry ID. `before` selects entries below the cursor and `after` selects entries above it, both read in that same descending order. An `after` page therefore begins with the newest entry above the cursor.+| limit? | integer | The maximum number of entries to return (0-100, default 50) |+| before? | snowflake | Returns entries older than this entry ID |+| after? | snowflake | Returns entries newer than this entry ID |+| user_id? | snowflake | Returns only entries made by this user |+| action_type? | integer | Returns only entries with this [audit action](#audit-actions) |-Consolidated entries have new IDs but retain the position of the run they replace. Sort the page by ID if a strictly descending array is required.+Two or more [MESSAGE_DELETE](#audit-actions) entries in a row by the same user in the same channel are replaced by one [MESSAGE_BULK_DELETE](#audit-actions) entry with a new ID and a `count`. This happens within about a minute of the deletions, and again on any read without `user_id` or `action_type`.-A caller other than a bot or a user session that declares `channel_threads` receives no entry about a thread, a forum channel, or a media channel. Its remaining entries lose the thread and forum keys of the [channel change fields](#channel-change-fields) and every [thread permission bit](/http-api/threads/#thread-permissions). The `webhooks` array also omits each webhook of a forum or media channel.--A stored update entry that fails the [no-change rule](#audit-actions) is skipped and does not count towards `limit`. A page holds fewer entries than `limit` only when the guild has no further matching entries in that direction.+A user session without the [`channel_threads` capability](/http-api/threads/#client-capability) gets no entries about threads, forum channels or media channels, and filtering by actions 110 to 112 returns 400.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [guild audit log response](#guild-audit-log-response-object) object | Page was returned |-| 400 | [error response](/http-api/#error-response) | Both cursors were supplied, or a filter value is invalid |-| 403<sup>1</sup> | [error response](/http-api/#error-response) | Guild is unavailable, or `VIEW_AUDIT_LOG` is absent |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |--<sup>1</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` for a guild with [UNAVAILABLE_FOR_EVERYONE](/http-api/guilds/#guild-features), or [UNAVAILABLE_FOR_EVERYONE_BUT_STAFF](/http-api/guilds/#guild-features) without the instance staff flag, and `MISSING_PERMISSIONS` otherwise--:::caution[An unfiltered read consolidates message deletion entries]-Without `user_id` or `action_type`, runs of two or more consecutive [MESSAGE_DELETE](#audit-actions) entries sharing one actor and one channel become a single [MESSAGE_BULK_DELETE](#audit-actions) entry.-:::--### Side effects--A consolidated entry has a new ID, `options.count` equal to the number of replaced entries and no reason. It emits [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create) to guild sessions holding `VIEW_AUDIT_LOG`.--### Rate limit+| 200 | [guild audit log response](#guild-audit-log-response-object) object | The page was returned |+| 400 | [error response](/http-api/#error-response) | `CANNOT_SPECIFY_BOTH_BEFORE_AND_AFTER` when both cursors are sent, or a filter value is invalid |+| 403 | [error response](/http-api/#error-response) | You lack `VIEW_AUDIT_LOG` |+| 404 | [error response](/http-api/#error-response) | The guild does not exist |-20 requests per 10 seconds for each authenticated user and guild ID, on the `guild:audit_logs::guild_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `guild:audit_logs::guild_id` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/guild-channels.mdx b/fluxer_docs/src/content/docs/http-api/guild-channels.mdxindex a8197310b..729263dc5 100644--- a/fluxer_docs/src/content/docs/http-api/guild-channels.mdx+++ b/fluxer_docs/src/content/docs/http-api/guild-channels.mdx@@ -1,72 +1,45 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Guild channels-description: Guild channel types, creation, and bulk hierarchy repositioning.+description: Lists, creates and reorders the channels in a guild.---import RouteHeader from '@/components/RouteHeader.astro';-A guild channel is one of the rooms a guild is divided into, including the categories that group them. The operations here list, create, and reorder a guild's channels, and the [Channels resource](/http-api/channels/) defines the channel object and every per-channel operation.--## Access rules--Every operation here returns 404 `UNKNOWN_GUILD` for a guild that does not exist. A caller who is not a member of an existing guild receives 403 `MISSING_PERMISSIONS`.--A request whose path names a guild that has [UNAVAILABLE_FOR_EVERYONE](/http-api/guilds/#guild-features) is refused with 403 `MISSING_ACCESS` before the operation runs.+A guild channel is a channel or category in a guild. These endpoints list, create and reorder them. [Channels](/http-api/channels/) has the channel object and the endpoints for a single channel.## Guild channel types-These are the [channel types](/http-api/channels/#channel-types) [Create guild channel](#create-guild-channel) accepts in `type`. A guild also holds threads, which the [Threads resource](/http-api/threads/) creates.+[Create guild channel](#create-guild-channel) accepts these [channel types](/http-api/channels/#channel-types) in `type`. [Threads](/http-api/threads/) are created separately.| Value | Name | Description || --- | --- | --- |-| 0 | GUILD_TEXT | Text channel that has messages and slowmode |-| 2 | GUILD_VOICE | Voice channel that has messages, voice sessions, and Go Live streams |-| 5 | GUILD_ANNOUNCEMENT | Text channel whose messages can be [published](/topics/announcement-channels/) to the channels that follow it |-| 4 | GUILD_CATEGORY | Category that groups other guild channels and supplies inherited permission overwrites |-| 998 | GUILD_LINK | Channel whose only content is an external destination URL |-| 15 | GUILD_FORUM<sup>1</sup> | Guild channel that holds [posts](/http-api/forums/) and no messages of its own |+| 0 | GUILD_TEXT | Text channel with messages and slowmode |+| 2 | GUILD_VOICE | Voice channel with messages, voice sessions and streams |+| 4 | GUILD_CATEGORY | Category that groups channels and gives them inherited permission overwrites |+| 5 | GUILD_ANNOUNCEMENT | Text channel whose messages can be [published](/topics/announcement-channels/) to following channels |+| 15 | GUILD_FORUM<sup>1</sup> | Channel that has [posts](/http-api/forums/) and no messages of its own || 16 | GUILD_MEDIA<sup>1</sup> | [Forum channel](/http-api/forums/) that can [hide media download options](/http-api/forums/#channel-flags) |+| 998 | GUILD_LINK | Channel whose only content is an external URL |-<sup>1</sup> Accepted only from a bot or a user session that declares the [`channel_threads` client capability](/http-api/threads/#client-capability). Any other caller receives 400 `INVALID_FORM_BODY`+<sup>1</sup> Accepted only from a bot or a session that declares the [`channel_threads` client capability](/http-api/threads/#client-capability). Any other caller gets 400 `INVALID_FORM_BODY`## Create permission overwrite object-The initial overwrite collection supplied when a channel is created. The stored form returned afterwards is the [permission overwrite object](/http-api/channels/#permission-overwrite-object).+You send these in `permission_overwrites` when you create a channel. Later reads return the [permission overwrite object](/http-api/channels/#permission-overwrite-object).### Structure| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the role or member the overwrite targets |-| type<sup>1</sup> | integer | [Permission overwrite type](/http-api/channels/#permission-overwrite-types) |-| allow?<sup>2</sup> | decimal string | The [permission](/http-api/permissions/) bits the overwrite grants (default 0) |-| deny?<sup>2</sup> | decimal string | The [permission](/http-api/permissions/) bits the overwrite removes (default 0) |--<sup>1</sup> Required. `0` names a role and `1` names a member, and no other value is accepted--<sup>2</sup> A decimal string of at most 9223372036854775807, or a JSON integer of at most 9007199254740991. Null is rejected--A larger decimal string returns 400 `INVALID_FORM_BODY` with the code `INTEGER_OUT_OF_INT64_RANGE`. A JSON number outside the safe integer range returns `INVALID_INTEGER_FORMAT`, and so does a string that is not all digits.--A bit that names no defined permission never fails the authority comparison described by [Create guild channel](#create-guild-channel). It is stored as supplied and echoed back by every later read of the channel.--A bit set in both masks resolves to an allow during [permission computation](/http-api/permissions/#permission-computation).--### Example--```json-{- "id": "1501314428688998182",- "type": 0,- "allow": "1024",- "deny": "2048"-}-```+| type | integer | [Permission overwrite type](/http-api/channels/#permission-overwrite-types), `0` for a role and `1` for a member |+| allow? | decimal string | The [permission](/http-api/permissions/) bits the overwrite grants (default 0) |+| deny? | decimal string | The [permission](/http-api/permissions/) bits the overwrite removes (default 0) |## Channel position object-One entry of the bulk hierarchy update. Entries are applied in array order, each against the result of the previous one.+One entry in the body of [Modify guild channel positions](#modify-guild-channel-positions). The API applies entries in array order.### Structure@@ -75,226 +48,126 @@ One entry of the bulk hierarchy update. Entries are applied in array order, each| id | snowflake | The ID of the channel to move || position?<sup>1</sup> | integer | Index among the destination siblings (minimum 0) || parent_id?<sup>2</sup> | ?snowflake | New parent category, or null to move the channel to the guild root |-| preceding_sibling_id?<sup>3</sup> | ?snowflake | Sibling that sits directly before this channel, or null to place it first |-| lock_permissions?<sup>4</sup> | boolean | Whether to copy the destination category's overwrites onto the moved channel (default false) |--<sup>1</sup> Read only when `preceding_sibling_id` is omitted. When `preceding_sibling_id` is sent, including as null, Fluxer ignores `position`--<sup>2</sup> An omitted field keeps the channel's current parent. A category given any parent is refused with `CATEGORIES_CANNOT_HAVE_PARENTS`+| preceding_sibling_id?<sup>3</sup> | ?snowflake | Sibling directly before this channel, or null to place it first |+| lock_permissions?<sup>4</sup> | boolean | Whether to copy the destination category's overwrites onto the channel (default false) |-<sup>3</sup> A preceding sibling must share the destination parent, so a category is valid here only when the moved channel's destination is the guild root+<sup>1</sup> Used only when `preceding_sibling_id` is omitted. A `position` past the last sibling places the channel last. With neither field, a voice channel goes last and any other channel goes before the first voice channel-<sup>4</sup> The copy runs only when the same entry also moves the channel into a category, and it replaces the moved channel's overwrites+<sup>2</sup> An omitted field keeps the current parent. A category can't have a parent-A `position` beyond the destination's last sibling places the channel last. Omitting both `position` and `preceding_sibling_id` places a voice channel last and any other channel directly before the first voice sibling.+<sup>3</sup> Must share the destination parent. A category as sibling places the channel after it and its children-Naming a category as the preceding sibling places the moved channel after that category and after every channel already inside it.+<sup>4</sup> Applies only when the same entry moves the channel into a category, and replaces the channel's overwrites### Example```json-{- "id": "1501314428688998182",- "parent_id": "1501314428688998100",- "preceding_sibling_id": null,- "lock_permissions": true-}+[+ {+ "id": "1501314428688998182",+ "parent_id": "1501314428688998100",+ "preceding_sibling_id": null,+ "lock_permissions": true+ }+]```## List guild channels<RouteHeader method="GET" path="/v1/guilds/{guild_id}/channels" bot />-Returns every [channel object](/http-api/channels/#channel-object) in the guild that the authenticated member can see. Membership is the only requirement.--Fluxer evaluates [channel visibility](/http-api/permissions/#permission-computation) per channel. A channel is included when the member holds [VIEW_CHANNEL](/http-api/permissions/) in it, or when the member holds temporary access to it through a voice transition. A forum or media channel is included only for a bot or a user session that declares `channel_threads`, and no thread is included. A category is included when at least one child grants the member `VIEW_CHANNEL`. A member with no visible channel receives an empty array.--:::note[Every visible channel arrives in one body]-The route accepts no limit and no cursor. Each entry is a complete channel object whose `permission_overwrites` array is always present and always complete.-:::--A guild holds at most the instance-configured `max_guild_channels` [limit](/http-api/instance/#limit-keys), which defaults to 500. A thread does not count towards this limit or towards `max_channels_per_category`. [Thread lifecycle](/http-api/threads/#thread-lifecycle) states the active thread limit.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns the [channel objects](/http-api/channels/#channel-object) you can see in the guild, with no pagination. You need to be a member, or a [visitor](/http-api/guilds/#visiting-guilds), who gets only the channels @everyone can view, each with only its @everyone overwrite. A category is included when you can see at least one channel in it. Forum and media channels are included only for a caller with `channel_threads`, and threads are never included.### Response| Status | Body | Condition || --- | --- | --- || 200 | array[[channel](/http-api/channels/#channel-object) object] | Visible channels were returned |-| 403 | [error response](/http-api/#error-response) | Caller is not a member of the guild, returning `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Guild does not exist, returning `UNKNOWN_GUILD` |--### Rate limit-60 requests per 10 seconds for each authenticated user and guild ID, on the `guild:channels:list::guild_id` bucket.+The rate limit is 60 requests per 10 seconds, on the `guild:channels:list::guild_id` bucket.## Create guild channel<RouteHeader method="POST" path="/v1/guilds/{guild_id}/channels" bot auditReason mfa />-Creates a guild channel and returns its [channel object](/http-api/channels/#channel-object) with status 200. Requires [MANAGE_CHANNELS](/http-api/permissions/) in the parent category when `parent_id` is supplied, and at guild level otherwise. Emits a [Channel Create](/gateway/events/#channel-create) Gateway event.--### Limitations--- Supplying `permission_overwrites` also requires [MANAGE_ROLES](/http-api/permissions/) in the same context.-- Both permissions resolve through the parent category's overwrites. A category overwrite that allows one grants it for that category only, and a category overwrite that denies one blocks a caller who holds it at guild level.--`MANAGE_CHANNELS` is an [elevated permission](/http-api/permissions/#elevated-permissions). It also requires an enrolled multi-factor authenticator when the guild [MFA level](/http-api/guilds/#mfa-levels) is elevated and the caller is not the guild owner.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Creates a channel and returns its [channel object](/http-api/channels/#channel-object). You need [MANAGE_CHANNELS](/http-api/permissions/) in the parent category when you send `parent_id`, and in the guild otherwise. To send `permission_overwrites` you also need [MANAGE_ROLES](/http-api/permissions/) there and every bit you allow. Fluxer sends [Channel Create](/gateway/events/#channel-create) to sessions that can view the channel.### JSON body-`type` is required and decides which kind of channel is created. Every type accepts the field set below. A field that has no meaning for the selected type is accepted and ignored. A forum channel also accepts every field of the [forum field table](/http-api/forums/#creating-and-modifying-a-forum). A media channel accepts every field of the [forum field table](/http-api/forums/#creating-and-modifying-a-forum) except `default_forum_layout`.+A forum channel also accepts every field of the [forum field table](/http-api/forums/#creating-and-modifying-a-forum). A media channel accepts every field of that [table](/http-api/forums/#creating-and-modifying-a-forum) except `default_forum_layout`. Fields that don't apply to the channel type are ignored.| Field | Type | Description || --- | --- | --- || type | integer | [Guild channel type](#guild-channel-types) |-| name<sup>1</sup><sup>2</sup> | string | Channel name (1-100 characters after normalisation) |+| name<sup>1</sup> | string | Channel name (1-100 characters after normalization) || topic? | ?string | Channel topic (1-1024 characters, or 1-4096 for a forum or media channel) |-| url?<sup>3</sup> | ?string | Destination URL for a link channel |-| parent_id?<sup>4</sup> | ?snowflake | Parent category |-| bitrate?<sup>5</sup><sup>11</sup> | ?integer | Voice channel bitrate in bits per second (8000-384000, default 64000) |-| user_limit?<sup>5</sup><sup>6</sup> | ?integer | Voice channel occupancy limit (0-99, default 0) |-| voice_connection_limit?<sup>5</sup> | ?integer | Simultaneous voice connections permitted for one user in a voice channel (1-100, default 5) |+| url?<sup>2</sup> | ?string | Destination URL for a link channel |+| parent_id?<sup>3</sup> | ?snowflake | Parent category |+| bitrate?<sup>4</sup> | ?integer | Voice channel bitrate in bits per second (8000-384000, default 64000) |+| user_limit? | ?integer | Voice channel occupancy limit (0-99, default 0 for no limit) |+| voice_connection_limit? | ?integer | Simultaneous voice connections for one user in a voice channel (1-100, default 5) || rate_limit_per_user? | ?integer | Slowmode interval in seconds (0-21600, default 0) |-| permission_overwrites?<sup>7</sup> | array[[create permission overwrite](#create-permission-overwrite-object) object] | Complete initial overwrite collection |-| nsfw?<sup>8</sup> | boolean | Legacy age restriction for this channel (default false) |-| nsfw_override?<sup>8</sup> | ?boolean | Explicit age restriction, or null to inherit from the parent category and then the guild |-| content_warning_level?<sup>9</sup> | integer | [Content warning level](/http-api/channels/#content-warning-levels) (default 0) |-| content_warning_text?<sup>10</sup> | ?string | Content warning text (max 200 characters), or null to inherit |-| default_auto_archive_duration?<sup>12</sup> | ?integer | The stored default [auto archive duration](/http-api/threads/#auto-archive-durations), which Fluxer does not apply to a new thread, or null to clear it |-| default_thread_rate_limit_per_user?<sup>12</sup> | ?integer | The slowmode interval in seconds new threads inherit (0-21,600), or null to clear it |+| permission_overwrites?<sup>5</sup> | array[[create permission overwrite](#create-permission-overwrite-object) object] | Complete initial overwrite collection |+| nsfw?<sup>6</sup> | boolean | `true` turns on the age restriction, and `false` inherits it |+| nsfw_override?<sup>6</sup> | ?boolean | Explicit age restriction, or null to inherit from the parent category and then the guild |+| content_warning_level?<sup>7</sup> | integer | [Content warning level](/http-api/channels/#content-warning-levels) (default 0) |+| content_warning_text? | ?string | Content warning text (max 200 characters), or null to inherit |+| default_auto_archive_duration?<sup>8</sup> | ?integer | The default [auto archive duration](/http-api/threads/#auto-archive-durations), or null for none |+| default_thread_rate_limit_per_user?<sup>8</sup> | ?integer | The slowmode interval in seconds new threads inherit (0-21600), or null for none |-<sup>1</sup> Normalisation strips control, join, bidirectional, and tag code points, collapses whitespace runs to one space, and trims. An empty result is rejected with `NAME_EMPTY_AFTER_NORMALIZATION`+<sup>1</sup> Control characters are stripped and whitespace is collapsed. A text, announcement, forum or media channel name is also lowercased, with hyphens for spaces and ASCII punctuation other than `-`, `.` and `_` removed, unless the guild has [TEXT_CHANNEL_FLEXIBLE_NAMES](/http-api/guilds/#guild-features). An empty result returns `NAME_EMPTY_AFTER_NORMALIZATION`-<sup>2</sup> A text, announcement, forum, or media channel name is also lowercased, its whitespace replaced with hyphens, and ASCII punctuation other than `-`, `.`, and `_` removed, unless the guild has [TEXT_CHANNEL_FLEXIBLE_NAMES](/http-api/guilds/#guild-features). That pass rewrites the stored name and never fails the request+<sup>2</sup> An `http` or `https` URL of at most 2048 characters with no credentials-<sup>3</sup> An `http` or `https` URL of at most 2048 characters with a host and no embedded credentials. It is stored for every channel type+<sup>3</sup> Must be a category in the same guild, or the request returns `INVALID_PARENT_CHANNEL` or `PARENT_MUST_BE_CATEGORY`. Sending `parent_id` when creating a category returns `CATEGORIES_CANNOT_HAVE_PARENTS`-<sup>4</sup> Names a category in the same guild. A category cannot be given a parent+<sup>4</sup> The bitrate is capped at 96000 unless the guild has an [audio bitrate feature](/http-api/guilds/#guild-features)-<sup>5</sup> Stored only for the voice variant, where the stated default applies when the field is omitted or null, and discarded for every other type+<sup>5</sup> When omitted, a channel in a category copies that category's overwrites. A present field, even an empty array, replaces them-<sup>6</sup> The value `0` means no occupancy limit+<sup>6</sup> When you send both, `nsfw_override` is used. Omitting both inherits from the parent category and then the guild-<sup>7</sup> When omitted, a new channel with a parent category copies that category's current overwrites. A present field replaces that inheritance completely, including with an empty array. Null is rejected+<sup>7</sup> `1` turns the warning on. Any other value stores `0`, which inherits the warning from the parent category and the guild-<sup>8</sup> `nsfw_override` takes precedence, and `nsfw` supplies the value only when `nsfw_override` is absent. Omitting both stores an explicit `false`, and only a null `nsfw_override` inherits+<sup>8</sup> Text, announcement, forum and media channels only, from a caller with `channel_threads`-<sup>9</sup> The value `1` enables the warning on this channel. Every other accepted value stores `0` and inherits from the parent category and then the guild+The [limit keys](/http-api/instance/#limit-keys) `max_guild_channels` and `max_channels_per_category` cap the channels in a guild and in one category.-<sup>10</sup> The value is trimmed, and an empty result is stored as null--<sup>11</sup> The stored value is capped at 96000 unless the guild holds an [audio bitrate feature](/http-api/guilds/#guild-features). A higher value is stored at the cap--<sup>12</sup> Stored only for a text, announcement, forum, or media channel. Fluxer discards both fields from a caller other than a bot or a user session that declares `channel_threads`--A value longer than 10000 characters is rejected with `STRING_LENGTH_INVALID` before normalisation runs. A parent that does not exist in this guild returns `INVALID_PARENT_CHANNEL`, and one that is not a category returns `PARENT_MUST_BE_CATEGORY`.--The guild holds at most the instance-configured `max_guild_channels` [limit](/http-api/instance/#limit-keys), defaulting to 500, and a parent category holds at most `max_channels_per_category`, defaulting to 50. Reaching the guild limit returns 400 `MAX_GUILD_CHANNELS` and reaching the category limit returns 400 `MAX_CATEGORY_CHANNELS`. Each error message states the resolved limit. The new channel is created with no RTC region.--The new channel takes a position derived from its siblings. A category, and a channel created with no parent, is placed after the highest position in the guild. A voice channel created inside a category is placed after the last voice sibling, or after the last text, announcement, link, forum, or media sibling when the category holds no voice channel. Any other channel is placed after the last text, announcement, link, forum, or media sibling, and a channel with no such sibling is placed directly after the category itself. The rest of the guild is not renumbered. Two channels can hold the same stored position until the next [hierarchy update](#modify-guild-channel-positions) renumbers them.--:::caution[Overwrites are checked against the parent category]-Fluxer compares the allowed bits of every supplied overwrite against the caller's effective permissions in the parent category, or in the guild when no parent is supplied. A bit the caller does not hold there fails the entire request with 403 `MISSING_PERMISSIONS`.-:::--Only the allowed mask is compared, so a supplied deny is stored without any authority check. A caller holding `ADMINISTRATOR` in that context holds every bit, and every requested bit passes.+In a category, a new voice channel goes last and any other channel goes after the text channels. Outside a category, the new channel goes last.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [channel](/http-api/channels/#channel-object) object | Channel was created |-| 400<sup>1</sup><sup>2</sup> | [error response](/http-api/#error-response) | Body, type, name, parent, URL, voice setting, or content warning text is invalid, a channel limit is reached, or the caller has no enrolled authenticator in an elevated-MFA guild |-| 403 | [error response](/http-api/#error-response) | Caller is not a member of the guild, lacks `MANAGE_CHANNELS` in the parent category or in the guild when no parent is supplied, supplied overwrites without `MANAGE_ROLES` in that context, or allowed a permission they do not hold there, each returning `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Guild does not exist, returning `UNKNOWN_GUILD` |--<sup>1</sup> A schema or parent failure returns `INVALID_FORM_BODY` and names the field with `CATEGORIES_CANNOT_HAVE_PARENTS`, `INVALID_PARENT_CHANNEL`, or `PARENT_MUST_BE_CATEGORY`. A capacity failure returns the top-level `MAX_GUILD_CHANNELS` or `MAX_CATEGORY_CHANNELS`+| 200 | [channel](/http-api/channels/#channel-object) object | The channel was created |+| 400 | [error response](/http-api/#error-response) | `MAX_GUILD_CHANNELS` or `MAX_CATEGORY_CHANNELS` when a limit is hit, or `TWO_FACTOR_REQUIRED` (see [MFA level](/http-api/guilds/#mfa-levels)) |+| 403 | [error response](/http-api/#error-response) | You lack a required permission, returning `MISSING_PERMISSIONS` |-<sup>2</sup> The missing-authenticator code is `TWO_FACTOR_REQUIRED`, returned only after `MANAGE_CHANNELS` has been confirmed, so a caller without the permission receives 403 instead--### Side effects--The operation consumes one guild channel slot and, when a parent is supplied, one slot in that category. It creates a [`CHANNEL_CREATE`](/http-api/guild-audit-logs/#audit-actions) guild audit log entry with the supplied reason, plus one [`CHANNEL_OVERWRITE_CREATE`](/http-api/guild-audit-logs/#audit-actions) entry for every stored overwrite, whether that overwrite was supplied or inherited. Reaching either channel limit fails the request without consuming a slot.--It emits [Channel Create](/gateway/events/#channel-create) with the complete channel object only to sessions that can view the new channel. For a forum or media channel the event reaches only a session with [thread access](/gateway/threads/#session-flag).--### Rate limit--10 requests per minute for each authenticated user and guild ID, on the `guild:channel:create::guild_id` bucket.+The rate limit is 10 requests per minute, on the `guild:channel:create::guild_id` bucket.## Modify guild channel positions<RouteHeader method="PATCH" path="/v1/guilds/{guild_id}/channels" bot mfa />-Applies a guild channel hierarchy update and returns 204 with an empty body. Requires [MANAGE_CHANNELS](/http-api/permissions/) at guild level. Emits one [Channel Update Bulk](/gateway/events/#channel-update-bulk) Gateway event for each entry that changes the order.--### Limitations--- Setting `lock_permissions` on an entry that changes the parent also requires [MANAGE_ROLES](/http-api/permissions/) in the moved channel.-- The operation records no guild audit log entry, so an `X-Audit-Log-Reason` header has no effect.--`MANAGE_CHANNELS` is an [elevated permission](/http-api/permissions/#elevated-permissions). It also requires an enrolled multi-factor authenticator when the guild [MFA level](/http-api/guilds/#mfa-levels) is elevated and the caller is not the guild owner.--Concurrent hierarchy updates to the same guild can return 423 [`GENERAL_ERROR`](/http-api/errors/) with a `Retry-After` header of two seconds.--An unknown channel, parent or sibling rejects the entire request. Fluxer applies entries one at a time. When a later entry fails a check after that existence check, including the `lock_permissions` authority check, every earlier entry stays applied. Moving a category moves its children with it, and neither the category nor its children count as destination siblings.--After a move, positions run consecutively from 1 across the guild. Each category is followed by its children, with voice channels last.--:::note[A move can change other channels' positions]-Renumbering can change positions of channels not named in the request. An entry that leaves the order unchanged has no effect.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Moves channels and categories and returns 204. You need [MANAGE_CHANNELS](/http-api/permissions/) in the guild. When an entry sets `lock_permissions` and changes the parent, you also need [MANAGE_ROLES](/http-api/permissions/) in the moved channel and every bit the copy adds or removes. Fluxer sends [Channel Update Bulk](/gateway/events/#channel-update-bulk) for each entry that changes the order and writes no audit log entry.### JSON body-The top-level body is an array of [channel position objects](#channel-position-object) of any length, including zero. Every channel, parent, and sibling an entry names must exist in this guild. For a caller other than a bot or a user session that declares `channel_threads`, a forum or media channel counts as absent. Naming one returns the same validation error as an unknown channel. A thread has no position and counts as absent for every caller. A category cannot be given a parent, and a parent that is not a category is refused. A channel cannot be positioned relative to itself or to one of its own children. Moving a channel into a full category is refused with 400 `MAX_CATEGORY_CHANNELS`.--:::caution[Inside a category, voice channels come last]-Placing a voice channel above a text, announcement, link, forum, or media sibling, or placing one of those below a voice sibling, returns `VOICE_CHANNELS_CANNOT_BE_ABOVE_TEXT_CHANNELS`.-:::+The body is an array of [channel position objects](#channel-position-object). For a caller without `channel_threads`, forum and media channels count as missing. Inside a category, voice channels must come after the other channels.-Channels at the guild root are exempt from this restriction.+The API checks that every channel, parent and sibling in the request exists before it moves anything. Other checks run one entry at a time, and a failing entry leaves the entries before it applied. Positions are renumbered from 1, and channels you didn't name can move.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Channel hierarchy was applied |-| 400<sup>1</sup><sup>2</sup> | [error response](/http-api/#error-response) | An entry is structurally invalid, the destination category is full, or the caller has no enrolled authenticator in an elevated-MFA guild |-| 403 | [error response](/http-api/#error-response) | Caller lacks `MANAGE_CHANNELS`, is not a member of the guild, or set `lock_permissions` without sufficient authority in the moved channel, each returning `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Guild does not exist, returning `UNKNOWN_GUILD` |-| 423 | [error response](/http-api/#error-response) | Another hierarchy update to this guild is in progress, returning `GENERAL_ERROR` |--<sup>1</sup> A structural failure returns `INVALID_FORM_BODY` and names the field with `CHANNEL_NOT_FOUND`, `INVALID_CHANNEL_ID`, `INVALID_PARENT_CHANNEL`, `PARENT_MUST_BE_CATEGORY`, `CATEGORIES_CANNOT_HAVE_PARENTS`, `PRECEDING_CHANNEL_MUST_SHARE_PARENT`, `CANNOT_POSITION_CHANNEL_RELATIVE_TO_ITSELF`, or `VOICE_CHANNELS_CANNOT_BE_ABOVE_TEXT_CHANNELS`. A full destination category returns the top-level `MAX_CATEGORY_CHANNELS`--<sup>2</sup> The missing-authenticator code is `TWO_FACTOR_REQUIRED`, returned only after `MANAGE_CHANNELS` has been confirmed, so a caller without the permission receives 403 instead--### Side effects--Each entry that changes the order emits [Channel Update Bulk](/gateway/events/#channel-update-bulk) with the resulting hierarchy filtered to channels each recipient can view.--When `lock_permissions` copies the destination category's overwrites, re-read the moved channel to obtain them. The copy has no Gateway event or audit entry.+| 204 | empty | The hierarchy was applied |+| 400<sup>1</sup> | [error response](/http-api/#error-response) | An entry is invalid, the destination category is full, or two-factor authentication is required |+| 403 | [error response](/http-api/#error-response) | You lack a required permission, returning `MISSING_PERMISSIONS` |+| 423 | [error response](/http-api/#error-response) | `GENERAL_ERROR` when another reorder in this guild is in progress. Retry after the `Retry-After` header |-The copy requires [MANAGE_ROLES](/http-api/permissions/) in the moved channel. The caller must also hold every allow bit the copy adds and every deny bit the copy removes. Insufficient authority returns 403 `MISSING_PERMISSIONS`, but the channel move remains applied.+<sup>1</sup> Field errors are `INVALID_FORM_BODY` with `CHANNEL_NOT_FOUND`, `INVALID_CHANNEL_ID`, `INVALID_PARENT_CHANNEL`, `PARENT_MUST_BE_CATEGORY`, `CATEGORIES_CANNOT_HAVE_PARENTS`, `PRECEDING_CHANNEL_MUST_SHARE_PARENT`, `CANNOT_POSITION_CHANNEL_RELATIVE_TO_ITSELF` or `VOICE_CHANNELS_CANNOT_BE_ABOVE_TEXT_CHANNELS`. A full category returns `MAX_CATEGORY_CHANNELS`, and two-factor authentication returns `TWO_FACTOR_REQUIRED`-### Rate limit+A failed `lock_permissions` copy returns 403 `MISSING_PERMISSIONS` and keeps the move. The copy sends no Gateway event. Re-read the channel to see it.-30 requests per 10 seconds for each authenticated user and guild ID, on the `guild:channel:positions::guild_id` bucket.+The rate limit is 30 requests per 10 seconds, on the `guild:channel:positions::guild_id` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/guild-emojis.mdx b/fluxer_docs/src/content/docs/http-api/guild-emojis.mdxindex f31444226..abba3e0fd 100644--- a/fluxer_docs/src/content/docs/http-api/guild-emojis.mdx+++ b/fluxer_docs/src/content/docs/http-api/guild-emojis.mdx@@ -1,22 +1,16 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Guild emojis-description: Guild emoji objects, uploads, cloning, bulk creation, renaming, and deletion.+description: Guild emoji objects and the routes to list, create, clone, rename and delete them.---import RouteHeader from '@/components/RouteHeader.astro';-An emoji is a custom image that one guild owns. Members use it in messages and reactions, and a forum channel can use it on a tag or as its default reaction. Its ID is a [snowflake](/snowflakes/) that is unique across every guild. [List guild emojis](#list-guild-emojis) is the only guild-scoped read, and [Get emoji metadata](/http-api/expressions/#get-emoji-metadata) resolves a single emoji without membership of its guild.--Every route names a guild in its path. When that guild has [UNAVAILABLE_FOR_EVERYONE](/http-api/guilds/#guild-features), Fluxer rejects the request with 403 `MISSING_ACCESS` before the operation runs. Fluxer does the same for a guild with [UNAVAILABLE_FOR_EVERYONE_BUT_STAFF](/http-api/guilds/#guild-features) when the account has no instance staff flag.--A guild that does not exist returns 404 `UNKNOWN_GUILD`. Fluxer returns 403 `MISSING_PERMISSIONS` to a caller who is not a current member of an existing guild, so guild existence is distinguishable from guild membership. On [Modify guild emoji](#modify-guild-emoji) a non-member receives the same 403 `MISSING_PERMISSIONS`, and a guild that does not exist returns 404 `UNKNOWN_EMOJI`.--Names and uploaded images must pass the instance's content policy. Blocked content returns 403 `CONTENT_BLOCKED`.+A guild emoji is a custom image that one guild owns and its members use in messages and reactions. To look up one emoji without joining its guild, use [Get emoji metadata](/http-api/expressions/#get-emoji-metadata).## Guild emoji object-Only `name` can be changed after creation. The stored image is written once at creation and is never replaced.+An emoji as the API returns it.### Structure@@ -24,12 +18,10 @@ Only `name` can be changed after creation. The stored image is written once at c| --- | --- | --- || id | snowflake | The ID of the emoji || name | string | The name of the emoji (2-32 characters) |-| animated<sup>1</sup> | boolean | Whether the stored image is animated |-| user?<sup>2</sup> | [partial user](/http-api/users/#partial-user-object) object | The account that uploaded the emoji |+| animated | boolean | Whether the image is animated |+| user?<sup>1</sup> | [partial user](/http-api/users/#partial-user-object) object | The account that uploaded the emoji |-<sup>1</sup> Detected from the submitted image at creation, and copied unchanged by [Clone guild emoji](#clone-guild-emoji)--<sup>2</sup> Present only on [List guild emojis](#list-guild-emojis), where it is set for every caller and requires no permission+<sup>1</sup> Only [List guild emojis](#list-guild-emojis) includes it### Example@@ -43,28 +35,16 @@ Only `name` can be changed after creation. The stored image is written once at c## Emoji create object-The image and name submitted for one new emoji.+The name and image for one new emoji.### Structure| Field | Type | Description || --- | --- | --- |-| name<sup>1</sup> | string | The name of the emoji (2-32 characters, ASCII letters, digits, and underscore) |-| image<sup>2</sup> <sup>3</sup> | base64 string | The image to store (at most the resolved `emoji_max_size` limit in decoded bytes, 524288 by default) |--<sup>1</sup> The value is trimmed, and both bounds apply to the trimmed value--<sup>2</sup> A data URL prefix is accepted and everything up to the first comma is removed before any bound applies+| name | string | The name of the emoji (2-32 characters, ASCII letters, digits and underscore) |+| image<sup>1</sup> | base64 string | The emoji image as base64 |-<sup>3</sup> The decoded ceiling is the resolved `emoji_max_size` [limit key](/http-api/instance/#limit-keys) in guild scope, 524288 bytes by default--The remaining encoded part is bounded to 139810136 characters, the base64 expansion of a 104857600 byte image. A longer value returns the validation code `BASE64_LENGTH_INVALID` at the `image` path. A value that is not canonical base64 with correct padding returns `INVALID_BASE64_FORMAT`. An image over the resolved ceiling returns `IMAGE_SIZE_EXCEEDS_LIMIT` at the same path, and `maxSize` is the ceiling that applied.--The character bound does not move with the limit key, so a resolved ceiling above 104857600 bytes admits no more than 104857602 decoded bytes.--Accepted upload formats are PNG, JPEG, WebP, GIF, APNG, AVIF, HEIC, HEIF, JXL, and SVG. Fluxer takes the format and the animation state from the decoded image. An animated AVIF is rejected.--Pixel dimensions are not enforced. An accepted image is stored at its original dimensions and the [Media Proxy image asset contract](/media-proxy/routes/#image-asset-contract) selects the delivered size.+<sup>1</sup> You can include a data URL prefix. The decoded image can be at most the `emoji_max_size` [limit key](/http-api/instance/#limit-keys), 524288 bytes by default. The API accepts PNG, JPEG, WebP, GIF, APNG, AVIF, HEIC, HEIF, JXL and SVG, but not animated AVIF### Example@@ -77,307 +57,160 @@ Pixel dimensions are not enforced. An accepted image is stored at its original d## Emoji bulk create response object-The outcome of one bulk creation, holding one entry for every submitted item.+The result of a bulk create, with each submitted item in either `success` or `failed`.### Structure| Field | Type | Description || --- | --- | --- || success | array[[guild emoji](#guild-emoji-object) object] | The emojis this request created |-| failed | array[[expression creation failure](#expression-creation-failure-object) object] | The items rejected after top-level request validation |--Both arrays are present on every success response, and either can be empty. An item appears in exactly one of them, so the combined length equals the submitted item count.--### Example--```json-{- "success": [{"id": "1501314428688998182", "name": "party_parrot", "animated": true}],- "failed": [{"name": "too_big", "error": "The image is too large."}]-}-```+| failed | array[[expression creation failure](#expression-creation-failure-object) object] | The items Fluxer rejected |## Expression creation failure object-One item a bulk creation rejected, identified only by the name the caller submitted.+One item a bulk creation rejected.### Structure| Field | Type | Description || --- | --- | --- |-| name<sup>1</sup> | string | The name echoed from the submitted item |-| error<sup>2</sup> | string | The failure message rendered for the item |--<sup>1</sup> The object has no index, so two submitted items sharing a name cannot be told apart--<sup>2</sup> Rendered in the locale of the authenticated account, so its value changes with the caller's locale--The failure contains display text, not a machine-readable code. Retry an item through [Create guild emoji](#create-guild-emoji) if a structured error is needed.+| name | string | The name submitted for the item |+| error | string | The failure message, in the account's locale |## List guild emojis<RouteHeader method="GET" path="/v1/guilds/{guild_id}/emojis" bot />-Returns every [guild emoji object](#guild-emoji-object) of the guild, each with `user`. Requires membership of the guild and no permission.--Fluxer returns the complete collection in one response, and the operation has no pagination parameters. An emoji whose uploader cannot be resolved is omitted, so the array can be shorter than the number of stored emojis.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns the guild's [guild emoji objects](#guild-emoji-object), each with the `user` who uploaded it. An emoji whose uploader cannot be resolved is left out. You need to be a member of the guild.### Response| Status | Body | Condition || --- | --- | --- || 200 | array[[guild emoji](#guild-emoji-object) object] | Emojis were returned |-| 403<sup>1</sup> | [error response](/http-api/#error-response) | Guild is unavailable, or the caller is not a member |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |-<sup>1</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` for an unavailable guild and `MISSING_PERMISSIONS` for a non-member--### Rate limit--60 requests per 10 seconds for each authenticated user and guild ID, on the `guild:emojis:list::guild_id` bucket.+The rate limit is 60 requests per 10 seconds, on the `guild:emojis:list::guild_id` bucket.## Create guild emoji<RouteHeader method="POST" path="/v1/guilds/{guild_id}/emojis" bot auditReason />-Creates one emoji from submitted image data and returns its [guild emoji object](#guild-emoji-object) without `user`. Requires membership of the guild and [CREATE_EXPRESSIONS](/http-api/permissions/). Emits a [Guild Emojis Update](/gateway/events/#guild-emojis-update) Gateway event.--The slot limit is the operator-configured [max_guild_emojis](/http-api/instance/#limit-keys) value resolved against the guild's complete feature set, defaulting to 500. A guild with [UNLIMITED_EMOJI](/http-api/guilds/#guild-features) bypasses that configuration and receives a fixed ceiling of 999999.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Creates an emoji and returns its [guild emoji object](#guild-emoji-object). You need [CREATE_EXPRESSIONS](/http-api/permissions/). A guild can have 500 emojis, or the [max_guild_emojis](/http-api/instance/#limit-keys) limit if the instance sets one. A guild with [UNLIMITED_EMOJI](/http-api/guilds/#guild-features) can have 999999.### JSON body-The body is one [emoji create object](#emoji-create-object).+The body is an [emoji create object](#emoji-create-object).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [guild emoji](#guild-emoji-object) object | Emoji was created |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Guild is at its emoji slot limit, or the image is undecodable, oversized, or in an unaccepted format |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | Name is blocked, the guild is unavailable, the caller is not a member or lacks `CREATE_EXPRESSIONS`, or the image hash is banned |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |--<sup>1</sup> The [error code](/http-api/errors/) is `MAX_EMOJIS` for the slot limit, with the resolved limit in its message variables, and `INVALID_FORM_BODY` for an image failure, with `BASE64_LENGTH_INVALID` for an oversized encoding, `IMAGE_SIZE_EXCEEDS_LIMIT` for decoded bytes over the resolved ceiling, or `INVALID_IMAGE_FORMAT` for an undecodable or unaccepted image at the `image` path+| 200 | [guild emoji](#guild-emoji-object) object | The emoji was created |+| 400 | [error response](/http-api/#error-response) | `MAX_EMOJIS` when the guild is full, or `INVALID_FORM_BODY` when the image is too large or in an unsupported format |+| 403 | [error response](/http-api/#error-response) | `CONTENT_BLOCKED` when the name or image is blocked |-<sup>2</sup> The [error code](/http-api/errors/) is `CONTENT_BLOCKED` for a blocked name and for a banned image hash, `MISSING_ACCESS` for an unavailable guild, and `MISSING_PERMISSIONS` for a membership or permission failure+Fluxer sends a [Guild Emojis Update](/gateway/events/#guild-emojis-update) event and records an [`EMOJI_CREATE`](/http-api/guild-audit-logs/#audit-actions) audit entry.-### Side effects--Creating an emoji consumes one guild emoji slot, emits [Guild Emojis Update](/gateway/events/#guild-emojis-update) with the complete collection and records an [`EMOJI_CREATE`](/http-api/guild-audit-logs/#audit-actions) audit entry with the supplied reason.--### Rate limit--10 requests per 30 seconds for each authenticated user and guild ID, on the `guild:emoji:create::guild_id` bucket.+The rate limit is 10 requests per 30 seconds, on the `guild:emoji:create::guild_id` bucket.## Bulk create guild emojis<RouteHeader method="POST" path="/v1/guilds/{guild_id}/emojis/bulk" bot auditReason />-Attempts to create between 1 and 50 emojis in one request and returns an [emoji bulk create response object](#emoji-bulk-create-response-object). Requires membership of the guild and [CREATE_EXPRESSIONS](/http-api/permissions/). Emits one [Guild Emojis Update](/gateway/events/#guild-emojis-update) Gateway event for the whole batch.+Creates several emojis in one request and returns an [emoji bulk create response object](#emoji-bulk-create-response-object). You need [CREATE_EXPRESSIONS](/http-api/permissions/).-Fluxer processes the items strictly in the submitted order and treats each one independently. Once the guild is full, every remaining item fails with the limit. A later item can still succeed after an earlier item failed for any other reason.--An undecodable image, an unaccepted format, and a banned hash each fail one item and leave the rest of the batch to run.--:::caution[200 does not mean every item was created]-The operation returns 200 whenever the top-level request was valid, including when every item failed. Read `success` and `failed` for the per-item outcome. The emojis in `success` are durable and are not rolled back when a later item fails.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+The response is 200 even when every item fails. An item goes into `failed` when the guild is full or the API can't use its image, and the rest of the batch still runs.### JSON body| Field | Type | Description || --- | --- | --- |-| emojis | array[[emoji create object](#emoji-create-object)] | The items to create, attempted in the order supplied (1-50) |+| emojis | array[[emoji create object](#emoji-create-object)] | The emojis to create (1-50) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [emoji bulk create response](#emoji-bulk-create-response-object) object | Every validated item was attempted |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Top-level body, item count, item shape, item name, or encoded image bound is invalid |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | An item name is blocked, the guild is unavailable, or the caller is not a member or lacks `CREATE_EXPRESSIONS` |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |--<sup>1</sup> Boundary validation rejects the whole request, so an oversized encoded image in one item fails before any item is created+| 200 | [emoji bulk create response](#emoji-bulk-create-response-object) object | Fluxer attempted every item |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` when the list is empty or over 50 items, or an item has an invalid name |+| 403 | [error response](/http-api/#error-response) | `CONTENT_BLOCKED` when any item name is blocked, and nothing is created |-<sup>2</sup> The [error code](/http-api/errors/) is `CONTENT_BLOCKED` for a blocked item name, `MISSING_ACCESS` for an unavailable guild, and `MISSING_PERMISSIONS` for a membership or permission failure+Fluxer sends one [Guild Emojis Update](/gateway/events/#guild-emojis-update) event and records an [`EMOJI_CREATE`](/http-api/guild-audit-logs/#audit-actions) audit entry for each created emoji.-One blocked name rejects the whole request without creating any emojis.--### Side effects--Each successful item consumes one guild emoji slot and records an [`EMOJI_CREATE`](/http-api/guild-audit-logs/#audit-actions) audit entry with the supplied reason. If any item succeeds, one [Guild Emojis Update](/gateway/events/#guild-emojis-update) contains the guild's complete emoji collection.--### Rate limit--6 requests per minute for each authenticated user and guild ID, on the `guild:emoji:bulk_create::guild_id` bucket.+The rate limit is 6 requests per minute, on the `guild:emoji:bulk_create::guild_id` bucket.## Clone guild emoji<RouteHeader method="POST" path="/v1/guilds/{guild_id}/emojis/clone" bot auditReason />-Copies an existing emoji into the target guild and returns the new [guild emoji object](#guild-emoji-object) without `user`. Requires membership of the target guild and [CREATE_EXPRESSIONS](/http-api/permissions/) there. Emits a [Guild Emojis Update](/gateway/events/#guild-emojis-update) Gateway event in the target guild.--The name, animation state and image are copied unchanged. Membership of the source guild is not required. The source guild must have [CLONE_EMOJI_ENABLED](/http-api/guilds/#guild-features).--[Get emoji metadata](/http-api/expressions/#get-emoji-metadata) reports whether a source permits cloning.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the target guild |+Copies an emoji from any guild into the guild in the path and returns the new [guild emoji object](#guild-emoji-object), which keeps the source emoji's name. You need [CREATE_EXPRESSIONS](/http-api/permissions/) in the target guild. The source guild needs [CLONE_EMOJI_ENABLED](/http-api/guilds/#guild-features).### JSON body| Field | Type | Description || --- | --- | --- |-| source_emoji_id | snowflake | The ID of the emoji to copy, which can belong to any guild |+| source_emoji_id | snowflake | The ID of the emoji to copy |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [guild emoji](#guild-emoji-object) object | Emoji was cloned |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Target guild is at its emoji slot limit |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | Source guild is missing or does not permit cloning, the target guild is unavailable, or the caller is not a member of the target guild or lacks `CREATE_EXPRESSIONS` there |-| 404<sup>3</sup> | [error response](/http-api/#error-response) | Source emoji or target guild does not exist |--<sup>1</sup> The [error code](/http-api/errors/) is `MAX_EMOJIS`--<sup>2</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` when the source guild is missing or lacks `CLONE_EMOJI_ENABLED` and when the target guild is unavailable, and `MISSING_PERMISSIONS` for a target membership or permission failure+| 200 | [guild emoji](#guild-emoji-object) object | The emoji was cloned |+| 400 | [error response](/http-api/#error-response) | `MAX_EMOJIS` when the target guild is full |+| 403 | [error response](/http-api/#error-response) | `MISSING_ACCESS` when the source guild does not allow cloning |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_EMOJI` when the source emoji does not exist |-<sup>3</sup> The [error code](/http-api/errors/) is `UNKNOWN_EMOJI` for the source emoji and `UNKNOWN_GUILD` for the target guild+Fluxer sends a [Guild Emojis Update](/gateway/events/#guild-emojis-update) event in the target guild and records an [`EMOJI_CREATE`](/http-api/guild-audit-logs/#audit-actions) audit entry.-A source guild that no longer exists returns 403 `MISSING_ACCESS`, so a caller cannot tell it apart from a source guild that does not permit cloning.--### Side effects--The copy consumes one target guild emoji slot and names the caller as uploader. It emits [Guild Emojis Update](/gateway/events/#guild-emojis-update) in the target guild and records an [`EMOJI_CREATE`](/http-api/guild-audit-logs/#audit-actions) audit entry. The source is unchanged.--### Rate limit--10 requests per 30 seconds for each authenticated user and target guild ID, on the `guild:emoji:clone::guild_id` bucket.+The rate limit is 10 requests per 30 seconds, on the `guild:emoji:clone::guild_id` bucket.## Modify guild emoji<RouteHeader method="PATCH" path="/v1/guilds/{guild_id}/emojis/{emoji_id}" bot auditReason />-Renames an emoji and returns its [guild emoji object](#guild-emoji-object) without `user`. Emits a [Guild Emojis Update](/gateway/events/#guild-emojis-update) Gateway event.--### Limitations--- The uploader can rename their own emoji with [CREATE_EXPRESSIONS](/http-api/permissions/).-- Any other caller requires [MANAGE_EXPRESSIONS](/http-api/permissions/).--Neither permission is subject to the guild [MFA level](/http-api/guilds/#mfa-levels).--An emoji that does not belong to the guild in the path returns 404 `UNKNOWN_EMOJI`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |-| emoji_id | snowflake | The ID of the emoji |+Renames an emoji and returns its [guild emoji object](#guild-emoji-object). The uploader needs [CREATE_EXPRESSIONS](/http-api/permissions/) and anyone else needs [MANAGE_EXPRESSIONS](/http-api/permissions/).### JSON body| Field | Type | Description || --- | --- | --- |-| name | string | The new name of the emoji (2-32 characters, ASCII letters, digits, and underscore) |+| name | string | The new name of the emoji (2-32 characters, ASCII letters, digits and underscore) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [guild emoji](#guild-emoji-object) object | Name was set, including a name equal to the current one |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Path parameter or name is invalid |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | Name is blocked, the guild is unavailable, or the caller is neither the uploader with `CREATE_EXPRESSIONS` nor a member holding `MANAGE_EXPRESSIONS` |-| 404 | [error response](/http-api/#error-response) | Emoji does not exist in that guild and the request returns `UNKNOWN_EMOJI` |--<sup>1</sup> The [error code](/http-api/errors/) is `INVALID_FORM_BODY` with `INVALID_SNOWFLAKE_FORMAT` or `SNOWFLAKE_OUT_OF_RANGE` for a path parameter, `STRING_LENGTH_INVALID` for a name outside 2 to 32 characters after normalisation, and `INVALID_FORMAT` for a disallowed character--<sup>2</sup> The [error code](/http-api/errors/) is `CONTENT_BLOCKED` for a blocked name, `MISSING_ACCESS` for an unavailable guild, and `MISSING_PERMISSIONS` for a permission failure+| 200 | [guild emoji](#guild-emoji-object) object | The emoji was renamed |+| 403 | [error response](/http-api/#error-response) | `CONTENT_BLOCKED` when the name is blocked |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_EMOJI` when the emoji is not in this guild |-### Side effects+Fluxer sends a [Guild Emojis Update](/gateway/events/#guild-emojis-update) event and records an [`EMOJI_UPDATE`](/http-api/guild-audit-logs/#audit-actions) audit entry.-The operation sets the requested name, emits [Guild Emojis Update](/gateway/events/#guild-emojis-update) with the guild's complete emoji collection, and then writes an [`EMOJI_UPDATE`](/http-api/guild-audit-logs/#audit-actions) audit entry. A submitted name that equals the current name still emits the Dispatch and records no audit entry.--### Rate limit--20 requests per 10 seconds for each authenticated user and guild ID, on the `guild:emoji:update::guild_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `guild:emoji:update::guild_id` bucket.## Delete guild emoji<RouteHeader method="DELETE" path="/v1/guilds/{guild_id}/emojis/{emoji_id}" bot auditReason />-Deletes the emoji record and returns 204 with an empty body. Emits a [Guild Emojis Update](/gateway/events/#guild-emojis-update) Gateway event.--### Limitations--- The uploader can delete their own emoji with [CREATE_EXPRESSIONS](/http-api/permissions/).-- Any other caller requires [MANAGE_EXPRESSIONS](/http-api/permissions/).--Neither permission is subject to the guild [MFA level](/http-api/guilds/#mfa-levels).--:::caution[A purge cannot be undone through the API]-Without `purge`, the emoji leaves the guild but its image remains available through the [Media Proxy](/media-proxy/routes/#image-asset-contract). With `purge`, the image is scheduled for permanent deletion.-:::--:::note[A clone outlives a purge of its source]-A later purge of the source emoji does not affect an existing clone in another guild.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |-| emoji_id | snowflake | The ID of the emoji |-+Deletes an emoji. The uploader needs [CREATE_EXPRESSIONS](/http-api/permissions/) and anyone else needs [MANAGE_EXPRESSIONS](/http-api/permissions/).### Query parameters| Field | Type | Description || --- | --- | --- |-| purge?<sup>1</sup> | boolean | Whether to permanently delete the stored image (default false) |+| purge? | boolean | Whether to delete the image file too (default false) |-<sup>1</sup> Read as true only when it is exactly `true`, `True`, or `1` after trimming. Every other value, including `TRUE` and `yes`, reads as false+:::caution[Purging cannot be undone]+With `purge`, Fluxer deletes the image file and you can't get it back. Without it, the image stays available through the [Media Proxy](/media-proxy/routes/#image-asset-contract).+:::### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Emoji record was deleted |-| 403<sup>1</sup> | [error response](/http-api/#error-response) | Guild is unavailable or cannot purge expression assets, or the caller is neither the uploader with `CREATE_EXPRESSIONS` nor a member holding `MANAGE_EXPRESSIONS` |-| 404<sup>2</sup> | [error response](/http-api/#error-response) | Guild or emoji does not exist |--<sup>1</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` for an unavailable guild and when `purge` is true and the guild lacks [EXPRESSION_PURGE_ALLOWED](/http-api/guilds/#guild-features), and `MISSING_PERMISSIONS` for a membership or permission failure--<sup>2</sup> The [error code](/http-api/errors/) is `UNKNOWN_GUILD` for the guild and `UNKNOWN_EMOJI` for the emoji--### Side effects--Deletion frees one guild emoji slot, emits [Guild Emojis Update](/gateway/events/#guild-emojis-update) with the remaining collection and records an [`EMOJI_DELETE`](/http-api/guild-audit-logs/#audit-actions) audit entry. Existing messages that reference the emoji are unchanged. A [forum tag](/http-api/forums/#forum-tag-object) or [default reaction](/http-api/forums/#default-reaction-object) that names the emoji keeps its `emoji_id`.+| 204 | empty | The emoji was deleted |+| 403 | [error response](/http-api/#error-response) | `MISSING_ACCESS` when `purge` is true and the guild lacks [EXPRESSION_PURGE_ALLOWED](/http-api/guilds/#guild-features) |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_EMOJI` when the emoji is not in this guild |-### Rate limit+Fluxer sends a [Guild Emojis Update](/gateway/events/#guild-emojis-update) event and records an [`EMOJI_DELETE`](/http-api/guild-audit-logs/#audit-actions) audit entry.-10 requests per 30 seconds for each authenticated user and guild ID, on the `guild:emoji:delete::guild_id` bucket. The route also draws on the `guild:emoji:delete:daily::guild_id` bucket of 300 requests per day for each authenticated user and guild ID.+The rate limit is 10 requests per 30 seconds, on the `guild:emoji:delete::guild_id` bucket. The route also allows 300 requests per day, on the `guild:emoji:delete:daily::guild_id` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/guild-member-search.mdx b/fluxer_docs/src/content/docs/http-api/guild-member-search.mdxindex e3c4b9ca5..263c5f5bc 100644--- a/fluxer_docs/src/content/docs/http-api/guild-member-search.mdx+++ b/fluxer_docs/src/content/docs/http-api/guild-member-search.mdx@@ -1,65 +1,45 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Guild member search-description: Guild member search filters, sorting, pagination and join metadata.+description: Search a guild's members by name, role and how they joined.---import RouteHeader from '@/components/RouteHeader.astro';-Search guild members by name, role and join information. Each match is a [guild member search result](#guild-member-search-result-object) object.--A guild an operator has marked unavailable returns 403 `MISSING_ACCESS` before the route runs.--:::caution[Search results can be stale]-Results can lag membership changes and can include members who have left. Use [Get guild member](/http-api/guild-members/#get-guild-member) when current membership matters.-:::+Search guild members by name, role and join information. Results can lag behind membership changes. [Get guild member](/http-api/guild-members/#get-guild-member) returns the current membership.## Join source types-Fluxer records the reason a membership exists at the moment it creates that membership. The HTTP API defines no operation that rewrites the value.-| Value | Name | Description || --- | --- | --- || 0 | CREATOR | Member created the guild |-| 1 | INSTANT_INVITE | Member joined through an ordinary invite |+| 1 | INSTANT_INVITE | Member joined through an invite || 2 | VANITY_URL | Member joined through the guild vanity URL |-| 3 | BOT_INVITE | Account was added through a bot invite |+| 3 | BOT_INVITE | Member was added through a bot invite || 4 | ADMIN_FORCE_ADD | Instance administrator added the member directly || 6 | DISCOVERY | Member joined through guild discovery |-The value 5 is not assigned.-## Guild member search result object-A matched membership. Account fields appear at the top level rather than under `user` as in the [guild member object](/http-api/guild-members/#guild-member-object).+One matched membership, with the account fields at the top level of the object.### Structure| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | string | The search result identifier, one per membership |-| guild_id | snowflake | The ID of the guild the membership belongs to |-| user_id | snowflake | The ID of the account the membership belongs to |+| id | string | The search result ID, as `{guild_id}_{user_id}` |+| guild_id | snowflake | The ID of the guild |+| user_id | snowflake | The ID of the account || username | string | The username of the account |-| discriminator<sup>2</sup> | string | The four-digit discriminator of the account |-| global_name | ?string | The global display name of the account, or null when none is set |-| nickname<sup>3</sup> | ?string | The nickname of the member in this guild, or null when none is set |-| role_ids<sup>3</sup> <sup>4</sup> | array[snowflake] | The IDs of the roles assigned to the member |-| joined_at<sup>5</sup> | integer | The time at which the account became a member, in Unix seconds |-| supplemental<sup>6</sup> | [guild member search supplemental](#guild-member-search-supplemental-object) object | The join metadata only this search exposes |+| discriminator | string | The four-digit discriminator of the account |+| global_name | ?string | The global display name of the account |+| nickname<sup>1</sup> | ?string | The nickname of the member in this guild |+| role_ids<sup>1</sup> | array[snowflake] | The IDs of the roles assigned to the member, without the everyone role |+| joined_at | integer | The time the account became a member, in Unix seconds |+| supplemental | [guild member search supplemental](#guild-member-search-supplemental-object) object | How the member joined || is_bot | boolean | Whether the account is a bot |-<sup>1</sup> The guild ID and the user ID joined by an underscore, as `{guild_id}_{user_id}`. No other operation accepts it as an identifier--<sup>2</sup> Left-padded with zeroes to four digits--<sup>3</sup> The [guild member object](/http-api/guild-members/#guild-member-object) names these fields `nick` and `roles`, so a client reusing a member renderer must map them--<sup>4</sup> The everyone role is never present--<sup>5</sup> The same unit as the `joined_at_gte` and `joined_at_lte` filters. The [guild member object](/http-api/guild-members/#guild-member-object) reports the same moment as an ISO 8601 timestamp--<sup>6</sup> Always present, with every field inside it null unless the caller holds [MANAGE_GUILD](/http-api/permissions/)+<sup>1</sup> The [guild member object](/http-api/guild-members/#guild-member-object) calls these fields `nick` and `roles`### Example@@ -79,147 +59,69 @@ A matched membership. Account fields appear at the top level rather than under `}```-:::note[Search results are partial member representations]-The result has no `avatar`, `banner`, `accent_color`, `mute`, `deaf`, `communication_disabled_until`, `profile_flags`, or `mention_flags`. Read the complete membership through [Get guild member](/http-api/guild-members/#get-guild-member).-:::-## Guild member search supplemental object-A guild member search supplemental object has the join source the [guild member object](/http-api/guild-members/#guild-member-object) never exposes. Only a caller holding [MANAGE_GUILD](/http-api/permissions/) receives its values.+The join source of a membership. Every field is null without [MANAGE_GUILD](/http-api/permissions/), and a field is also null when the membership recorded no value.### Structure| Field | Type | Description || --- | --- | --- |-| join_source_type?<sup>1</sup> <sup>2</sup> | ?integer | The [join source type](#join-source-types) recorded for the membership |-| source_invite_code<sup>1</sup> | ?string | The invite code the member joined through |-| inviter_id<sup>1</sup> | ?snowflake | The ID of the account that created the invite the member joined through |--<sup>1</sup> Null both when the caller lacks [MANAGE_GUILD](/http-api/permissions/) and when the membership recorded no value, so a null does not distinguish the two--<sup>2</sup> Always emitted, so treat an absent field and a null field alike+| join_source_type? | ?integer | The [join source type](#join-source-types) of the membership |+| source_invite_code | ?string | The invite code the member joined through |+| inviter_id | ?snowflake | The ID of the account that created that invite |## Guild member search response object-One search returns this envelope. Every field is always present.+One page of search results.### Structure| Field | Type | Description || --- | --- | --- |-| guild_id | snowflake | The ID of the guild the search ran against |-| members | array[[guild member search result](#guild-member-search-result-object) object] | The matched page in the requested order |-| page_result_count<sup>1</sup> | integer | The number of results in `members` |-| total_result_count<sup>2</sup> | integer | The total number of indexed memberships matching the filters |-| indexing<sup>3</sup> | boolean | Whether the guild member index is being built |--<sup>1</sup> The length of `members`--<sup>2</sup> The matching document count the configured search backend reports--<sup>3</sup> A true value always comes with an empty `members` array and both counts at zero--An Elasticsearch instance reports the true `total_result_count`. A Meilisearch instance reports an estimate that caps at 10000. In a very large guild that value can be lower than the true number of matches.--### Example--```json-{- "guild_id": "1489002177550843904",- "members": [],- "page_result_count": 0,- "total_result_count": 0,- "indexing": true-}-```+| guild_id | snowflake | The ID of the guild |+| members | array[[guild member search result](#guild-member-search-result-object) object] | The matched page |+| page_result_count | integer | The number of results in `members` |+| total_result_count | integer | The number of memberships matching the filters |+| indexing | boolean | Whether the guild member index is being built |## Search guild members<RouteHeader method="POST" path="/v1/guilds/{guild_id}/members-search" bot />-Searches the guild member index. Returns a [guild member search response](#guild-member-search-response-object) object on success. Requires membership of the guild.--### Limitations--- The caller must also hold at least one of [MANAGE_GUILD](/http-api/permissions/), [MANAGE_ROLES](/http-api/permissions/), [MANAGE_NICKNAMES](/http-api/permissions/), [BAN_MEMBERS](/http-api/permissions/), [MODERATE_MEMBERS](/http-api/permissions/), or [KICK_MEMBERS](/http-api/permissions/).-- Every qualifying bit except `MANAGE_NICKNAMES` is one of the [elevated permissions](/http-api/permissions/#elevated-permissions). In a guild whose [MFA level](/http-api/guilds/#mfa-levels) is elevated, a caller other than the guild owner who holds one of those elevated bits and has no enrolled authenticator receives 400 `TWO_FACTOR_REQUIRED`. A caller who qualifies through `MANAGE_NICKNAMES` alone never receives that code.-- A non-member of an existing guild receives the same 403 `MISSING_PERMISSIONS` as a member holding none of the qualifying bits, so a caller cannot tell the two apart.--A guild that does not exist returns 404 `UNKNOWN_GUILD`.--[List guild members](/http-api/guild-members/#list-guild-members) needs only membership and returns the complete member object for everyone. The permissions above gate the filtering, the sorting, the deep paging, and the [supplemental](#guild-member-search-supplemental-object) join source.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns a [guild member search response](#guild-member-search-response-object) object. You need at least one of the `MANAGE_GUILD`, `MANAGE_ROLES`, `MANAGE_NICKNAMES`, `BAN_MEMBERS`, `MODERATE_MEMBERS` or `KICK_MEMBERS` [permissions](/http-api/permissions/). In a guild that requires MFA, you also need an enrolled authenticator if you hold any of them other than `MANAGE_NICKNAMES`, unless you own the guild.### JSON body-Every field is optional, and an omitted filter is not applied. The route reads an omitted, empty, or whitespace-only body as an empty object. A body that is not valid JSON returns 400 `INVALID_FORM_BODY` with the validation code `INVALID_FORMAT` at the `body` path. A request with no usable field returns the first page of every indexed membership.-| Field | Type | Description || --- | --- | --- |-| query?<sup>1</sup> <sup>2</sup> | string | The text matched against the indexed identity fields (max 100 characters) |+| query? | string | The text matched against username, discriminator, global name, nickname and user ID (max 100 characters) || limit? | integer | The maximum number of results to return (1-100, default 25) || offset? | integer | The number of matching results to skip (minimum 0, default 0) |-| role_ids?<sup>3</sup> | array[snowflake] | The role IDs a matched member must hold (max 10) |-| joined_at_gte?<sup>4</sup> | integer | Unix seconds, includes members who joined at or after this time |-| joined_at_lte?<sup>4</sup> | integer | Unix seconds, includes members who joined at or before this time |-| join_source_type?<sup>5</sup> | array[integer] | The [join source types](#join-source-types) to include (max 10) |-| source_invite_code?<sup>2</sup> <sup>5</sup> | array[string] | The invite codes to include (max 10) |+| role_ids? | array[snowflake] | The role IDs a matched member must all hold (max 10) |+| joined_at_gte? | integer | Only members who joined at or after this time, in Unix seconds |+| joined_at_lte? | integer | Only members who joined at or before this time, in Unix seconds |+| join_source_type?<sup>1</sup> | array[integer] | The [join source types](#join-source-types) to include (max 10) |+| source_invite_code?<sup>1</sup> | array[string] | The invite codes to include (max 10) || is_bot? | boolean | Include only bot accounts when true, and only non-bot accounts when false |-| user_created_at_gte?<sup>4</sup> <sup>6</sup> | integer | Unix seconds, includes accounts created at or after this time |-| user_created_at_lte?<sup>4</sup> <sup>6</sup> | integer | Unix seconds, includes accounts created at or before this time |-| sort_by?<sup>7</sup> | string | The sort field, either `joinedAt` or `relevance` |-| sort_order?<sup>7</sup> | string | The sort direction, either `asc` or `desc` |--<sup>1</sup> Trimmed before use. An absent or whitespace-only value applies no text clause--<sup>2</sup> Scanned by content moderation like any other body string, so a value of at least three characters matching a blocklist returns 403 `CONTENT_BLOCKED`+| user_created_at_gte? | integer | Only accounts created at or after this time, in Unix seconds |+| user_created_at_lte? | integer | Only accounts created at or before this time, in Unix seconds |+| sort_by? | string | The sort field, `joinedAt` (default) or `relevance` |+| sort_order? | string | The sort direction, `asc` or `desc` (default `desc`, ignored for `relevance`) |-<sup>3</sup> Every listed role must be held by a result, so several entries narrow the search+<sup>1</sup> Ignored unless you have [MANAGE_GUILD](/http-api/permissions/)-<sup>4</sup> Both ends are inclusive, and supplying only one leaves the other unbounded--<sup>5</sup> Applied only when the caller holds [MANAGE_GUILD](/http-api/permissions/), and discarded for any other caller. Several entries widen the search--<sup>6</sup> Derived from the account's [snowflake](/snowflakes/)--<sup>7</sup> The sort field is camel-cased `joinedAt`, where the result object names the same value `joined_at`--[Input normalisation](/http-api/#input-normalisation) rewrites `""` to null, which the `query` field rejects with 400 `INVALID_FORM_BODY`. `" "` is accepted.--With no `sort_by`, the route sorts by join time and defaults `sort_order` to `desc`. Two members with the same join time are ordered by descending `id`. `relevance` ignores `sort_order`. A Meilisearch instance orders a `relevance` search by its own ranking rules, and an Elasticsearch instance by descending `id`.--Text matching runs over the username, the discriminator, the global display name, the guild nickname, and the user ID. A query can match the middle of a username as well as its start. The search backend defines term matching and typo tolerance. Filter matching is exact in every case.--:::caution[A deep `offset` returns 200 with an empty page]-An instance using Meilisearch returns an empty page beyond 10000 results. Instances using Elasticsearch support larger offsets.-:::+On an instance that uses Meilisearch, `total_result_count` is an estimate that stops at 10000, and an `offset` past 10000 returns an empty page.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [guild member search response](#guild-member-search-response-object) object | Search was evaluated, or the index is not ready |-| 400 | [error response](/http-api/#error-response) | Filter, sort value, limit, or offset is invalid |-| 403<sup>1</sup> | [error response](/http-api/#error-response) | Guild is unavailable, a body string is blocked, or the caller is not a member or holds none of the required permissions |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |--<sup>1</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` for an unavailable guild, `CONTENT_BLOCKED` for a blocked body string, and `MISSING_PERMISSIONS` otherwise--When Fluxer is building the guild member index, the response is 200 with an empty page and `indexing` set to true. Retry later. This route has no `FEATURE_TEMPORARILY_DISABLED` response. When the search backend is unavailable, the route returns 200 with an empty page and `indexing` false.--:::note[`indexing` false does not mean zero matches]-An empty page with `indexing` false can mean no matches or that search is unavailable.-:::--### Side effects--A search in a guild whose member index needs building queues an indexing job and returns `indexing` true. It does not change memberships.+| 200 | [guild member search response](#guild-member-search-response-object) object | The search ran, or the index is not ready |+| 400 | [error response](/http-api/#error-response) | `TWO_FACTOR_REQUIRED` when the guild requires MFA and you have none, or `INVALID_FORM_BODY` when a body field is invalid |+| 403 | [error response](/http-api/#error-response) | `MISSING_PERMISSIONS` without membership or any of the permissions above, or `MISSING_ACCESS` when the guild is unavailable |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_GUILD` when the guild does not exist |-### Rate limit+While Fluxer indexes the guild's members, the page is empty and `indexing` is true, and you can retry the request later. If the instance has no member search, the page is empty and `indexing` is false.-40 requests per 10 seconds for each authenticated user and guild ID, on the shared `guild:members::guild_id` bucket. [List guild members](/http-api/guild-members/#list-guild-members), [Get current guild member](/http-api/guild-members/#get-current-guild-member), [Get guild member](/http-api/guild-members/#get-guild-member), and [List guild bans](/http-api/guild-moderation/#list-guild-bans) consume the same bucket.+The rate limit is 40 requests per 10 seconds, on the `guild:members::guild_id` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/guild-members.mdx b/fluxer_docs/src/content/docs/http-api/guild-members.mdxindex 501cc30a8..020feb461 100644--- a/fluxer_docs/src/content/docs/http-api/guild-members.mdx+++ b/fluxer_docs/src/content/docs/http-api/guild-members.mdx@@ -1,20 +1,14 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Guild members-description: Guild member objects, profiles, voice moderation, ownership, removal, and roles.+description: Guild member objects, profiles, voice moderation, ownership, removal and roles.---import RouteHeader from '@/components/RouteHeader.astro';-A guild member is an account that has joined a guild. The membership has a nickname, avatar, role set, and moderation state that apply in that guild alone. Indexed member queries are on [Guild member search](/http-api/guild-member-search/), and bans on [Guild moderation](/http-api/guild-moderation/).+A guild member is an account that has joined a guild, with a nickname, avatar, roles and moderation state that apply in that guild only.-An unknown guild returns 404 `UNKNOWN_GUILD`, a non-member receives 403 `MISSING_PERMISSIONS`, and a guild marked unavailable returns 403 `MISSING_ACCESS`. [Transfer guild ownership](#transfer-guild-ownership) also returns 403 `ACCESS_DENIED` when the guild exists in storage but the Gateway reports it as not found.--The modify operations return the resulting membership, [Transfer guild ownership](#transfer-guild-ownership) returns the updated guild, and every other mutation returns 204 with an empty body.--:::note[A missing target returns 404]-A request whose target is not a member returns 404 `UNKNOWN_MEMBER` whether or not the caller can see the guild. The rule covers the modify operations, [Remove guild member](#remove-guild-member), [Add guild member role](#add-guild-member-role), and [Remove guild member role](#remove-guild-member-role).-:::+Every route here needs membership of the guild, and a target that isn't a member returns 404 `UNKNOWN_MEMBER`.## Guild member object@@ -23,33 +17,27 @@ A request whose target is not a member returns 404 `UNKNOWN_MEMBER` whether or n| Field | Type | Description || --- | --- | --- || user | [partial user](/http-api/users/#partial-user-object) object | The account the membership belongs to |-| nick | ?string | The nickname the account uses in this guild, or null when none is set |-| avatar<sup>1</sup> | ?string | The image hash of the guild-specific avatar, or null when none is set |-| banner<sup>1</sup> | ?string | The image hash of the guild-specific banner, or null when none is set |-| accent_color | ?integer | The guild profile accent colour as packed 24-bit RGB, or null when none is set |-| roles<sup>2</sup> | array[snowflake] | The IDs of the roles assigned to the membership (max 250) |-| joined_at | ISO8601 timestamp | The time the account became a member of this guild |-| mute<sup>3</sup> | boolean | Whether a moderator has muted the member in voice |-| deaf<sup>4</sup> | boolean | Whether a moderator has deafened the member in voice |-| communication_disabled_until<sup>5</sup> | ?ISO8601 timestamp | The time the communication timeout expires, or null when the member is not timed out |-| profile_flags?<sup>6</sup> | integer | The [guild member profile flags](#guild-member-profile-flags) set on the membership |-| mention_flags?<sup>6</sup> | integer | The [reply mention preference](/http-api/users/#reply-mention-preferences) that applies only inside this guild |--<sup>1</sup> An animated hash has the `a_` prefix. Both are reported as null while the membership is marked premium sanitised--<sup>2</sup> The everyone role is never present+| nick | ?string | The nickname in this guild |+| avatar<sup>1</sup> | ?string | The image hash of the guild avatar |+| banner<sup>1</sup> | ?string | The image hash of the guild banner |+| accent_color | ?integer | The guild profile accent color as packed 24-bit RGB |+| roles<sup>2</sup> | array[snowflake] | The IDs of the member's roles (max 250) |+| joined_at | ISO8601 timestamp | The time the account joined this guild |+| mute<sup>3</sup> | boolean | Whether the member is muted in voice |+| deaf | boolean | Whether the member is deafened in voice |+| communication_disabled_until<sup>4</sup> | ?ISO8601 timestamp | The time the communication timeout ends |+| profile_flags?<sup>5</sup> | integer | The [guild member profile flags](#guild-member-profile-flags) set on the membership |+| mention_flags?<sup>5</sup> | integer | The [reply mention preference](/http-api/users/#reply-mention-preferences) for this guild |-<sup>3</sup> True while a moderator mute is stored on the membership and also while a communication timeout is active+<sup>1</sup> An animated hash starts with `a_`-<sup>4</sup> True while a moderator deafen is stored on the membership. A communication timeout does not affect it+<sup>2</sup> The everyone role is never listed-<sup>5</sup> A timestamp in the past is retained until a later update supplies `communication_disabled_until`+<sup>3</sup> True for a moderator mute and while a communication timeout is active-<sup>6</sup> Omitted while the stored value is 0, so absence means no flag is set and, for `mention_flags`, that the account-level preference applies+<sup>4</sup> The time can be in the past, and the [communication timeout](/http-api/permissions/#communication-timeout) is only active while it's in the future-Fluxer marks a membership premium sanitised after its account loses premium, when the membership has a guild avatar, banner, bio, or accent colour. A premium sanitised membership reports `avatar` and `banner` as null.--A client compares `communication_disabled_until` against the current time, because a non-null value can name a moment that has already passed. A [communication timeout](/http-api/permissions/#communication-timeout) does not reduce the member's computed permission mask.+<sup>5</sup> Omitted when the value is 0### Example@@ -70,87 +58,61 @@ A client compares `communication_disabled_until` against the current time, becau## Guild member profile flags-A guild profile asset has these states. A membership with no flag and no stored hash inherits the account-level asset. A stored hash sets a guild-specific asset. Each flag below blocks inheritance, so the client shows the default asset.+A set flag makes the member show the default avatar or banner in this guild in place of their account one.| Value | Name | Description || --- | --- | --- |-| 1 << 0 | AVATAR_UNSET | The guild avatar is explicitly unset, so the account avatar is not inherited |-| 1 << 1 | BANNER_UNSET | The guild banner is explicitly unset, so the account banner is not inherited |--The field is validated as an integer between 0 and 2147483647, so an undefined bit below bit 31 is stored and returned unchanged. Bit 31, and any value above 2147483647, are rejected.+| 1 << 0 | AVATAR_UNSET | Show the default avatar |+| 1 << 1 | BANNER_UNSET | Show the default banner |## Guild member update object-The request body shared by [Modify current guild member](#modify-current-guild-member) and [Modify guild member](#modify-guild-member). An omitted field preserves its current value.+The request body for [Modify current guild member](#modify-current-guild-member) and [Modify guild member](#modify-guild-member). An omitted field keeps its value.### Structure| Field | Type | Description || --- | --- | --- |-| nick?<sup>1</sup> | ?string | The nickname to set in this guild (1-32 characters) |+| nick?<sup>1</sup> | ?string | The nickname (1-32 characters) || roles?<sup>2</sup> | array[snowflake] | The complete replacement role set (max 250) || avatar?<sup>3</sup> | ?base64 string | The guild avatar image data, or null to clear it || banner?<sup>3</sup> | ?base64 string | The guild banner image data, or null to clear it || bio? | ?string | The guild profile biography (1-320 characters) || pronouns? | ?string | The guild profile pronouns (1-40 characters) |-| accent_color? | ?integer | The guild profile accent colour as packed 24-bit RGB (0-16777215) |+| accent_color? | ?integer | The guild profile accent color as packed 24-bit RGB (0-16777215) || profile_flags? | ?integer | The [guild member profile flags](#guild-member-profile-flags) to store |-| mention_flags?<sup>4</sup> | ?integer | The [reply mention preference](/http-api/users/#reply-mention-preferences) to apply in this guild |-| mute?<sup>5</sup> | boolean | Whether the member is muted by a moderator in voice |-| deaf?<sup>5</sup> | boolean | Whether the member is deafened by a moderator in voice |-| communication_disabled_until?<sup>6</sup> | ?ISO8601 timestamp | The time at which the communication timeout expires |-| timeout_reason?<sup>7</sup> | ?string | The reason recorded alongside the timeout (1-512 characters) |-| channel_id?<sup>8</sup> | ?snowflake | The voice channel to move the member into, or null to disconnect them |-| connection_id?<sup>8</sup> | ?string | The single voice connection to move, defaulting to every connection (1-32 characters) |--<sup>1</sup> A blank string is normalised to null before the length bound runs, so an empty value clears the nickname+| mention_flags?<sup>4</sup> | ?integer | The [reply mention preference](/http-api/users/#reply-mention-preferences) for this guild |+| mute? | boolean | Whether the member is muted in voice |+| deaf? | boolean | Whether the member is deafened in voice |+| communication_disabled_until?<sup>5</sup> | ?ISO8601 timestamp | The time the communication timeout ends |+| timeout_reason? | ?string | The reason for the timeout (1-512 characters) |+| channel_id?<sup>6</sup> | ?snowflake | The voice channel to move the member into, or null to disconnect them |+| connection_id?<sup>6</sup> | ?string | The voice connection to move, defaulting to all of them (1-32 characters) |-<sup>2</sup> A role ID absent from the supplied array is removed from the member+<sup>1</sup> A blank string clears the nickname-<sup>3</sup> Base64 image data with an optional data URL prefix, which is not counted+<sup>2</sup> Roles missing from the array are removed, and unknown role IDs are dropped-<sup>4</sup> One of the [reply mention preference](/http-api/users/#reply-mention-preferences) enum values, where 0 restores the account-level preference+<sup>3</sup> Base64 image data with an optional data URL prefix. The decoded size is limited by `avatar_max_size` in the [instance limits](/http-api/instance/#limit-keys)-<sup>5</sup> Stored on the membership, so it applies whether or not the member holds a voice connection+<sup>4</sup> 0 restores the account-level preference-<sup>6</sup> An ISO 8601 date and time. A blank string is normalised to null+<sup>5</sup> Null or a past time clears the timeout, and a time more than 365.25 days ahead returns `TIMEOUT_CANNOT_EXCEED_365_DAYS`-<sup>7</sup> Trimmed, and used as the [audit log reason](/http-api/guild-audit-logs/#audit-log-reason) of the member update entry when the request sends no `X-Audit-Log-Reason` header--<sup>8</sup> `channel_id` moves or disconnects, and `connection_id` selects one of the member's voice connections--A `roles` entry that does not resolve to an existing role of the guild is dropped from the replacement, so a request naming only unknown roles clears the member's role set.--An `avatar` or `banner` base64 payload longer than 139810136 characters returns `BASE64_LENGTH_INVALID`, and a malformed one returns `INVALID_BASE64_FORMAT`. Fluxer then checks the decoded bytes against the instance-configured `avatar_max_size` [limit](/http-api/instance/#limit-keys), whose stock value is 10485760. The same limit applies to both fields. The decoded image must also be in a format the field accepts, and an animated AVIF is rejected. Pixel dimensions are not enforced. A value that is too large returns `IMAGE_SIZE_EXCEEDS_LIMIT`, and one whose format or animation is not allowed returns `INVALID_IMAGE_FORMAT`.--Null and any `communication_disabled_until` that is not in the future both clear the timeout. A time more than 365.25 days ahead returns `TIMEOUT_CANNOT_EXCEED_365_DAYS`, and a value that passes the schema but is not a real instant returns `INVALID_TIMEOUT_VALUE`. `timeout_reason` has no effect unless `communication_disabled_until` is also supplied.--Omitting `connection_id` applies the move or the disconnect to every voice connection the member holds in the guild. A `connection_id` that is not one of the member's own connections returns 400 `USER_NOT_IN_VOICE`.+<sup>6</sup> A `connection_id` that isn't one of the member's connections returns 400 `USER_NOT_IN_VOICE`## List guild members<RouteHeader method="GET" path="/v1/guilds/{guild_id}/members" bot />-Returns a page of [guild member objects](#guild-member-object) in ascending user ID order. Requires membership of the guild and no permission.--This route checks no permission bit, including [VIEW_CHANNEL_MEMBERS](/http-api/permissions/).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns [guild member objects](#guild-member-object) in ascending user ID order. It needs no permission.### Query parameters| Field | Type | Description || --- | --- | --- |-| limit?<sup>1</sup> | integer | The maximum number of members to return (1-1000, default 1) |-| after?<sup>2</sup> | snowflake | The lower bound on user ID, returning only members strictly greater than this value |--<sup>1</sup> A caller that wants a batch states `limit` explicitly, because the default returns one member--<sup>2</sup> The cursor is exclusive, and there is no descending or `before` form+| limit? | integer | The maximum number of members to return (1-1000, default 1) |+| after? | snowflake | Only return members with a user ID greater than this |### Response@@ -158,168 +120,88 @@ This route checks no permission bit, including [VIEW_CHANNEL_MEMBERS](/http-api/| --- | --- | --- || 200 | array[[guild member](#guild-member-object) object] | Members were returned |-### Rate limit--40 requests per 10 seconds for each authenticated user and guild ID, on the `guild:members::guild_id` bucket.+The rate limit is 40 requests per 10 seconds, on the `guild:members::guild_id` bucket.## Get current guild member<RouteHeader method="GET" path="/v1/guilds/{guild_id}/members/@me" bot />-Returns the authenticated account's own [guild member object](#guild-member-object). Requires membership of the guild and no permission.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns your own [guild member object](#guild-member-object).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [guild member](#guild-member-object) object | Membership was returned |-| 403 | [error response](/http-api/#error-response) | Guild is unavailable, or the caller is not a member |-| 404<sup>1</sup> | [error response](/http-api/#error-response) | Guild does not exist, or the membership record is absent |+| 200 | [guild member](#guild-member-object) object | The membership was returned |-<sup>1</sup> A missing guild returns `UNKNOWN_GUILD` and a missing membership record returns `UNKNOWN_MEMBER`--### Rate limit--40 requests per 10 seconds for each authenticated user and guild ID, on the shared `guild:members::guild_id` bucket.+The rate limit is 40 requests per 10 seconds, on the `guild:members::guild_id` bucket.## Get guild member<RouteHeader method="GET" path="/v1/guilds/{guild_id}/members/{user_id}" bot />-Returns one member's [guild member object](#guild-member-object). Requires membership of the guild and no permission.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |-| user_id | snowflake | The ID of the target member |+Returns one member's [guild member object](#guild-member-object).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [guild member](#guild-member-object) object | Membership was returned |-| 403 | [error response](/http-api/#error-response) | Guild is unavailable, or the caller is not a member |-| 404 | [error response](/http-api/#error-response) | Guild does not exist, returning `UNKNOWN_GUILD`, or the target is not a member, returning `UNKNOWN_MEMBER` |--### Rate limit+| 200 | [guild member](#guild-member-object) object | The membership was returned |-40 requests per 10 seconds for each authenticated user and guild ID, on the shared `guild:members::guild_id` bucket.+The rate limit is 40 requests per 10 seconds, on the `guild:members::guild_id` bucket.## Modify current guild member<RouteHeader method="PATCH" path="/v1/guilds/{guild_id}/members/@me" bot auditReason />-Modifies the authenticated account's own membership and returns the resulting [guild member object](#guild-member-object). Requires membership of the guild. Emits a [Guild Member Update](/gateway/events/#guild-member-update) Gateway event.--### Limitations--- Changing the nickname requires [CHANGE_NICKNAME](/http-api/permissions/).-- Supplying `channel_id` requires [MOVE_MEMBERS](/http-api/permissions/), even for the caller's own membership.-- Supplying `mute` requires [MUTE_MEMBERS](/http-api/permissions/), and `deaf` requires [DEAFEN_MEMBERS](/http-api/permissions/).-- Supplying `nick`, `avatar`, `banner`, `bio`, `pronouns`, `accent_color`, or `profile_flags` requires a verified email address, and a bot account is exempt. An unverified account is rejected with 403 `PROFILE_EMAIL_VERIFICATION_REQUIRED`.--A caller without `CHANGE_NICKNAME` does not fail the request. Fluxer discards the nickname change and applies every other supplied field. A member who holds the permission but is timed out is rejected with 403 `COMMUNICATION_DISABLED`.+Updates your own membership and returns the [guild member object](#guild-member-object).-A blocked `nick`, `bio` or `pronouns` returns 403 `CONTENT_BLOCKED`.+| Change | Permission |+| --- | --- |+| nick | [CHANGE_NICKNAME](/http-api/permissions/), and without it Fluxer ignores `nick` |+| mute | [MUTE_MEMBERS](/http-api/permissions/) |+| deaf | [DEAFEN_MEMBERS](/http-api/permissions/) |+| channel_id | [MOVE_MEMBERS](/http-api/permissions/), and [VIEW_CHANNEL](/http-api/permissions/) and [CONNECT](/http-api/permissions/) in the destination |-Guild avatar, banner, biography, and accent colour also require the instance-configured `feature_per_guild_profiles` [limit](/http-api/instance/#limit-keys) for the calling account. Fluxer discards any of those fields supplied without that capability and applies every other field. Pronouns, `profile_flags`, and `mention_flags` do not require it.+When `interaction_tier` is `legacy`, an [unverified account](/http-api/users/#account-tiers) can't change `nick`, `avatar`, `banner`, `bio`, `pronouns`, `accent_color` or `profile_flags`. `avatar`, `banner`, `bio` and `accent_color` are ignored without the `feature_per_guild_profiles` [limit](/http-api/instance/#limit-keys). A timed-out member can't change `nick`, and you can't time yourself out.-A `channel_id` destination must be a guild voice channel, and the caller must hold both [VIEW_CHANNEL](/http-api/permissions/) and [CONNECT](/http-api/permissions/) there. Supplying `channel_id` for a member with no live voice connection returns 400 `USER_NOT_IN_VOICE`. Supplying `mute` or `deaf` for such a member succeeds, stores the flags, and emits no voice Dispatch.--Fluxer rejects a supplied `communication_disabled_until` with 403 `MISSING_PERMISSIONS` before any other timeout check. [Modify guild member](#modify-guild-member) addressed at the caller's own user ID is rejected the same way.--:::caution[A profile change limit fails the whole request]-Avatar, banner, biography, pronouns, and accent colour each have a limit of 25 changes per 30 minutes for each authenticated user and guild. Exhausting one returns 400 `INVALID_FORM_BODY` and applies no field at all.-:::--Avatar and banner consume their limit whenever the field is present. Biography, pronouns, and accent colour consume theirs only when the supplied value differs from the stored one. The field code is `AVATAR_CHANGED_TOO_MANY_TIMES`, `BANNER_CHANGED_TOO_MANY_TIMES`, `BIO_CHANGED_TOO_MANY_TIMES`, `PRONOUNS_CHANGED_TOO_MANY_TIMES`, or `ACCENT_COLOR_CHANGED_TOO_MANY_TIMES`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+You can change each of `avatar`, `banner`, `bio`, `pronouns` and `accent_color` 25 times per 30 minutes in each guild. Going over returns 400 `INVALID_FORM_BODY` with a field code such as `AVATAR_CHANGED_TOO_MANY_TIMES`, and nothing is saved.### JSON body-The body is a [guild member update object](#guild-member-update-object) without `roles`. A supplied `roles` field is discarded without an error, so role assignment goes through [Modify guild member](#modify-guild-member).+The body is a [guild member update object](#guild-member-update-object) without `roles`, which Fluxer ignores here.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [guild member](#guild-member-object) object | Membership was processed |-| 400 | [error response](/http-api/#error-response) | Image data or a profile change limit rejects the request |-| 400 | [error response](/http-api/#error-response) | `channel_id` was supplied for a member with no live voice connection |-| 400 | [error response](/http-api/#error-response) | Destination channel does not exist or is not a voice channel |-| 403 | [error response](/http-api/#error-response) | Guild is unavailable, the caller is not a member, or the email address is unverified |-| 403 | [error response](/http-api/#error-response) | Blocked content was supplied, the caller is timed out, or a required voice permission is absent |-| 403 | [error response](/http-api/#error-response) | `communication_disabled_until` was supplied |-| 403 | [error response](/http-api/#error-response) | The account is [limited](/http-api/users/#account-limitation) and the body changes a profile field, and the request returns `ACCOUNT_LIMITED` |-| 404 | [error response](/http-api/#error-response) | Guild does not exist, or the membership record or account is absent |--### Side effects--The operation updates the membership, records a [`MEMBER_UPDATE`](/http-api/guild-audit-logs/#audit-actions) audit entry and emits [Guild Member Update](/gateway/events/#guild-member-update).--The target's own sessions always receive the Dispatch. Other guild sessions receive it subject to [event filtering](/gateway/event-filtering/). The Dispatch is produced even when the resulting membership is unchanged, and an update that changes nothing records no audit entry.+| 200 | [guild member](#guild-member-object) object | The membership was updated |+| 400 | [error response](/http-api/#error-response) | `USER_NOT_IN_VOICE` when `channel_id` is set and the member isn't in voice |+| 403 | [error response](/http-api/#error-response) | `MISSING_PERMISSIONS` for a missing voice permission or a timeout on yourself |+| 403 | [error response](/http-api/#error-response) | `PROFILE_EMAIL_VERIFICATION_REQUIRED`, `COMMUNICATION_DISABLED`, `CONTENT_BLOCKED` or `ACCOUNT_LIMITED` |-Supplying `channel_id` moves or disconnects every voice connection the member holds, or only the one named by `connection_id`. It records one [`MEMBER_MOVE`](/http-api/guild-audit-logs/#audit-actions) or [`MEMBER_DISCONNECT`](/http-api/guild-audit-logs/#audit-actions) audit entry for the whole request, however many connections it touched. A move into the channel the member already occupies records no entry. It emits [Voice State Update](/gateway/events/#voice-state-update) to sessions that can view the affected channel. Supplying `mute` or `deaf` updates the membership, records no separate audit entry, and emits the same voice Dispatch once for each live connection.+Fluxer sends [Guild Member Update](/gateway/events/#guild-member-update).-Fluxer emits [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create) for every audit entry. A request that fails after uploading a new avatar or banner leaves the previous asset in place.--### Rate limit--20 requests per 10 seconds for each authenticated user and guild ID, on the `guild:member:update::guild_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `guild:member:update::guild_id` bucket.## Modify guild member<RouteHeader method="PATCH" path="/v1/guilds/{guild_id}/members/{user_id}" bot auditReason />-Modifies another member's guild state and returns the resulting [guild member object](#guild-member-object). Requires membership of the guild. Emits a [Guild Member Update](/gateway/events/#guild-member-update) Gateway event.--### Limitations--- Changing another member's nickname requires [MANAGE_NICKNAMES](/http-api/permissions/) and role hierarchy authority over the target.-- Replacing `roles` requires [MANAGE_ROLES](/http-api/permissions/) and hierarchy authority over every role the replacement adds or removes, and the guild owner bypasses both checks.-- Applying `communication_disabled_until` requires [MODERATE_MEMBERS](/http-api/permissions/) and hierarchy authority, and the target must not hold [ADMINISTRATOR](/http-api/permissions/).-- Applying `mute` requires [MUTE_MEMBERS](/http-api/permissions/), applying `deaf` requires [DEAFEN_MEMBERS](/http-api/permissions/), and both require hierarchy authority over the target.-- Moving the target requires [MOVE_MEMBERS](/http-api/permissions/) and hierarchy authority, plus [VIEW_CHANNEL](/http-api/permissions/) and [CONNECT](/http-api/permissions/) for the caller in the destination.--A blocked `nick` returns 403 `CONTENT_BLOCKED`.--Hierarchy authority over the target is not checked for `roles`, so a caller who outranks every affected role can replace the role set of a member who outranks them. The everyone role in the array is rejected with the field code `INVALID_ROLE_ID`.--Fluxer never checks the target's own permissions in the destination, so a member can be moved into a channel they could not join themselves. Disconnecting sets `channel_id` to null and requires the same permission.--Supplying `channel_id` for a target with no live voice connection, or a `connection_id` that is not one of the target's own, returns 400 `USER_NOT_IN_VOICE`. Supplying `mute` or `deaf` for such a target succeeds and stores the flags. A destination that does not exist returns the field code `CHANNEL_DOES_NOT_EXIST`, and one that is not a voice channel `CHANNEL_MUST_BE_VOICE`. A destination that is [peer-to-peer](/gateway/events/#peer-to-peer-voice) also returns 400 `USER_NOT_IN_VOICE`.--`MANAGE_ROLES` and `MODERATE_MEMBERS` are [elevated permissions](/http-api/permissions/#elevated-permissions). When the guild [MFA level](/http-api/guilds/#mfa-levels) is elevated, a caller who is not the guild owner also needs an enrolled multi-factor authenticator to replace `roles` or apply `communication_disabled_until`.+Updates another member and returns the [guild member object](#guild-member-object). Each field needs the permission below and, except for `roles`, a higher role than the target. The guild owner skips the permission and role checks.-A caller addressing their own user ID here follows the self-targeted rules of [Modify current guild member](#modify-current-guild-member) for the guild profile fields. The body remains the complete update object, so `roles` is accepted. Replacing their own role set still requires `MANAGE_ROLES` and hierarchy authority, and `communication_disabled_until` is still rejected with 403 `MISSING_PERMISSIONS`.+| Change | Permission |+| --- | --- |+| nick | [MANAGE_NICKNAMES](/http-api/permissions/) |+| roles | [MANAGE_ROLES](/http-api/permissions/) and a higher role than every role added or removed |+| timeout | [MODERATE_MEMBERS](/http-api/permissions/), and the target can't have [ADMINISTRATOR](/http-api/permissions/) |+| mute | [MUTE_MEMBERS](/http-api/permissions/) |+| deaf | [DEAFEN_MEMBERS](/http-api/permissions/) |+| channel_id | [MOVE_MEMBERS](/http-api/permissions/), and [VIEW_CHANNEL](/http-api/permissions/) and [CONNECT](/http-api/permissions/) in the destination |-:::note[Guild profile fields belong to their own account]-`avatar`, `banner`, `bio`, `pronouns`, `accent_color`, `profile_flags`, and `mention_flags` describe the target's own profile, so a moderator cannot set them. Supplying one for another member leaves it unwritten, and the request still applies every field the caller may set.-:::+Fluxer ignores `avatar`, `banner`, `bio`, `pronouns`, `accent_color`, `profile_flags` and `mention_flags` here, but a blocked `bio` or `pronouns` still returns 403 `CONTENT_BLOCKED`. `MANAGE_ROLES` and `MODERATE_MEMBERS` are [elevated permissions](/http-api/permissions/#elevated-permissions).-:::caution[A blocklisted `bio` or `pronouns` returns 403]-A request that supplies a blocked `bio` or `pronouns` for another member fails with `CONTENT_BLOCKED`, even though Fluxer never writes those fields for another member.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |-| user_id | snowflake | The ID of the target member |+If `user_id` is your own ID, profile fields follow [Modify current guild member](#modify-current-guild-member).### JSON body@@ -329,89 +211,38 @@ The body is a [guild member update object](#guild-member-update-object).| Status | Body | Condition || --- | --- | --- |-| 200 | [guild member](#guild-member-object) object | Membership was processed |-| 400 | [error response](/http-api/#error-response) | Role set or timeout value rejects the request |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Caller holds `MANAGE_ROLES` or `MODERATE_MEMBERS` without an enrolled authenticator in an elevated-MFA guild |-| 400 | [error response](/http-api/#error-response) | `channel_id` was supplied for a target with no live voice connection |-| 400 | [error response](/http-api/#error-response) | Destination channel does not exist or is not a voice channel |-| 403 | [error response](/http-api/#error-response) | Guild is unavailable, the caller is not a member, or a required permission is absent |-| 403 | [error response](/http-api/#error-response) | Blocked content was supplied, hierarchy authority is absent, or the target holds `ADMINISTRATOR` |-| 403 | [error response](/http-api/#error-response) | Target is the caller and `communication_disabled_until` was supplied |-| 404 | [error response](/http-api/#error-response) | Guild does not exist, returning `UNKNOWN_GUILD`, or the target membership or account is absent, returning `UNKNOWN_MEMBER` |--<sup>1</sup> The missing-authenticator [error code](/http-api/errors/) is `TWO_FACTOR_REQUIRED`, returned only after the permission itself has been confirmed, so a caller lacking the permission entirely receives 403 instead--### Side effects--The operation has the same effects as [Modify current guild member](#modify-current-guild-member). Applying a non-empty role set also makes a temporary membership permanent. A membership is temporary when the member joined through an [invite](/http-api/invites/#invite-object) whose `temporary` field is true.+| 200 | [guild member](#guild-member-object) object | The membership was updated |+| 400 | [error response](/http-api/#error-response) | `USER_NOT_IN_VOICE` when the target isn't in voice, or `TWO_FACTOR_REQUIRED` in an elevated-MFA guild |+| 400 | [error response](/http-api/#error-response) | `INVALID_ROLE_ID` for the everyone role, or `CHANNEL_DOES_NOT_EXIST` or `CHANNEL_MUST_BE_VOICE` for `channel_id` |+| 403 | [error response](/http-api/#error-response) | `MISSING_PERMISSIONS` for a missing permission or role check, a target with ADMINISTRATOR, or a timeout on yourself |+| 403 | [error response](/http-api/#error-response) | `CONTENT_BLOCKED` for blocked profile text |-### Rate limit+Fluxer sends [Guild Member Update](/gateway/events/#guild-member-update). If the member joined through an [invite](/http-api/invites/#invite-object) with `temporary` set, a non-empty `roles` makes their membership permanent.-20 requests per 10 seconds for each authenticated user and guild ID, on the `guild:member:update::guild_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `guild:member:update::guild_id` bucket.## Remove guild member<RouteHeader method="DELETE" path="/v1/guilds/{guild_id}/members/{user_id}" bot auditReason />-Removes a member from the guild and returns 204 with an empty body. Requires membership, [KICK_MEMBERS](/http-api/permissions/), and role hierarchy authority over the target. Emits a [Guild Member Remove](/gateway/events/#guild-member-remove) Gateway event.--`KICK_MEMBERS` is an [elevated permission](/http-api/permissions/#elevated-permissions), so a caller who is not the guild owner needs an enrolled multi-factor authenticator while the guild [MFA level](/http-api/guilds/#mfa-levels) is elevated.--The caller and the guild owner cannot be removed through this operation, and both are reported as 404 `UNKNOWN_MEMBER`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |-| user_id | snowflake | The ID of the target member |+Removes a member from the guild. You need [KICK_MEMBERS](/http-api/permissions/), an [elevated permission](/http-api/permissions/#elevated-permissions), and a higher role than the target. Removing yourself or the owner returns 404 `UNKNOWN_MEMBER`.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Member was removed |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Caller holds `KICK_MEMBERS` without an enrolled authenticator in an elevated-MFA guild |-| 403 | [error response](/http-api/#error-response) | Guild is unavailable, the caller is not a member, or `KICK_MEMBERS` is absent |-| 403 | [error response](/http-api/#error-response) | Hierarchy authority over the target is absent |-| 404 | [error response](/http-api/#error-response) | Guild does not exist, returning `UNKNOWN_GUILD` |-| 404 | [error response](/http-api/#error-response) | Target is not a member, is the caller, or is the guild owner, each returning `UNKNOWN_MEMBER` |+| 204 | empty | The member was removed |+| 400 | [error response](/http-api/#error-response) | `TWO_FACTOR_REQUIRED` in an elevated-MFA guild |-<sup>1</sup> The [error code](/http-api/errors/) is `TWO_FACTOR_REQUIRED`, returned only after the permission itself has been confirmed+Fluxer sends [Guild Member Remove](/gateway/events/#guild-member-remove) to the guild and [Guild Delete](/gateway/events/#guild-delete) to the removed account.-### Side effects--Rejoining within one year resumes any communication timeout that has not expired.--The member loses their guild profile and roles. Read states, guild settings and guild folders are unchanged.--Removal from the guild removes every membership in its threads. Fluxer emits a [Thread Members Update](/gateway/threads/#thread-members-update) for each of them, as [Thread member flags](/http-api/thread-members/#thread-member-flags) states.--Fluxer records a [`MEMBER_KICK`](/http-api/guild-audit-logs/#audit-actions) audit entry with no change list and emits [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create). Remaining guild sessions receive [Guild Member Remove](/gateway/events/#guild-member-remove), subject to [event filtering](/gateway/event-filtering/). The removed account's sessions receive [Guild Delete](/gateway/events/#guild-delete).--### Rate limit--20 requests per 10 seconds for each authenticated user and guild ID, on the `guild:member:remove::guild_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `guild:member:remove::guild_id` bucket.## Transfer guild ownership<RouteHeader method="POST" path="/v1/guilds/{guild_id}/transfer-ownership" bot auditReason mfa />-Transfers guild ownership to another current member and returns the updated [guild object](/http-api/guilds/#guild-object). Requires the caller to be the current owner. Emits a [Guild Update](/gateway/events/#guild-update) Gateway event.--### Limitations--- No permission bit substitutes for ownership.-- The target must be a current member.-- A bot target returns 400 `CANNOT_TRANSFER_OWNERSHIP_TO_BOT`.--The operation requires the [sudo verification fields](/http-api/guilds/#sudo-verification-fields). A bot credential needs no proof. An account without a usable proof receives 403 `SUDO_MODE_REQUIRED`, whose payload names its available proofs in `methods`, reporting `totp`, `webauthn`, and `backup_codes`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Makes another member the owner and returns the [guild object](/http-api/guilds/#guild-object). Only the current owner can call it, with the [sudo verification fields](/http-api/guilds/#sudo-verification-fields) unless the owner is a bot. The previous owner keeps their roles.### Request headers@@ -424,7 +255,7 @@ The operation requires the [sudo verification fields](/http-api/guilds/#sudo-ver| Field | Type | Description || --- | --- | --- || new_owner_id | snowflake | The ID of the member to make the new owner |-| password? | string | The current owner password, as defined by the [sudo verification fields](/http-api/guilds/#sudo-verification-fields) |+| password? | string | The current owner's password || mfa_method? | string | The second factor to verify, one of `totp`, `webauthn` or `email_code` || mfa_code? | string | The authenticator code, required when the method is `totp` (1-32 characters) || webauthn_response? | [WebAuthn assertion](/http-api/authentication/#webauthn-assertion) object | The assertion produced when the method is `webauthn` |@@ -437,107 +268,48 @@ The operation requires the [sudo verification fields](/http-api/guilds/#sudo-ver| Status | Body | Condition || --- | --- | --- || 200 | [guild](/http-api/guilds/#guild-object) object | Ownership was transferred |-| 400 | [error response](/http-api/#error-response) | Supplied password or authenticator code is wrong, or the target is a bot account |-| 403 | [error response](/http-api/#error-response) | Guild is unavailable, sudo mode is absent, or the caller is not the guild owner |-| 403 | [error response](/http-api/#error-response) | Guild record exists while no Gateway process serves it, returning `ACCESS_DENIED` |-| 404 | [error response](/http-api/#error-response) | Guild does not exist, returning `UNKNOWN_GUILD`, or the target is not a member, returning `UNKNOWN_MEMBER` |+| 400 | [error response](/http-api/#error-response) | The password or code is wrong, or `CANNOT_TRANSFER_OWNERSHIP_TO_BOT` when the target is a bot |+| 403 | [error response](/http-api/#error-response) | `SUDO_MODE_REQUIRED` with the available proofs in `methods`, or `MISSING_PERMISSIONS` when you aren't the owner |+| 403 | [error response](/http-api/#error-response) | `ACCOUNT_VERIFICATION_REQUIRED` when `interaction_tier` is `enforced` and the new owner isn't [verified](/http-api/users/#account-tiers) |-### Side effects+Fluxer sends [Guild Update](/gateway/events/#guild-update).-The operation changes only the guild's `owner_id`. The outgoing owner keeps every role, permission overwrite, and membership they held.--It records a [`GUILD_UPDATE`](/http-api/guild-audit-logs/#audit-actions) audit entry naming the previous and new owner in its change list, emits [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create), and emits [Guild Update](/gateway/events/#guild-update) to every session that can see the guild. A request naming the current owner changes nothing and records no audit entry. The audit log response has no `options` member for this entry.--An account holding a TOTP secret or a registered WebAuthn credential also receives a reissued sudo proof. A bot credential and an account whose only proof was a password receive `X-Fluxer-Sudo-Mode-JWT` only when the request itself has one.--### Rate limit--20 requests per 10 seconds for each authenticated user and guild ID, on the shared `guild:update::guild_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `guild:update::guild_id` bucket.## Add guild member role<RouteHeader method="PUT" path="/v1/guilds/{guild_id}/members/{user_id}/roles/{role_id}" bot auditReason />-Adds one role to a member and returns 204 with an empty body. Requires membership, [MANAGE_ROLES](/http-api/permissions/), and hierarchy authority over the role. Emits a [Guild Member Update](/gateway/events/#guild-member-update) Gateway event.--### Limitations--- The guild owner bypasses the permission and the hierarchy check.-- The everyone role cannot be assigned and is rejected with the field code `INVALID_ROLE_ID`.--`MANAGE_ROLES` is an [elevated permission](/http-api/permissions/#elevated-permissions), so a caller who is not the guild owner needs an enrolled multi-factor authenticator while the guild [MFA level](/http-api/guilds/#mfa-levels) is elevated.--The guild owner receives 404 `UNKNOWN_ROLE` for a role that does not exist in the guild. Any other caller receives 403 `MISSING_PERMISSIONS`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |-| user_id | snowflake | The ID of the target member |-| role_id | snowflake | The ID of the role to add |+Adds one role to a member. You need [MANAGE_ROLES](/http-api/permissions/), an [elevated permission](/http-api/permissions/#elevated-permissions), and a higher role than the role you add, unless you're the guild owner.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Role is present on the member |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Role is the everyone role, or the caller holds `MANAGE_ROLES` without an enrolled authenticator in an elevated-MFA guild |-| 403 | [error response](/http-api/#error-response) | Guild is unavailable, the caller is not a member, `MANAGE_ROLES` is absent, or hierarchy authority over the role is absent |-| 404 | [error response](/http-api/#error-response) | Guild does not exist, returning `UNKNOWN_GUILD` |-| 404 | [error response](/http-api/#error-response) | Target is not a member, returning `UNKNOWN_MEMBER` |-| 404 | [error response](/http-api/#error-response) | Guild owner named a role that does not exist, returning `UNKNOWN_ROLE` |--<sup>1</sup> The missing-authenticator [error code](/http-api/errors/) is `TWO_FACTOR_REQUIRED`, returned only after the permission itself has been confirmed+| 204 | empty | The member has the role |+| 400 | [error response](/http-api/#error-response) | `INVALID_ROLE_ID` for the everyone role, or `TWO_FACTOR_REQUIRED` in an elevated-MFA guild |+| 403 | [error response](/http-api/#error-response) | `MISSING_PERMISSIONS` without MANAGE_ROLES or a higher role than the role |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_ROLE` when the role doesn't exist and you're the owner |-### Side effects+Fluxer sends [Guild Member Update](/gateway/events/#guild-member-update), and a new role makes a temporary member permanent.-Adding a new role makes a temporary membership permanent. The operation records a [`MEMBER_ROLE_UPDATE`](/http-api/guild-audit-logs/#audit-actions) audit entry and emits [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create) and [Guild Member Update](/gateway/events/#guild-member-update). An unchanged role set still emits [Guild Member Update](/gateway/events/#guild-member-update) and records no audit entry.--The audit log response names the role with the [`role_name`](/http-api/guild-audit-logs/#audit-log-options-object) option and through the change list.--### Rate limit--20 requests per 10 seconds for each authenticated user and guild ID, on the `guild:member:role:add::guild_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `guild:member:role:add::guild_id` bucket.## Remove guild member role<RouteHeader method="DELETE" path="/v1/guilds/{guild_id}/members/{user_id}/roles/{role_id}" bot auditReason />-Removes one role from a member and returns 204 with an empty body. Requires membership, [MANAGE_ROLES](/http-api/permissions/), and hierarchy authority over the role. Emits a [Guild Member Update](/gateway/events/#guild-member-update) Gateway event.--### Limitations--- The guild owner bypasses the permission and the hierarchy check.-- The everyone role cannot be removed and is rejected with the field code `INVALID_ROLE_ID`.--`MANAGE_ROLES` is an [elevated permission](/http-api/permissions/#elevated-permissions), so a caller who is not the guild owner needs an enrolled multi-factor authenticator while the guild [MFA level](/http-api/guilds/#mfa-levels) is elevated. A role that does not exist is reported the same way as for [Add guild member role](#add-guild-member-role).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |-| user_id | snowflake | The ID of the target member |-| role_id | snowflake | The ID of the role to remove |+Removes one role from a member. The rules are the same as [Add guild member role](#add-guild-member-role).### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Role is absent from the member |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Role is the everyone role, or the caller holds `MANAGE_ROLES` without an enrolled authenticator in an elevated-MFA guild |-| 403 | [error response](/http-api/#error-response) | Guild is unavailable, the caller is not a member, `MANAGE_ROLES` is absent, or hierarchy authority over the role is absent |-| 404 | [error response](/http-api/#error-response) | Guild does not exist, returning `UNKNOWN_GUILD` |-| 404 | [error response](/http-api/#error-response) | Target is not a member, returning `UNKNOWN_MEMBER` |-| 404 | [error response](/http-api/#error-response) | Guild owner named a role that does not exist, returning `UNKNOWN_ROLE` |--<sup>1</sup> The missing-authenticator [error code](/http-api/errors/) is `TWO_FACTOR_REQUIRED`, returned only after the permission itself has been confirmed--### Side effects--The operation records a [`MEMBER_ROLE_UPDATE`](/http-api/guild-audit-logs/#audit-actions) audit entry and emits [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create) and [Guild Member Update](/gateway/events/#guild-member-update). A role the member did not hold still emits [Guild Member Update](/gateway/events/#guild-member-update) and records no audit entry. Removing a role does not change whether the membership is temporary.+| 204 | empty | The member doesn't have the role |+| 400 | [error response](/http-api/#error-response) | `INVALID_ROLE_ID` for the everyone role, or `TWO_FACTOR_REQUIRED` in an elevated-MFA guild |+| 403 | [error response](/http-api/#error-response) | `MISSING_PERMISSIONS` without MANAGE_ROLES or a higher role than the role |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_ROLE` when the role doesn't exist and you're the owner |-### Rate limit+Fluxer sends [Guild Member Update](/gateway/events/#guild-member-update).-20 requests per 10 seconds for each authenticated user and guild ID, on the `guild:member:role:remove::guild_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `guild:member:role:remove::guild_id` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/guild-moderation.mdx b/fluxer_docs/src/content/docs/http-api/guild-moderation.mdxindex f9b51d3dd..e97f10fb8 100644--- a/fluxer_docs/src/content/docs/http-api/guild-moderation.mdx+++ b/fluxer_docs/src/content/docs/http-api/guild-moderation.mdx@@ -1,36 +1,32 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Guild moderation-description: Guild bans, temporary bans, ban replacement, and the blocks a ban has.+description: List, create and remove guild bans, including temporary bans.---import RouteHeader from '@/components/RouteHeader.astro';-A guild ban keeps one account out of one guild, and it outlives the membership it removes. Removing a member is a separate operation with its own permission, and [Remove guild member](/http-api/guild-members/#remove-guild-member) defines it.--Every route here requires [BAN_MEMBERS](/http-api/permissions/), which is an [elevated permission](/http-api/permissions/#elevated-permissions). In a guild whose [MFA level](/http-api/guilds/#mfa-levels) is elevated, every caller except the guild owner also needs an enrolled multi-factor authenticator. A guild an operator has marked unavailable returns 403 `MISSING_ACCESS` before the route runs.--[List guild bans](#list-guild-bans) is the only operation that reads a ban record, and there is no bulk ban operation.+A guild ban keeps an account out of a guild until you remove the ban or it expires. Every route on this page needs [BAN_MEMBERS](/http-api/permissions/). In a guild with an elevated [MFA level](/http-api/guilds/#mfa-levels), everyone except the owner also needs two-factor authentication turned on. A caller without the permission gets 403 `MISSING_PERMISSIONS`, and one without two-factor authentication gets 400 `TWO_FACTOR_REQUIRED`.## Guild ban object-A guild ban object names the banned account, the moderator, the reason, and any expiry. Creating a ban for a user who is already banned replaces the existing record.+A guild ban object describes one ban.++A ban also blocks joins from the account's email address and its last IP address. A join returns 403 `USER_BANNED_FROM_GUILD` for an account or email match and 403 `USER_IP_BANNED_FROM_GUILD` for an IP match. Fluxer skips the IP match for an address on the instance's IP ban exemption list. Removing the ban lifts both blocks, and permanently deleting the banned account removes all its guild bans.### Structure| Field | Type | Description || --- | --- | --- || user | [partial user](/http-api/users/#partial-user-object) object | The banned account |-| reason<sup>1</sup> | ?string | The stored ban reason, or null when none was recorded |-| moderator_id | snowflake | The account that issued or most recently replaced the ban, or `0` for the Fluxer system user when Fluxer staff placed it |-| banned_at<sup>2</sup> | ISO8601 timestamp | Time the ban was issued or most recently replaced |-| expires_at<sup>3</sup> | ?ISO8601 timestamp | Time a temporary ban stops applying, or null for a permanent ban |+| reason<sup>1</sup> | ?string | The ban reason |+| moderator_id | snowflake | The account that issued or last replaced the ban, or `0` when an instance admin placed it through the Admin API |+| banned_at | ISO8601 timestamp | Time the ban was issued or last replaced |+| expires_at<sup>2</sup> | ?ISO8601 timestamp | Time a temporary ban ends, or null for a permanent ban |-<sup>1</sup> The body `reason` when that field is supplied, and the `X-Audit-Log-Reason` value when it is omitted or null+<sup>1</sup> The body `reason`, or the `X-Audit-Log-Reason` value when the body has none-<sup>2</sup> Replacing a ban rewrites this value, so it records the most recent issuance--<sup>3</sup> An expired temporary ban is removed and never returned with a past `expires_at`+<sup>2</sup> Fluxer removes an expired ban and never returns it### Example@@ -48,17 +44,7 @@ A guild ban object names the banned account, the moderator, the reason, and any<RouteHeader method="GET" path="/v1/guilds/{guild_id}/bans" bot />-Returns every [guild ban object](#guild-ban-object) of the guild. Requires [BAN_MEMBERS](/http-api/permissions/).--A non-member cannot hold `BAN_MEMBERS`, so a caller outside the guild receives 403 `MISSING_PERMISSIONS`.--The operation returns the complete collection in one response and has no limit or cursor parameters. The response excludes an expired temporary ban, and omits a ban whose account can no longer be resolved, so the array can be shorter than the number of stored bans.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns every [guild ban object](#guild-ban-object) in the guild. The list isn't paginated.### Response@@ -66,130 +52,49 @@ The operation returns the complete collection in one response and has no limit o| --- | --- | --- || 200 | array[[guild ban](#guild-ban-object) object] | Bans were returned |-<sup>1</sup> The [error code](/http-api/errors/) is `TWO_FACTOR_REQUIRED`, returned only after the permission itself has been confirmed--<sup>2</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` for an unavailable guild and `MISSING_PERMISSIONS` otherwise--### Rate limit--40 requests per 10 seconds for each authenticated user and guild ID, on the shared `guild:members::guild_id` bucket.+The rate limit is 40 requests per 10 seconds, on the shared `guild:members::guild_id` bucket.## Create or replace guild ban<RouteHeader method="PUT" path="/v1/guilds/{guild_id}/bans/{user_id}" bot auditReason />-Creates a guild ban, or replaces an existing one, and returns 204 with an empty body. Requires [BAN_MEMBERS](/http-api/permissions/). Emits a [Guild Ban Add](/gateway/events/#guild-ban-add) Gateway event.--### Limitations--- The caller cannot ban themselves, and Fluxer reports a self-target as 404 `UNKNOWN_MEMBER`.-- Banning a target who is a member also requires role hierarchy authority over that member. The guild owner holds that authority over everyone, and no other caller holds it over the owner.-- A target who is not a member can still be banned, and Fluxer refuses a later join by that account.+Bans the account and returns 204. Banning an account that is already banned replaces the ban, which can make a permanent ban temporary or extend a temporary one. You can ban an account that isn't a member. To ban a member, your highest role must be above theirs. The owner can ban any member, and nobody can ban the owner.-A blocked `reason` returns 403 `CONTENT_BLOCKED`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |-| user_id | snowflake | The ID of the account to ban |+Fluxer removes a banned member from the guild and its threads and records a [`MEMBER_BAN_ADD`](/http-api/guild-audit-logs/#audit-actions) audit entry. Sends [Guild Ban Add](/gateway/events/#guild-ban-add). The guild gets [Guild Member Remove](/gateway/events/#guild-member-remove) and the banned account gets [Guild Delete](/gateway/events/#guild-delete).### JSON body-The body is optional, and so is every field in it. Fluxer reads an omitted or whitespace-only body as an empty object, so a bare request creates a permanent ban that deletes no messages and records no body reason. A body that is not valid JSON returns 400 `INVALID_FORM_BODY` with the validation code `INVALID_FORMAT` at the `body` path.+The body is optional. A request with no body creates a permanent ban and deletes no messages.| Field | Type | Description || --- | --- | --- |-| delete_message_seconds?<sup>1</sup> | integer | Age of the target's recent guild messages to delete, in seconds (0-604800) |-| delete_message_days?<sup>2</sup> | integer | Legacy age of those messages, in whole days (0-7, default 0) |-| reason?<sup>3</sup> | ?string | Reason stored on the ban record (max 512 characters) |-| ban_duration_seconds?<sup>4</sup> | integer | Ban duration in seconds, either 0 or 60 through 63072000 |--<sup>1</sup> Zero and an omitted field delete nothing. The field takes precedence over `delete_message_days` whenever it is present, including when it is 0--<sup>2</sup> Multiplied by 86400 to produce the effective interval, and only when `delete_message_seconds` is absent--<sup>3</sup> Stripped of removed control and format code points and trimmed before its length is measured. A longer result fails with `STRING_LENGTH_INVALID` at the `reason` path--<sup>4</sup> Zero and an omitted field both create a permanent ban. Any value outside 60 through 63072000, which is two years, fails with `INVALID_FORMAT`--A [`MEMBER_BAN_ADD`](/http-api/guild-audit-logs/#audit-actions) entry records `options.delete_message_seconds` when the effective interval is positive, whichever field set it. A ban that deletes nothing records no option, and the deprecated `delete_member_days` option is present only on an entry written before this field.--An omitted or null `reason` falls back to the `X-Audit-Log-Reason` value, while a supplied value that normalises to the empty string is stored as null without falling back. The audit entry reason is the header when the request sends one, and the stored ban reason otherwise.--:::caution[Banning an already banned account succeeds]-The second ban replaces the previous ban's details. Re-issuing can turn a permanent ban into a temporary one or extend a temporary ban. There is no conditional form.-:::+| delete_message_seconds? | integer | Age of the target's guild messages to delete, in seconds (0-604800) |+| delete_message_days? | integer | Same as `delete_message_seconds` in days (0-7), ignored when `delete_message_seconds` is set |+| reason? | ?string | Reason stored on the ban (max 512 characters) |+| ban_duration_seconds? | integer | Ban duration in seconds (0 or 60-63072000), where 0 is permanent |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Ban was created or replaced |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Duration, deletion interval, or reason is invalid, or the caller holds `BAN_MEMBERS` with no enrolled authenticator in an elevated-MFA guild |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | Guild is unavailable, blocked content was supplied, `BAN_MEMBERS` is absent, or hierarchy authority over a member target is absent |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |-| 404<sup>3</sup> | [error response](/http-api/#error-response) | Target account does not exist, or the target is the caller |--<sup>1</sup> The missing-authenticator [error code](/http-api/errors/) is `TWO_FACTOR_REQUIRED`, returned only after the permission itself has been confirmed--<sup>2</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` for an unavailable guild, `CONTENT_BLOCKED` for a blocked string, and `MISSING_PERMISSIONS` otherwise--<sup>3</sup> The [error code](/http-api/errors/) is `UNKNOWN_USER` for an account that does not exist and `UNKNOWN_MEMBER` for a caller that names itself, and the self-target check runs first--### Side effects--The operation records a [`MEMBER_BAN_ADD`](/http-api/guild-audit-logs/#audit-actions) audit entry with the [guild ban change fields](/http-api/guild-audit-logs/#guild-ban-change-fields). It emits [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create) and [Guild Ban Add](/gateway/events/#guild-ban-add), subject to [event filtering](/gateway/event-filtering/). A positive deletion interval permanently deletes the target's messages within that interval in every channel and thread of the guild.--A current member is removed. The guild receives [Guild Member Remove](/gateway/events/#guild-member-remove) and the banned account receives [Guild Delete](/gateway/events/#guild-delete). No `MEMBER_KICK` audit entry is recorded.--A ban does not preserve an active communication timeout for a later rejoin, and [Remove guild member](/http-api/guild-members/#remove-guild-member) does. The banned account loses its guild nickname, guild avatar hash, guild banner hash, biography, pronouns, accent colour, and role set. Its read states and guild settings stay in place.--Removal from the guild removes every membership in its threads. Fluxer emits a [Thread Members Update](/gateway/threads/#thread-members-update) for each of them, as [Thread member flags](/http-api/thread-members/#thread-member-flags) states.--From that point Fluxer refuses a join attempt by the banned account. The address and email matches described under the [guild ban object](#guild-ban-object) apply as well.--### Rate limit+| 204 | empty | The ban was created or replaced |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` when a body field is out of range |+| 403 | [error response](/http-api/#error-response) | `MISSING_PERMISSIONS` when your highest role isn't above the member's, or `CONTENT_BLOCKED` when `reason` is blocked |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_USER` when the account doesn't exist, or `UNKNOWN_MEMBER` when the target is you |-20 requests per 10 seconds for each authenticated user and guild ID, on the `guild:member:remove::guild_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `guild:member:remove::guild_id` bucket.## Remove guild ban<RouteHeader method="DELETE" path="/v1/guilds/{guild_id}/bans/{user_id}" bot auditReason />-Removes an existing guild ban and returns 204 with an empty body. Requires [BAN_MEMBERS](/http-api/permissions/). Emits a [Guild Ban Remove](/gateway/events/#guild-ban-remove) Gateway event.--Fluxer rejects a target that is not banned with 400 `INVALID_FORM_BODY`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |-| user_id | snowflake | The ID of the banned account |+Removes the ban and returns 204. The account can join again through an invite, and messages deleted by the ban stay deleted. Sends [Guild Ban Remove](/gateway/events/#guild-ban-remove) and records a [`MEMBER_BAN_REMOVE`](/http-api/guild-audit-logs/#audit-actions) audit entry.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Ban was removed |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Target is not banned, or the caller holds `BAN_MEMBERS` with no enrolled authenticator in an elevated-MFA guild |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | Guild is unavailable, or `BAN_MEMBERS` is absent |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |--<sup>1</sup> A target that is not banned returns `INVALID_FORM_BODY` with [`USER_IS_NOT_BANNED`](/http-api/errors/#validation-error-codes) against `user_id`. The missing-authenticator code is `TWO_FACTOR_REQUIRED`, returned only after the permission is confirmed--<sup>2</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` for an unavailable guild and `MISSING_PERMISSIONS` otherwise--### Side effects--The operation deletes the ban together with the address and email blocks it had. It records a [`MEMBER_BAN_REMOVE`](/http-api/guild-audit-logs/#audit-actions) audit entry whose change list has the removed [guild ban change fields](/http-api/guild-audit-logs/#guild-ban-change-fields), emits [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create), and emits [Guild Ban Remove](/gateway/events/#guild-ban-remove) to the guild's sessions, subject to [event filtering](/gateway/event-filtering/).--It does not restore the removed membership, the guild profile fields and roles that membership had, or the deleted messages. The unbanned account can rejoin through an ordinary invite.--An instance-wide IP ban is a separate mechanism this operation does not touch. Every request from an address it covers is still refused with 403 `GLOBAL_IP_BANNED` for a permanent ban and 403 `GLOBAL_IP_TEMPORARILY_BANNED` for a temporary one.--### Rate limit+| 204 | empty | The ban was removed |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY`, with [`USER_IS_NOT_BANNED`](/http-api/errors/#validation-error-codes) on `user_id` |-20 requests per 10 seconds for each authenticated user and guild ID, on the `guild:member:remove::guild_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `guild:member:remove::guild_id` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/guild-stickers.mdx b/fluxer_docs/src/content/docs/http-api/guild-stickers.mdxindex 45003ac3a..1beedcd01 100644--- a/fluxer_docs/src/content/docs/http-api/guild-stickers.mdx+++ b/fluxer_docs/src/content/docs/http-api/guild-stickers.mdx@@ -1,43 +1,25 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Guild stickers-description: Guild sticker objects, uploads, cloning, bulk creation, metadata updates, and deletion.+description: Guild sticker objects and the routes to list, create, clone, update and delete them.---import RouteHeader from '@/components/RouteHeader.astro';-A sticker is an image a guild stores for its members to send with a message. It belongs to exactly one guild. Its [snowflake](/snowflakes/) is unique across every guild. [Get sticker metadata](/http-api/expressions/#get-sticker-metadata) resolves a sticker without membership of its guild.--Every route names a guild in its path. A guild that has [UNAVAILABLE_FOR_EVERYONE](/http-api/guilds/#guild-features) rejects the request with 403 `MISSING_ACCESS` before the operation runs. [UNAVAILABLE_FOR_EVERYONE_BUT_STAFF](/http-api/guilds/#guild-features) does the same for an account without the instance staff flag. On [Clone guild sticker](#clone-guild-sticker) the gate covers the target guild and never the source guild.--Names, descriptions, tags and uploaded images must pass the instance's content policy. Blocked content returns 403 `CONTENT_BLOCKED`.--A guild that does not exist returns 404 `UNKNOWN_GUILD`. A caller who is not a current member of an existing guild returns 403 `MISSING_PERMISSIONS`, so guild existence is distinguishable from guild membership. [Modify guild sticker](#modify-guild-sticker) returns 404 `UNKNOWN_STICKER` for a guild that does not exist.--There is no single-sticker read scoped to a guild. [List guild stickers](#list-guild-stickers) returns the whole collection in one response.+A sticker is an image a guild stores for its members to send with a message. Names, descriptions, tags and images must pass the instance's content policy, and blocked content returns `CONTENT_BLOCKED`. To look up a sticker without being in its guild, see [Get sticker metadata](/http-api/expressions/#get-sticker-metadata).## Guild sticker object-A guild sticker object describes one sticker. Only its name, description and tags can change. Replacing the image requires creating a new sticker.-### Structure| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the sticker || name | string | The name of the sticker (2-30 characters) |-| description<sup>1</sup> | string | The sticker description, or an empty string when it has none |-| tags | array[string] | [Sticker tags](#sticker-tags) |-| animated<sup>2</sup> | boolean | Whether the stored image is animated |-| user?<sup>3</sup> | [partial user](/http-api/users/#partial-user-object) object | The account that uploaded the sticker |--<sup>1</sup> Never null on the wire. A sticker with no description has an empty string--<sup>2</sup> Detected from the submitted image at creation, and copied unchanged by [Clone guild sticker](#clone-guild-sticker)--<sup>3</sup> Present only on [List guild stickers](#list-guild-stickers), where it is set for every caller and requires no permission--A sticker is always a guild sticker, and `animated` alone describes its format. The object has no sticker type, format type, or availability field.+| description | string | The sticker description, or an empty string when it has none |+| tags | array[string] | The sticker tags |+| animated | boolean | Whether the image is animated |+| user? | [partial user](/http-api/users/#partial-user-object) object | The account that uploaded the sticker, only on [List guild stickers](#list-guild-stickers) |### Example@@ -51,130 +33,64 @@ A sticker is always a guild sticker, and `animated` alone describes its format.}```-## Sticker tags--Tags are an array of strings. A create or modify request accepts at most 10 entries. Fluxer trims each entry. The 1 to 30 character bound applies to the trimmed value. Entries are stored and returned in the submitted order.--The array is optional on every request that accepts it and defaults to an empty array, so omitting it on [Modify guild sticker](#modify-guild-sticker) clears the stored tags.-## Sticker create object-The item shape shared by [Create guild sticker](#create-guild-sticker) and each entry of [Bulk create guild stickers](#bulk-create-guild-stickers).+The body of [Create guild sticker](#create-guild-sticker) and each entry of [Bulk create guild stickers](#bulk-create-guild-stickers).### Structure| Field | Type | Description || --- | --- | --- |-| name<sup>1</sup> | string | The name of the sticker (2-30 characters) |-| description?<sup>2</sup> | ?string | The sticker description (1-500 characters), or null for none |-| tags? | array[string] | [Sticker tags](#sticker-tags), defaulting to an empty array |-| image<sup>3</sup> | base64 string | The image data (at most the resolved `sticker_max_size` limit in decoded bytes, 524288 by default) |--<sup>1</sup> The value is trimmed before the bound applies, as it is for `description` and each tag--<sup>2</sup> An omitted value and null are both stored as null and returned as an empty string--<sup>3</sup> A data URL prefix is accepted and everything up to the first comma is removed before any bound applies--The remaining encoded part is bounded to 139810136 characters, which encodes a 104857600 byte image, and a longer value returns the validation code `BASE64_LENGTH_INVALID` at the `image` path. A value that is not canonical base64 with correct padding returns `INVALID_BASE64_FORMAT`.--Decoded bytes are at most the operator-configured `sticker_max_size` [limit key](/http-api/instance/#limit-keys) value, resolved against the guild's complete feature set and defaulting to 524288. A larger image is rejected on the `image` path with `IMAGE_SIZE_EXCEEDS_LIMIT`, whose message names the resolved ceiling. The character bound does not move with the limit key, so a configured value above 104857600 admits no more than 104857602 decoded bytes.--Accepted upload formats are PNG, JPEG, APNG, GIF, WebP, AVIF, and SVG. Fluxer takes the format from the decoded image. An animated AVIF is rejected. Fluxer detects animation state from the image, so this object has no animation field.--Pixel dimensions and animation length are not enforced. An accepted image is stored at its original dimensions. The [Media Proxy image asset contract](/media-proxy/routes/#image-asset-contract) selects the delivered size.--### Example+| name | string | The name of the sticker (2-30 characters) |+| description? | ?string | The sticker description (1-500 characters) |+| tags? | array[string] | The sticker tags (at most 10, 1-30 characters each) |+| image | base64 string | The image data, up to the [`sticker_max_size`](/http-api/instance/#limit-keys) limit (524288 bytes by default) |-```json-{- "name": "shipit",- "description": "Ship it",- "tags": ["ship", "deploy"],- "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg=="-}-```+Fluxer accepts PNG, JPEG, APNG, GIF, WebP, AVIF and SVG as base64 or a data URL, but not animated AVIF. A larger image returns `IMAGE_SIZE_EXCEEDS_LIMIT`, and an image in another format or one Fluxer can't decode returns `INVALID_IMAGE_FORMAT`.## Sticker bulk create response object-The outcome of one [Bulk create guild stickers](#bulk-create-guild-stickers) call, split into the items that were created and the items that were rejected.+The outcome of one [Bulk create guild stickers](#bulk-create-guild-stickers) call.### Structure| Field | Type | Description || --- | --- | --- || success | array[[guild sticker](#guild-sticker-object) object] | The stickers that were created |-| failed | array[[sticker creation failure](#sticker-creation-failure-object) object] | The items rejected after top-level request validation |--Both arrays are present on every success response. Either can be empty. An item appears in exactly one of them, so the combined length equals the submitted item count.--### Example--```json-{- "success": [],- "failed": [{"name": "shipit", "error": "The image is too large."}]-}-```+| failed | array[[sticker creation failure](#sticker-creation-failure-object) object] | The items that were rejected |## Sticker creation failure object-One rejected item from a bulk create call, named and explained in display text.+One rejected item from a bulk create call.### Structure| Field | Type | Description || --- | --- | --- |-| name<sup>1</sup> | string | The requested sticker name, echoed from the submitted item |-| error<sup>2</sup> | string | The failure message rendered for the item |--<sup>1</sup> The object has no index, so two submitted items sharing a name cannot be told apart--<sup>2</sup> Rendered in the locale of the authenticated account, so its value changes with the caller's locale--There is no machine-readable code, so a client that needs to branch on the reason submits that item again through [Create guild sticker](#create-guild-sticker), which returns an error code.+| name | string | The requested sticker name |+| error | string | The failure message, in the language of the account that sent the request |## List guild stickers<RouteHeader method="GET" path="/v1/guilds/{guild_id}/stickers" bot />-Returns every [guild sticker object](#guild-sticker-object) of the guild, each with `user`. Requires membership of the guild and no permission.--One response has the complete collection. The operation is not paginated. A sticker whose uploader cannot be resolved is omitted, so the array can be shorter than the number of stored stickers.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns the guild's stickers. You need to be a member of the guild.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | array[[guild sticker](#guild-sticker-object) object] | Stickers were returned |-| 403<sup>1</sup> | [error response](/http-api/#error-response) | Guild is unavailable, or the caller is not a member |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |--<sup>1</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` for an unavailable guild and `MISSING_PERMISSIONS` for a non-member--### Rate limit+| 200 | array[[guild sticker](#guild-sticker-object) object] | The stickers were returned |-60 requests per 10 seconds for each authenticated user and guild ID, on the `guild:sticker:list::guild_id` bucket.+The rate limit is 60 requests per 10 seconds, on the `guild:sticker:list::guild_id` bucket.## Create guild sticker<RouteHeader method="POST" path="/v1/guilds/{guild_id}/stickers" bot auditReason />-Creates one sticker from submitted image data and returns its [guild sticker object](#guild-sticker-object) without `user`. Requires membership of the guild and [CREATE_EXPRESSIONS](/http-api/permissions/). Emits a [Guild Stickers Update](/gateway/events/#guild-stickers-update) Gateway event.+Creates a sticker and returns it. You need [CREATE_EXPRESSIONS](/http-api/permissions/). Fluxer sends a [Guild Stickers Update](/gateway/events/#guild-stickers-update) event.-The slot limit is the operator-configured [max_guild_stickers](/http-api/instance/#limit-keys) value resolved against the guild's complete feature set, defaulting to 500. A guild with [UNLIMITED_STICKERS](/http-api/guilds/#guild-features) bypasses that configuration and receives a fixed ceiling of 999999.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+A guild can have 500 stickers by default, set by the `max_guild_stickers` [limit key](/http-api/instance/#limit-keys), and [UNLIMITED_STICKERS](/http-api/guilds/#guild-features) raises it to 999999.### JSON body@@ -184,234 +100,106 @@ The body is one [sticker create object](#sticker-create-object).| Status | Body | Condition || --- | --- | --- |-| 200 | [guild sticker](#guild-sticker-object) object | Sticker was created |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Guild is at its sticker slot limit, or the image is invalid |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | Guild is unavailable, the caller is not a member or lacks `CREATE_EXPRESSIONS`, or the submitted text or image is blocked |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |--<sup>1</sup> The [error code](/http-api/errors/) is `MAX_STICKERS` for the slot limit, with the resolved limit in its message variables. An image failure is `INVALID_FORM_BODY` with `BASE64_LENGTH_INVALID` for an oversized encoding, `IMAGE_SIZE_EXCEEDS_LIMIT` for decoded bytes over the resolved ceiling, or `INVALID_IMAGE_FORMAT` for an undecodable or unaccepted image at the `image` path--<sup>2</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` for an unavailable guild, `MISSING_PERMISSIONS` for a membership or permission failure, and `CONTENT_BLOCKED` when the name, description, or a tag matches a blocklist or the decoded image matches a banned file hash--### Side effects+| 200 | [guild sticker](#guild-sticker-object) object | The sticker was created |+| 400 | [error response](/http-api/#error-response) | `MAX_STICKERS` when the guild is at its sticker limit, or a field or the [image](#sticker-create-object) is invalid |-Creating a sticker consumes one guild sticker slot, emits [Guild Stickers Update](/gateway/events/#guild-stickers-update) with the complete collection and records a [`STICKER_CREATE`](/http-api/guild-audit-logs/#audit-actions) audit entry with the supplied reason.--### Rate limit--10 requests per 30 seconds for each authenticated user and guild ID, on the `guild:sticker:create::guild_id` bucket.+The rate limit is 10 requests per 30 seconds, on the `guild:sticker:create::guild_id` bucket.## Bulk create guild stickers<RouteHeader method="POST" path="/v1/guilds/{guild_id}/stickers/bulk" bot auditReason />-Attempts to create between 1 and 50 stickers in one request and returns a [sticker bulk create response](#sticker-bulk-create-response-object) object. Emits one [Guild Stickers Update](/gateway/events/#guild-stickers-update) Gateway event for the whole batch.--The caller needs membership of the guild and [CREATE_EXPRESSIONS](/http-api/permissions/). Fluxer processes the items strictly in the submitted order and treats each one independently. An item fails when no guild sticker slot remains. A later item can still succeed after an earlier item failed for another reason.+Creates several stickers in one request and returns a [sticker bulk create response](#sticker-bulk-create-response-object) object. You need [CREATE_EXPRESSIONS](/http-api/permissions/). Fluxer sends one [Guild Stickers Update](/gateway/events/#guild-stickers-update) event when at least one sticker was created.-:::caution[A 200 does not mean every item succeeded]-The operation returns 200 whenever the top-level request was valid, including when every item failed. Read `success` and `failed` for the per-item outcome. The stickers in `success` are durable and are not rolled back when a later item fails.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Fluxer creates the items in order, and each one succeeds or fails on its own. The request returns 200 even when every item fails, and `failed` lists the items that weren't created.### JSON body| Field | Type | Description || --- | --- | --- |-| stickers | array[[sticker create object](#sticker-create-object)] | The items to create, in the order they are processed (1-50) |+| stickers | array[[sticker create object](#sticker-create-object)] | The stickers to create (1-50) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [sticker bulk create response](#sticker-bulk-create-response-object) object | Every validated item was attempted |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Top-level body, item count, item shape, item metadata, or encoded image bound is invalid |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | Guild is unavailable, the caller is not a member or lacks `CREATE_EXPRESSIONS`, or a submitted string is blocked |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |--<sup>1</sup> An oversized encoded image, an out-of-range name, or a tag outside its bound rejects the whole request before any item is created+| 200 | [sticker bulk create response](#sticker-bulk-create-response-object) object | Every item was attempted |+| 400 | [error response](/http-api/#error-response) | The body, the item count or any item's fields fail validation |-<sup>2</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` for an unavailable guild, `MISSING_PERMISSIONS` for a membership or permission failure, and `CONTENT_BLOCKED` for a blocked string--A decoded image that is oversized, undecodable, in an unaccepted format, or matching a banned file hash fails one item.--:::note[Blocked text can reject the whole batch]-A blocked name, description or tag of at least 3 characters rejects the whole request. A shorter blocked value fails only that item.-:::--### Side effects--Each successful item consumes one guild sticker slot and records a [`STICKER_CREATE`](/http-api/guild-audit-logs/#audit-actions) audit entry with the supplied reason.--Fluxer emits one [Guild Stickers Update](/gateway/events/#guild-stickers-update) after the batch when at least one item succeeded, with the guild's complete sticker collection. A batch in which no item succeeded emits nothing.--### Rate limit--6 requests per minute for each authenticated user and guild ID, on the `guild:sticker:bulk_create::guild_id` bucket.+The rate limit is 6 requests per minute, on the `guild:sticker:bulk_create::guild_id` bucket.## Clone guild sticker<RouteHeader method="POST" path="/v1/guilds/{guild_id}/stickers/clone" bot auditReason />-Copies an existing sticker into the target guild and returns the new [guild sticker object](#guild-sticker-object) without `user`. Emits a [Guild Stickers Update](/gateway/events/#guild-stickers-update) Gateway event in the target guild.--The caller needs membership of the target guild and [CREATE_EXPRESSIONS](/http-api/permissions/) there. Membership of the source guild is not required. The source guild must have [CLONE_STICKER_ENABLED](/http-api/guilds/#guild-features), which a guild holds only after it opts in.--The name, description, tags, animation state and image are copied unchanged.--[Get sticker metadata](/http-api/expressions/#get-sticker-metadata) reports whether a source permits cloning without attempting the operation.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the target guild |+Copies a sticker from any guild into this guild and returns it. You need [CREATE_EXPRESSIONS](/http-api/permissions/) in this guild, and you don't need to be a member of the source guild. The source guild needs [CLONE_STICKER_ENABLED](/http-api/guilds/#guild-features). Fluxer sends a [Guild Stickers Update](/gateway/events/#guild-stickers-update) event in the target guild.### JSON body| Field | Type | Description || --- | --- | --- |-| source_sticker_id | snowflake | The ID of the sticker to copy, which can belong to any guild |+| source_sticker_id | snowflake | The ID of the sticker to copy |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [guild sticker](#guild-sticker-object) object | Sticker was cloned |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Target guild is at its sticker slot limit |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | Source guild is missing or does not permit cloning, the target guild is unavailable, or the caller is not a member of the target guild or lacks `CREATE_EXPRESSIONS` there |-| 404<sup>3</sup> | [error response](/http-api/#error-response) | Source sticker or target guild does not exist |--<sup>1</sup> The [error code](/http-api/errors/) is `MAX_STICKERS`+| 200 | [guild sticker](#guild-sticker-object) object | The sticker was cloned |+| 400 | [error response](/http-api/#error-response) | `MAX_STICKERS` when the target guild is at its sticker limit |+| 403 | [error response](/http-api/#error-response) | `MISSING_ACCESS` when the source guild is gone or doesn't allow cloning |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_STICKER` when the source sticker doesn't exist |-<sup>2</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` when the source guild is missing or lacks `CLONE_STICKER_ENABLED` and when the target guild is unavailable, and `MISSING_PERMISSIONS` for a target membership or permission failure--<sup>3</sup> The [error code](/http-api/errors/) is `UNKNOWN_STICKER` for the source sticker and `UNKNOWN_GUILD` for the target guild--A source guild that no longer exists returns 403 `MISSING_ACCESS`, so a caller cannot tell it apart from a source guild that does not permit cloning.--### Side effects--The copy consumes one target guild sticker slot and names the caller as uploader. It emits [Guild Stickers Update](/gateway/events/#guild-stickers-update) in the target guild and records a [`STICKER_CREATE`](/http-api/guild-audit-logs/#audit-actions) audit entry. The source is unchanged.--### Rate limit--10 requests per 30 seconds for each authenticated user and target guild ID, on the `guild:sticker:clone::guild_id` bucket.+The rate limit is 10 requests per 30 seconds, on the `guild:sticker:clone::guild_id` bucket.## Modify guild sticker<RouteHeader method="PATCH" path="/v1/guilds/{guild_id}/stickers/{sticker_id}" bot auditReason />-Replaces sticker metadata and returns the [guild sticker object](#guild-sticker-object) without `user`. Emits a [Guild Stickers Update](/gateway/events/#guild-stickers-update) Gateway event.--### Limitations--- The uploader can modify their own sticker with [CREATE_EXPRESSIONS](/http-api/permissions/), and any other caller requires [MANAGE_EXPRESSIONS](/http-api/permissions/).-- Neither permission is subject to the guild [MFA level](/http-api/guilds/#mfa-levels).-- The stored image cannot be replaced, so an image change requires creating a new sticker.--A sticker that does not belong to the guild in the path returns 404 `UNKNOWN_STICKER`.+Updates the name, description and tags of a sticker and returns it. To replace the image, create a new sticker. The uploader needs [CREATE_EXPRESSIONS](/http-api/permissions/) and anyone else needs [MANAGE_EXPRESSIONS](/http-api/permissions/). Fluxer sends a [Guild Stickers Update](/gateway/events/#guild-stickers-update) event.:::caution[Every request writes `description` and `tags`]-Only `name` is required. Omitting `description` clears the stored description and omitting `tags` clears the stored tags. A client changing one field submits the current value of the other two alongside it.+Omitting `description` or `tags` clears the stored value. Send the current value of both when you change only one field.:::-### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |-| sticker_id | snowflake | The ID of the sticker |-### JSON body| Field | Type | Description || --- | --- | --- || name | string | The name of the sticker (2-30 characters) |-| description?<sup>1</sup> | ?string | The sticker description (1-500 characters), or null to clear it |-| tags?<sup>2</sup> | array[string] | [Sticker tags](#sticker-tags), defaulting to an empty array |--<sup>1</sup> An omitted value and null are both stored as null and returned as an empty string--<sup>2</sup> An omitted array is written as an empty array+| description? | ?string | The sticker description (1-500 characters) |+| tags? | array[string] | The sticker tags (at most 10, 1-30 characters each) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [guild sticker](#guild-sticker-object) object | Metadata was processed |-| 403<sup>1</sup> | [error response](/http-api/#error-response) | Guild is unavailable, the caller is neither the uploader with `CREATE_EXPRESSIONS` nor a member holding `MANAGE_EXPRESSIONS`, or the submitted text is blocked |-| 404 | [error response](/http-api/#error-response) | Sticker does not exist in that guild and the request returns `UNKNOWN_STICKER` |--<sup>1</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` for an unavailable guild, `MISSING_PERMISSIONS` for a membership or permission failure, and `CONTENT_BLOCKED` for a blocked name, description, or tag--A non-member who names an existing sticker receives `MISSING_PERMISSIONS`.--### Side effects+| 200 | [guild sticker](#guild-sticker-object) object | The sticker was updated |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_STICKER` when the sticker isn't in the guild |-The operation writes the supplied metadata, emits [Guild Stickers Update](/gateway/events/#guild-stickers-update) with the guild's complete sticker collection, and then records a [`STICKER_UPDATE`](/http-api/guild-audit-logs/#audit-actions) audit entry. Submitted values that match the stored ones still emit the Dispatch and record no audit entry.--### Rate limit--20 requests per 10 seconds for each authenticated user and guild ID, on the `guild:sticker:update::guild_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `guild:sticker:update::guild_id` bucket.## Delete guild sticker<RouteHeader method="DELETE" path="/v1/guilds/{guild_id}/stickers/{sticker_id}" bot auditReason />-Deletes the sticker record and returns 204 with an empty body. Emits a [Guild Stickers Update](/gateway/events/#guild-stickers-update) Gateway event.--### Limitations+Deletes a sticker and returns 204. The uploader needs [CREATE_EXPRESSIONS](/http-api/permissions/) and anyone else needs [MANAGE_EXPRESSIONS](/http-api/permissions/). Fluxer sends a [Guild Stickers Update](/gateway/events/#guild-stickers-update) event.-- The uploader can delete their own sticker with [CREATE_EXPRESSIONS](/http-api/permissions/), and any other caller requires [MANAGE_EXPRESSIONS](/http-api/permissions/).-- Setting `purge` needs the guild to have [EXPRESSION_PURGE_ALLOWED](/http-api/guilds/#guild-features).--:::caution[Purging the stored image cannot be undone]-Without `purge`, the sticker leaves the guild but its image remains available through the [Media Proxy](/media-proxy/routes/#image-asset-contract). With `purge`, the image is scheduled for permanent deletion.-:::--:::note[A clone outlives a purge of its source]-A later purge of the source sticker does not affect an existing clone in another guild.+:::caution[Purging the image cannot be undone]+Without `purge`, the image stays available through the [Media Proxy](/media-proxy/routes/#image-asset-contract). With `purge`, Fluxer schedules the image for permanent deletion, and the guild needs [EXPRESSION_PURGE_ALLOWED](/http-api/guilds/#guild-features).:::-### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |-| sticker_id | snowflake | The ID of the sticker |-### Query parameters| Field | Type | Description || --- | --- | --- |-| purge?<sup>1</sup> | boolean | Whether to permanently delete the stored image (default false) |--<sup>1</sup> Read as true only when it is exactly `true`, `True`, or `1` after trimming. Every other value, including `TRUE` and `yes`, reads as false+| purge? | boolean | Whether to permanently delete the stored image (default false) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Sticker was deleted |-| 403<sup>1</sup> | [error response](/http-api/#error-response) | Guild is unavailable or cannot purge expression assets, or the caller is neither the uploader with `CREATE_EXPRESSIONS` nor a member holding `MANAGE_EXPRESSIONS` |-| 404<sup>2</sup> | [error response](/http-api/#error-response) | Guild or sticker does not exist |--<sup>1</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` for an unavailable guild and when `purge` is true and the guild lacks [EXPRESSION_PURGE_ALLOWED](/http-api/guilds/#guild-features), and `MISSING_PERMISSIONS` for a membership or permission failure--<sup>2</sup> The [error code](/http-api/errors/) is `UNKNOWN_GUILD` for the guild and `UNKNOWN_STICKER` for the sticker--### Side effects--The operation removes the sticker from the guild, returns its slot, emits [Guild Stickers Update](/gateway/events/#guild-stickers-update) with the guild's remaining sticker collection, and then writes a [`STICKER_DELETE`](/http-api/guild-audit-logs/#audit-actions) audit entry.--With `purge`, the image can remain available briefly after the 204. Existing messages that reference the sticker are unchanged.--### Rate limit+| 204 | empty | The sticker was deleted |+| 403 | [error response](/http-api/#error-response) | `MISSING_ACCESS` when `purge` is set and the guild lacks `EXPRESSION_PURGE_ALLOWED` |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_STICKER` when the sticker isn't in the guild |-10 requests per 30 seconds for each authenticated user and guild ID, on the `guild:sticker:delete::guild_id` bucket. The route charges a second allowance of 300 requests per day for each authenticated user and guild ID, on the `guild:sticker:delete:daily::guild_id` bucket.+The rate limit is 10 requests per 30 seconds, on the `guild:sticker:delete::guild_id` bucket. The daily rate limit is 300 requests per day, on the `guild:sticker:delete:daily::guild_id` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/guilds.mdx b/fluxer_docs/src/content/docs/http-api/guilds.mdxindex b1a161e3d..8d601a861 100644--- a/fluxer_docs/src/content/docs/http-api/guilds.mdx+++ b/fluxer_docs/src/content/docs/http-api/guilds.mdx@@ -1,20 +1,12 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Guilds-description: Guild objects, creation templates, configuration registries, and lifecycle operations.+description: Guild objects, creation templates, visits and the endpoints that create, change and delete guilds.---import RouteHeader from '@/components/RouteHeader.astro';-A guild is a community with its own channels, roles, members, and configuration. Membership and ownership transfer are on [Guild members](/http-api/guild-members/), and channels on [Guild channels](/http-api/guild-channels/).--[List current user guilds](#list-current-user-guilds) and [Get guild](#get-guild) declare the `guilds` [OAuth2 scope](/http-api/oauth2/#oauth2-scopes), and a bearer credential without that scope receives 403 `MISSING_OAUTH_SCOPE`. Every other route rejects a bearer credential with 403 `ACCESS_DENIED`.--A guild that does not exist returns 404 `UNKNOWN_GUILD`. A non-member receives 403 `MISSING_PERMISSIONS`. A guild that exists in storage but that the Gateway reports as not found returns 403 `ACCESS_DENIED`.--An [unavailable guild](#guild-features) can still appear in [List current user guilds](#list-current-user-guilds). Members can still [leave](#leave-guild) or [delete their own messages](#bulk-delete-current-users-guild-messages).--Submitted names and other text must pass the instance's content policy. Blocked content returns 403 `CONTENT_BLOCKED`.+A guild is a community with its own channels, roles, members and settings. Members and ownership are on [Guild members](/http-api/guild-members/), and channels are on [Guild channels](/http-api/guild-channels/). An OAuth2 bearer token with the [`guilds` scope](/http-api/oauth2/#oauth2-scopes) can call only [List current user guilds](#list-current-user-guilds) and [Get guild](#get-guild). A guild that doesn't exist returns 404 `UNKNOWN_GUILD`, and a route that needs membership returns 403 `MISSING_PERMISSIONS` to a non-member.## Guild object@@ -25,85 +17,55 @@ Submitted names and other text must pass the instance's content policy. Blocked| id | snowflake | The ID of the guild || name | string | The name of the guild (1-100 characters) || icon<sup>1</sup> | ?string | Guild icon hash |-| banner<sup>2</sup> | ?string | Guild banner hash |-| banner_width<sup>3</sup> | ?integer | Banner width in pixels |-| banner_height<sup>3</sup> | ?integer | Banner height in pixels |-| splash<sup>4</sup> | ?string | Invite splash hash |-| splash_width<sup>3</sup> | ?integer | Invite splash width in pixels |-| splash_height<sup>3</sup> | ?integer | Invite splash height in pixels |+| banner<sup>1</sup> | ?string | Guild banner hash |+| banner_width<sup>2</sup> | ?integer | Banner width in pixels |+| banner_height<sup>2</sup> | ?integer | Banner height in pixels |+| splash<sup>1</sup> | ?string | Invite splash hash |+| splash_width<sup>2</sup> | ?integer | Invite splash width in pixels |+| splash_height<sup>2</sup> | ?integer | Invite splash height in pixels || splash_card_alignment | integer | [Splash card alignment](#splash-card-alignments) |-| embed_splash<sup>4</sup> | ?string | Embedded invite splash hash |-| embed_splash_width<sup>3</sup> | ?integer | Embedded invite splash width in pixels |-| embed_splash_height<sup>3</sup> | ?integer | Embedded invite splash height in pixels |+| embed_splash<sup>1</sup> | ?string | Embedded invite splash hash |+| embed_splash_width<sup>2</sup> | ?integer | Embedded invite splash width in pixels |+| embed_splash_height<sup>2</sup> | ?integer | Embedded invite splash height in pixels || vanity_url_code | ?string | Custom invite code || owner_id | snowflake | The ID of the guild owner |-| system_channel_id | ?snowflake | Text or announcement channel that receives system messages |+| system_channel_id | ?snowflake | Text or announcement channel that gets system messages || system_channel_flags | integer | [System channel flags](#system-channel-flags) |-| rules_channel_id<sup>5</sup> | ?snowflake | The ID of the rules channel |+| rules_channel_id | ?snowflake | The ID of the rules channel || afk_channel_id | ?snowflake | Voice channel that inactive members are moved to || afk_timeout | integer | AFK timeout in seconds (60-3600) |-| features<sup>6</sup> | array[string] | [Guild features](#guild-features) |+| features | array[string] | [Guild features](#guild-features), in no fixed order || verification_level | integer | [Verification level](#verification-levels) || mfa_level | integer | [MFA level](#mfa-levels) |-| nsfw_level<sup>7</sup> | integer | [NSFW level](#nsfw-levels) |+| nsfw_level | integer | [NSFW level](#nsfw-levels) || nsfw | boolean | Whether the guild is marked as adult content || content_warning_level | integer | [Guild content warning level](#guild-content-warning-levels) |-| content_warning_text<sup>8</sup> | ?string | Guild content warning text (max 200 characters) |+| content_warning_text | ?string | Content warning text (max 200 characters), or null for the default text || explicit_content_filter | integer | [Guild explicit content filter level](#guild-explicit-content-filter-levels) || default_message_notifications | integer | [Default message notification level](#default-message-notification-levels) |-| disabled_operations<sup>9</sup> | integer | [Disabled guild operations](#disabled-guild-operations) |-| message_history_cutoff<sup>10</sup> | ?ISO8601 timestamp | Earliest message visible to a member without `READ_MESSAGE_HISTORY` |-| permissions?<sup>11</sup> | decimal string | Caller permissions in the guild |-| roles?<sup>12</sup> | array[[guild role](/http-api/permissions/#guild-role-object) object] | Guild roles |-| emojis?<sup>12</sup> | array[[guild emoji](/http-api/guild-emojis/#guild-emoji-object) object] | Guild emojis |-| stickers?<sup>12</sup> | array[[guild sticker](/http-api/guild-stickers/#guild-sticker-object) object] | Guild stickers |-| channels?<sup>13</sup> | array[[channel](/http-api/channels/#channel-object) object] | Guild channels the caller can view |-| member_count?<sup>14</sup> | integer | Member count held by the main Gateway |-| online_count?<sup>14</sup> | integer | Online presence count held by the main Gateway |-| approximate_member_count?<sup>15</sup> | integer | Approximate member count |-| approximate_presence_count?<sup>15</sup> | integer | Approximate online presence count |-| threads_active?<sup>16</sup> | boolean | Whether the caller can use threads, forum channels, and media channels in the guild, always `true` when present |-| visiting?<sup>17</sup> | boolean | Present and `true` when the caller is [visiting](#visiting-guilds) the guild without being a member |--<sup>1</sup> An animated icon hash has the `a_` prefix, and that prefix is removed from the returned value while the guild lacks `ANIMATED_ICON`--<sup>2</sup> The field is null whenever the guild lacks `BANNER`, and the `a_` prefix is removed from the returned value while the guild lacks `ANIMATED_BANNER`--<sup>3</sup> The dimension is null whenever its own asset hash field is null--<sup>4</sup> The field is null whenever the guild lacks `INVITE_SPLASH`--<sup>5</sup> No operation on this page assigns the rules channel--<sup>6</sup> The set has each feature at most once, and its order is not stable--<sup>7</sup> The value is derived from `nsfw`, so it is 3 when `nsfw` is true and 0 otherwise--<sup>8</sup> A null value means the client renders the localised default warning text for the guild--<sup>9</sup> Written only through the [Admin API](/admin-api/guilds/)--<sup>10</sup> The cutoff is evaluated only for a member that lacks [READ_MESSAGE_HISTORY](/http-api/permissions/). A null value denies that member every message in the guild, and a set value exposes messages created at or after the timestamp+| disabled_operations | integer | [Disabled guild operations](#disabled-guild-operations) |+| message_history_cutoff<sup>3</sup> | ?ISO8601 timestamp | Earliest message a member without `READ_MESSAGE_HISTORY` can see |+| permissions?<sup>4</sup> | decimal string | Your permissions in the guild |+| roles?<sup>5</sup> | array[[guild role](/http-api/permissions/#guild-role-object) object] | Guild roles |+| emojis?<sup>5</sup> | array[[guild emoji](/http-api/guild-emojis/#guild-emoji-object) object] | Guild emojis |+| stickers?<sup>5</sup> | array[[guild sticker](/http-api/guild-stickers/#guild-sticker-object) object] | Guild stickers |+| channels?<sup>5</sup> | array[[channel](/http-api/channels/#channel-object) object] | Guild channels you can view, without threads |+| member_count?<sup>5</sup> | integer | Member count |+| online_count?<sup>5</sup> | integer | Online member count |+| approximate_member_count?<sup>4</sup> | integer | Approximate member count |+| approximate_presence_count?<sup>4</sup> | integer | Approximate online member count |+| threads_active?<sup>4</sup> | boolean | Always `true`, and says you can use threads, forum channels and media channels |+| visiting?<sup>5</sup> | boolean | `true` when you are [visiting](#visiting-guilds) the guild without being a member |-<sup>11</sup> Only [List current user guilds](#list-current-user-guilds) populates this field, and only when its permission lookup succeeds. The value is the complete mask the caller's roles grant+<sup>1</sup> Null when the guild doesn't have `BANNER` (banner) or `INVITE_SPLASH` (splash and embed_splash). An animated hash loses its `a_` prefix when the guild doesn't have `ANIMATED_ICON` or `ANIMATED_BANNER`-<sup>12</sup> Only [Get guild](#get-guild) populates this field+<sup>2</sup> Null when the matching hash is null-<sup>13</sup> Only [Get guild](#get-guild) populates this field, with the channels the caller can currently view. The array has forum and media channels for every caller and has no threads+<sup>3</sup> Null means a member without `READ_MESSAGE_HISTORY` can't see any earlier messages-<sup>14</sup> Only [Get guild](#get-guild) populates these fields+<sup>4</sup> Only [List current user guilds](#list-current-user-guilds) returns this field. The approximate counts need `with_counts`, and `threads_active` needs a bot or a session with the [`channel_threads` capability](/http-api/threads/#client-capability). Without that capability, a user session gets `permissions` and role `permissions` with the [thread permission bits](/http-api/threads/#thread-permissions) removed-<sup>15</sup> Only [List current user guilds](#list-current-user-guilds) populates these fields, and only when `with_counts` is true. A guild for which the Gateway holds no cached counts reports 0 for both--<sup>16</sup> Only [List current user guilds](#list-current-user-guilds) populates this field, and only for a bot or a user session that declares the [`channel_threads` client capability](/http-api/threads/#client-capability)--<sup>17</sup> Only [Get guild](#get-guild) populates this field, for a caller with a visit. That response has no `permissions`, and `channels` holds the channels a visitor can read with only the @everyone overwrite kept--A caller other than a bot or a user session that declares `channel_threads` receives `permissions` and each role `permissions` with the [thread permission bits](/http-api/threads/#thread-permissions) removed. The `permission_overwrites` of `channels` keep the thread bits.--:::note[An absent field means the operation omitted it]-`roles`, `emojis`, `stickers`, `channels`, and every count field arrive only from the operations named in the footnotes above. A guild returned without `roles` can still hold roles.-:::+<sup>5</sup> Only [Get guild](#get-guild) returns this field. For a visitor, each channel has only its @everyone overwrite### Example@@ -136,7 +98,7 @@ A caller other than a bot or a user session that declares `channel_threads` rece## Partial guild object-A partial guild object is the smaller shape that appears inside invite payloads. It has identity and display fields only, and the feature-gated asset rules of the complete [guild object](#guild-object) apply to it unchanged.+Invites return this smaller guild object, and its asset fields follow the same feature rules as the [guild object](#guild-object).### Structure@@ -144,50 +106,25 @@ A partial guild object is the smaller shape that appears inside invite payloads.| --- | --- | --- || id | snowflake | The ID of the guild || name | string | The name of the guild |-| icon<sup>1</sup> | ?string | Guild icon hash |-| banner<sup>2</sup> | ?string | Guild banner hash |-| banner_width<sup>3</sup> | ?integer | Banner width in pixels |-| banner_height<sup>3</sup> | ?integer | Banner height in pixels |-| splash<sup>4</sup> | ?string | Invite splash hash |-| splash_width<sup>3</sup> | ?integer | Invite splash width in pixels |-| splash_height<sup>3</sup> | ?integer | Invite splash height in pixels |+| icon | ?string | Guild icon hash |+| banner | ?string | Guild banner hash |+| banner_width | ?integer | Banner width in pixels |+| banner_height | ?integer | Banner height in pixels |+| splash | ?string | Invite splash hash |+| splash_width | ?integer | Invite splash width in pixels |+| splash_height | ?integer | Invite splash height in pixels || splash_card_alignment | integer | [Splash card alignment](#splash-card-alignments) |-| embed_splash<sup>4</sup> | ?string | Embedded invite splash hash |-| embed_splash_width<sup>3</sup> | ?integer | Embedded invite splash width in pixels |-| embed_splash_height<sup>3</sup> | ?integer | Embedded invite splash height in pixels |-| features<sup>5</sup> | array[string] | [Guild features](#guild-features) |-| visits_enabled?<sup>6</sup> | boolean | Whether the caller can [visit](#visiting-guilds) the guild from this invite |--<sup>1</sup> An animated icon hash has the `a_` prefix, and that prefix is removed from the returned value while the guild lacks `ANIMATED_ICON`+| embed_splash | ?string | Embedded invite splash hash |+| embed_splash_width | ?integer | Embedded invite splash width in pixels |+| embed_splash_height | ?integer | Embedded invite splash height in pixels |+| features | array[string] | [Guild features](#guild-features) |+| visits_enabled?<sup>1</sup> | boolean | Whether you can [visit](#visiting-guilds) the guild from this invite |-<sup>2</sup> The field is null whenever the guild lacks `BANNER`, and the `a_` prefix is removed from the returned value while the guild lacks `ANIMATED_BANNER`--<sup>3</sup> The dimension is null whenever its own asset hash field is null--<sup>4</sup> The field is null whenever the guild lacks `INVITE_SPLASH`--<sup>5</sup> The set has each feature at most once, and `vanity_url_code` is never part of this representation--<sup>6</sup> Present only on [Get invite](/http-api/invites/#get-invite) for a caller with the `guild_visits` assignment. True when the guild holds `VISITS_ENABLED` and invites are not disabled--### Example--```json-{- "id": "1489002177550843904",- "name": "Ada's Workshop",- "icon": "a_9f2c1d4e",- "banner": null,- "splash": null,- "splash_card_alignment": 0,- "embed_splash": null,- "features": ["ANIMATED_ICON", "BANNER"]-}-```+<sup>1</sup> Only [Get invite](/http-api/invites/#get-invite) returns this field, and only with the `guild_visits` assignment## Guild creation template object-A creation template describes the roles and channels that [Create guild](#create-guild) creates. Fluxer remaps its template-local identifiers to newly allocated guild snowflakes during creation. Every template-local identifier is compared as its decimal string form, so the integer `1` and the string `"1"` name the same entity.+A template lists the roles and channels that [Create guild](#create-guild) creates. Its IDs are local to the template, as integers or decimal strings, and Fluxer gives each role and channel a new snowflake.### Structure@@ -195,26 +132,20 @@ A creation template describes the roles and channels that [Create guild](#create| --- | --- | --- || name<sup>1</sup> | string | Template name || description?<sup>1</sup> | ?string | Template description |-| verification_level?<sup>2</sup> | integer | [Verification level](#verification-levels), defaulting to 0 |-| default_message_notifications?<sup>2</sup> | integer | [Default message notification level](#default-message-notification-levels), defaulting to 0 |-| explicit_content_filter?<sup>2</sup> | integer | [Guild explicit content filter level](#guild-explicit-content-filter-levels), defaulting to 0 |-| system_channel_id?<sup>3</sup> | ?decimal string \| integer | Template-local ID of the text or announcement channel that becomes the system channel |-| afk_timeout?<sup>2</sup> | integer | AFK timeout in seconds, clamped to 60-3600 and defaulting to 300 |-| system_channel_flags?<sup>4</sup> | integer | [System channel flags](#system-channel-flags), defaulting to 0 |-| roles<sup>5</sup> | array[[guild template role](#guild-template-role-object) object] | Template roles (max 250) |-| channels<sup>6</sup> | array[[guild template channel](#guild-template-channel-object) object] | Template channels (max 500) |--<sup>1</sup> The field is read and discarded. The new guild takes its name from the `name` of the [Create guild](#create-guild) body--<sup>2</sup> The value is truncated to an integer and clamped into its registry range, and a missing value becomes the stated default. A non-numeric value fails validation and returns 400 `INVALID_FORM_BODY`+| verification_level?<sup>2</sup> | integer | [Verification level](#verification-levels) (default 0) |+| default_message_notifications?<sup>2</sup> | integer | [Default message notification level](#default-message-notification-levels) (default 0) |+| explicit_content_filter?<sup>2</sup> | integer | [Guild explicit content filter level](#guild-explicit-content-filter-levels) (default 0) |+| system_channel_id?<sup>3</sup> | ?decimal string \| integer | Template ID of the text or announcement channel for system messages |+| afk_timeout?<sup>2</sup> | integer | AFK timeout in seconds (60-3600, default 300) |+| system_channel_flags? | integer | [System channel flags](#system-channel-flags) (default 0) |+| roles | array[[guild template role](#guild-template-role-object) object] | Template roles (max 250) |+| channels | array[[guild template channel](#guild-template-channel-object) object] | Template channels (max 500) |-<sup>3</sup> An identifier that resolves to no text or announcement channel in the same template, and an absent or null value, all fall back to the template's first text or announcement channel. A template with neither receives a root text channel named `general`, which becomes the system channel+<sup>1</sup> Fluxer ignores this field and uses `name` from the [Create guild](#create-guild) body-<sup>4</sup> Every bit outside the registry is discarded+<sup>2</sup> A value out of range is clamped into it-<sup>5</sup> A template with more than 250 roles is rejected with 400 `GUILD_TEMPLATE_INVALID`. The ceiling counts the submitted array, and the everyone role is created on top of it, so 250 template roles that name no everyone role produce a guild holding 251--<sup>6</sup> A template with more than 500 channels is rejected with 400 `GUILD_TEMPLATE_INVALID`+<sup>3</sup> When this isn't a text or announcement channel in the template, the first one becomes the system channel. A template with none gets a text channel called `general`### Guild template role object@@ -222,24 +153,16 @@ A creation template describes the roles and channels that [Create guild](#create| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | decimal string \| integer | Template-local role ID |-| name?<sup>2</sup> | ?string | Role name, defaulting to the empty string |-| permissions?<sup>3</sup> | decimal string \| integer | Legacy role permission bitfield |-| permissions_new?<sup>3</sup> | decimal string \| integer | Preferred role permission bitfield |-| color? | integer | Role colour, defaulting to 0 |-| hoist? | boolean | Whether the role is displayed separately (default false) |+| id | decimal string \| integer | Template role ID, unique in the template |+| name?<sup>1</sup> | ?string | Role name (default empty) |+| permissions? | decimal string \| integer | Legacy role permission bitfield |+| permissions_new? | decimal string \| integer | Role permission bitfield, which wins over `permissions` when you send both |+| color? | integer | Role color (default 0) |+| hoist? | boolean | Whether the role is shown separately in the member list (default false) || mentionable? | boolean | Whether anyone can mention the role (default false) |-| unicode_emoji?<sup>4</sup> | ?string | Role Unicode emoji |--<sup>1</sup> A duplicate identifier rejects creation with 400 `GUILD_TEMPLATE_INVALID`--<sup>2</sup> The role whose name is exactly `@everyone` supplies the permissions of the new guild's everyone role, and when no role has that name the role whose identifier is `0` supplies them. Every remaining role is created in array order at positions 1 upward+| unicode_emoji? | ?string | Role Unicode emoji |-<sup>3</sup> `permissions_new` takes precedence over `permissions`, the value is masked to the permission bits Fluxer defines, and a value that is not a valid integer rejects creation with 400 `GUILD_TEMPLATE_INVALID`. An everyone role whose resolved mask is 0 receives the default permission set--<sup>4</sup> The value is stored on the created role. The everyone role is always created with no Unicode emoji--A resolved everyone mask that has `SEND_MESSAGES` and no [thread permission bit](/http-api/threads/#thread-permissions) also receives `CREATE_PUBLIC_THREADS`, `CREATE_PRIVATE_THREADS`, and `SEND_MESSAGES_IN_THREADS`.+<sup>1</sup> The role called `@everyone`, or the role with ID `0` when none has that name, sets the permissions of the everyone role. The other roles are created in array order### Guild template channel object@@ -247,48 +170,30 @@ A resolved everyone mask that has `SEND_MESSAGES` and no [thread permission bit]| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | decimal string \| integer | Template-local channel ID |-| type<sup>2</sup> | integer | Source channel type |-| name? | ?string | Channel name, defaulting to the empty string |-| topic?<sup>6</sup> | ?string | Channel topic, or forum guidelines on a forum or media channel |+| id | decimal string \| integer | Template channel ID, unique in the template |+| type<sup>1</sup> | integer | [Channel type](/http-api/channels/#channel-types) |+| name? | ?string | Channel name (default empty) |+| topic? | ?string | Channel topic, or forum guidelines on a forum or media channel || position | integer | The sort position of the channel |-| parent_id?<sup>3</sup> | ?decimal string \| integer | Template-local parent category ID |-| bitrate?<sup>4</sup> | ?integer | Voice bitrate, defaulting to 64000 for a voice channel and capped at 96000 |-| user_limit?<sup>4</sup> | ?integer | Voice occupancy limit, defaulting to 0 for a voice channel |-| voice_connection_limit?<sup>4</sup> | ?integer | Per-user voice connection limit, defaulting to 5 for a voice channel |+| parent_id? | ?decimal string \| integer | Template ID of the parent category |+| bitrate? | ?integer | Voice bitrate (default 64000, max 96000) |+| user_limit? | ?integer | Voice occupancy limit (default 0) |+| voice_connection_limit? | ?integer | Per-user voice connection limit (default 5) || nsfw? | ?boolean | Whether the channel is age restricted (default false) |-| rate_limit_per_user? | ?integer | Slowmode interval in seconds, defaulting to 0 |-| permission_overwrites?<sup>5</sup> | ?array[[guild template role permission overwrite](#guild-template-role-permission-overwrite-object) object] | Role permission overwrites |-| available_tags?<sup>7</sup> | ?array[[guild template forum tag](#guild-template-forum-tag-object) object] | Tags for a forum or media channel |-| default_reaction_emoji?<sup>8</sup> | ?[guild template default reaction](#guild-template-default-reaction-object) object | Default reaction shown on posts in a forum or media channel |-| default_sort_order?<sup>9</sup> | ?integer | Default [forum sort order](/http-api/forums/#forum-sort-orders) of a forum or media channel |-| default_forum_layout?<sup>9</sup> | ?integer | Default [forum layout](/http-api/forums/#forum-layouts) of a forum channel |-| default_tag_setting?<sup>9</sup> | ?string | Default [forum tag setting](/http-api/forums/#forum-tag-settings) of a forum or media channel |-| default_thread_rate_limit_per_user?<sup>10</sup> | ?integer | Slowmode interval in seconds copied onto new threads |-| default_auto_archive_duration?<sup>9</sup> | ?integer | Default [auto archive duration](/http-api/threads/#auto-archive-durations) in minutes for new threads |-| flags?<sup>11</sup> | ?integer | [Channel flags](/http-api/forums/#channel-flags) of a forum or media channel |--<sup>1</sup> A duplicate identifier in the same template rejects creation with 400 `GUILD_TEMPLATE_INVALID`--<sup>2</sup> The value 0 creates a text channel, 2 a voice channel, 4 a category, 5 an announcement channel, 15 a forum channel, and 16 a media channel. The value 13, the stage channel type of another platform, creates a voice channel. Fluxer skips every other value and creates no channel for it--<sup>3</sup> The identifier is applied only when it resolves to a category in the same template and the channel is not itself a category, and every other value leaves the channel at the guild root--<sup>4</sup> These voice fields are stored only on a voice channel and are null on every other channel type--<sup>5</sup> An entry is applied only when its resolved `type` is 0 and its `id` resolves to a role in the same template, and the identifier `0` resolves to the everyone role. Fluxer skips every other entry, and a channel whose entries are all skipped is created with no overwrites+| rate_limit_per_user? | ?integer | Slowmode interval in seconds (default 0) |+| permission_overwrites?<sup>2</sup> | ?array[[guild template role permission overwrite](#guild-template-role-permission-overwrite-object) object] | Role permission overwrites |+| available_tags? | ?array[[guild template forum tag](#guild-template-forum-tag-object) object] | Tags for a forum or media channel (max 20) |+| default_reaction_emoji? | ?[guild template default reaction](#guild-template-default-reaction-object) object | Default reaction on posts in a forum or media channel |+| default_sort_order? | ?integer | Default [forum sort order](/http-api/forums/#forum-sort-orders) of a forum or media channel |+| default_forum_layout? | ?integer | Default [forum layout](/http-api/forums/#forum-layouts) of a forum channel |+| default_tag_setting? | ?string | Default [forum tag setting](/http-api/forums/#forum-tag-settings) of a forum or media channel |+| default_thread_rate_limit_per_user? | ?integer | Slowmode interval in seconds for new threads (max 21600) |+| default_auto_archive_duration? | ?integer | Default [auto archive duration](/http-api/threads/#auto-archive-durations) in minutes for new threads |+| flags? | ?integer | [Channel flags](/http-api/forums/#channel-flags) of a forum or media channel |-<sup>6</sup> A topic longer than 4096 characters on a forum or media channel, or 1024 characters on any other channel, is shortened to that limit+<sup>1</sup> 0 creates a text channel, 2 or 13 a voice channel, 4 a category, 5 an announcement channel, 15 a forum channel and 16 a media channel. Fluxer skips any other type-<sup>7</sup> Applied only to a forum or media channel. Each tag gets a new ID, its name is trimmed and shortened to 50 characters, a tag with an empty or repeated name is skipped, and Fluxer keeps at most 20 tags--<sup>8</sup> Applied only to a forum or media channel, and only when `emoji_name` is a single unicode emoji--<sup>9</sup> An unknown value is ignored and the channel keeps the default. `default_sort_order` and `default_tag_setting` apply only to a forum or media channel, `default_forum_layout` only to a forum channel, and `default_auto_archive_duration` to a text, announcement, forum or media channel--<sup>10</sup> Applied to a text, announcement, forum or media channel, capped at 21600, and a value of 0 or less is ignored--<sup>11</sup> Only the flags a forum or media channel can carry are kept, and `REQUIRE_TAG` is dropped when no imported tag can be applied by members without moderator permissions+<sup>2</sup> Fluxer applies only role overwrites whose `id` is a role in the template, and ID `0` is the everyone role### Guild template forum tag object@@ -298,12 +203,8 @@ A resolved everyone mask that has `SEND_MESSAGES` and no [thread permission bit]| --- | --- | --- || name | string | Tag name || moderated? | ?boolean | Whether only moderators can apply the tag |-| emoji_id?<sup>1</sup> | ?string \| integer | Custom emoji of the tag |-| emoji_name?<sup>2</sup> | ?string | Unicode emoji of the tag |--<sup>1</sup> Ignored on import, because the custom emoji does not exist in the new guild--<sup>2</sup> Kept only when the value is a single unicode emoji+| emoji_id? | ?string \| integer | Custom emoji of the tag, which Fluxer ignores |+| emoji_name? | ?string | Unicode emoji of the tag |### Guild template default reaction object@@ -311,12 +212,8 @@ A resolved everyone mask that has `SEND_MESSAGES` and no [thread permission bit]| Field | Type | Description || --- | --- | --- |-| emoji_id?<sup>1</sup> | ?string \| integer | Custom emoji of the reaction |-| emoji_name?<sup>2</sup> | ?string | Unicode emoji of the reaction |--<sup>1</sup> Ignored on import, because the custom emoji does not exist in the new guild--<sup>2</sup> Kept only when the value is a single unicode emoji+| emoji_id? | ?string \| integer | Custom emoji of the reaction, which Fluxer ignores |+| emoji_name? | ?string | Unicode emoji of the reaction |### Guild template role permission overwrite object@@ -324,58 +221,46 @@ A resolved everyone mask that has `SEND_MESSAGES` and no [thread permission bit]| Field | Type | Description || --- | --- | --- |-| id | decimal string \| integer | Template-local role ID |-| type<sup>1</sup> | integer \| string | Overwrite type |-| allow<sup>2</sup> | decimal string \| integer | Allowed permission bitfield |-| deny<sup>2</sup> | decimal string \| integer | Denied permission bitfield |--<sup>1</sup> The string `role` resolves to 0 and the string `member` resolves to 1, and every other string is read as a number. Only a resolved value of 0 is applied--<sup>2</sup> The value is masked to the permission bits Fluxer defines, and a value that is not a valid integer rejects creation with 400 `GUILD_TEMPLATE_INVALID`+| id | decimal string \| integer | Template role ID |+| type | integer \| string | Overwrite type, `0` or `role` for a role |+| allow | decimal string \| integer | Allowed permission bitfield |+| deny | decimal string \| integer | Denied permission bitfield |## Verification levels-A verification level gates member participation. Fluxer evaluates it when a member sends a message in the guild.+The verification level decides who can send messages in the guild. The owner, bots and members with at least one role skip the check.| Value | Name | Description || --- | --- | --- || 0 | NONE | No verification requirement || 1 | LOW<sup>1</sup> | The account is claimed and its email address verified || 2 | MEDIUM | The LOW requirement, and the account is at least 5 minutes old |-| 3 | HIGH<sup>2</sup> <sup>3</sup> | The MEDIUM requirement, and the membership is at least 10 minutes old |--<sup>1</sup> A guild with `DISCOVERABLE` is evaluated at an effective minimum of LOW even when the stored value is NONE, and [Modify guild](#modify-guild) rejects lowering a discoverable guild below LOW with 400 `INVALID_FORM_BODY` and the field code `DISCOVERABLE_GUILD_VERIFICATION_LEVEL_TOO_LOW`--<sup>2</sup> The membership age requirement is skipped when the join timestamp cannot be read, so the level behaves as MEDIUM--<sup>3</sup> A request value of 4 is stored as HIGH, and a [guild template](#guild-creation-template-object) value above HIGH is clamped to HIGH+| 3 | HIGH | The MEDIUM requirement, and the membership is at least 10 minutes old |-The guild owner, a bot, and any member holding at least one role bypass the check at every level.+<sup>1</sup> A guild with `DISCOVERABLE` is always at least LOW, and [Modify guild](#modify-guild) rejects a lower value with the field code `DISCOVERABLE_GUILD_VERIFICATION_LEVEL_TOO_LOW`-An unclaimed account that fails the check gets 403 `GUILD_VERIFICATION_REQUIRED`, and an unverified email address gets 403 `GUILD_EMAIL_VERIFICATION_REQUIRED`. An account younger than 5 minutes gets 403 `ACCOUNT_TOO_NEW_FOR_GUILD`. At HIGH, a membership younger than 10 minutes gets 403 `GUILD_VERIFICATION_REQUIRED`.+A member who fails the check gets 403 `GUILD_VERIFICATION_REQUIRED`, `GUILD_EMAIL_VERIFICATION_REQUIRED` or `ACCOUNT_TOO_NEW_FOR_GUILD`.## MFA levels| Value | Name | Description || --- | --- | --- || 0 | NONE | MFA is not required for moderation actions |-| 1 | ELEVATED<sup>1</sup> | MFA is required for moderation actions |+| 1 | ELEVATED | MFA is required for moderation actions |-<sup>1</sup> Only the guild owner can change this value, the owner account needs a second factor already configured, and the change requires sudo mode--While the level is ELEVATED, a non-owner caller uses the [elevated permissions](/http-api/permissions/#elevated-permissions) only with an enrolled authenticator. A bot inherits the enrolment state of its application owner. An operation that asserts an elevated permission the caller holds but cannot use returns 400 `TWO_FACTOR_REQUIRED` after confirming the permission itself.+At ELEVATED, a member other than the owner can use the [elevated permissions](/http-api/permissions/#elevated-permissions) only with an authenticator set up, and gets 400 `TWO_FACTOR_REQUIRED` without one. A bot needs its application owner to have an authenticator.## Splash card alignments| Value | Name | Description || --- | --- | --- |-| 0 | CENTER | Centre the splash card |+| 0 | CENTER | Center the splash card || 1 | LEFT | Align the splash card to the left || 2 | RIGHT | Align the splash card to the right |## Guild explicit content filter levels-A guild explicit content filter level is the guild-wide filter a moderator selects. The account setting of the same name on the [user settings object](/http-api/users/settings/) is a different registry with different values.+The account setting is on the [user settings object](/http-api/users/settings/).| Value | Name | Description || --- | --- | --- |@@ -392,6 +277,8 @@ A guild explicit content filter level is the guild-wide filter a moderator selec## NSFW levels+Fluxer sets the level from the guild's `nsfw` field.+| Value | Name | Description || --- | --- | --- || 0 | SAFE | Guild is not age restricted |@@ -399,12 +286,12 @@ A guild explicit content filter level is the guild-wide filter a moderator selec## Guild content warning levels-The guild is the last position in the resolution chain described by [channel content warning levels](/http-api/channels/#content-warning-levels).+A channel set to inherit uses the guild level, as described in [channel content warning levels](/http-api/channels/#content-warning-levels).| Value | Name | Description || --- | --- | --- |-| 0 | INHERIT | No level is set at guild level, so a channel that inherits displays no content warning |-| 1 | CONTENT_WARNING | A channel that inherits displays the guild content warning |+| 0 | INHERIT | A channel that inherits shows no content warning |+| 1 | CONTENT_WARNING | A channel that inherits shows the guild content warning |## System channel flags@@ -414,7 +301,7 @@ The guild is the last position in the resolution chain described by [channel con## Disabled guild operations-A set bit disables the named behaviour across the guild. Only the [Admin API](/admin-api/guilds/) writes the bitfield.+Only the [Admin API](/admin-api/guilds/) sets these bits.| Value | Name | Description || --- | --- | --- |@@ -431,70 +318,64 @@ A set bit disables the named behaviour across the guild. Only the [Admin API](/a| Value | Description || --- | --- || ANIMATED_BANNER | Guild can use an animated banner |-| AUDIO_BITRATE_128_KBPS<sup>6</sup> | Voice channel bitrate ceiling is raised to 128000 |-| AUDIO_BITRATE_256_KBPS<sup>6</sup> | Voice channel bitrate ceiling is raised to 256000 |-| AUDIO_BITRATE_384_KBPS<sup>6</sup> | Voice channel bitrate ceiling is raised to 384000 |+| ANIMATED_ICON | Guild can use an animated icon |+| ANNOUNCEMENT_CHANNELS_DISABLED<sup>1</sup> | Publishing from and following the guild's announcement channels is disabled |+| AUDIO_BITRATE_128_KBPS<sup>2</sup> | Voice channel bitrate limit is 128000 |+| AUDIO_BITRATE_256_KBPS<sup>2</sup> | Voice channel bitrate limit is 256000 |+| AUDIO_BITRATE_384_KBPS<sup>2</sup> | Voice channel bitrate limit is 384000 || BANNER | Guild can use a banner |-| CLONE_EMOJI_DISABLED<sup>7</sup> | Deprecated. Emoji cloning now needs CLONE_EMOJI_ENABLED |-| CLONE_EMOJI_ENABLED<sup>1</sup> | Guild permits another guild to clone its emojis |-| CLONE_STICKER_DISABLED<sup>7</sup> | Deprecated. Sticker cloning now needs CLONE_STICKER_ENABLED |-| CLONE_STICKER_ENABLED<sup>1</sup> | Guild permits another guild to clone its stickers |-| DETACHED_BANNER<sup>1</sup> | Guild banner is independent from its splash |+| CLONE_EMOJI_DISABLED | Deprecated and has no effect |+| CLONE_EMOJI_ENABLED<sup>3</sup> | Other guilds can clone this guild's emojis |+| CLONE_STICKER_DISABLED | Deprecated and has no effect |+| CLONE_STICKER_ENABLED<sup>3</sup> | Other guilds can clone this guild's stickers |+| DETACHED_BANNER<sup>3</sup> | Guild banner is independent from its splash |+| DISCOVERABLE | Guild is listed in discovery |+| EXPRESSION_PURGE_ALLOWED | [Emoji](/http-api/guild-emojis/#delete-guild-emoji) and [sticker](/http-api/guild-stickers/#delete-guild-sticker) deletes can use `purge` |+| HIDE_OWNER_CROWN<sup>3</sup> | Guild owner crown is hidden || INVITE_SPLASH | Guild can use invite splash assets |-| INVITES_DISABLED<sup>1</sup> | Guild invite use is disabled |-| RAID_DETECTED | Raid detection is active and invites are restricted |-| TEXT_CHANNEL_FLEXIBLE_NAMES<sup>1</sup> | Text, announcement, forum, and media channel names keep uppercase letters, spaces, and punctuation |-| HIDE_OWNER_CROWN<sup>1</sup> | Guild owner crown is hidden |-| MORE_EMOJI<sup>2</sup> | Legacy increased emoji slot allowance |-| MORE_STICKERS<sup>2</sup> | Legacy increased sticker slot allowance |-| UNLIMITED_EMOJI<sup>3</sup> | Guild emoji slots are effectively unlimited |-| UNLIMITED_STICKERS<sup>3</sup> | Guild sticker slots are effectively unlimited |-| EXPRESSION_PURGE_ALLOWED | Expression assets can be purged through delete operations |-| VANITY_URL | Guild can own a custom invite code |-| DISCOVERABLE | Guild is present in public discovery |+| INVITES_DISABLED<sup>3</sup> | Guild invites can't be used |+| LARGE_GUILD_OVERRIDE<sup>4</sup> | Guild is marked as a large guild |+| MORE_EMOJI<sup>4</sup> | Raises the emoji limit |+| MORE_STICKERS<sup>4</sup> | Raises the sticker limit || PARTNERED | Guild has partnered status |+| RAID_DETECTED | Set together with `INVITES_DISABLED` while invites are paused after a raid |+| TEXT_CHANNEL_FLEXIBLE_NAMES<sup>3</sup> | Text, announcement, forum and media channel names keep uppercase letters, spaces and punctuation |+| UNAVAILABLE_FOR_EVERYONE<sup>5</sup> | Guild is unavailable to every account, including the owner |+| UNAVAILABLE_FOR_EVERYONE_BUT_STAFF<sup>5</sup> | Guild is unavailable to every account without the instance staff flag |+| UNAVAILABLE_HIDDEN | The Gateway sends the unavailable guild with `unavailable_hidden: true` |+| UNLIMITED_EMOJI | Guild has 999999 emoji slots |+| UNLIMITED_STICKERS | Guild has 999999 sticker slots |+| VANITY_URL | Guild can have a custom invite code || VERIFIED | Guild has verified status |-| VIP_VOICE | Guild can use voice regions that are restricted to VIP guilds |+| VERY_LARGE_GUILD | Member limit is 10000000 (default 1000000) |+| VIP_VOICE | Guild can use voice regions limited to VIP guilds |+| VISITS_ENABLED<sup>3</sup> | People can [visit](#visiting-guilds) the guild before joining || VOICE_E2EE | Guild voice channels support end-to-end encryption |-<sup>1</sup> The feature is added or removed through [Modify guild](#modify-guild), as part of the complete array. Send every feature without this marker back to `features` exactly as the guild holds it--<sup>2</sup> The feature changes no HTTP API behaviour. An instance can name it in a filter of the ordered [limit configuration](/http-api/instance/#limit-keys), and the stock configuration names none of them--<sup>3</sup> Emoji and sticker creation use a fixed slot ceiling of 999999 and ignore the instance limit configuration+<sup>1</sup> [Crosspost message](/http-api/messages/#crosspost-message) and [Follow announcement channel](/http-api/channels/#follow-announcement-channel) return 403 `FEATURE_TEMPORARILY_DISABLED`-<sup>4</sup> Guild and channel routes return 403 `MISSING_ACCESS`. `UNAVAILABLE_FOR_EVERYONE` includes the guild owner. `UNAVAILABLE_FOR_EVERYONE_BUT_STAFF` exempts accounts with the instance staff flag+<sup>2</sup> Without one of these, the limit is 96000. A higher `bitrate` is stored at the limit-<sup>5</sup> The feature raises the default `max_guild_members` limit from 1000000 to 10000000 before the ordered [limit configuration](/http-api/instance/#limit-keys) is checked, so the raised ceiling applies even when no configured rule names the feature+<sup>3</sup> You can add or remove this feature with [Modify guild](#modify-guild)-<sup>6</sup> A guild holding none of the three caps a voice channel `bitrate` at 96000. The highest feature the guild holds wins, and a write above the cap is stored at the cap rather than rejected. A guild that loses the feature keeps the stored value, and the next write to `bitrate` lowers it to the cap+<sup>4</sup> Has no effect unless an instance [limit rule](/http-api/instance/#limit-keys) uses it-<sup>7</sup> The feature is deprecated and changes no behaviour. Fluxer still returns it for a guild that already holds it, and [Modify guild](#modify-guild) can neither add nor remove it--<sup>8</sup> Set by an instance administrator. [Crosspost message](/http-api/messages/#crosspost-message) and [Follow announcement channel](/http-api/channels/#follow-announcement-channel) return 403 `FEATURE_TEMPORARILY_DISABLED`, and copies of messages published earlier are no longer delivered or updated. Creating and converting announcement channels is unaffected--:::caution[Expression cloning is opt-in]-Cloning requires `CLONE_EMOJI_ENABLED` or `CLONE_STICKER_ENABLED`. A member with `MANAGE_GUILD` can enable them through [Modify guild](#modify-guild). The deprecated `CLONE_EMOJI_DISABLED` and `CLONE_STICKER_DISABLED` features have no effect.-:::+<sup>5</sup> Guild and channel routes return 403 `MISSING_ACCESS`## Visiting guilds-A visit lets someone read a guild before joining it. The visitor reads the channels the @everyone role can see, and cannot post, react, type, join voice, or see the member list. Members see no member add, presence, or count change. Visits need the `guild_visits` [experiment assignment](/http-api/experiments/#guild-visits-assignment-object). Without it every route here behaves as if the guild or invite did not exist, and no session receives a visited guild. A session receives its visited guilds only when it identifies with the `GUILD_VISITS` [session flag](/gateway/commands/#session-flags).+A visit lets someone read a guild before joining. A visitor sees the channels the @everyone role can read, with only the @everyone overwrite applied, and can't post, react, type, join voice or see the member list. Visits need the `guild_visits` [experiment assignment](/http-api/experiments/#guild-visits-assignment-object), and a session gets its visited guilds only when it identifies with the `GUILD_VISITS` [session flag](/gateway/commands/#session-flags).-A guild accepts visitors while it holds `VISITS_ENABLED`. New guilds get it at creation, an approved [discovery](/http-api/discovery/) listing turns it back on, and a member with `MANAGE_GUILD` can turn it off through [Modify guild](#modify-guild). A visit starts from an invite ([Visit invite guild](/http-api/invites/#visit-invite-guild)), from a discovery listing ([Visit discovery guild](/http-api/discovery/#visit-discovery-guild)), or from the instance community after sign up. The instance community does not need `VISITS_ENABLED`.+A guild takes visitors while it has `VISITS_ENABLED`. A visit starts from [Visit invite guild](/http-api/invites/#visit-invite-guild), [Visit discovery guild](/http-api/discovery/#visit-discovery-guild) or the instance's single community after sign up. Visitors can't see private threads, and adult channels stay hidden from people who may not see adult content. Without a verified email, a visitor sees only the last `guild_visit_history_days_unverified` days of messages (30 by default). Search by author or mention returns 400 `SEARCH_FILTER_NEEDS_MEMBERSHIP`.-What a visitor can read:+You can visit `max_guild_visits` guilds at once (10 by default, half without a verified email), and starting another ends the oldest. A visit ends in these cases, and each one sends [Guild Delete](/gateway/events/#guild-delete).-- The visitor's permissions in a channel are the @everyone role permissions without `ADMINISTRATOR`, with only the @everyone channel overwrite applied, limited to `VIEW_CHANNEL` and `READ_MESSAGE_HISTORY`. Role and member overwrites are ignored.-- Adult channels are hidden from a visitor who may not see adult content, and an adult guild cannot be visited by them at all.-- Private threads are never visible. Public threads follow their parent channel.-- An account without a confirmed email reads only the last `guild_visit_history_days_unverified` days of history, 30 by default.-- Channel search accepts content, `has`, and date filters. Filtering by author or mention returns 400 `SEARCH_FILTER_NEEDS_MEMBERSHIP`.-- Every channel object a visitor receives has only the @everyone permission overwrite.+- 14 days pass without you opening it+- Its invite is deleted or expires+- You're banned+- The guild turns off `VISITS_ENABLED`-A person can visit at most `max_guild_visits` guilds at once, 10 by default and half that without a confirmed email. Starting another visit ends the one opened longest ago. A visit ends after 14 days without being opened, when the invite that started it is deleted or expires, when the person is banned, when the guild drops `VISITS_ENABLED`, and when the person joins. Each ending sends [Guild Delete](/gateway/events/#guild-delete) to every session of that person, except a join, which sends a member [Guild Create](/gateway/events/#guild-create) in place.--Visiting does not use up a limited invite. Joining from the visit uses one, so a visitor cannot join once every use is taken.+Joining the guild ends the visit and sends [Guild Create](/gateway/events/#guild-create).### Guild visit object@@ -503,9 +384,7 @@ Visiting does not use up a limited invite. Joining from the visit uses one, so a| guild_id | snowflake | The ID of the guild being visited || source | integer | [Guild visit source](#guild-visit-sources) || started_at | ISO8601 timestamp | When the visit started |-| opened_at<sup>1</sup> | ISO8601 timestamp | When the visit was last opened |--<sup>1</sup> Updated at most once a day+| opened_at | ISO8601 timestamp | When the visit was last opened |### Guild visit sources@@ -514,244 +393,164 @@ Visiting does not use up a limited invite. Joining from the visit uses one, so a| 1 | INVITE | The visit started from an invite || 2 | VANITY_URL | The visit started from a custom invite URL || 3 | DISCOVERY | The visit started from a discovery listing |-| 4 | OPERATOR | The visit started from the instance community after sign up |+| 4 | OPERATOR | The visit started from the instance's single community after sign up |### Guild visit start object+[Visit invite guild](/http-api/invites/#visit-invite-guild) and [Visit discovery guild](/http-api/discovery/#visit-discovery-guild) return this object.+| Field | Type | Description || --- | --- | --- || guild_id | snowflake | The ID of the guild |-| member | boolean | Whether the caller is already a member, in which case no visit starts |+| member | boolean | Whether you are already a member, in which case no visit starts || visit | ?[guild visit](#guild-visit-object) object | The visit, or null when `member` is true |## Custom invite URL object-A custom invite URL object reports the guild's current custom invite code and how many times the invite behind it has been used. [Get guild custom invite URL](#get-guild-custom-invite-url) returns it.+Returned by [Get guild custom invite URL](#get-guild-custom-invite-url).### Structure| Field | Type | Description || --- | --- | --- || code | ?string | Current custom invite code |-| uses<sup>1</sup> | integer | Use count of the invite backing the current code |--<sup>1</sup> The value is 0 when the guild holds no code and when the backing invite can no longer be resolved--### Example--```json-{- "code": "workshop",- "uses": 128-}-```+| uses | integer | How many times the code was used, or 0 when there is no code |## Custom invite URL selection object-A custom invite URL selection object reports the code the guild holds after a write. [Modify guild custom invite URL](#modify-guild-custom-invite-url) returns it.+Returned by [Modify guild custom invite URL](#modify-guild-custom-invite-url).### Structure| Field | Type | Description || --- | --- | --- |-| code | ?string | Custom invite code held by the guild after the request (2-32 characters) |+| code | ?string | Custom invite code the guild has after the request (2-32 characters) |## Sudo verification fields-These fields prove [sudo mode](/http-api/users/mfa/#sudo-mode) when an operation requires it. A caller can also supply an existing proof through the `X-Fluxer-Sudo-Mode-JWT` request header.+Routes that need [sudo mode](/http-api/users/mfa/#sudo-mode) take these fields in the JSON body. You can send an earlier proof in the `X-Fluxer-Sudo-Mode-JWT` header instead, and a successful response can return a new one in that header.### Structure| Field | Type | Description || --- | --- | --- || password?<sup>1</sup> | string | Current account password |-| mfa_method?<sup>2</sup> | string | MFA method, one of `totp`, `webauthn` or `email_code` |-| mfa_code? | string | Authenticator code or unconsumed backup code when the method is `totp` (1-32 characters) |+| mfa_method? | string | MFA method, one of `totp`, `webauthn` or `email_code` |+| mfa_code? | string | Authenticator or backup code when the method is `totp` (1-32 characters) || webauthn_response? | [WebAuthn assertion](/http-api/authentication/#webauthn-assertion) object | Assertion when the method is `webauthn` || webauthn_challenge? | string | Challenge bound to the WebAuthn assertion || email_code_ticket? | string | The ticket from [send a sudo email code](/http-api/users/mfa/#send-a-sudo-email-code) (1-128 characters) || email_code? | string | The 6-digit code from that email |-<sup>1</sup> The password is accepted only while the account holds neither a TOTP secret nor a registered WebAuthn credential, and it returns the field code `INVALID_PASSWORD` when it does not match+<sup>1</sup> Accepted only when the account has no authenticator app or passkey-<sup>2</sup> The MFA proof is accepted only while the account holds a TOTP secret or a registered WebAuthn credential, and it returns the field code `INVALID_MFA_CODE` on any failure--A bot credential satisfies sudo mode without any proof, and so does an account with no password, no TOTP secret, and no registered WebAuthn credential. Every other account that supplies no usable proof receives 403 `SUDO_MODE_REQUIRED`, whose error object has `has_mfa` and a `methods` object reporting whether `totp`, `webauthn`, and `backup_codes` are available.--Fluxer issues a newly generated proof in the `X-Fluxer-Sudo-Mode-JWT` header of the success response, and only for an account holding a TOTP secret or a registered WebAuthn credential. A proof supplied on the request is echoed back in that same header.+A request without a proof gets 403 `SUDO_MODE_REQUIRED`, except from a bot or an account with no password, email address, authenticator or passkey.## Create guild<RouteHeader method="POST" path="/v1/guilds" />-Creates a guild owned by the caller. Requires a user session credential. Returns a [guild object](#guild-object) on success. Emits [Guild Create](/gateway/events/#guild-create) and [User Settings Update](/gateway/events/#user-settings-update) Gateway events to the owner.--### Limitations--- A bot credential is rejected with 400 `BOTS_CANNOT_CREATE_GUILDS`.-- An unclaimed account is rejected with 400 `UNCLAIMED_ACCOUNT_CANNOT_CREATE_GUILDS`.-- An account without a verified email address is rejected with 403 `GUILD_CREATION_EMAIL_VERIFICATION_REQUIRED`.-- A caller already at the configured guild limit is rejected with 400 `MAX_GUILDS`.-- While `single_community_enabled` is true in the [instance policy](/admin-api/instance/#instance-policy-object), every caller is rejected with 400 `SINGLE_COMMUNITY_CANNOT_CREATE_GUILDS`.+Creates a guild that you own and returns the [guild object](#guild-object) without roles, channels or counts. You need a user account with a verified email address.### JSON body| Field | Type | Description || --- | --- | --- |-| name<sup>1</sup> | string | Guild name (1-100 characters) |-| icon?<sup>2</sup> | ?base64 string | Guild icon |-| empty_features?<sup>3</sup> | boolean | Whether to create the guild with no features (default false) |-| template? | [guild creation template object](#guild-creation-template-object) | Roles and channels to create for the new guild |--<sup>1</sup> Fluxer trims the value before it measures the length bound--<sup>2</sup> The field accepts raw base64, or a data URL whose payload is everything after the first comma--<sup>3</sup> When false the guild is created holding `ANIMATED_ICON`, `ANIMATED_BANNER`, `BANNER`, and `INVITE_SPLASH`+| name | string | Guild name (1-100 characters) |+| icon?<sup>1</sup> | ?base64 string | Guild icon |+| empty_features?<sup>2</sup> | boolean | Whether to create the guild with no features (default false) |+| template? | [guild creation template object](#guild-creation-template-object) | Roles and channels to create |-A `name` outside 1 to 100 characters after normalisation returns `STRING_LENGTH_INVALID`. A blocked name returns 403 `CONTENT_BLOCKED`.+<sup>1</sup> Raw base64 or a data URL, up to the instance `avatar_max_size` limit. Animated AVIF isn't accepted-The `icon` base64 payload is bounded to 1 to 139810136 characters and is otherwise rejected with `BASE64_LENGTH_INVALID`, and a payload that is not valid base64 with `INVALID_BASE64_FORMAT`. The decoded image must fit within the instance `avatar_max_size` limit, which defaults to the 10 MiB ceiling, and a larger image is rejected with `IMAGE_SIZE_EXCEEDS_LIMIT`. PNG, JPEG, WebP, GIF, APNG, AVIF, HEIC, HEIF, JXL, and SVG are accepted. An animated AVIF is rejected with `INVALID_IMAGE_FORMAT`.+<sup>2</sup> When false, the guild starts with `ANIMATED_ICON`, `ANIMATED_BANNER`, `BANNER`, `INVITE_SPLASH` and `VISITS_ENABLED`-Without a template the guild is created with a `Text Channels` category holding a text channel named `general`, a `Voice Channels` category holding a voice channel named `General`, and an everyone role with the default permission set plus `CREATE_PUBLIC_THREADS`, `CREATE_PRIVATE_THREADS`, and `SEND_MESSAGES_IN_THREADS`. The `general` channel becomes the system channel.--:::note[Embedded collections arrive on the Guild Create Dispatch]-The creation response has no roles, channels, emojis, stickers, or member counts. Read [Get guild](#get-guild) afterwards to fetch them over HTTP.-:::+Without a template, the guild gets a `general` text channel, a `General` voice channel and an everyone role with the default permissions.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [guild object](#guild-object) | Guild was created |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Body, image, template, bot or unclaimed credential, configured guild limit, or single community policy rejects creation |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | Email address is unverified, or the name is blocked |-| 403 | [error response](/http-api/#error-response) | The account is [limited](/http-api/users/#account-limitation) and the request returns `ACCOUNT_LIMITED` |--<sup>1</sup> The [error code](/http-api/errors/) is `SINGLE_COMMUNITY_CANNOT_CREATE_GUILDS` while the single community policy is active, `BOTS_CANNOT_CREATE_GUILDS` for a bot credential, `UNCLAIMED_ACCOUNT_CANNOT_CREATE_GUILDS` for an unclaimed account, `MAX_GUILDS` at the configured guild limit, `GUILD_TEMPLATE_INVALID` for a rejected template, and `INVALID_FORM_BODY` otherwise+| 200 | [guild object](#guild-object) | The guild was created |+| 400 | [error response](/http-api/#error-response) | `MAX_GUILDS`, `GUILD_TEMPLATE_INVALID`, `BOTS_CANNOT_CREATE_GUILDS` or `UNCLAIMED_ACCOUNT_CANNOT_CREATE_GUILDS` |+| 400 | [error response](/http-api/#error-response) | `SINGLE_COMMUNITY_CANNOT_CREATE_GUILDS` while the instance runs a single community |+| 403 | [error response](/http-api/#error-response) | `GUILD_CREATION_EMAIL_VERIFICATION_REQUIRED`, `CONTENT_BLOCKED` or `ACCOUNT_LIMITED` |-<sup>2</sup> The [error code](/http-api/errors/) is `GUILD_CREATION_EMAIL_VERIFICATION_REQUIRED` for an unverified email address and `CONTENT_BLOCKED` for a blocked name or body string+You get [Guild Create](/gateway/events/#guild-create) and [User Settings Update](/gateway/events/#user-settings-update) with the new guild in your folders.-### Side effects--The operation creates the guild, its everyone role, its template or default channels, and the owner's membership. A supplied icon becomes the guild icon. Fluxer adds the guild to the owner's guild folder layout. The owner receives [Guild Create](/gateway/events/#guild-create) for the new guild and [User Settings Update](/gateway/events/#user-settings-update) with the changed folder layout. No audit log entry is recorded, and an `X-Audit-Log-Reason` header on this request is read and discarded.--### Rate limit--10 requests per minute for each authenticated user, on the `guild:create` bucket.+The rate limit is 10 requests per minute, on the `guild:create` bucket.## List current user guilds<RouteHeader method="GET" path="/v1/users/@me/guilds" bot oauth2="guilds" />-Returns an array of [guild objects](#guild-object), one for every guild the authenticated user is a member of. A bearer credential requires the `guilds` [OAuth2 scope](/http-api/oauth2/#oauth2-scopes).+Returns a [guild object](#guild-object) for each guild you are a member of, in ascending ID order.### Query parameters| Field | Type | Description || --- | --- | --- |-| before?<sup>1</sup> | snowflake | Return guilds with a lower ID than this guild ID |-| after?<sup>1</sup> | snowflake | Return guilds with a higher ID than this guild ID |-| limit? | integer | Maximum number returned (1-200, default 200) |-| with_counts?<sup>2</sup> | boolean | Include approximate member and presence counts (default false) |--<sup>1</sup> A page is always ordered by ascending guild ID whichever cursor is used, and `after` takes precedence when both cursors are supplied. A cursor naming a guild the caller is not a member of is ignored, so the page starts at the first guild+| before? | snowflake | Return guilds with a lower ID than this guild ID |+| after? | snowflake | Return guilds with a higher ID than this guild ID |+| limit?<sup>1</sup> | integer | Maximum number returned (1-200, default 200) |+| with_counts? | boolean | Include approximate member and presence counts (default false) |-<sup>2</sup> A guild whose counts cannot be fetched is returned without them--The page excludes deleted guilds but includes guilds marked `UNAVAILABLE_FOR_EVERYONE`.--:::caution[`permissions` needs a limit of 100 or lower]-A page of more than 100 guilds, or a failed lookup, omits `permissions` from every guild. The request still succeeds.-:::--A page within that ceiling can still omit `permissions` from an individual guild the lookup could not resolve.+<sup>1</sup> Above 100, the guilds have no `permissions`### Response| Status | Body | Condition || --- | --- | --- || 200 | array[[guild](#guild-object) object] | Guilds were returned |-| 403 | [error response](/http-api/#error-response) | Bearer credential lacks the `guilds` scope and the request returns `MISSING_OAUTH_SCOPE` |--### Rate limit+| 403 | [error response](/http-api/#error-response) | `MISSING_OAUTH_SCOPE` when the bearer credential lacks `guilds` |-40 requests per 10 seconds for each authenticated user, on the `guild:list` bucket.+The rate limit is 40 requests per 10 seconds, on the `guild:list` bucket.## Get guild<RouteHeader method="GET" path="/v1/guilds/{guild_id}" bot oauth2="guilds" />-Returns the [guild object](#guild-object) with its roles, emojis, stickers, viewable channels, `member_count`, and `online_count`. Requires membership of the guild, and a bearer credential requires the `guilds` [OAuth2 scope](/http-api/oauth2/#oauth2-scopes).--The response has no `permissions` field. Read [List current user guilds](#list-current-user-guilds) for the caller's mask.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns the [guild object](#guild-object) with its roles, emojis, stickers, the channels you can view and member counts. You need to be a member or a visitor.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [guild object](#guild-object) | Guild was returned |-| 403<sup>1</sup> | [error response](/http-api/#error-response) | Guild is unavailable, the bearer credential lacks the `guilds` scope, or the caller is not a member |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |--<sup>1</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` for an unavailable guild, `MISSING_OAUTH_SCOPE` for a missing scope, `MISSING_PERMISSIONS` for a non-member, and `ACCESS_DENIED` when the guild exists in storage but the Gateway reports it as not found--### Rate limit+| 200 | [guild object](#guild-object) | The guild was returned |+| 403 | [error response](/http-api/#error-response) | `MISSING_ACCESS` when the guild is unavailable |-100 requests per 10 seconds for each authenticated user and guild, on the `guild:read::guild_id` bucket.+The rate limit is 100 requests per 10 seconds, on the `guild:read::guild_id` bucket.## Modify guild<RouteHeader method="PATCH" path="/v1/guilds/{guild_id}" bot auditReason mfa />-Modifies guild configuration and returns the updated [guild object](#guild-object). Requires membership and [MANAGE_GUILD](/http-api/permissions/). Emits a [Guild Update](/gateway/events/#guild-update) Gateway event to every session that can see the guild.--`MANAGE_GUILD` is an [elevated permission](/http-api/permissions/#elevated-permissions). While the guild [MFA level](#mfa-levels) is elevated, a non-owner caller also needs an enrolled authenticator, and receives 400 `TWO_FACTOR_REQUIRED` without one.--Changing `mfa_level` to a different value also requires the guild owner, an owner account that already has a second factor, and sudo mode. A caller who is not the owner receives 403 `MISSING_PERMISSIONS` for that change even while holding `MANAGE_GUILD`. Sudo mode is verified before ownership, so a non-owner without a proof receives 403 `SUDO_MODE_REQUIRED` first.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |--### Request headers--| Field | Type | Description |-| --- | --- | --- |-| X-Fluxer-Sudo-Mode-JWT? | string | Existing sudo mode proof, read when the MFA level changes |+Changes guild settings and returns the updated [guild object](#guild-object). You need `MANAGE_GUILD`, which is an [elevated permission](/http-api/permissions/#elevated-permissions). Only the owner can change `mfa_level`, and it needs [sudo mode](#sudo-verification-fields).### JSON body| Field | Type | Description || --- | --- | --- |-| name?<sup>1</sup> | string | Guild name (1-100 characters) |-| icon?<sup>2</sup> | ?base64 string | Guild icon, or null to clear it |-| system_channel_id?<sup>3</sup> | ?snowflake | System channel ID, or null to clear it |-| system_channel_flags?<sup>4</sup> | integer | [System channel flags](#system-channel-flags) |-| afk_channel_id?<sup>5</sup> | ?snowflake | AFK voice channel ID, or null to clear it |+| name? | string | Guild name (1-100 characters) |+| icon? | ?base64 string | Guild icon, or null to clear it |+| system_channel_id? | ?snowflake | Text or announcement channel for system messages, or null to clear it |+| system_channel_flags? | integer | [System channel flags](#system-channel-flags) |+| afk_channel_id? | ?snowflake | AFK voice channel ID, or null to clear it || afk_timeout? | integer | AFK timeout in seconds (60-3600) || default_message_notifications? | integer | [Default message notification level](#default-message-notification-levels) |-| verification_level?<sup>6</sup> | integer | [Verification level](#verification-levels) |-| mfa_level?<sup>7</sup> | integer | [MFA level](#mfa-levels) |-| nsfw_level?<sup>8</sup> | integer | Legacy [NSFW level](#nsfw-levels), which is translated into `nsfw` and the content warning level |-| nsfw?<sup>9</sup> | boolean | Whether the guild is marked as adult content |-| content_warning_level?<sup>10</sup> | integer | [Guild content warning level](#guild-content-warning-levels) |-| content_warning_text?<sup>11</sup> | ?string | Content warning text (max 200 characters), or null for the localised default |+| verification_level? | integer | [Verification level](#verification-levels) |+| mfa_level?<sup>1</sup> | integer | [MFA level](#mfa-levels) |+| nsfw_level?<sup>2</sup> | integer | Legacy [NSFW level](#nsfw-levels), 0 or 3 |+| nsfw? | boolean | Whether the guild is marked as adult content |+| content_warning_level? | integer | [Guild content warning level](#guild-content-warning-levels) |+| content_warning_text? | ?string | Content warning text (max 200 characters), or null for the default text || explicit_content_filter? | integer | [Guild explicit content filter level](#guild-explicit-content-filter-levels) |-| banner?<sup>12</sup> | ?base64 string | Guild banner, or null to clear it |-| splash?<sup>13</sup> | ?base64 string | Static invite splash, or null to clear it |-| embed_splash?<sup>13</sup> | ?base64 string | Static embedded invite splash, or null to clear it |+| banner?<sup>3</sup> | ?base64 string | Guild banner, or null to clear it |+| splash?<sup>4</sup> | ?base64 string | Static invite splash, or null to clear it |+| embed_splash?<sup>4</sup> | ?base64 string | Static embedded invite splash, or null to clear it || splash_card_alignment? | integer | [Splash card alignment](#splash-card-alignments) |-| features?<sup>14</sup> | array[string] | Complete desired [guild feature](#guild-features) set (max 100 entries) |-| message_history_cutoff?<sup>15</sup> | ?ISO8601 timestamp | Earliest history visible without [READ_MESSAGE_HISTORY](/http-api/permissions/), or null to deny historical access |+| features?<sup>5</sup> | array[string] | The full [guild feature](#guild-features) set you want (max 100 entries) |+| message_history_cutoff? | ?ISO8601 timestamp | Earliest history visible without `READ_MESSAGE_HISTORY`, or null to hide all of it || password? | string | [Sudo verification](#sudo-verification-fields) password || mfa_method? | string | [Sudo verification](#sudo-verification-fields) method, one of `totp`, `webauthn` or `email_code` || mfa_code? | string | [Sudo verification](#sudo-verification-fields) authenticator code |@@ -760,316 +559,192 @@ Changing `mfa_level` to a different value also requires the guild owner, an owne| email_code_ticket? | string | The ticket from [send a sudo email code](/http-api/users/mfa/#send-a-sudo-email-code) (1-128 characters) || email_code? | string | The 6-digit code from that email |-<sup>1</sup> Normalised and trimmed before its length is measured. A blocked name returns 403 `CONTENT_BLOCKED`--<sup>2</sup> The accepted encoding, byte ceiling, and format set are the ones listed by [Create guild](#create-guild). No guild feature gates an animated icon on write, but the `a_` prefix is stripped from the returned hash while the guild lacks `ANIMATED_ICON`--<sup>3</sup> The channel must exist in this guild and be a text or announcement channel, and is otherwise rejected with `SYSTEM_CHANNEL_MUST_BE_IN_GUILD` or `SYSTEM_CHANNEL_MUST_BE_TEXT`--<sup>4</sup> Every bit outside the registry is discarded--<sup>5</sup> The channel must exist in this guild and be a voice channel, and is otherwise rejected with `AFK_CHANNEL_MUST_BE_IN_GUILD` or `AFK_CHANNEL_MUST_BE_VOICE`--<sup>6</sup> A guild with `DISCOVERABLE` cannot be lowered below LOW and is rejected with the field code `DISCOVERABLE_GUILD_VERIFICATION_LEVEL_TOO_LOW`.--<sup>7</sup> Sending the value the guild already holds needs neither ownership nor sudo mode, and an owner without a configured second factor is rejected with the field code `MUST_ENABLE_2FA_BEFORE_REQUIRING_FOR_MODS`+<sup>1</sup> Fails with the field code `MUST_ENABLE_2FA_BEFORE_REQUIRING_FOR_MODS` when the owner has no authenticator-<sup>8</sup> The only accepted values are 0 and 3, and `nsfw` takes precedence when both fields are supplied. Setting 3 through this field also raises the content warning level to CONTENT_WARNING when `content_warning_level` is absent from the same body and the guild content warning level is INHERIT+<sup>2</sup> `nsfw` wins when you send both-<sup>9</sup> The write also sets `nsfw_level` to 3 when true and 0 when false, and unlike `nsfw_level` it never changes the content warning level+<sup>3</sup> Needs `BANNER`, and an animated banner also needs `ANIMATED_BANNER`-<sup>10</sup> Any value other than 1 is stored as 0+<sup>4</sup> Needs `INVITE_SPLASH`-<sup>11</sup> The value is trimmed, and a value that is empty after trimming is stored as null+<sup>5</sup> You can only add or remove `INVITES_DISABLED`, `TEXT_CHANNEL_FLEXIBLE_NAMES`, `DETACHED_BANNER`, `CLONE_EMOJI_ENABLED`, `CLONE_STICKER_ENABLED`, `HIDE_OWNER_CROWN` and `VISITS_ENABLED`, and Fluxer keeps every other feature the guild has-<sup>12</sup> A non-null value requires `BANNER`, and an animated image also requires `ANIMATED_BANNER`, otherwise the request is rejected with the field codes `GUILD_BANNER_REQUIRES_FEATURE` or `ANIMATED_GUILD_BANNER_REQUIRES_FEATURE`--<sup>13</sup> A non-null value requires `INVITE_SPLASH` and is rejected with the field codes `INVITE_SPLASH_REQUIRES_FEATURE` or `EMBED_SPLASH_REQUIRES_FEATURE`. Both splash fields take static images only, so GIF and APNG are not accepted for either and an animated upload is rejected with the field code `INVALID_IMAGE_FORMAT`--<sup>14</sup> Adding a feature that is not user-toggleable is rejected with the field code `GUILD_FEATURE_NOT_TOGGLEABLE`, while omitting a feature that is not user-toggleable leaves it in place. The user-toggleable features are `INVITES_DISABLED`, `TEXT_CHANNEL_FLEXIBLE_NAMES`, `DETACHED_BANNER`, `CLONE_EMOJI_ENABLED`, `CLONE_STICKER_ENABLED`, and `HIDE_OWNER_CROWN`--<sup>15</sup> A timestamp earlier than the guild's creation time or in the future is rejected with `MESSAGE_HISTORY_CUTOFF_BEFORE_GUILD_CREATION` or `MESSAGE_HISTORY_CUTOFF_IN_FUTURE`--:::caution[Omitting a user-toggleable feature removes it]-Send the current array with the intended changes applied. A feature without the toggleable marker stays in place when the array omits it.+:::caution[Leaving out a feature you can change removes it]+Send the current `features` array with your changes applied.:::### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [guild object](#guild-object) | Guild was modified, or the supplied values matched current state |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Body, image, feature set, channel reference, timestamp, or sudo proof is invalid |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Caller cannot use `MANAGE_GUILD` |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | Guild is unavailable, the name is blocked, `MANAGE_GUILD` or ownership is absent, or sudo mode is required |-| 404<sup>3</sup> | [error response](/http-api/#error-response) | Guild does not exist |--<sup>1</sup> The [error code](/http-api/errors/) is `TWO_FACTOR_REQUIRED` for a caller who holds `MANAGE_GUILD` but cannot use it, and `INVALID_FORM_BODY` otherwise--<sup>2</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` for an unavailable guild, `CONTENT_BLOCKED` for a blocked name or body string, `SUDO_MODE_REQUIRED` when an MFA level change is unproven, and `MISSING_PERMISSIONS` for a non-member, a missing `MANAGE_GUILD`, or a non-owner changing the MFA level--<sup>3</sup> The [error code](/http-api/errors/) is `UNKNOWN_GUILD`+| 200 | [guild object](#guild-object) | The guild was updated |+| 400 | [error response](/http-api/#error-response) | `TWO_FACTOR_REQUIRED` when the guild has the [ELEVATED MFA level](#mfa-levels) and you have no authenticator |+| 403 | [error response](/http-api/#error-response) | `SUDO_MODE_REQUIRED` when changing `mfa_level` without a proof |-### Side effects+Every successful request sends [Guild Update](/gateway/events/#guild-update), and a request that changes something also records a [`GUILD_UPDATE`](/http-api/guild-audit-logs/#audit-actions) audit entry.-Every successful request emits [Guild Update](/gateway/events/#guild-update) to every session that can see the guild, and a request that writes no field still emits it.--A request that changes the stored value of at least one body field records a [`GUILD_UPDATE`](/http-api/guild-audit-logs/#audit-actions) audit entry with the previous and new values. That entry emits [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create) to sessions that can read the audit log.--Removing `TEXT_CHANNEL_FLEXIBLE_NAMES` renames every guild text and announcement channel whose stored name changes when Fluxer trims it, lowercases it, replaces each whitespace run with a hyphen, and removes disallowed punctuation. A forum or media channel keeps its stored name until [Modify channel](/http-api/channels/#modify-channel) next sets `name`. When at least one channel is renamed, the removal emits one [Channel Update Bulk](/gateway/events/#channel-update-bulk) Dispatch with every channel in the guild.--Replacing an image removes the previous asset. A failed replacement leaves the previous image unchanged.--### Rate limit--20 requests per 10 seconds for each authenticated user and guild, on the `guild:update::guild_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `guild:update::guild_id` bucket.## Delete guild<RouteHeader method="POST" path="/v1/guilds/{guild_id}/delete" mfa />-Permanently deletes the guild and returns 204 with an empty body. Requires the guild owner and sudo mode. Emits a [Guild Delete](/gateway/events/#guild-delete) Gateway event to every member session. The guild is unavailable from that point, and its channels, messages and other records are removed in the background shortly after.--Fluxer refuses a non-owner with 403 `MISSING_PERMISSIONS`. A bot can never own a guild, so a bot credential never satisfies the requirement.--While `single_community_enabled` is true in the [instance policy](/admin-api/instance/#instance-policy-object), the guild named by `single_community_guild_id` cannot be deleted and returns 400 `SINGLE_COMMUNITY_CANNOT_DELETE`.+Deletes the guild with its channels, messages, attachments, roles and invites, and returns 204. You need to be the owner and in sudo mode.-### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |--### Request headers--| Field | Type | Description |-| --- | --- | --- |-| X-Fluxer-Sudo-Mode-JWT? | string | Existing sudo mode proof |+:::danger[Deleting a guild can't be undone]+There is no grace period and no way to restore the guild.+:::### JSON body-The body is the optional [sudo verification fields](#sudo-verification-fields). A request that already has a valid proof can omit it.--:::danger[Deleting a guild destroys its messages and attachments]-Deletion removes the guild, memberships, roles, channels, threads, messages, attachments, invites, webhooks and discovery listing. There is no grace period or way to restore them through the API.-:::+Takes the [sudo verification fields](#sudo-verification-fields), all optional.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Guild was deleted |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Body, sudo proof, or single community policy rejects the request |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | Guild is unavailable, the caller is not the owner, or sudo mode is required |-| 404<sup>3</sup> | [error response](/http-api/#error-response) | Guild does not exist |--<sup>1</sup> The [error code](/http-api/errors/) is `SINGLE_COMMUNITY_CANNOT_DELETE` while the policy protects this guild, and `INVALID_FORM_BODY` otherwise--<sup>2</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` for an unavailable guild, `SUDO_MODE_REQUIRED` when sudo mode is unproven, and `MISSING_PERMISSIONS` for a caller who is not a member or not the owner--<sup>3</sup> The [error code](/http-api/errors/) is `UNKNOWN_GUILD`+| 204 | empty | The guild was deleted |+| 400 | [error response](/http-api/#error-response) | `SINGLE_COMMUNITY_CANNOT_DELETE` for the instance's single community |+| 403 | [error response](/http-api/#error-response) | `SUDO_MODE_REQUIRED` without a proof |-### Side effects+Every member gets [Guild Delete](/gateway/events/#guild-delete).-Every member receives [Guild Delete](/gateway/events/#guild-delete). Fluxer deletes every member's [user guild settings](/http-api/users/settings/#user-guild-settings-object) for the guild. Non-bot members also receive [User Settings Update](/gateway/events/#user-settings-update) with the guild removed from their folder layout.--No audit log entry is recorded, because the audit log is destroyed with the guild. An `X-Audit-Log-Reason` header on this request is read and discarded.--### Rate limit--10 requests per minute for each authenticated user and guild, on the `guild:delete::guild_id` bucket.+The rate limit is 10 requests per minute, on the `guild:delete::guild_id` bucket.## Leave guild<RouteHeader method="DELETE" path="/v1/users/@me/guilds/{guild_id}" bot />-Removes the authenticated account's membership and returns 204 with an empty body. Requires a current membership. Emits a [Guild Member Remove](/gateway/events/#guild-member-remove) Gateway event to the remaining guild sessions and a [Guild Delete](/gateway/events/#guild-delete) Gateway event to the leaving account's own sessions.--A caller with no current membership receives 404 `UNKNOWN_MEMBER` whether or not the guild exists. The guild owner cannot leave and receives 400 `INVALID_FORM_BODY` with the field code `CANNOT_LEAVE_GUILD_AS_OWNER`. While `single_community_enabled` is true in the [instance policy](/admin-api/instance/#instance-policy-object), the guild named by `single_community_guild_id` cannot be left and returns 400 `SINGLE_COMMUNITY_CANNOT_LEAVE`. Setting `delete_messages` requires sudo mode, which a bot credential satisfies implicitly.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Removes your membership and returns 204.### Query parameters| Field | Type | Description || --- | --- | --- |-| delete_messages?<sup>1</sup> | boolean | Delete every message the caller authored in the guild before leaving (default false) |--<sup>1</sup> The deletion runs inside this request and completes before the membership is removed. The response is sent only after every matching message is gone--With `delete_messages`, a non-member of an existing guild receives 403 `MISSING_PERMISSIONS` rather than 404 `UNKNOWN_MEMBER`.--### Request headers--| Field | Type | Description |-| --- | --- | --- |-| X-Fluxer-Sudo-Mode-JWT? | string | Existing sudo mode proof, read only when `delete_messages` is true |+| delete_messages? | boolean | Delete every message you wrote in the guild first, which needs sudo mode (default false) |### JSON body-The optional body is the [sudo verification fields](#sudo-verification-fields). It is validated on every request and used only when `delete_messages` is true.+Takes the [sudo verification fields](#sudo-verification-fields) when `delete_messages` is true.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Membership was removed |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Query, body, sudo proof, guild ownership, or single community policy rejects the request |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | Sudo mode is required, or the caller is not a member while `delete_messages` is true |-| 404<sup>3</sup> | [error response](/http-api/#error-response) | Caller holds no membership in the guild |--<sup>1</sup> The [error code](/http-api/errors/) is `SINGLE_COMMUNITY_CANNOT_LEAVE` while the policy protects this guild, and `INVALID_FORM_BODY` otherwise, with the field code `CANNOT_LEAVE_GUILD_AS_OWNER` on `guild_id` for the guild owner--<sup>2</sup> The [error code](/http-api/errors/) is `SUDO_MODE_REQUIRED` when `delete_messages` is true and sudo mode is unproven, and `MISSING_PERMISSIONS` for a non-member reached through the `delete_messages` path--<sup>3</sup> The [error code](/http-api/errors/) is `UNKNOWN_MEMBER`, and `UNKNOWN_GUILD` when `delete_messages` is true and the guild does not exist--### Side effects--The account leaves the guild. Non-bot accounts receive [User Settings Update](/gateway/events/#user-settings-update) with the guild removed from their folder layout.+| 204 | empty | You left the guild |+| 400 | [error response](/http-api/#error-response) | Field code `CANNOT_LEAVE_GUILD_AS_OWNER` when you own the guild |+| 400 | [error response](/http-api/#error-response) | `SINGLE_COMMUNITY_CANNOT_LEAVE` for the instance's single community |+| 403 | [error response](/http-api/#error-response) | `SUDO_MODE_REQUIRED` when `delete_messages` is true without a proof |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_MEMBER` when you aren't a member |-Remaining guild sessions receive [Guild Member Remove](/gateway/events/#guild-member-remove) and the leaving account's sessions receive [Guild Delete](/gateway/events/#guild-delete).+Other members get [Guild Member Remove](/gateway/events/#guild-member-remove) and your sessions get [Guild Delete](/gateway/events/#guild-delete).-Guild read states and settings are unchanged, but the guild profile and roles are lost. Rejoining within one year resumes any unexpired communication timeout. Leaving records no audit entry, and `X-Audit-Log-Reason` has no effect.--Removal from the guild removes every membership in its threads. Fluxer emits a [Thread Members Update](/gateway/threads/#thread-members-update) for each of them, as [Thread member flags](/http-api/thread-members/#thread-member-flags) states.--### Rate limit--10 requests per 10 seconds for each authenticated user and guild, on the `guild:leave::guild_id` bucket.+The rate limit is 10 requests per 10 seconds, on the `guild:leave::guild_id` bucket.## Bulk delete current user's guild messages<RouteHeader method="POST" path="/v1/users/@me/guilds/{guild_id}/messages/bulk-delete-mine" bot mfa />-Deletes every message the authenticated account has authored in the guild and returns 202 with an empty body. Requires membership and sudo mode, which a bot credential satisfies implicitly. The membership survives the request.--The deletion runs inside this request. Fluxer sends the 202 only after it has removed every matching message in every channel and thread of the guild. Each processed batch emits [Message Delete Bulk](/gateway/events/#message-delete-bulk) in its channel or thread.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |--### Request headers--| Field | Type | Description |-| --- | --- | --- |-| X-Fluxer-Sudo-Mode-JWT? | string | Existing sudo mode proof |+Deletes every message you wrote in the guild and returns 202 when all are gone. You stay a member, and you need sudo mode.### JSON body-The body is the optional [sudo verification fields](#sudo-verification-fields).--:::danger[Deletion is irreversible and unbounded]-Every message the caller authored in the guild is destroyed together with its attachments. There is no filter and no dry run, and the request runs for as long as the caller's authored history takes.-:::+Takes the [sudo verification fields](#sudo-verification-fields), all optional.### Response| Status | Body | Condition || --- | --- | --- |-| 202 | empty | Messages were deleted |-| 400 | [error response](/http-api/#error-response) | Body or sudo proof is invalid |-| 403<sup>1</sup> | [error response](/http-api/#error-response) | Caller is not a member, or sudo mode is required |-| 404<sup>2</sup> | [error response](/http-api/#error-response) | Guild does not exist |+| 202 | empty | The messages were deleted |+| 403 | [error response](/http-api/#error-response) | `SUDO_MODE_REQUIRED` without a proof |-<sup>1</sup> The [error code](/http-api/errors/) is `MISSING_PERMISSIONS` for a caller who is not a member and `SUDO_MODE_REQUIRED` when sudo mode is unproven+Each channel gets [Message Delete Bulk](/gateway/events/#message-delete-bulk) events.-<sup>2</sup> The [error code](/http-api/errors/) is `UNKNOWN_GUILD`+The rate limit is 10 requests per 10 seconds, on the shared `guild:leave::guild_id` bucket.-### Side effects+## Get guild custom invite URL-The caller's messages and attachments are permanently deleted. Affected channels receive [Message Delete Bulk](/gateway/events/#message-delete-bulk) events with up to 100 message IDs each. No audit entry is recorded.+<RouteHeader method="GET" path="/v1/guilds/{guild_id}/vanity-url" bot />-### Rate limit+Returns the [custom invite URL object](#custom-invite-url-object). You need `MANAGE_GUILD`.-10 requests per 10 seconds for each authenticated user and guild, on the shared `guild:leave::guild_id` bucket.+### Response-## Get guild custom invite URL+| Status | Body | Condition |+| --- | --- | --- |+| 200 | [custom invite URL object](#custom-invite-url-object) | The custom invite URL was returned |+| 400 | [error response](/http-api/#error-response) | `TWO_FACTOR_REQUIRED` when the guild has the [ELEVATED MFA level](#mfa-levels) and you have no authenticator |-<RouteHeader method="GET" path="/v1/guilds/{guild_id}/vanity-url" bot />+The rate limit is 100 requests per 10 seconds, on the `guild:vanity_url:get::guild_id` bucket.-Returns the guild's [custom invite URL object](#custom-invite-url-object). Requires membership and [MANAGE_GUILD](/http-api/permissions/).+## Modify guild custom invite URL-`MANAGE_GUILD` is an [elevated permission](/http-api/permissions/#elevated-permissions). While the guild [MFA level](#mfa-levels) is elevated, a non-owner caller also needs an enrolled authenticator, and receives 400 `TWO_FACTOR_REQUIRED` without one.+<RouteHeader method="PATCH" path="/v1/guilds/{guild_id}/vanity-url" bot auditReason mfa />-### Path parameters+Sets or removes the custom invite code and returns the [custom invite URL selection object](#custom-invite-url-selection-object). You need `MANAGE_GUILD`, and setting a code needs the `VANITY_URL` feature.++### JSON body| Field | Type | Description || --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+| code?<sup>1</sup> | ?string | Custom invite code, or null to remove it |++<sup>1</sup> Fluxer lowercases the code and turns spaces into hyphens. It must be 2-32 characters of `a-z`, `0-9` and inner hyphens and can't contain `fluxer`### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [custom invite URL object](#custom-invite-url-object) | Custom invite URL state was returned |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Caller cannot use `MANAGE_GUILD` |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | Guild is unavailable, or `MANAGE_GUILD` is absent |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |--<sup>1</sup> The [error code](/http-api/errors/) is `TWO_FACTOR_REQUIRED`--<sup>2</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` for an unavailable guild and `MISSING_PERMISSIONS` for a non-member or a caller lacking `MANAGE_GUILD`--### Rate limit+| 200 | [custom invite URL selection object](#custom-invite-url-selection-object) | The code was set, removed or already matched |+| 400 | [error response](/http-api/#error-response) | `TWO_FACTOR_REQUIRED` when the guild has the [ELEVATED MFA level](#mfa-levels) and you have no authenticator |+| 400 | [error response](/http-api/#error-response) | Field code `VANITY_URL_CODE_ALREADY_TAKEN` when another invite uses the code |-100 requests per 10 seconds for each authenticated user and guild, on the `guild:vanity_url:get::guild_id` bucket.+A change sends [Guild Update](/gateway/events/#guild-update) and records a [`GUILD_UPDATE`](/http-api/guild-audit-logs/#audit-actions) audit entry.-## Modify guild custom invite URL--<RouteHeader method="PATCH" path="/v1/guilds/{guild_id}/vanity-url" bot auditReason mfa />+The rate limit is 10 requests per minute, on the `guild:vanity_url:patch::guild_id` bucket.-Sets or removes the guild's custom invite code and returns the [custom invite URL selection object](#custom-invite-url-selection-object). Requires membership and [MANAGE_GUILD](/http-api/permissions/). An effective change emits a [Guild Update](/gateway/events/#guild-update) Gateway event to every session that can see the guild.+## List guild visits-`MANAGE_GUILD` is an [elevated permission](/http-api/permissions/#elevated-permissions). While the guild [MFA level](#mfa-levels) is elevated, a non-owner caller also needs an enrolled authenticator, and receives 400 `TWO_FACTOR_REQUIRED` without one.+<RouteHeader method="GET" path="/v1/users/@me/guild-visits" />-A non-null code also requires the `VANITY_URL` guild feature and is otherwise rejected with the field code `VANITY_URL_REQUIRES_FEATURE`.+Returns the guilds you are visiting, most recently opened first.-### Path parameters+### Response-| Field | Type | Description |+| Status | Body | Condition || --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+| 200 | array[[guild visit](#guild-visit-object) object] | Visits were returned |-### JSON body+The rate limit is 30 requests per 10 seconds, on the `user:guild_visits` bucket.-| Field | Type | Description |-| --- | --- | --- |-| code?<sup>1</sup> | ?string | Custom invite code to claim, or null to remove the current code |+## Stop visiting guild-<sup>1</sup> Fluxer lowercases the value, turns each whitespace run into one hyphen, and collapses repeated hyphens. The result must match `^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$` and be 2 to 32 characters+<RouteHeader method="DELETE" path="/v1/users/@me/guild-visits/{guild_id}" />-A result that fails the pattern returns `VANITY_URL_INVALID_CHARACTERS`, and one outside the length bound returns `VANITY_URL_CODE_LENGTH_INVALID`. A code containing `fluxer` returns `VANITY_URL_CODE_CANNOT_CONTAIN_FLUXER`. An unchanged valid code succeeds. A code claimed by another invite returns `VANITY_URL_CODE_ALREADY_TAKEN`.--:::note[A custom invite code competes with ordinary invites]-Selecting a code claims it in the global invite namespace, and replacing or removing the code releases it back.-:::+Ends your visit to a guild and returns 204. Your sessions get [Guild Delete](/gateway/events/#guild-delete).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [custom invite URL selection object](#custom-invite-url-selection-object) | Code was claimed, removed, or already matched |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Code, reserved term policy, feature requirement, or global uniqueness check rejects the request |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Caller cannot use `MANAGE_GUILD` |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | Guild is unavailable, the code is blocked, or `MANAGE_GUILD` is absent |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |+| 204 | empty | The visit ended, or there was none |++The rate limit is 30 requests per 10 seconds, on the `user:guild_visits` bucket.-<sup>1</sup> The [error code](/http-api/errors/) is `TWO_FACTOR_REQUIRED` for a caller who holds `MANAGE_GUILD` but cannot use it, and `INVALID_FORM_BODY` otherwise+## Join visited guild-<sup>2</sup> The [error code](/http-api/errors/) is `MISSING_ACCESS` for an unavailable guild, `CONTENT_BLOCKED` for a blocked code, and `MISSING_PERMISSIONS` for a non-member or a caller lacking `MANAGE_GUILD`+<RouteHeader method="POST" path="/v1/users/@me/guild-visits/{guild_id}/join" />-### Side effects+Turns your visit into membership and returns the [guild object](#guild-object). The join runs the same checks as the invite or discovery listing that started the visit. Your sessions get [Guild Create](/gateway/events/#guild-create).-An unchanged code has no side effects. A change replaces or removes the previous invite, records a [`GUILD_UPDATE`](/http-api/guild-audit-logs/#audit-actions) audit entry and emits [Guild Update](/gateway/events/#guild-update) and [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create).+### Response-### Rate limit+| Status | Body | Condition |+| --- | --- | --- |+| 200 | [guild object](#guild-object) | You joined the guild, or were already a member |+| 400 | [error response](/http-api/#error-response) | `MAX_GUILDS` or `MAX_GUILD_MEMBERS` |+| 403 | [error response](/http-api/#error-response) | `ACCOUNT_VERIFICATION_REQUIRED`, `INVITES_DISABLED`, `USER_BANNED_FROM_GUILD` or `USER_IP_BANNED_FROM_GUILD` |+| 404 | [error response](/http-api/#error-response) | `GUILD_VISIT_NOT_FOUND`, or `UNKNOWN_INVITE` when the invite that started the visit is gone |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_GUILD` when the discovery listing that started the visit is no longer approved |-10 requests per minute for each authenticated user and guild, on the `guild:vanity_url:patch::guild_id` bucket.+The rate limit is 10 requests per 10 seconds, on the `invite:accept` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/index.md b/fluxer_docs/src/content/docs/http-api/index.mdindex 516510aa4..b3453d083 100644--- a/fluxer_docs/src/content/docs/http-api/index.md+++ b/fluxer_docs/src/content/docs/http-api/index.md@@ -1,247 +1,175 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: HTTP API-description: Request format, body representations, shared headers, cross-origin policy, and the error objects.+description: Request format, shared headers, cross-origin policy, error objects and the list of resource pages.----Use the HTTP API to read and change resources. Discover the base URL through [`/.well-known/fluxer`](/http-api/instance/#get-instance-discovery). Third-party clients use `endpoints.api_public`, and the first-party web application uses `endpoints.api_client`.--Use `/v1`, the only API version.--Read resource limits from [instance discovery](/http-api/instance/#limit-keys). Attachment counts, expression counts and profile field lengths can differ between deployments.--[Field notation](/#field-notation) explains optional, nullable, and nullish fields.+Use the HTTP API to read and change resources. Every path starts with `/v1` under the base URL in [`/.well-known/fluxer`](/http-api/instance/#get-instance-discovery), and third-party clients use `endpoints.api_public`.++Limits such as attachment counts differ between instances, and [instance discovery](/http-api/instance/#limit-keys) lists them. Field tables use the [field notation](/#field-notation) for optional and nullable fields.++## Resource pages++| Page | Covers |+| --- | --- |+| [Errors](/http-api/errors/) | Error responses, status codes and every error code |+| [Deployment availability](/http-api/deployment-availability/) | Routes served only while premium or billing is on |+| [Authentication operations](/http-api/authentication/) | Registration, login, MFA, WebAuthn, SSO, recovery, sessions |+| [Gateway](/http-api/gateway/) | Gateway endpoint discovery and the session start budget |+| [Instance](/http-api/instance/) | Instance discovery, geolocation, limit keys, the OpenAPI document |+| [Experiments](/http-api/experiments/) | Experiment assignments and how to poll for them |+| [OAuth2](/http-api/oauth2/) | Authorization, consent, tokens, introspection, revocation |+| [Applications](/http-api/applications/) | Applications, bot accounts, client secrets, bot tokens |+| [Connections](/http-api/connections/) | External account connections |+| [Users](/http-api/users/) | The user object and shared user enumerations |+| [Current user](/http-api/users/current-user/) | Your account, profile, lifecycle and policy acceptance |+| [User settings](/http-api/users/settings/) | Account, notification and privacy settings, guild folders |+| [User settings Protobuf](/http-api/users/settings-protobuf/) | Structured client preference messages |+| [Email and password changes](/http-api/users/email-and-password/) | The ticketed credential change flows |+| [Multi-factor authentication](/http-api/users/mfa/) | TOTP, backup codes, WebAuthn credentials, sudo verification |+| [Relationships](/http-api/users/relationships/) | Friends, friend requests, blocks |+| [User notes](/http-api/users/notes/) | Private notes on users |+| [Private channels](/http-api/users/private-channels/) | Direct message and group DM channels |+| [Push notifications](/http-api/users/push-notifications/) | Registering a device for push delivery |+| [User content collections](/http-api/users/content/) | Recent mentions, saved messages, message deletion |+| [Gift inventory](/http-api/users/gifts/) | Premium gift codes you created |+| [Data harvests](/http-api/users/data-harvest/) | Requesting and downloading your data |+| [Read states](/http-api/read-states/) | Read acknowledgements and mention counts |+| [Memes](/http-api/memes/) | Saved media and GIF URL resolution |+| [GIFs](/http-api/gifs/) | GIF search, featured and trending listings, share registration |+| [Themes](/http-api/themes/) | Shareable custom CSS themes |+| [Channels](/http-api/channels/) | Channels, recipients, permission overwrites, slowmode |+| [Threads](/http-api/threads/) | Starting, archiving and searching threads |+| [Thread members](/http-api/thread-members/) | Joining and leaving threads, notification settings |+| [Forums](/http-api/forums/) | Forum and media channels, tags, posts |+| [Calls](/http-api/calls/) | Call eligibility, regions, ringing, termination |+| [Peer-to-peer voice](/http-api/peer-to-peer-voice/) | Connection outcome reports for peer-to-peer calls |+| [Streams](/http-api/streams/) | Stream keys, regions, previews |+| [Entrance sounds](/http-api/entrance-sounds/) | The entrance sound collection and playback |+| [Messages](/http-api/messages/) | Messages, attachments, embeds, history, pins, reactions, typing |+| [Guilds](/http-api/guilds/) | Guild objects and lifecycle |+| [Guild channels](/http-api/guild-channels/) | Listing, creating and positioning guild channels |+| [Guild members](/http-api/guild-members/) | Members, profiles, voice moderation, roles |+| [Guild member search](/http-api/guild-member-search/) | Member search filters and sorting |+| [Guild moderation](/http-api/guild-moderation/) | Bans and temporary bans |+| [Guild emojis](/http-api/guild-emojis/) | Guild emoji management |+| [Guild stickers](/http-api/guild-stickers/) | Guild sticker management |+| [Expressions](/http-api/expressions/) | Emoji and sticker metadata |+| [Guild audit logs](/http-api/guild-audit-logs/) | Audit entries, filters and the audit reason |+| [Roles and permissions](/http-api/permissions/) | Permission flags and roles |+| [Discovery](/http-api/discovery/) | Public guild listings and listing applications |+| [Invites](/http-api/invites/) | Invite lookup, creation, acceptance, deletion |+| [Webhooks](/http-api/webhooks/) | Webhook management, execution and provider callbacks |+| [Search](/http-api/search/) | Global message search |+| [Unfurl](/http-api/unfurl/) | External URL metadata |+| [Billing](/http-api/billing/) | Stripe checkout, gift purchase, the Stripe webhook |+| [Premium](/http-api/premium/) | Pricing, entitlement state, subscription self-service |+| [Gifts](/http-api/gifts/) | Gift code lookup and redemption |+| [Reports](/http-api/reports/) | Safety reports and Digital Services Act notices |## Request format-Send JSON bodies with `Content-Type: application/json`. Responses are UTF-8 JSON unless an operation states otherwise. Message operations, [Start thread](/http-api/threads/#start-thread), and webhook execution also accept multipart bodies, and OAuth2 token operations accept form bodies.--An overloaded instance returns 503 `SERVICE_UNAVAILABLE` with `Retry-After: 1`. Wait before retrying.+Send JSON bodies with `Content-Type: application/json`. Responses are UTF-8 JSON unless an operation says otherwise, and every `GET` route also answers `HEAD`.-Unknown paths and unsupported methods return 404 `NOT_FOUND` without an `Allow` header. Trailing slashes are significant.--Every `GET` route supports `HEAD`, returning the same status and headers without a body. Routes without `GET` do not support `HEAD`. The [same-host origin requirement](#cross-origin-requests) also applies to `HEAD`.+Unknown paths, including a known path with a trailing slash, return 404 `NOT_FOUND`. An overloaded instance returns 503 `SERVICE_UNAVAILABLE` with `Retry-After: 1`.## Request body formats-Each operation documents its accepted body format and fields.--Use `application/json` for JSON and `application/x-www-form-urlencoded` for OAuth2 form bodies. OAuth2 token operations also accept `multipart/form-data`.--[Create message](/http-api/messages/#create-message), [Modify message](/http-api/messages/#modify-message) and [Execute webhook](/http-api/webhooks/#execute-webhook) accept these multipart fields:+[Create message](/http-api/messages/#create-message), [Modify message](/http-api/messages/#modify-message), [Execute webhook](/http-api/webhooks/#execute-webhook) and [Start thread](/http-api/threads/#start-thread) take `multipart/form-data` with these fields when you attach files.| Field | Type | Description || --- | --- | --- |-| payload_json?<sup>1</sup> | string | JSON object with the operation's complete message request payload |-| files[n]?<sup>2</sup> | file | Direct attachment file at zero-based index `n` |--<sup>1</sup> An absent `payload_json` is read as an empty object. A value that is not a string, or does not parse as JSON, is rejected with `INVALID_JSON_IN_PAYLOAD_JSON`--<sup>2</sup> `n` is a run of decimal digits, at most 10000 and below the deployment's [`max_attachments_per_message`](/http-api/instance/#limit-keys) limit, which defaults to 10--The legacy names `file` and `file` followed by an index are accepted as file fields as well, and a bare `file` takes the next free legacy index.--[Start thread](/http-api/threads/#start-thread) reads `payload_json` from a multipart body, and reads `files[n]` for a forum or media post.--Field-name failures are rejected with their own code:--- An index outside either bound returns `FILE_INDEX_EXCEEDS_MAXIMUM`.-- Any other name beginning with `files[` returns `INVALID_FILE_FIELD_NAME`.-- Two file fields resolving to the same index return `DUPLICATE_FILE_INDEX`.-- More than one file supplied for one index returns `MULTIPLE_FILES_FOR_INDEX_NOT_ALLOWED`.-- Where the resolved limit is 0, any file field at all returns `ATTACHMENTS_NOT_ALLOWED_FOR_MESSAGE`.--Include the multipart boundary in `Content-Type` and each field name in `Content-Disposition`. Malformed multipart bodies return `FAILED_TO_PARSE_MULTIPART_FORM_DATA`. Unknown fields and non-file values for valid `files[n]` indices are ignored.+| payload_json? | string | The JSON request payload of the operation |+| files[n]? | file | The attachment file at index `n` |-A multipart message body MAY also have `content`, `nonce`, `tts`, `flags`, `favorite_meme_id`, and `sticker_ids` as plain form fields. Each overrides the member of the same name in the parsed `payload_json`, and `sticker_ids` collects every value it is given.+The index `n` must be below the instance's [`max_attachments_per_message`](/http-api/instance/#limit-keys) limit and matches the `id` of an entry in the `attachments` array of `payload_json`. Indexes don't need to start at zero or be consecutive.-The `attachments` array inside `payload_json` maps attachment metadata to files by matching each attachment `id` to `n` in `files[n]`. A metadata entry that has a `filename` but matches no supplied file is rejected with `NO_FILE_FOR_ATTACHMENT_METADATA`, and two metadata entries claiming the same file index are rejected with `DUPLICATE_ATTACHMENT_IDS_NOT_ALLOWED`. A supplied file that no metadata entry claims is still attached, taking its index as the attachment ID and its uploaded filename as the attachment filename. A metadata entry that has no `filename` and matches no supplied file is read as a pre-uploaded attachment reference.+A malformed multipart body returns 400 `INVALID_FORM_BODY` with the validation code `FAILED_TO_PARSE_MULTIPART_FORM_DATA`. To upload files before sending, see [Attachment uploads](/topics/uploads/). The OAuth2 token operations take `application/x-www-form-urlencoded` or `multipart/form-data` bodies.-[Messages](/http-api/messages/) defines the attachment metadata and pre-uploaded attachment form, and [Attachment uploads](/topics/uploads/) defines the separate relay upload flow.+## Input normalization-:::caution[Multipart indices are attachment IDs]-Each direct file's `files[n]` index is also the `id` in its attachment metadata entry. Fluxer reads `n` from the field name, so part order sets no identity. The indices need not begin at zero and need not be consecutive.-:::--## Input normalisation--:::note[Empty values are normalised before validation]-An empty string becomes `null` at any depth, and an empty nested object becomes `null` below the root of the payload.-:::--This normalisation applies to JSON and form bodies, query strings, path parameters, request headers, and cookies.--A nested object containing only `null` values also becomes `null`. The root object never becomes `null`, even when it is empty or has only `null` values. An empty body is treated as `{}` and validated for required fields. Malformed JSON returns 400 `INVALID_FORM_BODY` with a validation error at path `body` and code `INVALID_FORMAT`.--:::caution[Message operations preserve empty values]-[Create message](/http-api/messages/#create-message), [Modify message](/http-api/messages/#modify-message), [Execute webhook](/http-api/webhooks/#execute-webhook), and [Start thread](/http-api/threads/#start-thread) do not apply this normalisation.-:::--Those operations document their own JSON validation errors.+Before validation, empty strings and empty nested objects become `null`, and an empty body counts as `{}`. Create message, Modify message, Execute webhook and Start thread skip this step. Malformed JSON returns 400 `INVALID_FORM_BODY` with the `path` `body` and the `code` `INVALID_FORMAT`.## Authentication-[Authentication](/authentication/) defines the accepted `Authorization` schemes and links to the OAuth2 scope registry. Each operation states which credentials it accepts. The [sudo verification object](/http-api/users/mfa/#sudo-verification-object) defines the proof required for sensitive account operations.--An OAuth2 bearer access token is accepted only where a route opts in, and the resource page says so. Everywhere else a bearer credential is refused with 403 `ACCESS_DENIED`. The routes with a route header on [Threads](/http-api/threads/), [Thread members](/http-api/thread-members/), and [Forums](/http-api/forums/) return 404 `NOT_FOUND` to a bearer credential, as [Client capability](/http-api/threads/#client-capability) describes.+Each operation says which credentials it accepts, and [Authentication](/authentication/) has the `Authorization` schemes. An OAuth2 bearer token works only on routes marked OAuth2, and other routes return 403 `ACCESS_DENIED`.## Standard request headers| Field | Type | Description || --- | --- | --- |-| Authorization? | string | The single credential for an authenticated request, in one of the [accepted schemes](/authentication/#authorization-schemes) |-| Content-Type?<sup>1</sup> | string | Request body media type and, for multipart bodies, the boundary |-| Accept-Language?<sup>2</sup> | string | Selects the locale used for an error `message` |-| X-Audit-Log-Reason?<sup>3</sup> | string | Free-text reason recorded on the resulting audit log entry |-| X-Fluxer-Client-Properties?<sup>4</sup> | string | Base64-encoded JSON with the native client's `os`, read when an authentication session is created |-| X-Fluxer-Sudo-Mode-JWT?<sup>5</sup> | string | A sudo mode proof previously issued to the authenticated user |-| X-Captcha-Token?<sup>6</sup> | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |-| X-Request-ID?<sup>7</sup> | string | A correlation identifier the client chooses, echoed unchanged in the response |-| User-Agent? | string | The originating client description recorded on a new authentication session and on an Admin audit entry |-| Origin?<sup>8</sup> | string | The browser origin used for cross-origin negotiation and for the mutating same-host origin check |--<sup>1</sup> Use the media type specified in [request body formats](#request-body-formats)--<sup>2</sup> The configured locale of the authenticated account takes precedence, so this header selects the locale only for an unauthenticated request or an account with no configured locale--<sup>3</sup> The value is read verbatim with no percent-decoding, then stripped of form feed and right-to-left override characters and trimmed. A blank or too-long value is treated as absent--<sup>4</sup> Read only for a native Fluxer `User-Agent`, at most 4096 characters, and only the `os` member is used--<sup>5</sup> A valid token replaces the sudo proof fields in the operation body and is echoed in the response header without extending its lifetime.--<sup>6</sup> Read only on a gated operation while the instance CAPTCHA check is on--<sup>7</sup> A supplied value is echoed back unchanged and unvalidated--<sup>8</sup> The exact use is defined in [cross-origin requests](#cross-origin-requests)--A client MUST NOT send an `X-Request-ID` it is not willing to see in logs, because Fluxer echoes and records the value without validating it.--An `X-Audit-Log-Reason` normalised to more than 512 characters is discarded, and the request still succeeds. Every request is normalised this way, but only an operation that supports an audit reason records the result.+| Authorization? | string | The credential for an authenticated request |+| Content-Type? | string | The body media type and, for multipart bodies, the boundary |+| Accept-Language? | string | The locale for an error `message`, used when the account has none set |+| X-Audit-Log-Reason? | string | A reason for the audit log entry (up to 512 characters) |+| X-Fluxer-Sudo-Mode-JWT? | string | The sudo token from [Multi-factor authentication](/http-api/users/mfa/#sudo-mode) |+| X-Captcha-Token? | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |+| X-Request-ID? | string | An identifier you choose, echoed in the response |## Standard response headers| Field | Type | Description || --- | --- | --- |-| X-Fluxer-Version?<sup>1</sup> | string | The build version of the instance that served the request |-| X-Request-ID?<sup>2</sup> | string | The identifier assigned to the request |-| X-Fluxer-Sudo-Mode-JWT?<sup>3</sup> | string | The sudo mode token for the caller, present only on an operation that completes a sudo proof |-| Content-Type? | string | The media type of the representation, absent from a response with no body |-| Cache-Control?<sup>4</sup> | string | The literal value `no-cache` unless the operation sets its own directive |-| Access-Control-Allow-Origin?<sup>5</sup> | string | The request `Origin` when it is a configured application origin, and the literal `*` on routes that set their own wildcard |-| Access-Control-Expose-Headers?<sup>5</sup> | string | The literal value `X-Fluxer-Version, ETag` |-| Vary?<sup>5</sup> | string | The literal value `Origin`, sent whenever the allowed origin was echoed |-| Retry-After?<sup>6</sup> | string | Whole seconds to wait, sent on a rate limit denial, a slowmode denial, a resource lock, and the in-flight ceiling 503 |-| X-RateLimit-Limit?<sup>7</sup> | string | Present on a route denial and on a successful bot or webhook request |-| X-RateLimit-Remaining?<sup>7</sup> | string | Present on a route denial and on a successful bot or webhook request |-| X-RateLimit-Reset?<sup>7</sup> | string | Unix timestamp in seconds |-| X-RateLimit-Reset-After?<sup>7</sup> | string | Seconds until the bucket resets |-| X-RateLimit-Bucket?<sup>7</sup> | string | A stable 16-character hash of the bucket name |-| X-RateLimit-Scope?<sup>7</sup> | string | Present on a rate limit denial, taking the value `user`, `shared`, or `global` |-| X-RateLimit-Global?<sup>7</sup> | string | Present on a global rate limit denial, taking the literal value `true` |--<sup>1</sup> The value is the literal `dev` when the build has no version stamp--<sup>2</sup> A generated UUID unless the request supplied its own, in which case that value is echoed back unchanged and unvalidated--<sup>3</sup> A token newly issued where the caller proved sudo mode again, and otherwise the incoming proof echoed back with no extension of its lifetime--<sup>4</sup> Absent from a response with no body+| X-Fluxer-Version? | string | The build version of the instance |+| X-Request-ID? | string | The request identifier, generated when you send none |+| X-Fluxer-Sudo-Mode-JWT? | string | The sudo mode token, sent when an operation completes a sudo proof |+| Cache-Control? | string | `no-cache` unless the operation sets its own value or the body is media |+| Retry-After? | string | Whole seconds to wait after a 429 or 503 |-<sup>5</sup> `Access-Control-Expose-Headers` is sent on every response the instance CORS policy handles. `Access-Control-Allow-Origin` and `Vary` are sent only for an allowed origin--<sup>6</sup> The literal 1 on the in-flight ceiling 503, and otherwise the [rate limit header](/topics/rate-limits/#rate-limit-headers) contract--<sup>7</sup> The complete contract is defined in [Rate limits](/topics/rate-limits/#rate-limit-headers)--An operation that sets its own `Cache-Control` keeps that value. A response whose `Content-Type` names a stylesheet, script, font, image, video, or audio representation receives `public, max-age=31536000`.--<a id="rate-limits"></a>+The `X-RateLimit-*` headers are listed under [Rate limits](/topics/rate-limits/).## Rate limits-Every route consumes its own rate limit bucket. A route that is not exempt from the global bucket also counts against one global bucket. A denial returns 429 `RATE_LIMITED`. [Rate limits](/topics/rate-limits/) defines the bucket scoping rules, the global allowance, the 429 body, the scope registry, and the complete `X-RateLimit-*` header contract.--:::note[These 429 responses have no `X-RateLimit-*` header]-A 429 `RESOURCE_LOCKED` response has `Retry-After: 1`, and a 429 `IP_AUTHORIZATION_RESEND_COOLDOWN` response has the remaining cooldown in whole seconds. A client that reads the bucket headers branches on `code`.-:::--A global denial has `Retry-After`, `X-RateLimit-Scope`, and `X-RateLimit-Global` alone.+Every route has its own bucket, and most routes also count against a global bucket. A denial returns 429 `RATE_LIMITED`, as described in [Rate limits](/topics/rate-limits/).## Conditional routes-A small set of routes depends on the deployment. A self-hosted deployment serves them only while its operator runs a premium tier or sells it, and answers an unserved one with 404 `NOT_FOUND`. [Deployment availability](/http-api/deployment-availability/) lists every such route and states how a client reads which ones a deployment serves before authenticating.+A self-hosted instance serves some routes only while its premium mode or billing is on, and answers the others with 404 `NOT_FOUND`. [Deployment availability](/http-api/deployment-availability/) lists them.## Cross-origin requests-The CORS response policy is an allow-list of exactly two origins, the deployment's configured web application endpoint and its marketing endpoint. A request whose `Origin` matches one of them receives `Access-Control-Allow-Origin` set to that origin and `Vary: Origin`. Every other request, including one that sends no `Origin`, receives no `Access-Control-Allow-Origin` from that policy. Credentialed cross-origin requests are not enabled, so `Access-Control-Allow-Credentials` is never sent.--The paths below are readable from any origin. `/v1/webhooks/{webhook_id}/{token}` and `/v1/webhooks/{webhook_id}/{token}/messages/{message_id}` have a second cross-origin policy that allows any origin. Four of the methods registered on them refuse the first-party web client outright, and that refusal is defined by [Origin refusal](/http-api/webhooks/#origin-refusal).+Only the instance's web app and marketing origins are allowed. A request from one of them gets `Access-Control-Allow-Origin` set to that origin and `Vary: Origin`. Browsers don't send cookies cross-origin, and you send your token in `Authorization`.-[Get instance discovery](/http-api/instance/#get-instance-discovery) on `/.well-known/fluxer`, [Get OpenAPI document](/http-api/instance/#get-openapi-document) on `/v1/openapi.json`, and [Get client geolocation](/http-api/instance/#get-client-geolocation) on `/v1/ip` set `Access-Control-Allow-Origin: *` in the operation itself. A request whose `Origin` is absent or outside the allow-list receives `*`. For an allowed origin, the policy replaces `*` with that exact origin and sends `Vary: Origin`.+[Get instance discovery](/http-api/instance/#get-instance-discovery), [Get OpenAPI document](/http-api/instance/#get-openapi-document) and [Get client geolocation](/http-api/instance/#get-client-geolocation) answer any origin with `*`. The webhook execution routes also allow any origin, with the exceptions under [Origin refusal](/http-api/webhooks/#origin-refusal).-`Access-Control-Expose-Headers` is the value `X-Fluxer-Version, ETag`. Every other Fluxer response header, the rate limit headers and `X-Request-ID` included, is hidden from cross-origin script. `Access-Control-Allow-Headers` is `Content-Type, Authorization, X-Requested-With, Accept-Language, X-Request-ID, If-None-Match`, so a cross-origin client revalidates an [ETag](/http-api/experiments/#get-experiment-assignments) it was served.+Browser scripts can read only the `X-Fluxer-Version` and `ETag` response headers. Cross-origin requests can send the headers in [Standard request headers](#standard-request-headers) plus `X-Requested-With`, `If-None-Match`, `X-Captcha-ID` and the `X-Fluxer-*` client headers.<a id="error-response"></a>## Error response object-A JSON error response identifies the stable error code and a human-readable message. An operation can add further top-level members with structured detail. [Errors](/http-api/errors/) lists status codes and every error code.+[Errors](/http-api/errors/) lists every status code and `code` value.### Structure| Field | Type | Description || --- | --- | --- |-| code<sup>1</sup> | string | Stable machine-readable [API error code](/http-api/errors/#api-error-codes) |-| message<sup>2</sup> | string | Human-readable description of this failure |-| errors?<sup>3</sup> | array[[validation error](#validation-error-object) object] | Request fields that failed validation |+| code | string | The stable [API error code](/http-api/errors/#api-error-codes) |+| message | string | A description in the request locale |+| errors? | array[[validation error](#validation-error-object) object] | The request fields that failed validation |-<sup>1</sup> Every code is an uppercase symbolic name matching `[A-Z][A-Z0-9_]*`--<sup>2</sup> The wording varies by locale and defaults to the code itself when the failure supplies no message--<sup>3</sup> Present on an `INVALID_FORM_BODY` response, and on any other failure that has field detail--### Example--```json-{- "code": "MISSING_PERMISSIONS",- "message": "Missing permissions"-}-```--The body has no request identifier. A client correlates a failure through the `X-Request-ID` response header.--Some codes add top-level fields, listed under [Extra fields](/http-api/errors/#extra-fields). A client MUST treat any member it does not recognise as absent. Two operations returning the same `code` can have different extra members, so a client MUST read the members its own operation documents.+Some codes add more top-level fields, listed under [Extra fields](/http-api/errors/#extra-fields). Ignore fields you don't recognize.## Validation error object-Each entry identifies one failed input field. A 400 response whose top-level code is `INVALID_FORM_BODY` has the array in `errors`. [Errors](/http-api/errors/#validation-errors) states which failures produce it.+A 400 `INVALID_FORM_BODY` response has one validation error object in `errors` for each field that failed, and [Validation errors](/http-api/errors/#validation-errors) lists the codes.### Structure| Field | Type | Description || --- | --- | --- |-| path<sup>1</sup> | string | The location of the request field that failed validation |-| code?<sup>2</sup> | string | Stable machine-readable validation code |-| message<sup>3</sup> | string | The human-readable description of this validation failure |--<sup>1</sup> A nested field is a dot-joined path such as `embeds.0.title`, and a failure with no field position uses the literal path `root`--<sup>2</sup> Present whenever the failure has an enumerated code from the [validation error codes](/http-api/errors/#validation-error-codes)--<sup>3</sup> The localised message registered for the `code`, falling back to the code itself, and a fixed English string on a failure that has no code+| path | string | The failed field as a dotted path like `embeds.0.title`, `root` for the whole object or `body` for malformed JSON |+| code? | string | The [validation error code](/http-api/errors/#validation-error-codes) |+| message | string | A description of the failure |### Example```json{"code": "INVALID_FORM_BODY",- "message": "Invalid form body",+ "message": "Invalid form body.","errors": [- {"path": "name", "code": "BASE_TYPE_REQUIRED", "message": "This field is required"}+ {"path": "name", "code": "INVALID_FORMAT", "message": "The provided value is in an invalid format."}]}```diff --git a/fluxer_docs/src/content/docs/http-api/instance.mdx b/fluxer_docs/src/content/docs/http-api/instance.mdxindex a4f0cd43b..c3edbf062 100644--- a/fluxer_docs/src/content/docs/http-api/instance.mdx+++ b/fluxer_docs/src/content/docs/http-api/instance.mdx@@ -1,130 +1,72 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Instance-description: Instance discovery, client geolocation, the limit key registry, the served OpenAPI document, and the setup sign-in method.+description: How a client discovers an instance's URLs, features and limits, and how a new instance sets its sign-in method.---import RouteHeader from '@/components/RouteHeader.astro';-Discover a deployment's endpoints, available features, and [limits](#limit-keys), look up the client's approximate location, download its OpenAPI document, or choose how members of a new deployment sign in.--[Get instance discovery](#get-instance-discovery) is the entry point of the API. A client that knows only a Fluxer origin reads `/.well-known/fluxer` first, and that one unauthenticated response has every field of the [instance discovery object](#instance-discovery-object). Those values include the API base URLs, the [main Gateway](/gateway/overview/) WebSocket URL, and the [Media Proxy](/media-proxy/overview/) base URL. They override the [endpoint path defaults](#instance-endpoints-object) a deployment would otherwise serve from its canonical public origin.--Every route here is unauthenticated. A credential changes no response body. One that resolves to an account moves the [rate limit bucket](/topics/rate-limits/) from the client IP address onto that account.--Each `GET` route answers with `Access-Control-Allow-Origin: *`, replaced by the request `Origin` when the deployment-wide [cross-origin policy](/http-api/#cross-origin-requests) allows that origin. The [Admin Instance API](/admin-api/instance/) defines the operator side of the same configuration.+A client that knows only an instance's origin starts with [get instance discovery](#get-instance-discovery), which returns the API, Gateway and media URLs, the enabled features and the limits. Every route on this page works without a token.## Instance discovery object-The discovery document is the complete public description of one deployment. Every field without a `?` is always present. This server never sends `codename` or `age_policy`, and `endpoints.upload_relay` is absent only from a server older than this version.+The public description of one instance.### Structure| Field | Type | Description || --- | --- | --- |-| codename? | string | The protocol generation the deployment speaks |-| api_code_version<sup>1</sup> | integer | The version of the API server code this deployment runs |-| endpoints | [instance endpoints](#instance-endpoints-object) object | Public service endpoints for this deployment |-| captcha | [captcha configuration](#captcha-configuration-object) object | Public CAPTCHA configuration |-| features | [instance features](#instance-features-object) object | Public deployment feature state |-| gif | [GIF provider](#gif-provider-object) object | The active GIF provider and its attribution requirement |-| sso | [SSO status](/http-api/authentication/#sso-status-object) object | Public single sign-on state |-| registration | [registration policy](#registration-policy-object) object | Public registration policy |-| community | [community policy](#community-policy-object) object | Community defaults and direct message policy |-| services | [service availability](#service-availability-object) object | Resolved third-party integration availability |-| limits | [limit configuration](#limit-configuration-object) object | Ordered limit rules and the trait names the deployment declares |-| push | [push configuration](#push-configuration-object) object | Public Web Push identity |-| app_public | [public application configuration](#public-application-configuration-object) object | Public client configuration |-| age_policy? | [age policy](#age-policy-object) object | Regional age policy for the deployment |-| notice?<sup>2</sup> | ?[instance notice](#instance-notice-object) object | Notice from the deployment's admins, or null when there is none |--<sup>1</sup> The value is a plain integer that increases when the API introduces a change a client is expected to notice, and the current value is `1`--<sup>2</sup> Absent only from a server older than this version. A notice whose `ends_at` has passed is reported as null+| codename? | string | The protocol generation the instance speaks |+| api_code_version | integer | The API code version, which goes up when clients need to change their behavior |+| endpoints | [instance endpoints](#instance-endpoints-object) object | Public service URLs |+| captcha | [captcha configuration](#captcha-configuration-object) object | CAPTCHA configuration |+| features | [instance features](#instance-features-object) object | Instance-wide feature switches |+| gif | [GIF provider](#gif-provider-object) object | The GIF provider and its attribution rule |+| sso | [SSO status](/http-api/authentication/#sso-status-object) object | Single sign-on state |+| registration | [registration policy](#registration-policy-object) object | Who can register |+| community | [community policy](#community-policy-object) object | Community and direct message policy |+| services | [service availability](#service-availability-object) object | Optional integrations that are available |+| limits | [limit configuration](#limit-configuration-object) object | Limit rules and trait names |+| push | [push configuration](#push-configuration-object) object | Web Push identity |+| app_public | [public application configuration](#public-application-configuration-object) object | Branding, setup state and legal links |+| age_policy? | [age policy](#age-policy-object) object | Regional age policy |+| notice? | ?[instance notice](#instance-notice-object) object | The current notice from the instance admins, or null |## Instance notice object-A short message an admin writes for everyone on the deployment, such as planned maintenance. Clients show it from `starts_at` until `ends_at` and let people dismiss it.+A short message from the instance admins, such as planned maintenance, that people can dismiss.### Structure| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | string | Identifier of this version of the notice |-| message | string | Notice text written by an admin (1-1000 characters) |-| url | ?string | Absolute `http` or `https` link shown with the notice, or null |-| starts_at | ?ISO8601 timestamp | When clients start showing the notice, or null to show it at once |-| ends_at | ?ISO8601 timestamp | When clients stop showing the notice, or null for no end |--<sup>1</sup> A new identifier is issued whenever the text, link or either time changes, so a client can remember which notice a person dismissed+| id | string | The ID of this version of the notice, which changes when any other field changes |+| message | string | The notice text (1-1000 characters) |+| url | ?string | An `http` or `https` link shown with the notice, or null |+| starts_at | ?ISO8601 timestamp | When to start showing the notice, or null to show it at once |+| ends_at | ?ISO8601 timestamp | When to stop showing the notice, or null for no end |## Instance endpoints object-Each value is an absolute URL supplied by the operator. A value can be a bare origin or an origin with a path prefix, because a deployment can serve several roles from one canonical public origin. A client accepts two endpoints that share an origin and MUST NOT infer a separate host, scheme, or port for any of them.+Each value is an absolute URL. Use it exactly as published, including its scheme and port.### Structure| Field | Type | Description || --- | --- | --- |-| api<sup>1</sup> | string | Base URL for authenticated API requests |-| api_client<sup>1</sup> | string | Base URL for client API requests |-| api_public | string | Base URL for public API requests |-| gateway<sup>2</sup> | string | The [main Gateway](/gateway/overview/) WebSocket URL |+| api | string | Base URL of the client API, the same as `api_client` |+| api_client | string | Base URL of the client API, used by the Fluxer apps |+| api_public | string | Base URL of the public API, used by bots and other clients |+| gateway | string | The [Gateway](/gateway/overview/) WebSocket URL, with a `ws` or `wss` scheme || media | string | [Media Proxy](/media-proxy/overview/) base URL || upload_relay? | string | Attachment [upload relay](/media-proxy/upload-relay/) base URL |-| static_cdn<sup>3</sup> | string | Static asset base URL |+| static_cdn | string | Static asset base URL || marketing | string | Marketing site base URL |-| admin | string | Admin application base URL |+| admin | string | Admin app base URL || invite | string | Invite link base URL || gift | string | Gift link base URL |-| webapp | string | Web application base URL |-| docs? | string | Documentation website base URL |--<sup>1</sup> Both fields are the same configured client API endpoint, which the first-party web application reads. `api_public` is the separately configured public API endpoint, which a bot, a library, or any other third-party client reads. A deployment can serve the client API and the public API from one origin, and the instance Fluxer hosts serves them from different origins--<sup>2</sup> The value is the configured Gateway endpoint and its scheme is `ws` or `wss` as the operator configured it--<sup>3</sup> When a deployment configures a separate static asset domain, the value is `https://` followed by that domain, with no port--Every value is the exact origin the deployment advertises, including its scheme and any explicit port, and a deliberately plain HTTP deployment publishes `http` and `ws` values here.--The operator configures one canonical public origin with an exact `http` or `https` scheme, a host, and an optional explicit port. The web application is served at that origin itself, and the other endpoints default to a path under it:--| Endpoint | Default path |-| --- | --- |-| HTTP API | `/api` |-| Media Proxy | `/media` |-| Admin application | `/admin` |-| Marketing site | `/marketing` |-| Invite links | `/invite` |-| Gift links | `/gift` |-| Gateway | `/gateway` |--The Gateway scheme is `ws` or `wss`. A port that equals the default for its scheme is omitted.--A deployment can configure a separate static asset domain, invite domain, and gift domain, and it can replace any single endpoint with an exact override.--:::caution[Use a published endpoint exactly as published]-A client MUST NOT upgrade a published `http` value to `https`, downgrade a published `https` value after a failure, discard a port, or assume a DNS suffix.-:::--### Example--```json-{- "api": "https://api.example.com",- "api_client": "https://api.example.com",- "api_public": "https://public.example.com",- "gateway": "wss://gateway.example.com",- "media": "https://media.example.com",- "static_cdn": "https://cdn.example.com",- "marketing": "https://example.com",- "admin": "https://admin.example.com",- "invite": "https://example.com/invite",- "gift": "https://example.com/gift",- "webapp": "https://app.example.com"-}-```+| webapp | string | Web app base URL |+| docs? | string | Documentation site base URL |## CAPTCHA configuration object@@ -138,96 +80,78 @@ A client MUST NOT upgrade a published `http` value to `https`, downgrade a publi| Value | Description || --- | --- |-| altcha | An ALTCHA proof-of-work challenge gates the operations that require one |-| none | The deployment requires no CAPTCHA |+| altcha | Gated operations need an ALTCHA proof-of-work challenge |+| none | The instance needs no CAPTCHA |-The complete challenge handshake, including the `X-Captcha-Token` request header, is defined in [CAPTCHA handling](/topics/captcha/).+Send the solved challenge in the `X-Captcha-Token` header, as [CAPTCHA handling](/topics/captcha/) explains.## Instance features object-Deployment-wide switches a client reads before it offers a feature, plus whether the deployment calls itself self-hosted.+Instance-wide switches to check before you offer a feature.### Structure| Field | Type | Description || --- | --- | --- |-| voice_enabled | boolean | Whether voice and video calling is enabled |-| stripe_enabled<sup>2</sup> | boolean | Whether premium purchases through Stripe [billing](/http-api/billing/) are available |-| premium_enabled<sup>3</sup> | boolean | Whether the deployment has a premium tier, so premium state, gifts and perks apply |-| stripe_serviceable<sup>4</sup> | boolean | Whether existing Stripe subscriptions can be managed, cancelled and billed |-| self_hosted | boolean | Whether this deployment identifies itself as self-hosted |-| presigned_attachment_uploads | boolean | Whether a client can request presigned attachment upload URLs |-| emails_enabled<sup>1</sup> | boolean | Whether the deployment sends email |+| voice_enabled | boolean | Whether voice and video calls are enabled |+| stripe_enabled | boolean | Whether premium purchases through Stripe [billing](/http-api/billing/) are available |+| premium_enabled | boolean | Whether the instance has a premium tier |+| stripe_serviceable | boolean | Whether existing Stripe subscriptions can be managed and billed |+| self_hosted | boolean | Whether the instance is self-hosted |+| presigned_attachment_uploads | boolean | Whether you can request presigned attachment upload URLs |+| emails_enabled | boolean | Whether the instance sends email || phone_verification_enabled | boolean | Deprecated. Always false || discovery_enabled? | boolean | Whether the Explore community directory is available, true when missing |-| account_identity<sup>5</sup> | string | How members sign in, one of the [account identity modes](#account-identity-modes) |-| tag_style<sup>6</sup> | string | How usernames are tagged, one of the [tag styles](#tag-styles) |-| desktop_modules_enabled? | boolean | Whether desktop clients may load downloadable modules |-| account_deletion_grace_period_hours? | integer | Hours between a deletion request and the permanent deletion of the account (1-8,760) |-| identifier_first? | boolean | Whether clients start sign-in with [identify an account](/http-api/authentication/#identify-an-account), false when missing |-| instant_accounts?<sup>7</sup> | boolean | Whether [register an account](/http-api/authentication/#register-an-account) accepts an instant account, created from only a display name, false when missing |-| email_codes? | boolean | Whether [send an email code](/http-api/authentication/#send-an-email-code) works, false when missing |-| date_of_birth_step? | boolean | Whether accounts [set their date of birth](/http-api/users/current-user/#set-date-of-birth) after they are created, so sign-up forms never ask for it, false when missing |-| instant_account_availability?<sup>7</sup> | string | Whether public sign-up can create an instant account, and why not, one of the [instant account availability](#instant-account-availability) values |-| interaction_tier?<sup>8</sup> | string | How the [account tiers](/http-api/users/#account-tiers) apply, `legacy` or `enforced` |-| guild_join_gate?<sup>8</sup> | string | When joining a community needs a verified account under `enforced`, `off`, `visits_capable` or `always` |-| email_delivery_state? | string | Whether the deployment sends email, and why not, one of the [email delivery states](#email-delivery-states) |-| verification_basis?<sup>9</sup> | string | What an account needs to be verified right now, `confirmed_email` or `local_credential` |--<sup>1</sup> The value is true only when email is switched on and the transport is completely configured. It is always false on a `username` deployment--<sup>2</sup> True only when billing is switched on, a Stripe secret key is set, at least one currency has both a monthly and a yearly price, and `premium_enabled` is true. It is computed on each request--<sup>3</sup> True only while its [premium mode](/admin-api/instance/#premium-modes) is `mirror`--<sup>4</sup> True while a Stripe secret key is set and `premium_enabled` is true, even after billing is switched off--<sup>5</sup> A client treats a missing value as `email`, which is what a deployment from before the field existed means--<sup>6</sup> Always `none` on a `username` deployment. Always `random` on an instance that existed before the field. A client treats a missing value as `random`--<sup>7</sup> `instant_accounts` is true only while `instant_account_availability` is `available`. A registration URL code that skips approval still allows an instant account while public sign-up is closed or needs approval. A client treats a missing `instant_account_availability` as `available` when `instant_accounts` is true and `disabled` otherwise--<sup>8</sup> A client treats a missing `interaction_tier` as `legacy` and a missing `guild_join_gate` as `always`. The admin [accounts configuration](/admin-api/instance/#accounts-configuration-object) explains both--<sup>9</sup> The value in effect after `auto` is resolved, so it is never `auto`. A `username` deployment, and any instance that cannot send email right now, reports `local_credential`. A client treats a missing value as `confirmed_email` while `emails_enabled` is true and `local_credential` otherwise--A deployment that reports `emails_enabled` as false sends no verification, password recovery, or IP authorisation message, and the flows that depend on one are unusable there. [Deployment availability](/http-api/deployment-availability/) states which routes a self-hosted deployment does not serve at all.+| account_identity | string | How people sign in, one of the [account identity modes](#account-identity-modes) |+| tag_style | string | How usernames are tagged, one of the [tag styles](#tag-styles) |+| desktop_modules_enabled? | boolean | Whether the desktop app can load downloadable modules |+| account_deletion_grace_period_hours? | integer | Hours between a deletion request and permanent deletion (1-8,760) |+| identifier_first? | boolean | Whether sign-in starts with [identify an account](/http-api/authentication/#identify-an-account) |+| instant_accounts? | boolean | Whether [register an account](/http-api/authentication/#register-an-account) accepts an account with only a display name |+| email_codes? | boolean | Whether [send an email code](/http-api/authentication/#send-an-email-code) works |+| date_of_birth_step? | boolean | Whether accounts [set their date of birth](/http-api/users/current-user/#set-date-of-birth) after sign-up |+| instant_account_availability? | string | Whether sign-up can create an instant account, one of the [instant account availability](#instant-account-availability) values |+| interaction_tier? | string | How the [account tiers](/http-api/users/#account-tiers) apply, `legacy` or `enforced` |+| guild_join_gate? | string | When joining a guild needs a verified account, `off`, `visits_capable` (only for clients that can visit guilds) or `always` |+| email_delivery_state? | string | Whether the instance sends email and why not, one of the [email delivery states](#email-delivery-states) |+| verification_basis? | string | What an account needs to be verified, `confirmed_email` or `local_credential` |++When `emails_enabled` is false, email verification, password recovery and IP authorization don't work.### Instant account availability| Value | Description || --- | --- |-| available | Public sign-up can create an instant account |-| disabled | An admin has turned instant accounts off |+| available | Sign-up can create an instant account |+| disabled | An admin turned instant accounts off || captcha_off | Instant accounts are on, but the CAPTCHA they need is off || registration_closed | Public registration is closed |-| approval_required | New accounts wait for admin approval, which needs a password to sign in afterwards |+| approval_required | New accounts wait for admin approval |### Email delivery states| Value | Description || --- | --- |-| on | The deployment sends email |-| off_username_mode | The deployment uses usernames and never sends email |-| off_disabled | An admin or the deployment configuration has turned email off |-| off_incomplete | Email is turned on, but the SMTP settings or the sender address are incomplete |+| on | The instance sends email |+| off_username_mode | The instance uses usernames and never sends email |+| off_disabled | An admin or the configuration turned email off |+| off_incomplete | Email is on, but the SMTP settings or sender address are incomplete |### Account identity modes| Value | Description || --- | --- |-| email | Members register and sign in with an email address |-| username | Members register and sign in with a username, and the deployment collects no email address |+| email | People register and sign in with an email address |+| username | People register and sign in with a username, and the instance collects no email address |++On a `username` instance, email routes return 400 `EMAIL_UNAVAILABLE_ON_INSTANCE`. On an `email` instance, username-only routes such as [recover an account](/http-api/authentication/#recover-an-account) return 400 `USERNAME_SIGN_IN_ONLY`.### Tag styles| Value | Description || --- | --- |-| none | Usernames are unique and shown without a tag. Every account that is not a bot has the discriminator `0000` |-| random | Every account gets a random tag. Tags are shown and can be changed |--A `username` deployment answers its email routes with 400 `EMAIL_UNAVAILABLE_ON_INSTANCE`. [Authentication](/http-api/authentication/#shared-behaviour) and [Email and password changes](/http-api/users/email-and-password/) list them. Routes that exist only for username sign-in, such as [recover an account](/http-api/authentication/#recover-an-account), answer 400 `USERNAME_SIGN_IN_ONLY` on an `email` deployment.+| none | Usernames are unique and have no tag, and every account that isn't a bot has the discriminator `0000` |+| random | Every account gets a random tag that can be changed |## GIF provider object@@ -235,13 +159,11 @@ A `username` deployment answers its email routes with 400 `EMAIL_UNAVAILABLE_ON_| Field | Type | Description || --- | --- | --- |-| provider | string | Stable machine name of the active GIF provider |-| display_name | string | Human-readable provider name a client shows |-| attribution_required<sup>1</sup> | boolean | Whether a client shows the provider attribution |--<sup>1</sup> A client that renders GIF results displays the provider's attribution mark alongside them when this value is true+| provider | string | The machine name of the GIF provider |+| display_name | string | The provider name to show |+| attribution_required | boolean | Whether you must show the provider's attribution next to GIF results |-The fields describe the provider a deployment has bound even when [service availability](#service-availability-object) reports `gif_enabled` as false. A client reads `gif_enabled` to decide whether to offer the picker at all. A deployment that has bound no GIF provider still publishes the stock values `klipy`, `Klipy`, and false.+Check `services.gif_enabled` before you show a GIF picker.## Registration policy object@@ -250,16 +172,14 @@ The fields describe the provider a deployment has bound even when [service avail| Field | Type | Description || --- | --- | --- || mode | string | The [registration mode](#registration-modes) |-| admin_registration_urls_enabled<sup>1</sup> | boolean | Whether an administrator-issued registration URL code is accepted |--<sup>1</sup> When true, [Register an account](/http-api/authentication/#register-an-account) accepts `registration_url_code`, a valid code admits registration even while `mode` is `closed`, and the code's own approval requirement replaces the one the mode would set+| admin_registration_urls_enabled | boolean | Whether [register an account](/http-api/authentication/#register-an-account) accepts an admin-issued `registration_url_code`, which works even while `mode` is `closed` |### Registration modes| Value | Description || --- | --- |-| open | Anyone can register and receives a session immediately |-| approval | Registration succeeds but the account waits for administrator approval before it can sign in |+| open | Anyone can register and gets a session at once |+| approval | New accounts wait for admin approval before they can sign in || closed | Public registration is refused |## Community policy object@@ -268,15 +188,11 @@ The fields describe the provider a deployment has bound even when [service avail| Field | Type | Description || --- | --- | --- |-| single_community | boolean | Whether this deployment runs as one community that every account joins |-| single_community_guild_id<sup>1</sup> | ?snowflake | The ID of the guild every account joins in single-community mode, or null |-| direct_messages_disabled | boolean | Whether direct messages are disabled for the whole deployment |-| friends_disabled?<sup>2</sup> | boolean | Whether friend requests are disabled for the whole deployment |-| guild_create_access | boolean | Whether every account can create communities, or only admins and holders of the `feature_guild_create` limit |--<sup>1</sup> The identifier is published only while `single_community` is true and the deployment has designated a community guild--<sup>2</sup> Absent only from a server older than this version, where `direct_messages_disabled` covers friend requests too+| single_community | boolean | Whether the instance runs as one community that every account joins |+| single_community_guild_id | ?snowflake | The ID of the single community's guild, or null when `single_community` is false |+| direct_messages_disabled | boolean | Whether direct messages are off for the whole instance |+| friends_disabled? | boolean | Whether friend requests are off for the whole instance |+| guild_create_access | boolean | Whether every account can create communities. When false, only admins and accounts with `feature_guild_create` can |## Service availability object@@ -285,7 +201,7 @@ The fields describe the provider a deployment has bound even when [service avail| Field | Type | Description || --- | --- | --- || gif_enabled | boolean | Whether the GIF picker is available |-| youtube_enabled | boolean | Whether YouTube link enrichment is available |+| youtube_enabled | boolean | Whether YouTube link previews are available || bluesky_enabled | boolean | Whether Bluesky [connections](/http-api/connections/) are available |## Push configuration object@@ -294,52 +210,42 @@ The fields describe the provider a deployment has bound even when [service avail| Field | Type | Description || --- | --- | --- |-| public_vapid_key<sup>1</sup> | ?string | The deployment's Web Push VAPID public key, or null |-| delivery_mode? | string | How push notifications reach devices, one of `direct`, `external_relay`, or `hybrid` |-| event_resolution_path? | string | API path a client calls to resolve the payload of a push event |-| external_relay_url? | ?string | URL of the external push relay, or null when there is none |+| public_vapid_key | ?string | The Web Push VAPID public key, or null when Web Push isn't set up |+| delivery_mode? | string | How push notifications get to devices, `direct`, `external_relay` or `hybrid` |+| event_resolution_path? | string | The API path to call to get the payload of a push event |+| external_relay_url? | ?string | The URL of the external push relay, or null || relay_signing_key_hashes? | ?array[string] | Hashes of the keys the external push relay signs with, or null |## Limit configuration object-The ordered rules a client evaluates to work out the limits that apply to an account or a guild.+The rules you evaluate to work out the limits for an account or a guild.### Structure| Field | Type | Description || --- | --- | --- |-| version | integer | The wire format version, always `2` |-| traitDefinitions<sup>1</sup> | array[string] | The trait names this deployment declares |+| version | integer | The format version, always `2` |+| traitDefinitions | array[string] | The trait names the instance declares || rules | array[[limit rule](#limit-rule-object) object] | The rules to evaluate |-| defaultsHash<sup>2</sup> | string | A hash of the release's built-in default limit values |--<sup>1</sup> A stock hosted configuration publishes the single name `premium`, which is computed from the account's premium state--<sup>2</sup> The value is computed from the release's default limit values alone, so an operator editing a rule leaves it unchanged. It changes when a release changes the defaults, which invalidates a resolution a client cached against the older ones+| defaultsHash | string | A hash of the release's default limit values, which changes when a release changes them |-Each rule publishes only the keys whose values differ from the release defaults. The defaults themselves are not published in this document, so a client MUST hold its own copy of them. Before it resolves anything, a client MUST also rebuild every rule into a full limit map, taking the default value of every [limit key](#limit-keys) and overlaying that rule's `overrides` on it.+Each rule lists the keys that differ from the release defaults, plus `max_guild_emojis`, `max_guild_stickers` and their aliases whenever the rule sets them. The document doesn't include the defaults, and your client needs its own copy of them. To resolve limits, follow these steps.-The client starts from the default value of every key. It evaluates the rules from least specific to most specific, where specificity is the total number of trait and guild feature names in a rule's filters. Two rules of equal specificity keep their published order. A rule matches when every trait it names is present in the evaluation context and every guild feature it names is present.+1. Start with the default value of every [limit key](#limit-keys).+2. Sort the rules by the number of traits and guild features in their filters, fewest first, keeping the published order for ties.+3. Skip a rule unless every trait and guild feature it lists is present. You supply the account's traits and the guild's features yourself.+4. Expand the rule by giving every key it doesn't list the default value.+5. A rule with no filters sets each key to its value. A rule with filters raises each key to its value when that is higher.-A rule that names no trait and no guild feature replaces the current value for each key it has. A rule that names at least one raises the current value to its own value when that is higher. Because a rebuilt rule has every key, an unfiltered rule returns each key it did not override to the default. A matching filtered rule raises each key it did not override to at least the default.--The evaluation contexts are listed below. A client reads the key's scope and the rule's filters to decide which keys an evaluation applies. The [limit key](#limit-keys) registry states the scope of each key.+Each key's scope decides whether a rule applies it.| Scope | User evaluation | Guild evaluation || --- | --- | --- || user | Applied | Applied only when the rule has no guild feature filter |-| guild | Not applied | Applied when the rule has a guild feature filter, or when the rule has no trait filter at all |+| guild | Not applied | Applied when the rule has a guild feature filter or no trait filter || both | Applied | Applied |-:::note[The operation applies its own authoritative bound]-The document lets a client present the correct bounds before it attempts an operation. A request that exceeds the resolved value still fails with the operation's own documented error.-:::--:::caution[An unauthenticated reader resolves only the unfiltered outcome]-The document publishes neither the requesting account's traits nor any guild feature set. A client supplies the account's traits and the guild's feature names itself, from data it received while authenticated.-:::--Nothing validates a rule's `traits` filter against `traitDefinitions`, so a rule can filter on a name that collection omits. A self-hosted deployment whose [premium mode](/admin-api/instance/#premium-modes) is `everyone` publishes an empty collection and has no rule that filters on `premium`.+Use the resolved values to show limits in your UI. The API still checks every limit and returns the endpoint's own error when a request goes over one.## Limit rule object@@ -347,11 +253,9 @@ Nothing validates a rule's `traits` filter against `traitDefinitions`, so a rule| Field | Type | Description || --- | --- | --- |-| id | string | The stable rule identifier |-| filters? | [limit filters](#limit-filters-object) object | The traits and guild features that select the rule, omitted when the rule always matches |-| overrides<sup>1</sup> | map[string, integer] | Integer values keyed by [limit key](#limit-keys) |--<sup>1</sup> An entry whose value is negative or is not a finite number is ignored when the rule is applied+| id | string | The rule ID |+| filters? | [limit filters](#limit-filters-object) object | What selects the rule, omitted when it always matches |+| overrides | map[string, integer] | Values keyed by [limit key](#limit-keys). Negative values are ignored |### Example@@ -368,91 +272,83 @@ Nothing validates a rule's `traits` filter against `traitDefinitions`, so a rule## Limit filters object-The traits and guild features a [limit rule](#limit-rule-object) requires before it matches.+An empty or missing list adds no condition.### Structure| Field | Type | Description || --- | --- | --- |-| traits? | array[string] | Trait names that must all be present for the rule to match |-| guildFeatures? | array[string] | Guild feature names that must all be present for the rule to match |--An empty or omitted collection imposes no condition. A rule whose filters object has neither collection always matches, and it replaces each key's current value exactly as a rule that omits `filters` does.+| traits? | array[string] | Trait names that must all be present |+| guildFeatures? | array[string] | Guild feature names that must all be present |## Limit keys-Each key names one limit. A key whose name begins with `feature_` is a feature gate whose value is `0` when the feature is unavailable and `1` when it is available. Every other key's value is a bound in the unit named by its description.+A `feature_` key is `1` when the feature is available and `0` when it isn't. The scope of each key is in parentheses.| Value | Description || --- | --- |-| avatar_max_size | Maximum file size for avatar uploads in bytes, effective up to 104857600, in user scope |-| emoji_max_size | Maximum file size for emoji uploads in bytes, effective up to 104857600, in guild scope |-| feature_animated_avatar | Allow animated avatar uploads, in user scope |-| feature_animated_banner | Allow animated banner uploads, in user scope |-| feature_custom_discriminator | Allow custom discriminator selection, in user scope. Ignored for people on an instance with the `none` tag style |-| feature_custom_notification_sounds | Allow custom notification sounds, in user scope |-| feature_early_access | Access to beta features, in user scope |-| feature_global_expressions | Use expressions across all guilds, in user scope |-| feature_guild_create | Create communities while the instance restricts community creation, in user scope |-| feature_higher_video_quality | Access to higher video streaming quality, in user scope |-| feature_per_guild_profiles | Different profile per guild, in user scope |-| feature_voice_entrance_sounds | Play a sound when joining voice, in user scope |-| guild_visit_history_days_unverified | Days of message history an account without a confirmed email can read while [visiting](/http-api/guilds/#visiting-guilds) a guild, in user scope |-| max_attachment_file_size | Maximum size of each attachment file in bytes, in user and guild scope |-| max_attachments_per_message | Maximum number of file attachments per message, in user and guild scope |-| max_bio_length | Maximum characters in a user biography, in user scope. At most 320 |-| max_bookmarks | Maximum bookmarked messages, in user scope |-| max_channels_per_category | Maximum channels per category, in guild scope |-| max_custom_backgrounds | Maximum custom profile backgrounds, in user scope |-| max_embeds_per_message | Maximum number of embeds per message, in user and guild scope |-| max_favorite_meme_tags | Maximum meme tags to track, in user scope |-| max_favorite_memes | Maximum favourited memes, in user scope |-| max_group_dm_recipients | Maximum members per group direct message, in user scope |-| max_group_dms_per_user | Maximum group direct messages a user can own, in user scope |-| max_guild_channels | Maximum channels per guild, in guild scope |-| max_guild_emojis | Maximum total emojis per guild, in guild scope |-| max_guild_emojis_animated<sup>1</sup> | Compatibility alias for older clients, in guild scope |-| max_guild_emojis_animated_more<sup>1</sup> | Compatibility alias for older clients, in guild scope |-| max_guild_emojis_static<sup>1</sup> | Compatibility alias for older clients, in guild scope |-| max_guild_emojis_static_more<sup>1</sup> | Compatibility alias for older clients, in guild scope |-| max_guild_invites | Maximum active invites per guild, in guild scope |-| max_guild_members | Maximum members per guild, in guild scope |-| max_guild_roles | Maximum roles per guild, in guild scope |-| max_guild_stickers | Maximum stickers per guild, in guild scope |-| max_guild_stickers_more<sup>2</sup> | Compatibility alias for older clients, in guild scope |-| max_guild_visits | Maximum guilds a user can [visit](/http-api/guilds/#visiting-guilds) at once. Accounts without a confirmed email get half, in user scope |-| max_guilds | Maximum number of guilds a user can join, in user scope |-| max_message_length | Maximum number of characters per message, in user and guild scope |-| max_private_channels_per_user | Maximum direct message channels per user, in user scope |-| max_reactions_per_message | Maximum distinct reactions per message, in guild scope |-| max_relationships | Maximum friend and blocked relationships, in user scope |-| max_screen_share_bitrate | Highest screen share video bitrate in bits per second, from 1000000 to 50000000, in user scope |-| max_users_per_message_reaction | Maximum users who can use the same reaction on a message, in guild scope |-| max_voice_message_duration | Maximum voice message duration in seconds, in user and guild scope |-| max_webhooks_per_channel | Maximum webhooks per channel, in guild scope |-| max_webhooks_per_guild | Maximum webhooks per guild, in guild scope |-| sticker_max_size | Maximum file size for sticker uploads in bytes, effective up to 104857600, in guild scope |--<sup>1</sup> Emoji limits are enforced as one shared total against `max_guild_emojis`, and the aliases exist only for older clients. The default of each alias equals the `max_guild_emojis` default--<sup>2</sup> Sticker limits are enforced as one shared total against `max_guild_stickers`--No key sets a thread or forum limit. [Thread lifecycle](/http-api/threads/#thread-lifecycle), [Thread members](/http-api/thread-members/), and [Forum channel fields](/http-api/forums/#forum-channel-fields) state those fixed bounds. `max_guild_channels` counts forum and media channels and counts no thread.--Where a rule sets `max_guild_emojis`, `max_guild_stickers`, or one of the compatibility aliases, it republishes that key in its own `overrides` even when the value matches the default.+| avatar_max_size | Maximum avatar upload size in bytes, up to 104857600 (user) |+| emoji_max_size | Maximum emoji upload size in bytes, up to 104857600 (guild) |+| feature_animated_avatar | Animated avatar uploads (user) |+| feature_animated_banner | Animated banner uploads (user) |+| feature_custom_discriminator | Choosing a custom discriminator, ignored with the `none` tag style (user) |+| feature_custom_notification_sounds | Custom notification sounds (user) |+| feature_early_access | Beta features (user) |+| feature_global_expressions | Using expressions in every guild (user) |+| feature_guild_create | Creating communities while the instance restricts it (user) |+| feature_higher_video_quality | Higher video streaming quality (user) |+| feature_per_guild_profiles | A different profile in each guild (user) |+| feature_voice_entrance_sounds | A sound when joining voice (user) |+| guild_visit_history_days_unverified | Days of history an unverified account sees while [visiting](/http-api/guilds/#visiting-guilds) a guild (user) |+| max_attachment_file_size | Maximum size of each attachment in bytes (user and guild) |+| max_attachments_per_message | Maximum attachments per message (user and guild) |+| max_bio_length | Maximum characters in a bio, at most 320 (user) |+| max_bookmarks | Maximum bookmarked messages (user) |+| max_channels_per_category | Maximum channels per category (guild) |+| max_custom_backgrounds | Maximum custom profile backgrounds (user) |+| max_embeds_per_message | Maximum embeds per message (user and guild) |+| max_favorite_meme_tags | Maximum meme tags to track (user) |+| max_favorite_memes | Maximum favorite memes (user) |+| max_group_dm_recipients | Maximum members per group DM (user) |+| max_group_dms_per_user | Maximum group DMs a user can own (user) |+| max_guild_channels | Maximum channels per guild, counting forum and media channels but not threads (guild) |+| max_guild_emojis | Maximum emojis per guild (guild) |+| max_guild_emojis_animated | Alias of `max_guild_emojis` for older clients (guild) |+| max_guild_emojis_animated_more | Alias of `max_guild_emojis` for older clients (guild) |+| max_guild_emojis_static | Alias of `max_guild_emojis` for older clients (guild) |+| max_guild_emojis_static_more | Alias of `max_guild_emojis` for older clients (guild) |+| max_guild_invites | Maximum active invites per guild (guild) |+| max_guild_members | Maximum members per guild (guild) |+| max_guild_roles | Maximum roles per guild (guild) |+| max_guild_stickers | Maximum stickers per guild (guild) |+| max_guild_stickers_more | Alias of `max_guild_stickers` for older clients (guild) |+| max_guild_visits | Maximum guilds a user can [visit](/http-api/guilds/#visiting-guilds) at once, halved for unverified accounts (user) |+| max_guilds | Maximum guilds a user can join (user) |+| max_message_length | Maximum characters per message (user and guild) |+| max_private_channels_per_user | Maximum DM channels per user (user) |+| max_reactions_per_message | Maximum distinct reactions per message (guild) |+| max_relationships | Maximum friends and blocked users (user) |+| max_screen_share_bitrate | Highest screen share bitrate in bits per second, 1000000 to 50000000 (user) |+| max_users_per_message_reaction | Maximum users per reaction on a message (guild) |+| max_voice_message_duration | Maximum voice message length in seconds (user and guild) |+| max_webhooks_per_channel | Maximum webhooks per channel (guild) |+| max_webhooks_per_guild | Maximum webhooks per guild (guild) |+| sticker_max_size | Maximum sticker upload size in bytes, up to 104857600 (guild) |++Threads and forums have fixed limits, listed under [thread lifecycle](/http-api/threads/#thread-lifecycle), [thread members](/http-api/thread-members/) and [forum channel fields](/http-api/forums/#forum-channel-fields).## Public application configuration object-Branding, setup state, legal documents, and registration fields a client reads before an account signs in.+What a client needs before anyone signs in.### Structure| Field | Type | Description || --- | --- | --- |-| branding | [public branding](#public-branding-object) object | Public instance identity |-| setup | [public setup state](#public-setup-state-object) object | Initial configuration state |-| legal | [public legal configuration](#public-legal-configuration-object) object | Legal and policy document URLs |-| registration | [public registration fields](#public-registration-fields-object) object | Registration field collection policy |+| branding | [public branding](#public-branding-object) object | Instance name and images |+| setup | [public setup state](#public-setup-state-object) object | Setup state |+| legal | [public legal configuration](#public-legal-configuration-object) object | Legal document URLs |+| registration | [public registration fields](#public-registration-fields-object) object | Extra sign-up fields |## Public branding object@@ -460,29 +356,21 @@ Branding, setup state, legal documents, and registration fields a client reads b| Field | Type | Description || --- | --- | --- |-| product_name | string | The configured instance name a client displays |-| icon_url | ?string | Full application icon URL, or null |-| symbol_url | ?string | Compact application symbol URL, or null |-| logo_url | ?string | Application logo URL, or null |-| wordmark_url | ?string | Application wordmark URL, or null |-| favicon_url | ?string | Browser favicon URL, or null |-| favicon_dark_url<sup>3</sup> | ?string | Browser favicon URL for a dark colour scheme, or null |-| theme_color | ?string | Brand and browser theme colour as lowercase `#rrggbb`, or null |-| status_page_url | ?string | Public status page URL, or null |+| product_name | string | The instance name |+| icon_url | ?string | App icon URL, or null |+| symbol_url | ?string | Compact app symbol URL, or null |+| logo_url | ?string | App logo URL, or null |+| wordmark_url | ?string | App wordmark URL, or null |+| favicon_url | ?string | Favicon URL, or null |+| favicon_dark_url | ?string | Favicon URL for a dark color scheme, or null to use `favicon_url` |+| theme_color | ?string | Brand color as lowercase `#rrggbb`, or null |+| status_page_url | ?string | Status page URL, or null || status_page_incident_history_url | ?string | Status page incident history URL, or null |-| premium_product_name | string | Name of the premium tier a client displays. A self-hosted deployment reports `Premium` until the operator sets a name |-| premium_info_url | ?string | Absolute URL of a page describing the premium tier, or null |-| sign_in_backdrop_url<sup>1</sup> | ?string | Image URL drawn behind the sign-in screens under a dark scrim, or null |-| custom_css<sup>2</sup> | ?string | Stylesheet the web and desktop app apply on every page, or null |-| upload_limit_message<sup>4</sup> | ?string | Markdown shown when a file is over the upload limit, or null |--<sup>1</sup> Null means the default space background--<sup>2</sup> Applied before the person's own theme and custom CSS, so those win--<sup>3</sup> Shown in place of `favicon_url` while the browser uses a dark colour scheme. Null means one favicon for every colour scheme--<sup>4</sup> Shown in place of the default sentence about the instance setting the limit+| premium_product_name | string | The name of the premium tier, `Premium` unless an admin sets one |+| premium_info_url | ?string | URL of a page about the premium tier, or null |+| sign_in_backdrop_url | ?string | Image shown behind the sign-in screens, or null for the default |+| custom_css | ?string | CSS the web and desktop app apply before the person's own theme, or null |+| upload_limit_message | ?string | Markdown shown when a file is over the upload limit, or null for the default text |## Public setup state object@@ -490,28 +378,22 @@ Branding, setup state, legal documents, and registration fields a client reads b| Field | Type | Description || --- | --- | --- |-| configured | boolean | Whether initial deployment configuration is complete |-| admin_url<sup>1</sup> | ?string | The admin application URL used to continue setup, or null |-| account_identity_locked? | boolean | Whether the sign-in method can no longer change, sent only while a self-hosted deployment is not configured |-| account_identity_lock_reason? | ?string | One of the [account identity lock reasons](#account-identity-lock-reasons), or null while the method can still change |-| setup_token_required? | boolean | Whether registration needs the setup token, sent only while a self-hosted deployment is not configured |--<sup>1</sup> The value is the deployment's configured admin endpoint, and it is null when no admin endpoint is configured+| configured | boolean | Whether setup is finished |+| admin_url | ?string | The admin app URL to finish setup in, or null |+| account_identity_locked? | boolean | Whether the sign-in method can no longer change |+| account_identity_lock_reason? | ?string | One of the [account identity lock reasons](#account-identity-lock-reasons), or null while the method can change |+| setup_token_required? | boolean | Whether [register an account](/http-api/authentication/#register-an-account) needs `setup_token` |-`account_identity_locked` is true once the first account exists, and on a deployment stored as already in use. [Set the setup sign-in method](#set-the-setup-sign-in-method) returns 409 there. `account_identity_lock_reason` says why, and is sent only while a self-hosted deployment is not configured, like the lock itself.+`account_identity_locked`, `account_identity_lock_reason` and `setup_token_required` are sent only while a self-hosted instance isn't configured.### Account identity lock reasons| Value | Description || --- | --- |-| setup_configured | The deployment configuration marks setup as finished |-| existing_instance | The deployment was in use before username sign-in existed, so it stays on `email` |-| admin_exists | The deployment already has an admin account |-| accounts_exist | The deployment already has accounts, none of them an admin |--When more than one applies, the value is the first one in this table.--`setup_token_required` is true while [Register an account](/http-api/authentication/#register-an-account) refuses a body without `setup_token`. It is false once the first admin account exists, and on a deployment that does not enforce the token.+| setup_configured | Setup is finished |+| existing_instance | The instance had an admin, accounts or finished setup when its sign-in method was first set, so it stays on `email` |+| admin_exists | The instance has an admin account |+| accounts_exist | The instance has accounts, none of them an admin |## Public legal configuration object@@ -519,11 +401,9 @@ When more than one applies, the value is the first one in this table.| Field | Type | Description || --- | --- | --- |-| terms_url | ?string | Public terms of service URL, or null |-| privacy_url | ?string | Public privacy policy URL, or null |-| guidelines_url<sup>1</sup> | ?string | Public community guidelines URL, or null |--<sup>1</sup> The URL the operator set. A [report flow](/http-api/reports/#report-flows) and the account enforcement emails link it. When it is null, every guidelines link is hidden+| terms_url | ?string | Terms of service URL, or null |+| privacy_url | ?string | Privacy policy URL, or null |+| guidelines_url | ?string | Community guidelines URL, used by [report flows](/http-api/reports/#report-flows), or null to hide guidelines links |## Public registration fields object@@ -531,9 +411,7 @@ When more than one applies, the value is the first one in this table.| Field | Type | Description || --- | --- | --- |-| collect_date_of_birth<sup>1</sup> | boolean | Whether the deployment asks accounts for a date of birth |--<sup>1</sup> Derived from the admin [`date_of_birth`](/admin-api/instance/#accounts-configuration-object) setting, and false only while it is `off`+| collect_date_of_birth | boolean | Whether sign-up asks for a date of birth, set in the admin [accounts configuration](/admin-api/instance/#accounts-configuration-object) |## Age policy object@@ -550,44 +428,25 @@ When more than one applies, the value is the first one in this table.| Field | Type | Description || --- | --- | --- || country_code | string | The ISO 3166-1 alpha-2 country code |-| region_code | ?string | The ISO 3166-2 subdivision code, or null when the entry covers the whole country |-| action | string | `restrict` to require an age check, or `block` to refuse access |+| region_code | ?string | The ISO 3166-2 subdivision code, or null for the whole country |+| action | string | `restrict` to need an age check, or `block` to refuse access |## Geolocation object-The approximate location Fluxer resolved for the request, together with the regions where mature content is gated behind an age check or is unavailable.+The approximate location of the request, and the places where mature content needs an age check or isn't available.### Structure| Field | Type | Description || --- | --- | --- |-| countryCode<sup>1</sup> <sup>2</sup> | ?string | The detected ISO 3166-1 alpha-2 country code, or null |-| regionCode<sup>1</sup> <sup>2</sup> | ?string | The detected ISO 3166-2 subdivision code within the country, or null |-| latitude<sup>1</sup> <sup>3</sup> | ?string | The approximate latitude, or null |-| longitude<sup>1</sup> <sup>3</sup> | ?string | The approximate longitude, or null |-| ageRestrictedGeos | array[[geo entry](#geo-entry-object) object] | Locations where mature content requires an age check |-| ageBlockedGeos | array[[geo entry](#geo-entry-object) object] | Locations where mature content is unavailable |--<sup>1</sup> All detected fields are null when the location is unknown. A known location can still omit the subdivision code or coordinates--<sup>2</sup> The value is upper case--<sup>3</sup> The value is a decimal string--The geo collections are fixed by the release, so they are identical in every response. A client resolves its own country and subdivision from the detected fields and then selects the matching entry itself.+| countryCode | ?string | The upper-case ISO 3166-1 alpha-2 country code, or null |+| regionCode | ?string | The upper-case ISO 3166-2 subdivision code, or null |+| latitude | ?string | The approximate latitude as a decimal string, or null |+| longitude | ?string | The approximate longitude as a decimal string, or null |+| ageRestrictedGeos | array[[geo entry](#geo-entry-object) object] | Places where mature content needs an age check |+| ageBlockedGeos | array[[geo entry](#geo-entry-object) object] | Places where mature content isn't available |-### Example--```json-{- "countryCode": "GB",- "regionCode": "ENG",- "latitude": "51.5074",- "longitude": "-0.1278",- "ageRestrictedGeos": [{"countryCode": "US", "regionCode": "TX"}],- "ageBlockedGeos": []-}-```+When the location is unknown, all four location fields are null. Match `countryCode` and `regionCode` against the geo lists yourself.## Geo entry object@@ -596,7 +455,7 @@ The geo collections are fixed by the release, so they are identical in every res| Field | Type | Description || --- | --- | --- || countryCode | string | The ISO 3166-1 alpha-2 country code |-| regionCode | ?string | The ISO 3166-2 subdivision code within the country, or null when the entry covers the whole country |+| regionCode | ?string | The ISO 3166-2 subdivision code, or null for the whole country |## Account identity object@@ -604,126 +463,91 @@ The geo collections are fixed by the release, so they are identical in every res| Field | Type | Description || --- | --- | --- |-| mode | string | The [account identity mode](#account-identity-modes) now in effect |-| tag_style | string | How usernames are tagged, one of the [tag styles](#tag-styles) |+| mode | string | The [account identity mode](#account-identity-modes) in effect |+| tag_style | string | One of the [tag styles](#tag-styles) |## Get instance discovery<RouteHeader method="GET" path="/.well-known/fluxer" unauthenticated />-Returns the [instance discovery object](#instance-discovery-object) describing this deployment.--The path has no `/v1` prefix.+Returns the [instance discovery object](#instance-discovery-object). The response has `ETag` and `Last-Modified` headers, and a request with a matching `If-None-Match` or `If-Modified-Since` gets 304 with no body.### Response| Status | Body | Condition || --- | --- | --- || 200 | [instance discovery](#instance-discovery-object) object | The discovery document was returned |+| 304 | None | The document hasn't changed |-### Rate limit--60 requests per minute for each authenticated user, or for each client IP address when the request has no credential, on the `instance:info` bucket. [Get OpenAPI document](#get-openapi-document) shares this bucket.+The rate limit is 60 requests per minute, on the `instance:info` bucket.## Get client geolocation<RouteHeader method="GET" path="/v1/ip" unauthenticated />-Returns the [geolocation object](#geolocation-object) for the request's client address.--A lookup that resolves nothing still returns 200 with `countryCode`, `regionCode`, `latitude`, and `longitude` all null. Treat this as an unknown location.+Returns the [geolocation object](#geolocation-object) for your IP address.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [geolocation](#geolocation-object) object | The location was resolved, fully, partly, or not at all |+| 200 | [geolocation](#geolocation-object) object | The lookup ran, even if it found no location |-### Rate limit--30 requests per minute for each authenticated user, or for each client IP address when the request has no credential, on the `ip:geo_lookup` bucket.+The rate limit is 30 requests per minute, on the `ip:geo_lookup` bucket.## Check the setup token<RouteHeader method="POST" path="/v1/instance/setup/token-checks" unauthenticated />-Checks a setup token without using it up. The setup wizard calls this first, so a wrong token is caught before any other question.--The route returns 204 when the token is correct, and also when the deployment no longer needs one, which is the case once the first admin account exists and on a deployment that does not enforce the token.+Checks a setup token without using it up.### JSON body| Field | Type | Description || --- | --- | --- |-| setup_token<sup>1</sup> | string | The setup token of the deployment (1-256 characters) |--<sup>1</sup> Checked the way [Register an account](/http-api/authentication/#register-an-account) checks it, with the same field codes and the same allowance for wrong tokens+| setup_token | string | The setup token (1-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | None | The token is correct, or the deployment needs no setup token |-| 400 | [error response](/http-api/#error-response) | The body is invalid, or the setup token is missing or wrong |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request, or the address has used its wrong setup token allowance |--### Side effects--None. The token stays valid, and a wrong token counts toward the allowance of the address.+| 204 | None | The token is correct, or the instance needs no setup token |+| 400 | [error response](/http-api/#error-response) | The setup token is missing or wrong |+| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Too many requests, or too many wrong tokens from your IP address |-### Rate limit--10 requests per minute for each authenticated user, or for each client IP address when the request has no credential, on the `instance:setup:token_check` bucket.+The rate limit is 10 requests per minute, on the `instance:setup:token_check` bucket.## Set the setup sign-in method<RouteHeader method="PUT" path="/v1/instance/setup/account-identity" unauthenticated />-Chooses how members sign in on a new self-hosted deployment, and on an `email` deployment whether usernames have tags. Returns an [account identity](#account-identity-object) object with the choice now in effect.--The setup wizard calls this before the owner account exists. The choice stays open on a self-hosted deployment until setup is complete or the first account exists. After that, on a deployment that was already in use before username sign-in existed, and on every hosted deployment, the route returns 409 `ACCOUNT_IDENTITY_LOCKED`. The choice and the first registration take turns, so a choice never lands after the first account exists. A repeated call while the choice is open replaces the earlier one.--:::caution[The setup token stands in for a credential]-The route needs no credential. While `setup_token_required` is true in the [public setup state](#public-setup-state-object), a call without the correct `setup_token` is refused.-:::+Sets how people sign in on a new self-hosted instance and, for `email`, whether usernames have tags. Returns an [account identity](#account-identity-object) object. It works until one of the [account identity lock reasons](#account-identity-lock-reasons) applies, such as setup being finished or the first account existing. Send `setup_token` while `setup_token_required` is true in the [public setup state](#public-setup-state-object).### JSON body| Field | Type | Description || --- | --- | --- |-| mode | string | The [account identity mode](#account-identity-modes) to use |-| tag_style?<sup>1</sup> | string | How usernames are tagged, one of the [tag styles](#tag-styles). Defaults to `none` |-| setup_token?<sup>2</sup> | ?string | The setup token of the deployment (1-256 characters) |--<sup>1</sup> A `username` instance always uses `none`. Sending `random` with `username` returns the field code `TAG_STYLE_REQUIRES_EMAIL_SIGN_IN` on `tag_style`--<sup>2</sup> Checked the way [Register an account](/http-api/authentication/#register-an-account) checks it, with the same field codes and the same allowance for wrong tokens+| mode | string | The [account identity mode](#account-identity-modes) |+| tag_style? | string | One of the [tag styles](#tag-styles), `none` by default and always `none` for `username` |+| setup_token? | ?string | The setup token (1-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [account identity](#account-identity-object) object | The mode was stored |-| 400 | [error response](/http-api/#error-response) | The body is invalid, `random` tags were requested with `username`, or the setup token is missing or wrong |-| 409 | [error response](/http-api/#error-response) | `ACCOUNT_IDENTITY_LOCKED`, because the sign-in method can no longer change |-| 423 | [error response](/http-api/#error-response) | `GENERAL_ERROR`, because a registration or another choice held the turn for more than 15 seconds |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request, or the address has used its wrong setup token allowance |+| 200 | [account identity](#account-identity-object) object | The sign-in method was saved |+| 400 | [error response](/http-api/#error-response) | `TAG_STYLE_REQUIRES_EMAIL_SIGN_IN` for `random` with `username`, or the setup token is missing or wrong |+| 409 | [error response](/http-api/#error-response) | `ACCOUNT_IDENTITY_LOCKED` when the sign-in method can no longer change |+| 423 | [error response](/http-api/#error-response) | `GENERAL_ERROR` when another registration or setup call held the setup lock for 15 seconds. Retry after `Retry-After` |+| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Too many requests, or too many wrong tokens from your IP address |-### Side effects--The deployment stores the choice, and [instance discovery](#get-instance-discovery) reports it as `account_identity` and `tag_style` from then on. No Gateway Dispatch is emitted.--### Rate limit--10 requests per minute for each authenticated user, or for each client IP address when the request has no credential, on the `instance:setup:account_identity` bucket.+The rate limit is 10 requests per minute, on the `instance:setup:account_identity` bucket.## Get OpenAPI document<RouteHeader method="GET" path="/v1/openapi.json" unauthenticated />-Returns the deployment's OpenAPI 3.1 document as JSON with `Content-Type: application/json; charset=utf-8`.--The document has no `ETag`. Its server URL is the deployment's `api_client` [endpoint](#instance-endpoints-object) followed by `/v1`. Every path is relative to that URL.+Returns the instance's OpenAPI 3.1 document as JSON. Its server URL is the `api_client` [endpoint](#instance-endpoints-object) followed by `/v1`.### Response@@ -731,6 +555,4 @@ The document has no `ETag`. Its server URL is the deployment's `api_client` [end| --- | --- | --- || 200 | OpenAPI 3.1 document | The document was returned |-### Rate limit--60 requests per minute for each authenticated user, or for each client IP address when the request has no credential, on the `instance:info` bucket. The allowance is shared with [Get instance discovery](#get-instance-discovery).+The rate limit is 60 requests per minute, on the `instance:info` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/invites.mdx b/fluxer_docs/src/content/docs/http-api/invites.mdxindex 5fde0873a..152ae8e55 100644--- a/fluxer_docs/src/content/docs/http-api/invites.mdx+++ b/fluxer_docs/src/content/docs/http-api/invites.mdx@@ -1,14 +1,12 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Invites-description: Invite objects, invite metadata, custom invite URLs, and the invite operations.+description: Invite objects and the routes for getting, accepting, creating, listing and deleting invites.---import RouteHeader from '@/components/RouteHeader.astro';-An invite is a code that admits an account into a guild or a group direct message.--[Get invite](#get-invite) is the only route here that needs no credential. [Modify guild custom invite URL](/http-api/guilds/#modify-guild-custom-invite-url) configures a guild's custom invite URL, and [Discovery](/http-api/discovery/) defines joining an approved public guild with no invite.+An invite is a code that lets an account join a guild or a group direct message. A guild can also have one [custom invite URL](#custom-invite-urls).## Invite object@@ -16,31 +14,21 @@ An invite is a code that admits an account into a guild or a group direct messag| Field | Type | Description || --- | --- | --- |-| code | string | The unique code that identifies the invite |+| code | string | The unique code of the invite || type | integer | [Invite type](#invite-types) |-| guild?<sup>1</sup> | [partial guild](/http-api/guilds/#partial-guild-object) object | The guild the invite admits into |-| channel?<sup>2</sup> | [partial invite channel](#partial-invite-channel-object) object | The guild channel or group direct message the invite targets |-| inviter<sup>3</sup> | ?[partial user](/http-api/users/#partial-user-object) object | The account that created the invite, or null |-| member_count?<sup>4</sup> | integer | The member count of the guild, or the exact recipient count of the group direct message |-| presence_count?<sup>4</sup> | integer | The online member count of the guild |-| expires_at<sup>5</sup> | ?ISO8601 timestamp | The time at which the invite stops resolving, or null when it never expires |-| temporary<sup>6</sup> | boolean | Whether admission through this invite grants temporary membership |--<sup>1</sup> Present only when `type` is `0`, and it applies the same feature-gated asset stripping as the full [guild object](/http-api/guilds/#guild-object)--<sup>2</sup> Present when `type` is `0` or `1`. A guild invite with no stored target channel resolves the first guild text channel the default role can view--<sup>3</sup> Null when the record stores no creator, which is always the case for a custom invite URL+| guild? | [partial guild](/http-api/guilds/#partial-guild-object) object | The guild the invite joins |+| channel? | [partial invite channel](#partial-invite-channel-object) object | The channel the invite targets |+| inviter<sup>1</sup> | ?[partial user](/http-api/users/#partial-user-object) object | The account that created the invite |+| member_count? | integer | The member count of the guild, or the recipient count of the group direct message |+| presence_count? | integer | The online member count of the guild |+| expires_at | ?ISO8601 timestamp | When the invite stops working, or null when it never expires |+| temporary<sup>2</sup> | boolean | Whether joining through this invite gives temporary membership |-<sup>4</sup> Guild counts are `0` when unavailable+<sup>1</sup> Null for a custom invite URL-<sup>5</sup> Computed from the creation time plus the stored lifetime, and null whenever that lifetime is `0`+<sup>2</sup> Has no effect on a group direct message invite-<sup>6</sup> Has no effect on a group direct message invite--:::note[Branch on `type` to know which fields arrive]-A guild invite always has `guild`, `channel`, `member_count`, and `presence_count`. A group direct message invite has `channel` and `member_count` only.-:::+A guild invite has `guild`, `channel`, `member_count` and `presence_count`. A group direct message invite has `channel` and `member_count`.### Example@@ -62,62 +50,40 @@ A guild invite always has `guild`, `channel`, `member_count`, and `presence_coun| Value | Name | Description || --- | --- | --- |-| 0 | GUILD | An invite that admits an account into a guild |-| 1 | GROUP_DM | An invite that admits an account into a group direct message |+| 0 | GUILD | Joins a guild |+| 1 | GROUP_DM | Joins a group direct message |## Invite metadata object-The metadata object extends the [invite](#invite-object) with its creation and usage state. [Create channel invite](#create-channel-invite), [List channel invites](#list-channel-invites), and [List guild invites](#list-guild-invites) return it. [Get invite](#get-invite) never does.+The metadata object extends the [invite object](#invite-object) with creation and usage details. [Create channel invite](#create-channel-invite), [List channel invites](#list-channel-invites) and [List guild invites](#list-guild-invites) return it.### Structure| Field | Type | Description || --- | --- | --- |-| created_at | ISO8601 timestamp | The time at which the invite record was created |-| uses<sup>1</sup> | integer | The number of admissions completed through the invite |-| max_uses<sup>2</sup> | integer | The maximum admissions the invite permits, where `0` is unlimited |-| max_age?<sup>3</sup> | integer | The stored lifetime in seconds, where `0` never expires |--<sup>1</sup> The counter advances only when the admission adds the account, so accepting an invite for a target the account already belongs to leaves it unchanged--<sup>2</sup> The value is `0` for every custom invite URL and for any invite created without an explicit maximum--<sup>3</sup> Present only when `type` is `0`, because a group direct message invite reports its expiry only through `expires_at`--### Example--```json-{- "code": "aB3dEf7h",- "type": 0,- "created_at": "2026-08-04T11:22:19.000Z",- "uses": 3,- "max_uses": 25,- "max_age": 86400,- "temporary": false-}-```+| created_at | ISO8601 timestamp | When the invite was created |+| uses | integer | How many accounts joined through the invite |+| max_uses | integer | The maximum number of joins, where `0` is unlimited |+| max_age? | integer | The lifetime in seconds, where `0` never expires. Only when `type` is `0` |## Partial invite channel object-The partial channel has only enough identity to describe the target before admission.+The `channel` field of an [invite object](#invite-object).### Structure| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the channel |-| name<sup>1</sup> | ?string | The name of the channel, or null |+| name | ?string | The name of the channel || type | integer | [Channel type](/http-api/channels/#channel-types) |-| recipients?<sup>2</sup> | array[[partial invite recipient](#partial-invite-recipient-object) object] | The accounts in the group direct message |--<sup>1</sup> A guild channel always stores a name, and a group direct message that stores no name reports null+| recipients?<sup>1</sup> | array[[partial invite recipient](#partial-invite-recipient-object) object] | The accounts in the group direct message |-<sup>2</sup> Present only on a group direct message invite, and it lists every current recipient including the invite creator+<sup>1</sup> Only on a group direct message invite## Partial invite recipient object-A partial recipient has only the username.+An entry in `recipients` on a group direct message invite.### Structure@@ -127,333 +93,154 @@ A partial recipient has only the username.## Custom invite URLs-[Modify guild custom invite URL](/http-api/guilds/#modify-guild-custom-invite-url) creates or replaces a custom invite code. It has type `0`, null `inviter` and `expires_at`, and `max_uses` and `max_age` of `0`. Its channel is the first guild text channel in channel order that the default role can view.--Custom invite codes are case-insensitive. Clearing or replacing a code makes the old link stop resolving immediately.--[Accept invite](#accept-invite) records the join as a custom invite URL admission and attributes no inviter and no source invite code. [List channel invites](#list-channel-invites) and [List guild invites](#list-guild-invites) exclude custom invite URLs, and [Delete invite](#delete-invite) refuses them.+A custom invite URL is a guild invite with a code you choose. It has no inviter, no expiry and no use limit. Its code is case-insensitive, and clearing or replacing it stops the old link from working right away. [List channel invites](#list-channel-invites) and [List guild invites](#list-guild-invites) leave it out, and [Delete invite](#delete-invite) returns `UNKNOWN_INVITE` for it. To read the code, use [Get guild custom invite URL](/http-api/guilds/#get-guild-custom-invite-url).## Get invite<RouteHeader method="GET" path="/v1/invites/{invite_code}" unauthenticated />-Reads one invite. Returns an [invite object](#invite-object) on success.--An `Authorization` header that cannot be resolved is ignored, and the route returns the same representation to every caller. The read consumes no use.--Codes from [Create channel invite](#create-channel-invite) are case-sensitive. Custom invite codes are case-insensitive.--:::note[Every admission gate runs at accept time]-A 200 response means the invite code exists and none of the 404 conditions in the response table below applies. [Accept invite](#accept-invite) checks bans, the guild's invites-disabled feature, exhausted uses, the active presence a temporary invite requires, and whether the target is full.-:::--:::note[Lookup does not guarantee admission]-Expired invites no longer resolve. An exhausted invite may still resolve until an acceptance attempt removes it.-:::+Returns an [invite object](#invite-object) without using up the invite. Codes from [Create channel invite](#create-channel-invite) are case-sensitive.### Path parameters| Field | Type | Description || --- | --- | --- |-| invite_code<sup>1</sup> | string | The invite code to resolve (1 through 256 characters) |--<sup>1</sup> Normalised before lookup by removing form feed and right-to-left override characters and trimming, and a value empty or above 256 characters afterwards returns the field code `STRING_LENGTH_INVALID`+| invite_code | string | The invite code (1-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [invite](#invite-object) object | Invite resolved |-| 404 | [error response](/http-api/#error-response) | No record has the code, a guild invite names no guild, a group direct message invite names no channel or unresolvable recipient, or a guild invite with no stored target channel exposes no viewable channel, each returning `UNKNOWN_INVITE` |-| 404 | [error response](/http-api/#error-response) | The stored target channel no longer exists and the request returns `UNKNOWN_CHANNEL` |-| 404 | [error response](/http-api/#error-response) | The named guild no longer exists and the request returns `UNKNOWN_GUILD` |--### Rate limit+| 200 | [invite](#invite-object) object | The invite was returned |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_INVITE`, `UNKNOWN_CHANNEL` or `UNKNOWN_GUILD` when the invite or its target is gone |-100 requests per 10 seconds for each identity and invite code, on the `invite:read::invite_code` bucket. The identity is the authenticated account when a credential resolves, and otherwise the derived key for the client IP address.+The rate limit is 100 requests per 10 seconds, on the `invite:read::invite_code` bucket.## Accept invite<RouteHeader method="POST" path="/v1/invites/{invite_code}" />-Accepts an invite and admits the authenticated account into its target. Returns an [invite object](#invite-object) on success.--A guild admission emits [Guild Create](/gateway/events/#guild-create), [Guild Member Add](/gateway/events/#guild-member-add), [User Settings Update](/gateway/events/#user-settings-update), [User Guild Settings Update](/gateway/events/#user-guild-settings-update), and [Message Create](/gateway/events/#message-create) Gateway events. A group direct message admission emits [Channel Create](/gateway/events/#channel-create), [Channel Recipient Add](/gateway/events/#channel-recipient-add), and [Message Create](/gateway/events/#message-create) Gateway events.--### Limitations--- User-only, so a bot token is rejected with 403 `ACCESS_DENIED`.-- The caller needs no permission.--:::caution[Exhausted invites stop working]-Accepting an exhausted invite returns 404 `UNKNOWN_INVITE` and makes the code stop resolving. Custom invite URLs have no use limit.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| invite_code | string | The invite code to accept (1 through 256 characters) |+Joins the authenticated account to the target of the invite and returns an [invite object](#invite-object). Each new join counts as one use, and the invite is deleted after `max_uses` joins. An account that is already in the target gets a 200 and no use is counted, unless the guild has paused invites or disabled `INSTANT_INVITES`.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [invite](#invite-object) object | Account was admitted, or was already a member of the target |-| 400 | [error response](/http-api/#error-response) | A temporary guild invite is accepted without an active presence and the request returns `TEMPORARY_INVITE_REQUIRES_PRESENCE` |-| 400 | [error response](/http-api/#error-response) | An unclaimed account accepts a group direct message invite and the request returns `UNCLAIMED_ACCOUNT_CANNOT_JOIN_GROUP_DMS` |-| 400 | [error response](/http-api/#error-response) | A type `1` invite names a private channel that is not a group direct message and the caller is not already a recipient and the request returns `INVALID_CHANNEL_TYPE` |-| 400 | [error response](/http-api/#error-response) | The caller already holds the maximum number of guilds and the request returns `MAX_GUILDS` |-| 400 | [error response](/http-api/#error-response) | The target is full and the request returns `MAX_GUILD_MEMBERS` or `MAX_GROUP_DM_RECIPIENTS` |-| 403 | [error response](/http-api/#error-response) | The group is marked for mature content and the caller fails the age check, returning `NSFW_CONTENT_AGE_RESTRICTED` |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The guild has the invites-disabled feature and the request returns `INVITES_DISABLED` |-| 403 | [error response](/http-api/#error-response) | Instant invites are temporarily disabled for the guild and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 403 | [error response](/http-api/#error-response) | The caller is banned by account or email address and the request returns `USER_BANNED_FROM_GUILD` |-| 403 | [error response](/http-api/#error-response) | The caller is banned by network address and the request returns `USER_IP_BANNED_FROM_GUILD` |-| 403 | [error response](/http-api/#error-response) | The account is [limited](/http-api/users/#account-limitation) and not already a member or recipient, and the request returns `ACCOUNT_LIMITED` |-| 404 | [error response](/http-api/#error-response) | The named guild no longer exists and the request returns `UNKNOWN_GUILD` |-| 404 | [error response](/http-api/#error-response) | The target channel no longer exists and the request returns `UNKNOWN_CHANNEL` |-| 404 | [error response](/http-api/#error-response) | The code resolves to no record, the record is exhausted, a guild invite names no guild, or a group direct message invite names no channel or a channel that no longer exists, each returning `UNKNOWN_INVITE` |--### Side effects+| 200 | [invite](#invite-object) object | The account joined or was already in the target |+| 400 | [error response](/http-api/#error-response) | `TEMPORARY_INVITE_REQUIRES_PRESENCE` when a temporary invite is accepted with no active presence |+| 400 | [error response](/http-api/#error-response) | `UNCLAIMED_ACCOUNT_CANNOT_JOIN_GROUP_DMS` when an unclaimed account joins a group direct message |+| 400 | [error response](/http-api/#error-response) | `INVALID_CHANNEL_TYPE` when a type `1` invite targets a private channel that is not a group direct message |+| 400 | [error response](/http-api/#error-response) | `MAX_GUILDS` when the account is in the maximum number of guilds |+| 400 | [error response](/http-api/#error-response) | `MAX_GUILD_MEMBERS` or `MAX_GROUP_DM_RECIPIENTS` when the target is full |+| 403 | [error response](/http-api/#error-response) | `NSFW_CONTENT_AGE_RESTRICTED` when the guild or channel is age restricted and the age check fails |+| 403 | [error response](/http-api/#error-response) | `INVITES_DISABLED` when the guild has paused invites |+| 403 | [error response](/http-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED` when `INSTANT_INVITES` is set in the guild's [disabled operations](/http-api/guilds/#disabled-guild-operations) |+| 403 | [error response](/http-api/#error-response) | `USER_BANNED_FROM_GUILD` or `USER_IP_BANNED_FROM_GUILD` when the account or its network address is banned |+| 403 | [error response](/http-api/#error-response) | `ACCOUNT_LIMITED` when the account is [limited](/http-api/users/#account-limitation) and not already in the target |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_INVITE` when the code is unknown or used up, `UNKNOWN_GUILD` or `UNKNOWN_CHANNEL` when the target is gone |-When the account is already in the target, the route returns 200 with the invite object. It consumes no use and emits no Dispatch. A new admission consumes one use and removes the invite when its limit is reached. A failed admission consumes no use. If the invite's channel has been deleted, the account can still join and consume a use even though the response is 404 `UNKNOWN_CHANNEL`.+A guild join sends [Guild Create](/gateway/events/#guild-create) and [Guild Member Add](/gateway/events/#guild-member-add), and a group direct message join sends [Channel Create](/gateway/events/#channel-create) and [Channel Recipient Add](/gateway/events/#channel-recipient-add).-A guild admission creates the membership, records whether the join used a custom invite URL or an instant invite, and adds the guild to the caller's settings and folder layout. A temporary invite marks the membership temporary.--The joining account receives [Guild Create](/gateway/events/#guild-create). [Guild Member Add](/gateway/events/#guild-member-add) is guild-wide and reaches every session connected to the guild, subject to the [event filtering](/gateway/event-filtering/) gates, which withhold it from a passive user session in a guild with more than 250 members. The joining account receives [User Settings Update](/gateway/events/#user-settings-update) when the join changes its stored settings, and [User Guild Settings Update](/gateway/events/#user-guild-settings-update) when its `default_hide_muted_channels` setting is enabled. Unless the guild's `system_channel_flags` has [SUPPRESS_JOIN_NOTIFICATIONS](/http-api/guilds/#system-channel-flags) or the guild has no system channel, the operation creates a join system message and delivers [Message Create](/gateway/events/#message-create).--A group direct message admission adds the caller as a recipient and creates a recipient addition system message. The joining account receives [Channel Create](/gateway/events/#channel-create), the recipients the group already held receive [Channel Recipient Add](/gateway/events/#channel-recipient-add), and every recipient receives [Message Create](/gateway/events/#message-create).--No admission path records a guild audit entry.--### Rate limit--10 requests per 10 seconds for each authenticated user, on the `invite:accept` bucket, which is not partitioned by invite code.+The rate limit is 10 requests per 10 seconds, on the `invite:accept` bucket.## Visit invite guild<RouteHeader method="POST" path="/v1/invites/{invite_code}/visit" />-Starts a [visit](/http-api/guilds/#visiting-guilds) to the guild of an invite and returns the [guild visit start object](/http-api/guilds/#guild-visit-start-object). The caller reads the guild without joining it. A caller who is already a member receives `member: true` and no visit. Opening the same visit again returns it unchanged.--Visiting does not use up a limited invite. Joining later from the visit uses one. Deleting the invite, or its expiry, ends every visit it started. The caller's sessions with the `GUILD_VISITS` [session flag](/gateway/commands/#session-flags) receive [Guild Create](/gateway/events/#guild-create) with `visiting: true`.--### Limitations--- User-only, so a bot token is rejected with 403 `ACCESS_DENIED`.-- Needs the `guild_visits` [experiment assignment](/http-api/experiments/#guild-visits-assignment-object), otherwise the route returns 404 `UNKNOWN_INVITE`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| invite_code | string | The invite code (1 through 256 characters) |+Starts a [visit](/http-api/guilds/#visiting-guilds) to the guild of a guild invite and returns a [guild visit start object](/http-api/guilds/#guild-visit-start-object). Only user accounts can call it, and a user account without the `guild_visits` [experiment assignment](/http-api/experiments/#guild-visits-assignment-object) gets `UNKNOWN_INVITE`. A visit doesn't count as a use, and the visit ends when the invite is deleted or expires. Sessions with the `GUILD_VISITS` [session flag](/gateway/commands/#session-flags) get [Guild Create](/gateway/events/#guild-create) with `visiting: true`.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [guild visit start](/http-api/guilds/#guild-visit-start-object) object | Visit started, was already open, or the caller is a member |-| 403 | [error response](/http-api/#error-response) | The guild does not accept visitors and the request returns `GUILD_VISITS_DISABLED` |-| 403 | [error response](/http-api/#error-response) | The guild is for adults and the caller may not see adult content, returning `GUILD_VISIT_AGE_RESTRICTED` |-| 403 | [error response](/http-api/#error-response) | Invites are disabled for the guild and the request returns `INVITES_DISABLED` |-| 403 | [error response](/http-api/#error-response) | The caller is banned from the guild and the request returns `USER_BANNED_FROM_GUILD` or `USER_IP_BANNED_FROM_GUILD` |-| 403 | [error response](/http-api/#error-response) | The account is [limited](/http-api/users/#account-limitation) and the request returns `ACCOUNT_LIMITED` |-| 403 | [error response](/http-api/#error-response) | The caller has not given a date of birth and the request returns `DATE_OF_BIRTH_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | The caller is below the minimum age and the request returns `ACCOUNT_BELOW_MINIMUM_AGE` |-| 404 | [error response](/http-api/#error-response) | The code resolves to no guild invite, the invite is used up, or visits are off for the caller, returning `UNKNOWN_INVITE` |-| 404 | [error response](/http-api/#error-response) | The guild is unavailable and the request returns `UNKNOWN_GUILD` |--### Rate limit+| 200 | [guild visit start](/http-api/guilds/#guild-visit-start-object) object | The visit started or was already open, or the caller is a member |+| 403 | [error response](/http-api/#error-response) | `GUILD_VISITS_DISABLED` when the guild does not accept visitors |+| 403 | [error response](/http-api/#error-response) | `GUILD_VISIT_AGE_RESTRICTED` when the guild is for adults and the caller may not see it |+| 403 | [error response](/http-api/#error-response) | `INVITES_DISABLED` when the guild has paused invites |+| 403 | [error response](/http-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED` when `INSTANT_INVITES` is set in the guild's [disabled operations](/http-api/guilds/#disabled-guild-operations) |+| 403 | [error response](/http-api/#error-response) | `USER_BANNED_FROM_GUILD` or `USER_IP_BANNED_FROM_GUILD` when the caller is banned |+| 403 | [error response](/http-api/#error-response) | `ACCOUNT_LIMITED` when the account is [limited](/http-api/users/#account-limitation) |+| 403 | [error response](/http-api/#error-response) | `DATE_OF_BIRTH_REQUIRED` or `ACCOUNT_BELOW_MINIMUM_AGE` when the age check fails |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_INVITE` or `UNKNOWN_GUILD` when the invite or guild is unavailable |-10 requests per 60 seconds for each authenticated user, on the `guild:visit:start` bucket. Each address can also start 30 visits per 60 seconds.+The rate limit is 10 requests per 60 seconds, on the `guild:visit:start` bucket. Each IP address can also start 30 visits per 60 seconds.## Delete invite<RouteHeader method="DELETE" path="/v1/invites/{invite_code}" bot auditReason mfa />-Deletes an invite permanently and returns 204 with an empty body. Emits an [Invite Delete](/gateway/events/#invite-delete) Gateway event.--### Limitations--- A guild invite requires guild membership.-- The invite creator deletes it without holding [MANAGE_GUILD](/http-api/permissions/), and any other member needs that permission.-- A group direct message invite requires the caller to be a current recipient and the owner of the group.--`MANAGE_GUILD` is an [elevated permission](/http-api/permissions/#elevated-permissions), so a caller who is neither the guild owner nor enrolled in multi-factor authentication receives 400 [`TWO_FACTOR_REQUIRED`](/http-api/errors/) in a guild whose [MFA level](/http-api/guilds/#mfa-levels) is elevated.--:::note[Non-membership and missing permission return the same 403]-A non-member and a member without the permission both receive 403 `MISSING_PERMISSIONS`. A guild that no longer exists returns 404 `UNKNOWN_GUILD`.-:::--:::caution[Deletion is immediate and unrecoverable]-The invite code can be allocated again later, and every outstanding link with that code stops resolving immediately.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| invite_code | string | The invite code to delete (1 through 256 characters) |+Deletes an invite. For a guild invite, the creator can delete it and anyone else needs [MANAGE_GUILD](/http-api/permissions/). For a group direct message invite, you need to own the group. Sends [Invite Delete](/gateway/events/#invite-delete), and a guild invite also records an [INVITE_DELETE audit action](/http-api/guild-audit-logs/#audit-actions).### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Invite was deleted |-| 400 | [error response](/http-api/#error-response) | The caller is not the creator and the guild requires elevated multi-factor authentication that the caller lacks, and the request returns `TWO_FACTOR_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Caller presents a bearer credential and the request returns `ACCESS_DENIED`, or the caller is not a guild member, is neither the creator nor a [MANAGE_GUILD](/http-api/permissions/) holder, or does not own the group direct message, each returning `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | The named guild no longer exists and the request returns `UNKNOWN_GUILD` |-| 404 | [error response](/http-api/#error-response) | No record has the code, the record is the guild's current custom invite URL, or a guild invite names no target, each returning `UNKNOWN_INVITE` |-| 404 | [error response](/http-api/#error-response) | The group direct message no longer exists or the caller is not one of its recipients and the request returns `UNKNOWN_CHANNEL` |--### Side effects+| 204 | empty | The invite was deleted |+| 400 | [error response](/http-api/#error-response) | `TWO_FACTOR_REQUIRED` when the guild needs [multi-factor authentication](/http-api/guilds/#mfa-levels) you lack |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_INVITE` when the code is unknown or is the guild's custom invite URL |-A guild invite records an [INVITE_DELETE audit action](/http-api/guild-audit-logs/#audit-actions) targeting the invite code, with the channel, creator, maximum uses, lifetime, and temporary flag as metadata, the removed record as the change set, and the supplied reason. Fluxer logs a failure to write that entry and still completes the request. The `X-Audit-Log-Reason` header is read but never recorded for a group direct message invite.--Sessions holding `VIEW_AUDIT_LOG` receive [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create). [Invite Delete](/gateway/events/#invite-delete) has only `code`, `channel_id`, and `guild_id`. The guild delivers it to the sessions holding `MANAGE_CHANNELS` on the channel named by `channel_id`, as [event filtering](/gateway/event-filtering/) states. A passive session in a guild with more than 250 members is suppressed after that filter. A group direct message invite creates no audit entry and delivers Invite Delete to every current recipient's sessions, where no passive gate applies.--### Rate limit--20 requests per 10 seconds for each authenticated user and invite code, on the `invite:delete::invite_code` bucket.+The rate limit is 20 requests per 10 seconds, on the `invite:delete::invite_code` bucket.## Create channel invite<RouteHeader method="POST" path="/v1/channels/{channel_id}/invites" bot auditReason />-Creates an invite for a channel, or returns an existing equivalent invite. Returns an [invite metadata object](#invite-metadata-object) on success. Emits an [Invite Create](/gateway/events/#invite-create) Gateway event when a new record is created.--### Limitations--- A guild channel requires guild membership, [VIEW_CHANNEL](/http-api/permissions/), and [CREATE_INSTANT_INVITE](/http-api/permissions/) in that exact channel.-- An age-restricted guild channel also requires an age-verified account.-- A private channel requires the caller to be a current recipient, and no ownership is required.-- A [thread](/http-api/threads/), a [forum channel, or a media channel](/http-api/forums/) creates no invite. A caller who can view the channel receives 400 `INVALID_CHANNEL_TYPE`. A user request without the [`channel_threads` client capability](/http-api/threads/#client-capability) receives 404 `UNKNOWN_CHANNEL`. A caller who lacks `VIEW_CHANNEL` in the parent of a thread, or cannot view a private thread, receives 403 `MISSING_ACCESS`.--This operation does not require elevated multi-factor authentication.+Creates an invite for a channel and returns an [invite metadata object](#invite-metadata-object). A guild channel needs `VIEW_CHANNEL` and `CREATE_INSTANT_INVITE`, and a private channel needs you to be a recipient. Sends [Invite Create](/gateway/events/#invite-create) for a new invite, and a guild invite also records an [INVITE_CREATE audit action](/http-api/guild-audit-logs/#audit-actions).-:::note[Guild affiliation determines the invite type]-A channel that belongs to a guild creates a guild invite. Any other channel the caller can resolve creates a type `1` invite, including a direct message and the personal notes channel. Of these type `1` invites, only one whose channel is a group direct message admits an account through [Accept invite](#accept-invite).-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the guild channel or private channel |+A guild channel makes a guild invite, and a group direct message makes a group direct message invite.### JSON body| Field | Type | Description || --- | --- | --- |-| max_uses?<sup>1</sup> | ?integer | The maximum number of admissions (0-100, default 0, where 0 is unlimited) |-| max_age?<sup>1</sup> | ?integer | The lifetime in seconds (0-604800, default 0, where 0 never expires) |-| unique?<sup>2</sup> | ?boolean | Whether to create a new invite even when an equivalent one already exists (default false) |-| temporary?<sup>3</sup> | ?boolean | Whether admission grants temporary membership (default false) |--<sup>1</sup> A negative value, a `max_uses` above 100, or a `max_age` above 604,800 seconds is rejected with 400 `INVALID_FORM_BODY` on that field+| max_uses? | ?integer | The maximum number of joins (0-100, default 0 for unlimited) |+| max_age? | ?integer | The lifetime in seconds (0-604800, default 0 for never) |+| unique? | ?boolean | Whether to always make a new invite (default false)<sup>1</sup> |+| temporary? | ?boolean | Whether joining gives temporary membership (default false)<sup>2</sup> |-<sup>2</sup> When false or omitted the operation returns an existing invite whose creator, target channel, maximum uses, lifetime, and temporary flag all match the request exactly. A custom invite URL never matches+<sup>1</sup> When false, an existing invite with the same creator, channel, `max_uses`, `max_age` and `temporary` is returned-<sup>3</sup> Has no effect on a private channel invite+<sup>2</sup> Has no effect on a private channel### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [invite metadata](#invite-metadata-object) object | Invite was created, or an equivalent existing invite was returned |-| 400 | [error response](/http-api/#error-response) | The guild already holds its maximum number of invites and the request returns `MAX_INVITES` |-| 400 | [error response](/http-api/#error-response) | Channel is a thread, a forum channel, or a media channel the caller can view and the request returns `INVALID_CHANNEL_TYPE` |-| 403 | [error response](/http-api/#error-response) | Caller presents a bearer credential and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The guild is unavailable to the caller and the request returns `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` in the parent of a thread, or cannot view a private thread, each returning `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | Instant invites are temporarily disabled for the guild and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 403 | [error response](/http-api/#error-response) | The caller is not a guild member or lacks [VIEW_CHANNEL](/http-api/permissions/) or [CREATE_INSTANT_INVITE](/http-api/permissions/) and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The channel is age restricted and the account is not age verified and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist, is pending deletion, or the caller is not a recipient of the private channel, each returning `UNKNOWN_CHANNEL`, or the channel's guild no longer exists and the request returns `UNKNOWN_GUILD` |-| 404 | [error response](/http-api/#error-response) | Channel is a thread, a forum channel, or a media channel and the caller is neither a bot nor a user session that declares the `channel_threads` client capability, returning `UNKNOWN_CHANNEL` |+| 200 | [invite metadata](#invite-metadata-object) object | The invite was created or an existing one was returned |+| 400 | [error response](/http-api/#error-response) | `MAX_INVITES` when the guild has `max_guild_invites` invites (default 1,000), counting its custom invite URL |+| 400 | [error response](/http-api/#error-response) | `INVALID_CHANNEL_TYPE` when the channel is a thread, forum channel or media channel |+| 403 | [error response](/http-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED` when instant invites are paused for the guild |+| 403 | [error response](/http-api/#error-response) | `NSFW_CONTENT_AGE_RESTRICTED` when the guild or channel is age restricted and the age check fails |-### Side effects--Returning an existing equivalent invite changes nothing, records no audit entry, and emits no Dispatch.--Creating an invite allocates a random eight-character code drawn from the mixed-case alphanumeric alphabet. A guild invite records an [INVITE_CREATE audit action](/http-api/guild-audit-logs/#audit-actions) targeting the invite code, with the channel, creator, maximum uses, lifetime, and temporary flag as metadata and the supplied reason, then delivers [Guild Audit Log Entry Create](/gateway/events/#guild-audit-log-entry-create) to sessions holding `VIEW_AUDIT_LOG`. Fluxer logs a failure to write that entry and still completes the request. The `X-Audit-Log-Reason` header is read but never recorded for a private channel.--The guild delivers [Invite Create](/gateway/events/#invite-create) to sessions holding `MANAGE_CHANNELS` on the invite's channel, subject to [event filtering](/gateway/event-filtering/). A private channel invite records no audit entry and delivers the event to every current recipient's sessions.--The guild invite ceiling is its configured `max_guild_invites` limit, which defaults to 1,000. It includes invites across all channels and the custom invite URL.--### Rate limit--20 requests per minute for each authenticated user and channel ID, on the `invite:create::channel_id` bucket.+The rate limit is 20 requests per minute, on the `invite:create::channel_id` bucket.## List channel invites<RouteHeader method="GET" path="/v1/channels/{channel_id}/invites" bot mfa />-Returns the standard invites of one channel as an array of [invite metadata objects](#invite-metadata-object), ordered by descending creation time.--### Limitations--- A guild channel requires guild membership, [VIEW_CHANNEL](/http-api/permissions/) in that channel, and [MANAGE_CHANNELS](/http-api/permissions/) in the guild.-- An age-restricted guild channel also requires an age-verified account.-- A group direct message requires the caller to be a current recipient and its owner.--`MANAGE_CHANNELS` is an [elevated permission](/http-api/permissions/#elevated-permissions), so a caller who is neither the guild owner nor enrolled in multi-factor authentication receives 400 [`TWO_FACTOR_REQUIRED`](/http-api/errors/) in a guild whose [MFA level](/http-api/guilds/#mfa-levels) is elevated.--The operation is not paginated. Every matching record is returned in one response, bounded by the guild invite ceiling described by [Create channel invite](#create-channel-invite). The response excludes the custom invite URL record.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the guild channel or group direct message |+Returns the channel's [invite metadata objects](#invite-metadata-object), newest first, with no pagination. A guild channel needs `VIEW_CHANNEL` and `MANAGE_CHANNELS`, and a group direct message needs you to own it.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | array[[invite metadata](#invite-metadata-object) object] | Invites were returned, and the array is empty when the channel holds none |-| 400 | [error response](/http-api/#error-response) | The guild requires elevated multi-factor authentication that the caller lacks and the request returns `TWO_FACTOR_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Caller presents a bearer credential and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The guild is unavailable to the caller and the request returns `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The caller is not a guild member, lacks [VIEW_CHANNEL](/http-api/permissions/) or [MANAGE_CHANNELS](/http-api/permissions/), or does not own the group direct message and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The channel is age restricted and the account is not age verified and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist, is pending deletion, the caller is not a recipient of the private channel, or the private channel is not a group direct message, each returning `UNKNOWN_CHANNEL`, or the channel's guild no longer exists and the request returns `UNKNOWN_GUILD` |+| 200 | array[[invite metadata](#invite-metadata-object) object] | The invites were returned |+| 400 | [error response](/http-api/#error-response) | `TWO_FACTOR_REQUIRED` when the guild needs [multi-factor authentication](/http-api/guilds/#mfa-levels) you lack |+| 403 | [error response](/http-api/#error-response) | `NSFW_CONTENT_AGE_RESTRICTED` when the guild or channel is age restricted and the age check fails |-### Rate limit--40 requests per 10 seconds for each authenticated user and channel ID, on the `invite:list::channel_id` bucket.+The rate limit is 40 requests per 10 seconds, on the `invite:list::channel_id` bucket.## List guild invites<RouteHeader method="GET" path="/v1/guilds/{guild_id}/invites" bot mfa />-Returns the standard invites of one guild across all of its channels as an array of [invite metadata objects](#invite-metadata-object), ordered by descending creation time. Requires guild membership and [MANAGE_GUILD](/http-api/permissions/).--`MANAGE_GUILD` is an [elevated permission](/http-api/permissions/#elevated-permissions), so a caller who is neither the guild owner nor enrolled in multi-factor authentication receives 400 [`TWO_FACTOR_REQUIRED`](/http-api/errors/) in a guild whose [MFA level](/http-api/guilds/#mfa-levels) is elevated.--The operation is not paginated. Every matching record is returned in one response, bounded by the guild invite ceiling described by [Create channel invite](#create-channel-invite). The response excludes the custom invite URL record, so a client reads the current custom invite code through [Get guild custom invite URL](/http-api/guilds/#get-guild-custom-invite-url).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns the [invite metadata objects](#invite-metadata-object) for every channel in the guild, newest first, with no pagination. You need [MANAGE_GUILD](/http-api/permissions/).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | array[[invite metadata](#invite-metadata-object) object] | Invites were returned, and the array is empty when the guild holds none |-| 400 | [error response](/http-api/#error-response) | The guild requires elevated multi-factor authentication that the caller lacks and the request returns `TWO_FACTOR_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Caller presents a bearer credential and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The guild is unavailable to the caller and the request returns `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The caller is not a member of the guild or lacks [MANAGE_GUILD](/http-api/permissions/) and the request returns `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |--### Rate limit+| 200 | array[[invite metadata](#invite-metadata-object) object] | The invites were returned |+| 400 | [error response](/http-api/#error-response) | `TWO_FACTOR_REQUIRED` when the guild needs [multi-factor authentication](/http-api/guilds/#mfa-levels) you lack |-40 requests per 10 seconds for each authenticated user and guild ID, on the `invite:list::guild_id` bucket.+The rate limit is 40 requests per 10 seconds, on the `invite:list::guild_id` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/memes.mdx b/fluxer_docs/src/content/docs/http-api/memes.mdxindex a55d79b8b..50cc974bb 100644--- a/fluxer_docs/src/content/docs/http-api/memes.mdx+++ b/fluxer_docs/src/content/docs/http-api/memes.mdx@@ -1,30 +1,20 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Memes-description: Saved favourite media and batch GIF URL resolution.+description: Routes for saving, listing, changing and deleting your memes, and for looking up GIF URLs.---import RouteHeader from '@/components/RouteHeader.astro';-A meme is an image, video, or audio asset saved as a favourite. Fluxer stores a copy of the media with the meme. The copy remains available after the source URL or the source message is gone.+A meme is an image, video or audio file you save to your account. Fluxer keeps its own copy, so the meme still works after the source message or URL is gone. Bot tokens get 403 `ACCESS_DENIED` on these routes, and you send a saved meme with `favorite_meme_id` in [Create message](/http-api/messages/#create-message).-The routes here are user-only and operate on the caller's own collection. Fluxer rejects a bot token with 403 `ACCESS_DENIED`. [Create message](/http-api/messages/#create-message) sends a stored meme through its `favorite_meme_id` field, and the [GIF provider API](/http-api/gifs/) searches the configured provider for a GIF to save.+## Limits-## Collection limits--Fluxer caps a collection at the instance-configured `max_favorite_memes` [limit](/http-api/instance/#limit-keys), with a fallback of 50. Both creation operations check the count before they look up the channel or the message and before they fetch the source URL, so an account at its limit is refused with 400 `MAX_FAVORITE_MEMES` even when the rest of the request would have failed. The error body has `max_favorite_memes` reporting the ceiling reached.--A meme has at most `max_favorite_meme_tags` tags, with a fallback of 10. Fluxer rejects a longer list with 400 `INVALID_FORM_BODY` and the validation code `MAX_FAVORITE_MEME_TAGS_EXCEEDED` at the `tags` path.--Fluxer normalises and trims a tag before counting it, and the result must be 1 through 30 characters. A tag that normalises to the empty string fails with 400 `INVALID_FORM_BODY` and `STRING_LENGTH_INVALID`.--## Deduplication--A meme is identified by the content hash of its stored bytes. The same bytes reached through a different URL or a different message are still a duplicate. Saving an asset whose hash already exists in the account's collection returns 400 `INVALID_FORM_BODY` with the validation code `MEDIA_ALREADY_IN_FAVORITE_MEMES` at the `media` path. The existing meme is not returned and nothing is created.+You can save up to `max_favorite_memes` memes (default 50) with up to `max_favorite_meme_tags` tags each (default 10). See [instance limits](/http-api/instance/#limit-keys). Fluxer compares the stored bytes, so saving a file you already have returns `MEDIA_ALREADY_IN_FAVORITE_MEMES`, even from a different URL or message.## Meme object-One media asset owned by one account. Fluxer resolves every media field at creation, and only the name, alt text, and tags change afterwards.+A meme object is one saved file. You can change only `name`, `alt_text` and `tags` after you save it.### Structure@@ -32,39 +22,29 @@ One media asset owned by one account. Fluxer resolves every media field at creat| --- | --- | --- || id | snowflake | The ID of the meme || user_id | snowflake | The ID of the owning account |-| name<sup>1</sup> | string | The display name of the meme (1-100 characters) |-| alt_text<sup>2</sup> | ?string | The accessibility description of the media, or null when none is set |-| tags | array[string] | The search tags stored on the meme, each 1-30 characters |-| attachment_id<sup>3</sup> | snowflake | The ID of the attachment holding the durable Fluxer copy |+| name | string | The display name of the meme (1-100 characters) |+| alt_text | ?string | The accessibility description of the media |+| tags | array[string] | The search tags, each 1-30 characters |+| attachment_id | snowflake | The ID of the attachment holding the stored copy || filename | string | The filename of the stored copy || content_type | string | The MIME type of the stored copy |-| content_hash | ?string | The content hash used for [deduplication](#deduplication), or null when it is unavailable |-| size | integer | The stored size of the copy in bytes |-| width | ?integer | The width of the media in pixels, or null when not applicable or unknown |-| height | ?integer | The height of the media in pixels, or null when not applicable or unknown |-| duration | ?number | The duration of the media in seconds, or null when not applicable or unknown |-| url<sup>3</sup> | string | The Fluxer attachment URL of the stored copy |-| is_gifv<sup>4</sup> | boolean | Whether the stored media is animated or a video converted from a GIF |-| gif_slug<sup>5</sup> | ?string | The provider-issued slug this meme was sourced from, or null |-| gif_provider<sup>5</sup> | ?string | The name of the GIF provider that issued `gif_slug`, or null |-| media<sup>6</sup> | ?map[string, [GIF media format](#gif-media-format-object) object] | The provider format map for a GIF-sourced meme, or null |-| placeholder | ?string | The compact thumbhash placeholder recorded at save time, or null |--<sup>1</sup> Required by [Save meme from message](#save-meme-from-message). [Save meme from URL](#save-meme-from-url) derives it from `filename`, truncated to 100 characters, when it is omitted or null--<sup>2</sup> [Save meme from message](#save-meme-from-message) falls back to the selected attachment's own description when the body supplies no non-empty alt text--<sup>3</sup> `url` is the media endpoint followed by `attachments/{user_id}/{attachment_id}/{filename}`, and Fluxer signs it on every read as a [signed attachment URL](/http-api/messages/#signed-attachment-urls)+| content_hash | ?string | The content hash used for [duplicate checks](#limits) |+| size | integer | The size of the copy in bytes |+| width | ?integer | The width of the media in pixels |+| height | ?integer | The height of the media in pixels |+| duration | ?number | The duration of the media in seconds |+| url<sup>1</sup> | string | The signed attachment URL of the stored copy |+| is_gifv | boolean | Whether the media is animated or a video converted from a GIF |+| gif_slug<sup>2</sup> | ?string | The provider slug the meme came from |+| gif_provider<sup>2</sup> | ?string | The name of the GIF provider that issued `gif_slug` |+| media<sup>3</sup> | ?map[string, [GIF media format](#gif-media-format-object) object] | The provider formats for a GIF-sourced meme |+| placeholder | ?string | The thumbhash placeholder recorded at save time |-<sup>4</sup> Set when the source attachment or embed was already animated, and when the Media Proxy reports the stored copy as animated+<sup>1</sup> A new [signed attachment URL](/http-api/messages/#signed-attachment-urls) on every read-<sup>5</sup> Both fields are null together. `klipy` is the only value a new meme records, and `tenor` appears on legacy records alone+<sup>2</sup> Both are set or both are null. The value is `klipy` or `tenor`-<sup>6</sup> Keyed by [GIF media format name](#gif-media-format-names). Stored only by [Save meme from URL](#save-meme-from-url), and null on every message-sourced meme--A message-sourced meme records a slug only when the selected embed is a `gifv` embed whose URL the configured provider recognises. An attachment selection never records one.--The creation time is the timestamp embedded in `id`, as defined by [Snowflakes](/snowflakes/).+<sup>3</sup> Set only by [Save meme from URL](#save-meme-from-url)### Example@@ -79,8 +59,11 @@ The creation time is the timestamp embedded in `id`, as defined by [Snowflakes]("filename": "party_parrot.gif","content_type": "image/gif","size": 40213,+ "url": "https://media.example.com/attachments/1501314428688998183/party_parrot.gif?ex=6a1b2c3d&sig=4f9e2a",+ "content_hash": "b3f1c2e4a5d6978812ab34cd56ef7890","width": 320,"height": 240,+ "duration": null,"is_gifv": true,"gif_slug": "party-parrot-1234","gif_provider": "klipy",@@ -90,7 +73,7 @@ The creation time is the timestamp embedded in `id`, as defined by [Snowflakes](## GIF media format object-One descriptor describes one encoding of one provider GIF. A provider returns several for the same GIF so a client can pick the smallest encoding it can decode.+A GIF media format object is one size and file type of a provider GIF.### Structure@@ -98,12 +81,8 @@ One descriptor describes one encoding of one provider GIF. A provider returns se| --- | --- | --- || src | string | The direct media URL of this format || proxy_src | string | The [Media Proxy](/media-proxy/overview/) URL of this format |-| width<sup>1</sup> | integer | The width of this format in pixels |-| height<sup>1</sup> | integer | The height of this format in pixels |--<sup>1</sup> A non-negative value of at most 2147483647. A descriptor with an empty `src` or `proxy_src`, or a zero dimension, is skipped when Fluxer picks the [preview format](#resolved-gif-entry-object) for Resolve GIF URLs--A client submitting a format map to [Save meme from URL](#save-meme-from-url) supplies all members of every descriptor, and a descriptor missing one fails validation with 400 `INVALID_FORM_BODY`.+| width | integer | The width in pixels |+| height | integer | The height in pixels |## GIF media format names@@ -127,11 +106,11 @@ A client submitting a format map to [Save meme from URL](#save-meme-from-url) su| nanogif | Smallest GIF image || loopedmp4 | Looping MP4 video |-A map contains only the formats the provider returned, so no key is guaranteed to be present. A client walks a priority list until it finds a key the map has. A client that cannot decode the video keys SHOULD prefer `tinywebp`, `tinygif`, `mediumwebp`, `mediumgif`, `webp`, `gif`, `nanowebp`, and `nanogif`, in that order.+A map has only the formats the provider returned. Use the first format from your own order of preference that the map has.## Resolved GIF entry object-One entry describes one URL submitted to [Resolve GIF URLs](#resolve-gif-urls).+One entry for one URL submitted to [Resolve GIF URLs](#resolve-gif-urls).### Structure@@ -141,46 +120,37 @@ One entry describes one URL submitted to [Resolve GIF URLs](#resolve-gif-urls).| proxy_url | string | The signed [Media Proxy](/media-proxy/overview/) URL for the preview format || width<sup>2</sup> | integer | The width of the preview format in pixels || height<sup>2</sup> | integer | The height of the preview format in pixels |-| media<sup>3</sup> | map[string, [GIF media format](#gif-media-format-object) object] | The formats available for the URL, keyed by [GIF media format name](#gif-media-format-names) |-| content_type<sup>4</sup> | string | The MIME type of the media addressed by `proxy_url` |-| placeholder | ?string | The compact thumbhash placeholder, or null when the Media Proxy emitted none |+| media<sup>3</sup> | map[string, [GIF media format](#gif-media-format-object) object] | The formats for the URL, keyed by [format name](#gif-media-format-names) |+| content_type<sup>4</sup> | string | The MIME type of the media at `proxy_url` |+| placeholder | ?string | The thumbhash placeholder |-<sup>1</sup> The provider's own canonical URL when the submitted URL resolved through the configured GIF provider, and the submitted URL otherwise+<sup>1</sup> The provider's canonical URL when the provider recognizes the URL, and the submitted URL otherwise-<sup>2</sup> Zero when the dimensions could not be determined+<sup>2</sup> Zero when unknown-<sup>3</sup> Empty when the URL belongs to no registered GIF provider and no single direct format could be derived from it+<sup>3</sup> Empty when Fluxer can't find the GIF-<sup>4</sup> The empty string means the type is unknown, and a client treats that as `image/gif`--A direct format is derived only for `video/webm`, `video/mp4`, `image/webp`, and `image/gif`, and only when both dimensions are positive.--The preview format is the first usable descriptor in the order `tinywebm`, `tinymp4`, `mediumwebm`, `mediummp4`, `webm`, `mp4`, `loopedmp4`, `nanowebm`, `nanomp4`, `tinywebp`, `tinygif`, `mediumwebp`, `webp`, `mediumgif`, `gif`, `nanowebp`, `nanogif`. When no key in that list is usable, Fluxer takes the first usable descriptor in map order. When the map holds nothing usable, it takes the provider's own top-level media.+<sup>4</sup> Empty when unknown. Treat an empty value as `image/gif`## List memes<RouteHeader method="GET" path="/v1/users/@me/memes" />-Returns every [meme object](#meme-object) the current account owns, in descending meme ID order, so the most recently saved comes first.--The account's [collection limit](#collection-limits) bounds how many entries the array holds.+Returns your memes, newest first.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | array[[meme](#meme-object) object] | Collection was returned, possibly as an empty array |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |--### Rate limit+| 200 | array[[meme](#meme-object) object] | The collection was returned |-60 requests per 10 seconds for each authenticated user, on the `favorite_meme:list` bucket.+The rate limit is 60 requests per 10 seconds, on the `favorite_meme:list` bucket.## Save meme from URL<RouteHeader method="POST" path="/v1/users/@me/memes" />-Fetches an absolute media URL, stores a durable Fluxer copy, and returns the created [meme object](#meme-object). Emits a [Favorite Meme Create](/gateway/events/#favorite-meme-create) Gateway event.+Fetches a media URL, stores a copy and returns the new meme. Sends [Favorite Meme Create](/gateway/events/#favorite-meme-create).### JSON body@@ -189,238 +159,138 @@ Fetches an absolute media URL, stores a durable Fluxer copy, and returns the cre| url | string | The absolute media URL to fetch and store || name?<sup>1</sup> | ?string | The display name of the meme (1-100 characters) || alt_text? | ?string | The accessibility description of the media (0-500 characters) |-| tags?<sup>2</sup> | ?array[string] | The search tags to store, each 1-30 characters |-| gif_slug?<sup>3</sup> | ?string | The provider-issued slug or slug-id token for the GIF (1-300 characters) |-| gif_provider?<sup>3</sup> | ?string | The stable name of the provider that issued `gif_slug` (1-32 characters) |-| media?<sup>4</sup> | ?map[string, [GIF media format](#gif-media-format-object) object] | The provider format map captured by the client at save time |--<sup>1</sup> When omitted or null, the name is the stored `filename` truncated to 100 characters--<sup>2</sup> An omitted or null value is an empty tag list--<sup>3</sup> Fluxer uses the supplied pair only when both are present and `gif_provider` names the configured provider. Otherwise Fluxer extracts a slug from `url` with the configured provider+| tags? | ?array[string] | The search tags to store, each 1-30 characters |+| gif_slug?<sup>2</sup> | ?string | The provider slug or slug-id token for the GIF (1-300 characters) |+| gif_provider?<sup>2</sup> | ?string | The name of the provider that issued `gif_slug` (1-32 characters) |+| media?<sup>3</sup> | ?map[string, [GIF media format](#gif-media-format-object) object] | The provider formats captured at save time |-<sup>4</sup> Stored only when the request resolved to a provider GIF and the map is non-empty, and discarded otherwise+<sup>1</sup> Defaults to the stored `filename`, truncated to 100 characters-The filename is derived from the URL and media type. Use the returned `filename` rather than constructing one.+<sup>2</sup> Used only when both are set and `gif_provider` matches the provider configured on the instance. Otherwise Fluxer reads the slug from `url`-A URL that resolves to no usable media fails with 400 `MEDIA_METADATA_ERROR`. Saving media already in the collection fails as described under [Deduplication](#deduplication).+<sup>3</sup> Stored only when the URL resolved to a provider GIF and the map is not empty### Response| Status | Body | Condition || --- | --- | --- |-| 201 | [meme](#meme-object) object | Meme was created |-| 400 | [error response](/http-api/#error-response) | Body fails validation with `INVALID_FORM_BODY`<sup>5</sup> |-| 400 | [error response](/http-api/#error-response) | The URL resolves to no usable media with `MEDIA_METADATA_ERROR` |-| 400 | [error response](/http-api/#error-response) | The collection is at its limit with `MAX_FAVORITE_MEMES` |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |--<sup>5</sup> Including `MAX_FAVORITE_MEME_TAGS_EXCEEDED` at the `tags` path and `MEDIA_ALREADY_IN_FAVORITE_MEMES` at the `media` path+| 201 | [meme](#meme-object) object | The meme was created |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` when the body is invalid, as with `MAX_FAVORITE_MEME_TAGS_EXCEEDED` or `MEDIA_ALREADY_IN_FAVORITE_MEMES` |+| 400 | [error response](/http-api/#error-response) | `MEDIA_METADATA_ERROR` when the URL has no usable media |+| 400 | [error response](/http-api/#error-response) | `MAX_FAVORITE_MEMES` when the collection is full |-### Side effects--The operation emits one [Favorite Meme Create](/gateway/events/#favorite-meme-create) with the created object to the caller's own sessions.--### Rate limit--20 requests per minute for each authenticated user, on the `favorite_meme:create:url` bucket.+The rate limit is 20 requests per minute, on the `favorite_meme:create:url` bucket.## Save meme from message<RouteHeader method="POST" path="/v1/channels/{channel_id}/messages/{message_id}/memes" />-Copies one attachment or one embed asset from a readable message into the caller's own collection and returns the created [meme object](#meme-object). Requires [VIEW_CHANNEL](/http-api/permissions/) in a guild channel. Emits a [Favorite Meme Create](/gateway/events/#favorite-meme-create) Gateway event.--A message in a thread follows [Channel resolution](/http-api/messages/#channel-resolution).--A guild caller without [READ_MESSAGE_HISTORY](/http-api/permissions/) can select media only from a message on or after the guild's [message history cutoff](/http-api/messages/). Attachments and embeds in the message's forwarded snapshots are selectable alongside its own.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel containing the message |-| message_id | snowflake | The ID of the message containing the selected media |+Copies one attachment or embed asset from a message you can read into your collection and returns the new meme. You need [VIEW_CHANNEL](/http-api/permissions/) in a guild channel. Sends [Favorite Meme Create](/gateway/events/#favorite-meme-create).### JSON body| Field | Type | Description || --- | --- | --- || name | string | The display name of the meme (1-100 characters) |-| attachment_id?<sup>1</sup> | ?snowflake | The ID of an attachment in the message or one of its snapshots |-| embed_index?<sup>1</sup> <sup>2</sup> | ?integer | The zero-based index of an embed in the message or one of its snapshots |-| alt_text?<sup>3</sup> | ?string | The accessibility description of the media (0-500 characters) |+| attachment_id?<sup>1</sup> | ?snowflake | The ID of an attachment in the message or one of its forwarded snapshots |+| embed_index?<sup>1</sup> | ?integer | The zero-based index of an embed in the message or one of its snapshots |+| alt_text?<sup>2</sup> | ?string | The accessibility description of the media (0-500 characters) || tags? | ?array[string] | The search tags to store, each 1-30 characters |-<sup>1</sup> At least one of the keys must be present, and a body with neither fails validation. Both may be present as null, which selects nothing explicitly--<sup>2</sup> `embed_index` takes precedence when both have a value, and an index outside the combined embed list fails with `EMBED_INDEX_OUT_OF_BOUNDS`--<sup>3</sup> Taken from the selected attachment's own description whenever the supplied value is omitted, null, empty, or whitespace only--When neither key selects anything, Fluxer takes the message's first attachment. It takes the first usable embed when the message has no attachment, or when that attachment has no supported media type. An embed selection has no alt text of its own.+<sup>1</sup> Send at least one of these keys. If both are null, Fluxer takes the first attachment, then the first usable embed. From an embed, Fluxer uses its image, then its video, then its thumbnail-Only an `image/*`, `video/*`, or `audio/*` asset can be saved. `attachment_id` is matched only when the message or one of its snapshots has at least one attachment. An ID matching none of them fails with `ATTACHMENT_ID_NOT_FOUND_IN_MESSAGE` at the `attachment_id` path. When the message has no attachment at all, Fluxer ignores the ID and takes the first usable embed. Only the selected attachment is tried, so a message whose chosen attachment has an unsupported type falls through to its embeds. A selection that resolves to no supported media fails with `NO_VALID_MEDIA_IN_MESSAGE` at the `media` path.--An embed selection uses its image, video, or thumbnail, in that order. Media whose metadata cannot be resolved fails with 400 `MEDIA_METADATA_ERROR`.+<sup>2</sup> Defaults to the selected attachment's own description when omitted, null or blank### Response| Status | Body | Condition || --- | --- | --- |-| 201 | [meme](#meme-object) object | Meme was created |-| 400 | [error response](/http-api/#error-response) | Body or selection fails validation with `INVALID_FORM_BODY`<sup>4</sup> |-| 400 | [error response](/http-api/#error-response) | External media metadata cannot be resolved with `MEDIA_METADATA_ERROR` |-| 400 | [error response](/http-api/#error-response) | The collection is at its limit with `MAX_FAVORITE_MEMES` |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The caller is not a member of the guild or lacks `VIEW_CHANNEL` and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The caller cannot view the thread that holds the message and the request returns `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The channel requires age verification the account has not completed and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel is unavailable or the caller is not a recipient of it with `UNKNOWN_CHANNEL` |-| 404 | [error response](/http-api/#error-response) | The message is unavailable or unreadable with `UNKNOWN_MESSAGE` |--<sup>4</sup> The validation code is `ATTACHMENT_ID_NOT_FOUND_IN_MESSAGE`, `EMBED_INDEX_OUT_OF_BOUNDS`, `NO_VALID_MEDIA_IN_MESSAGE`, `MEDIA_ALREADY_IN_FAVORITE_MEMES`, or `MAX_FAVORITE_MEME_TAGS_EXCEEDED`--:::note[Missing message history reads as an unknown message]-A guild caller that can view the channel but lacks `READ_MESSAGE_HISTORY` receives 404 `UNKNOWN_MESSAGE` for a message before the guild's history cutoff, and for every message when the guild has no cutoff. This matches [Get message](/http-api/messages/#get-message).-:::--### Side effects--The meme gets its own copy of the selected asset. Reading the source message renews its attachment decay deadline when attachment decay is enabled. The source message is otherwise unchanged.--The operation emits one [Favorite Meme Create](/gateway/events/#favorite-meme-create) with the created object to the caller's own sessions.+| 201 | [meme](#meme-object) object | The meme was created |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY`<sup>3</sup> when the body or selection fails validation |+| 400 | [error response](/http-api/#error-response) | `MEDIA_METADATA_ERROR` when the media cannot be read |+| 400 | [error response](/http-api/#error-response) | `MAX_FAVORITE_MEMES` when the collection is full |+| 403 | [error response](/http-api/#error-response) | `MISSING_PERMISSIONS`, `MISSING_ACCESS` or `NSFW_CONTENT_AGE_RESTRICTED` when you can't view the channel or aren't verified |-### Rate limit+<sup>3</sup> The validation code is `ATTACHMENT_ID_NOT_FOUND_IN_MESSAGE`, `EMBED_INDEX_OUT_OF_BOUNDS`, `NO_VALID_MEDIA_IN_MESSAGE`, `MEDIA_ALREADY_IN_FAVORITE_MEMES` or `MAX_FAVORITE_MEME_TAGS_EXCEEDED`-10 requests per minute for each authenticated user, on the `favorite_meme:create:message` bucket.+The rate limit is 10 requests per minute, on the `favorite_meme:create:message` bucket.## Get meme<RouteHeader method="GET" path="/v1/users/@me/memes/{meme_id}" />-Returns one [meme object](#meme-object) owned by the current account.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| meme_id | snowflake | The ID of the meme |+Returns one of your memes.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [meme](#meme-object) object | Meme was returned |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |-| 404 | [error response](/http-api/#error-response) | Meme is unknown or belongs to another account with `UNKNOWN_FAVORITE_MEME` |+| 200 | [meme](#meme-object) object | The meme was returned |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_FAVORITE_MEME` when you own no meme with that ID |-### Rate limit--100 requests per 10 seconds for each authenticated user, on the `favorite_meme:get` bucket.+The rate limit is 100 requests per 10 seconds, on the `favorite_meme:get` bucket.## Modify meme<RouteHeader method="PATCH" path="/v1/users/@me/memes/{meme_id}" />-Changes the name, alt text, or tags of one meme owned by the current account and returns the updated [meme object](#meme-object). Emits a [Favorite Meme Update](/gateway/events/#favorite-meme-update) Gateway event.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| meme_id | snowflake | The ID of the meme |+Changes the name, alt text or tags of one of your memes and returns it. Sends [Favorite Meme Update](/gateway/events/#favorite-meme-update).### JSON body| Field | Type | Description || --- | --- | --- || name? | string | The replacement display name (1-100 characters) |-| alt_text?<sup>1</sup> | ?string | The replacement accessibility description (0-500 characters), or null to clear it |+| alt_text?<sup>1</sup> | ?string | The replacement accessibility description (0-500 characters) || tags?<sup>2</sup> | ?array[string] | The replacement tags, each 1-30 characters |-<sup>1</sup> An omitted field leaves the stored value unchanged, and an explicit null clears it+<sup>1</sup> Null clears it, and an omitted field stays unchanged-<sup>2</sup> An omitted or null value leaves the stored tags unchanged+<sup>2</sup> Omit it or send null to keep the current tags-:::caution[Supplying `tags` overwrites the complete tag list]-An empty array clears every tag. Omit the field, or send null, to leave the stored tags untouched.+:::caution[Sending `tags` replaces the whole list]+An empty array removes every tag.:::-Fluxer checks the tag allowance against the resulting list, so a request omitting `tags` re-checks the tags already stored. A meme that exceeds a since-lowered allowance therefore fails with 400 `INVALID_FORM_BODY` and `MAX_FAVORITE_MEME_TAGS_EXCEEDED` until the caller supplies a shorter list.-### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [meme](#meme-object) object | Meme was updated |-| 400 | [error response](/http-api/#error-response) | Path, name, alt text, or tag length fails validation with `INVALID_FORM_BODY`<sup>3</sup> |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |-| 404 | [error response](/http-api/#error-response) | Meme is unknown or belongs to another account with `UNKNOWN_FAVORITE_MEME` |--<sup>3</sup> Including `MAX_FAVORITE_MEME_TAGS_EXCEEDED` at the `tags` path--### Side effects+| 200 | [meme](#meme-object) object | The meme was updated |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY`, including `MAX_FAVORITE_MEME_TAGS_EXCEEDED` at `tags` |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_FAVORITE_MEME` when you own no meme with that ID |-The operation changes the supplied fields and leaves every omitted field unchanged. It emits one [Favorite Meme Update](/gateway/events/#favorite-meme-update) with the updated object to the caller's own sessions.--### Rate limit--30 requests per 10 seconds for each authenticated user, on the `favorite_meme:update` bucket.+The rate limit is 30 requests per 10 seconds, on the `favorite_meme:update` bucket.## Delete meme<RouteHeader method="DELETE" path="/v1/users/@me/memes/{meme_id}" />-Deletes one meme owned by the current account and returns 204 with an empty body. Emits a [Favorite Meme Delete](/gateway/events/#favorite-meme-delete) Gateway event.--An unknown meme, or one owned by another account, is a successful no-op.+Deletes one of your memes and returns 204, also when the meme doesn't exist. Fluxer sends [Favorite Meme Delete](/gateway/events/#favorite-meme-delete) only when it deleted one.-### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| meme_id | snowflake | The ID of the meme |--:::danger[Deleting a meme destroys its stored copy]-Every meme owns its stored bytes, so deletion removes them permanently. The meme cannot be restored, and saving the same source again creates a new meme with a new ID and a new attachment ID.+:::caution[Deleting a meme also deletes Fluxer's copy of the file]+You can't restore it.:::### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Meme was deleted, or no owned meme existed |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |--### Side effects--The meme is removed from the collection even if its stored copy cannot be deleted.+| 204 | empty | The meme was deleted, or none existed |-It emits one [Favorite Meme Delete](/gateway/events/#favorite-meme-delete) with `meme_id` to the caller's own sessions. A request naming a meme the account does not own emits nothing.--### Rate limit--30 requests per 10 seconds for each authenticated user, on the `favorite_meme:delete` bucket.+The rate limit is 30 requests per 10 seconds, on the `favorite_meme:delete` bucket.## Resolve GIF URLs<RouteHeader method="POST" path="/v1/users/@me/favorite-gifs/resolve" />-Resolves a batch of GIF URLs into [resolved GIF entry objects](#resolved-gif-entry-object) with signed [Media Proxy](/media-proxy/overview/) URLs and preview metadata.--A client uses it to turn stored URL-only favourite GIFs into renderable picker entries without saving anything.+Looks up GIF URLs and returns a [resolved GIF entry](#resolved-gif-entry-object) for each one without saving anything. A URL Fluxer can't find still gets an entry, with an empty `media` map.### Request headers| Field | Type | Description || --- | --- | --- |-| Accept-Language?<sup>1</sup> | string | The preferred locale used for a GIF provider lookup |--<sup>1</sup> Fluxer uses the account's stored locale when it has one. Otherwise it matches this header against the [supported locale registry](/topics/locales/#supported-locales), and it falls back to `en-US`--Fluxer derives a two-letter country from the requesting address by geolocation, with `US` as the fallback.+| Accept-Language? | string | The preferred locale for the GIF provider lookup |### JSON body@@ -432,19 +302,12 @@ Fluxer derives a two-letter country from the requesting address by geolocation,| Field | Type | Description || --- | --- | --- |-| entries<sup>1</sup> | array[[resolved GIF entry](#resolved-gif-entry-object) object] | One entry for each submitted URL |--<sup>1</sup> Exactly one entry per submitted URL, in the submitted order, so a client may index the result by position against its request--An unresolved URL still returns an entry with its signed proxy URL and an empty `media` map. Unavailable dimensions are zero and an unknown `content_type` is the empty string. One URL's failure does not fail the batch.+| entries | array[[resolved GIF entry](#resolved-gif-entry-object) object] | One entry for each submitted URL, in the same order |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | One entry was returned for each URL, including URLs that did not resolve |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |--### Rate limit+| 200 | response body | An entry was returned for each URL |-30 requests per minute for each authenticated user, on the `favorite_gif:resolve` bucket.+The rate limit is 30 requests per minute, on the `favorite_gif:resolve` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/messages.mdx b/fluxer_docs/src/content/docs/http-api/messages.mdxindex 176373b0a..c3b8ca79c 100644--- a/fluxer_docs/src/content/docs/http-api/messages.mdx+++ b/fluxer_docs/src/content/docs/http-api/messages.mdx@@ -1,24 +1,20 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Messages-description: Message objects, attachments, history, acknowledgements, pins, reactions, and typing.+description: Message objects and the routes for messages, attachments, pins, reactions, typing and acknowledgements.---import RouteHeader from '@/components/RouteHeader.astro';-A message is one post in a channel, together with the text, attachments, embeds, stickers, and reactions stored with it. Channel metadata and membership are defined by the [Channels resource](/http-api/channels/).+A message is one post in a [channel](/http-api/channels/), with its text, attachments, embeds, stickers and reactions. Categories, link channels, forum channels and media channels don't have messages of their own.-A text-bearing channel is a [channel type](/http-api/channels/#channel-types) that stores messages, which is every type except a guild category, a guild link channel, a forum channel, and a media channel. A thread is text-bearing. The message history cutoff is a time stored on the guild, and a member without [READ_MESSAGE_HISTORY](/http-api/permissions/) reads nothing created before it.+## Access and history-## Channel resolution+A private channel returns 404 `UNKNOWN_CHANNEL` when you're not a recipient. A guild channel needs [VIEW_CHANNEL](/http-api/permissions/), and in a thread you also need access to the parent and to a private thread, as [Thread permissions](/http-api/threads/#thread-permissions) describes.-Fluxer resolves the channel before it applies any per-route authorisation. A private channel returns 404 `UNKNOWN_CHANNEL` to a caller who is not a recipient. A guild channel returns 403 `MISSING_PERMISSIONS` to a non-member and to a member without [VIEW_CHANNEL](/http-api/permissions/). A thread returns 403 `MISSING_ACCESS` to a member who lacks `VIEW_CHANNEL` in its parent or cannot view a private thread. A guild an operator has marked unavailable returns 403 `MISSING_ACCESS` before the route runs. A guild that no Gateway process serves returns 404 `UNKNOWN_GUILD`, or 403 `ACCESS_DENIED` when its stored record survives.+In a guild channel without [READ_MESSAGE_HISTORY](/http-api/permissions/), you only see messages created after the guild's message history cutoff, and nothing when the guild has no cutoff. In an age-restricted channel, the routes that read, send, edit or delete messages return 403 `NSFW_CONTENT_AGE_RESTRICTED` until the account passes the age check.-[Thread permissions](/http-api/threads/#thread-permissions) and [Thread lifecycle](/http-api/threads/#thread-lifecycle) state the permission, lock, and archive rules of every operation on this page in a thread. In a thread, each Gateway event an operation on this page emits reaches the sessions that [Dispatch events](/gateway/threads/#dispatch-events) lists.--The message read, create, modify, and delete routes, [Bulk delete messages](#bulk-delete-messages), [Bulk delete own messages](#bulk-delete-own-messages), and [List pinned messages](#list-pinned-messages) also enforce age verification on an age restricted guild channel. A guild channel is age restricted when its own setting says so. A channel with no setting of its own uses its parent category's setting, and then the guild's. They return 403 `NSFW_CONTENT_AGE_RESTRICTED` until the account satisfies it. The attachment routes, the pin routes, the reaction routes, and [Indicate typing](#indicate-typing) resolve the channel without that check.--[Clear channel read state](#clear-channel-read-state) resolves no channel. [Acknowledge message](#acknowledge-message) checks no channel access. For a user session that declares the [`channel_threads` client capability](/http-api/threads/#client-capability) it reads the channel type to set the [read state flags](/http-api/read-states/#read-state-flags). [Acknowledge pins](#acknowledge-pins) reads the channel without checking the caller's access, except for a thread. Clear channel read state and Acknowledge message check no permission. Acknowledge pins checks none outside a thread.+Routes that need `MANAGE_MESSAGES` also follow the guild's [MFA level](/http-api/guilds/#mfa-levels) for [elevated permissions](/http-api/permissions/#elevated-permissions).## Message object@@ -28,56 +24,38 @@ The message read, create, modify, and delete routes, [Bulk delete messages](#bul| --- | --- | --- || id | snowflake | The ID of the message || channel_id | snowflake | The ID of the channel |-| author<sup>1</sup> | [partial user](/http-api/users/#partial-user-object) object | The user credited with the message |-| webhook_id? | snowflake | Originating webhook ID, present only for a webhook-authored message |+| author<sup>1</sup> | [partial user](/http-api/users/#partial-user-object) object | The user who sent the message |+| webhook_id? | snowflake | The ID of the webhook that sent the message || type | integer | [Message type](#message-types) || flags | integer | [Message flags](#message-flags) |-| content | string | The text of the message, empty when the message has only media |-| timestamp | ISO8601 timestamp | Creation time derived from the message [snowflake](/snowflakes/) |-| edited_timestamp | ?ISO8601 timestamp | Most recent edit time, or null when the message has never been edited |+| content | string | The text of the message, empty when it only has media |+| timestamp | ISO8601 timestamp | When the message was created |+| edited_timestamp | ?ISO8601 timestamp | When the message was last edited || pinned | boolean | Whether the message is pinned || mention_everyone | boolean | Whether the message mentions everyone |-| tts<sup>2</sup> | boolean | Whether the message requested text-to-speech |-| mentions<sup>3</sup> | array[[partial user](/http-api/users/#partial-user-object) object] | The users the message actively mentions |-| mention_roles | array[snowflake] | The IDs of the roles the message actively mentions |-| mention_channels? | array[[channel mention](#channel-mention-object) object] | The channels the message content links by ID |-| users?<sup>3</sup> | array[[partial user](/http-api/users/#partial-user-object) object] | Users referenced by non-notifying content, embed, and snapshot text |-| embeds<sup>4</sup> | array[[embed](#embed-object) object] | The previews resolved or supplied for the message |-| attachments<sup>5</sup> | array[[message attachment](#message-attachment-object) object] | The files attached to the message |+| tts | boolean | Whether the create request asked for text-to-speech |+| mentions | array[[partial user](/http-api/users/#partial-user-object) object] | The users the message mentions |+| mention_roles | array[snowflake] | The IDs of the roles the message mentions |+| mention_channels? | array[[channel mention](#channel-mention-object) object] | The channels the content links to |+| users?<sup>2</sup> | array[[partial user](/http-api/users/#partial-user-object) object] | Users referred to in the message who weren't mentioned |+| embeds | array[[embed](#embed-object) object] | The embeds, empty while `SUPPRESS_EMBEDS` is set |+| attachments | array[[message attachment](#message-attachment-object) object] | The files attached to the message || stickers | array[[sticker item](#sticker-item-object) object] | The stickers sent with the message |-| reactions? | array[[reaction](#reaction-object) object] | Reaction summaries |-| message_reference? | [message reference](#message-reference-object) object | Reply, forward, or published message reference |-| message_snapshots? | array[[message snapshot](#message-snapshot-object) object] | The immutable copies captured for a forward |-| nonce?<sup>6</sup> | string | Caller-supplied message nonce, echoed to the sender as a string of 1 through 32 characters |-| call? | [message call](#message-call-object) object | Call state attached to a call message |-| referenced_message?<sup>7</sup> | ?[message](#message-object) object | Resolved referenced message without a nested `referenced_message` field |-| thread?<sup>8</sup> | [thread](/http-api/threads/#thread-object) object | The thread started from this message |--<sup>1</sup> Built for a webhook-authored message and for a stored author ID that no longer resolves--<sup>2</sup> Echoed from the create request, so a message read through any other operation always reports false--<sup>3</sup> A user who became an active mention appears in `mentions`, and a user who is only referenced by rendered text appears in `users` instead, so the arrays never contain the same user--<sup>4</sup> Empty while `SUPPRESS_EMBEDS` is set on the message--<sup>5</sup> An attachment that a [rich embed input](#rich-embed-input-objects) names with an `attachment://` URL in `image` or `thumbnail` is excluded from this array. The attachment's URL is in that embed's media object instead--<sup>6</sup> Echoed only in the create message response and its originating [Message Create](/gateway/events/#message-create) Gateway Dispatch, and never stored on the message+| reactions? | array[[reaction](#reaction-object) object] | The reactions on the message |+| message_reference? | [message reference](#message-reference-object) object | The message this one replies to, forwards or copies |+| message_snapshots? | array[[message snapshot](#message-snapshot-object) object] | Copies of a forwarded message |+| nonce?<sup>3</sup> | string | The nonce from the create request |+| call? | [message call](#message-call-object) object | The call a `CALL` message records |+| referenced_message?<sup>4</sup> | ?[message](#message-object) object | The message a reply points to |+| thread? | [thread](/http-api/threads/#thread-object) object | The thread started from this message |-<sup>7</sup> The key is absent when the message has no reply reference, present and null when the reply target no longer resolves, and present with the message when it does. It is always absent on a copy of a [published message](#crosspost-message). A client must tell absent apart from null by key presence+<sup>1</sup> For a webhook message, Fluxer builds the author from the webhook, with `bot` set to true-<sup>8</sup> Present only on a message with `HAS_THREAD` whose thread still exists+<sup>2</sup> A user is in `mentions` or in `users`, never both. Resolve the IDs in a snapshot's `mentions` against this array-A `THREAD_STARTER_MESSAGE` also has `referenced_message`. It is the message the thread started from, or null once that message is deleted, as [Thread messages](/http-api/threads/#thread-messages) describes.+<sup>3</sup> Only in the create response and its [Message Create](/gateway/events/#message-create) event-A webhook-authored message has no stored author user. Fluxer builds its author from the webhook, with the webhook ID as `id`, the stored webhook name as `username`, the discriminator `0000`, the stored webhook avatar hash as `avatar`, and `bot` true. A message whose stored author ID no longer resolves to an account is served with a deleted-user placeholder. The placeholder has that ID, the discriminator `0000`, and no avatar.--`mentions`, `mention_roles`, `embeds`, `attachments`, and `stickers` are always present and can be empty. A field marked `?` above is omitted from the object when it has no value. `referenced_message` is the one optional field that can also be present and null. A message whose author user and webhook are both absent is omitted from every read.--:::note[A forward has immutable copies in `message_snapshots`]-A reply reference resolves into `referenced_message`, and a forward has none. Fluxer captures the snapshots at forward time, and they never follow later edits to the source. [Message reference types](#message-reference-types) tells the two apart.-:::+<sup>4</sup> Absent when the message isn't a reply, and null when the message it replies to is gone### Example@@ -111,51 +89,35 @@ A reply reference resolves into `referenced_message`, and a forward has none. Fl| Value | Name | Description || --- | --- | --- |-| 0 | DEFAULT<sup>1</sup> <sup>2</sup> | Ordinary message |-| 1 | RECIPIENT_ADD | Recipient-add system message of a group direct message or a thread |-| 2 | RECIPIENT_REMOVE | Recipient-remove system message of a group direct message or a thread |-| 3 | CALL | Private call system message |-| 4 | CHANNEL_NAME_CHANGE | Name-change system message of a group direct message or a thread |-| 5 | CHANNEL_ICON_CHANGE | Group direct message icon-change system message |-| 6 | CHANNEL_PINNED_MESSAGE<sup>2</sup> | Channel pin system message |-| 7 | USER_JOIN<sup>2</sup> | User-join system message |-| 12 | CHANNEL_FOLLOW_ADD<sup>2</sup> <sup>3</sup> | System message posted when a channel starts following an announcement channel |-| 18 | THREAD_CREATED<sup>2</sup> <sup>4</sup> | System message in the parent that announces a new public or announcement thread |-| 19 | REPLY<sup>1</sup> <sup>2</sup> | Message with a reply reference |-| 21 | THREAD_STARTER_MESSAGE<sup>4</sup> | First message of a thread started from a message, built on read and never stored |--<sup>1</sup> Only `DEFAULT` and `REPLY` can be modified, pinned, unpinned, or used as the target of a reply reference. Any other stored type rejects modification, pinning, and unpinning with 400 `CANNOT_MODIFY_SYSTEM_WEBHOOK`, and rejects being replied to with the field code `CANNOT_REPLY_TO_SYSTEM_MESSAGE`--<sup>2</sup> Only `DEFAULT`, `CHANNEL_PINNED_MESSAGE`, `USER_JOIN`, `CHANNEL_FOLLOW_ADD`, `THREAD_CREATED`, and `REPLY` can be deleted, and any other stored type rejects deletion with 403 `MISSING_PERMISSIONS`--<sup>3</sup> Its `content` is the name of the new [channel follower webhook](/http-api/webhooks/#webhook-types). Its `message_reference` names the followed announcement channel and its guild, has `type` `0`, and has no `message_id`. It never sends a push notification--<sup>4</sup> [Thread messages](/http-api/threads/#thread-messages) describes this type--A caller other than a bot or a user session that declares the [`channel_threads` client capability](/http-api/threads/#client-capability) never receives a `THREAD_CREATED` message or a `thread` field. That caller receives a thread flag only from a token-authenticated [webhook](/http-api/webhooks/) operation, which returns the stored flags.+| 0 | DEFAULT | Ordinary message |+| 1 | RECIPIENT_ADD | Someone was added to a group DM or thread |+| 2 | RECIPIENT_REMOVE | Someone was removed from a group DM or thread |+| 3 | CALL | A call in a private channel |+| 4 | CHANNEL_NAME_CHANGE | A group DM or thread was renamed |+| 5 | CHANNEL_ICON_CHANGE | A group DM icon was changed |+| 6 | CHANNEL_PINNED_MESSAGE | A message was pinned |+| 7 | USER_JOIN | A member joined |+| 12 | CHANNEL_FOLLOW_ADD | The channel started following an announcement channel |+| 18 | THREAD_CREATED | A thread was created from the channel |+| 19 | REPLY | A reply to another message |+| 21 | THREAD_STARTER_MESSAGE | The first message of a thread started from a message |++You can only edit, pin or reply to `DEFAULT` and `REPLY` messages. [Thread messages](/http-api/threads/#thread-messages) describes the thread types.## Message flags| Value | Name | Description || --- | --- | --- |-| 1 << 0 | CROSSPOSTED<sup>3</sup> | Message was published to the channels that follow its announcement channel |-| 1 << 1 | IS_CROSSPOST<sup>3</sup> | Message is a copy delivered from a followed announcement channel |-| 1 << 2 | SUPPRESS_EMBEDS<sup>1</sup> | Suppress rendering of embeds |-| 1 << 3 | SOURCE_MESSAGE_DELETED<sup>3</sup> | The published message this copy came from was deleted |-| 1 << 5 | HAS_THREAD<sup>4</sup> | A thread was started from this message |-| 1 << 8 | FAILED_TO_MENTION_SOME_ROLES_IN_THREAD<sup>4</sup> | Some members of a mentioned role were not added to the thread |-| 1 << 12 | SUPPRESS_NOTIFICATIONS | Do not generate ordinary mention notifications |-| 1 << 13 | VOICE_MESSAGE<sup>2</sup> | Message has one voice recording attachment |--<sup>1</sup> The only flag a guild moderator can change on a message they did not author--<sup>2</sup> A message with this flag has the voice message restrictions listed under [Create message](#create-message)--<sup>3</sup> Set by the server. [Announcement channels](/topics/announcement-channels/) describes when each is set+| 1 << 0 | CROSSPOSTED | The message was published to following channels |+| 1 << 1 | IS_CROSSPOST | The message is a copy from a followed announcement channel |+| 1 << 2 | SUPPRESS_EMBEDS | Embeds are hidden |+| 1 << 3 | SOURCE_MESSAGE_DELETED | The published message this copy came from was deleted |+| 1 << 5 | HAS_THREAD | A thread was started from this message |+| 1 << 8 | FAILED_TO_MENTION_SOME_ROLES_IN_THREAD | Some members of a mentioned role weren't added to the thread |+| 1 << 12 | SUPPRESS_NOTIFICATIONS | The message sends no mention notifications |+| 1 << 13 | VOICE_MESSAGE | The message is a voice message |-<sup>4</sup> Set by the server. [Thread messages](/http-api/threads/#thread-messages) describes when each is set--`SUPPRESS_EMBEDS`, `SUPPRESS_NOTIFICATIONS`, and `VOICE_MESSAGE` are the complete sendable set. A create masks the supplied value down to them, and a modify replaces only them and leaves every other stored bit untouched. Any other bit in the request is discarded, and the request still succeeds.+You can set `SUPPRESS_EMBEDS`, `SUPPRESS_NOTIFICATIONS` and `VOICE_MESSAGE`. Fluxer ignores any other bit you send and sets the rest itself.## Message attachment object@@ -164,66 +126,40 @@ A caller other than a bot or a user session that declares the [`channel_threads`| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the attachment |-| filename | string | The filename stored with the attachment |-| title | ?string | Display title, or null when none is stored |-| description | ?string | Alternative text or description, or null when none is stored |-| content_type<sup>1</sup> | string | The media type detected for the attachment |-| content_hash | ?string | The hash of the attachment's stored bytes, or null when they were never hashed |-| size | integer | The stored size of the attachment in bytes |-| url<sup>2</sup> | ?string | Signed public attachment URL, or null once the attachment has expired |-| proxy_url<sup>2</sup> | ?string | Signed Media Proxy URL, or null once the attachment has expired |-| width?<sup>3</sup> | integer | Pixel width for visual media |-| height?<sup>3</sup> | integer | Pixel height for visual media |-| placeholder? | string | Encoded media placeholder |+| filename | string | The filename |+| title | ?string | The display title |+| description | ?string | The alt text |+| content_type | string | The media type Fluxer detected |+| content_hash | ?string | The hash of the file |+| size | integer | The size in bytes |+| url | ?string | The [signed](#signed-attachment-urls) URL, or null once the attachment has expired |+| proxy_url | ?string | The same URL as `url` |+| width? | integer | The width in pixels |+| height? | integer | The height in pixels |+| placeholder? | string | An encoded placeholder image || flags | integer | [Attachment flags](#attachment-flags) |-| nsfw? | boolean | Whether media inspection marked the attachment explicit |-| duration? | integer | Audio or video duration in seconds |-| waveform? | string | Base64-encoded voice waveform |-| expires_at<sup>4</sup> | ?ISO8601 timestamp | Attachment URL expiry time, or null when the attachment has no recorded decay deadline |-| expired?<sup>5</sup> | boolean | Whether the attachment is expired |--<sup>1</sup> Always present. It falls back to a type guessed from the stored filename when the attachment has no recorded media type, and to `application/octet-stream` when the filename yields no guess--<sup>2</sup> Both fields are the same media endpoint URL with the same [signature](#signed-attachment-urls), and both become null together once the attachment has expired--<sup>3</sup> Omitted for an audio media type even when a stored dimension exists--<sup>4</sup> The key is always present. Its value is the recorded decay deadline, or null when the attachment has none. It is unrelated to the `ex` time of a signed URL--<sup>5</sup> Present and true only when the attachment has already expired, so an absent key must be read as false--A new attachment starts with the media type derived from the filename given when its upload was requested. For a pre-uploaded attachment that is the `filename` of its [attachment upload request item](#attachment-upload-request-item-object), which can differ from the `filename` the message sends. When the starting type is not a supported image, video, or audio type, Fluxer checks the first 8 KiB of the file for one. For an image, video, or audio file the Media Proxy can read, `content_type` is then the type detected from its bytes. When the starting type is not a media type, SVG bytes keep it. So does a file Fluxer cannot check or the Media Proxy cannot read.+| nsfw? | boolean | Whether media inspection marked the file as explicit |+| duration? | integer | The audio or video length in seconds |+| waveform? | string | The base64 voice waveform |+| expires_at | ?ISO8601 timestamp | When the attachment expires, or null if it doesn't |+| expired? | boolean | Present and true once the attachment has expired |### Signed attachment URLs-An instance configured with attachment URL secrets signs `url` and `proxy_url`. Fluxer adds the signature parameters to the attachment path, before any other parameter. An instance without those secrets returns the URL with none of them.+When the instance has attachment URL secrets, Fluxer adds these query parameters to `url` and `proxy_url`.| Field | Type | Description || --- | --- | --- |-| ex | string | The Unix time in seconds at which the URL expires, as 8 lowercase hexadecimal digits, or `0` on a data package URL |-| is | string | The Unix time in seconds at which the URL was issued, as 8 lowercase hexadecimal digits |-| hm | string | The signature over `ex`, `is`, `uc`, and the attachment path, as 64 lowercase hexadecimal digits |-| uc | string | Present only on a data package URL, where the value is always `dp` |--An ordinary URL has `ex`, `is`, and `hm`, and no `uc`. It is valid for 24 hours from `is`. `is` starts at the attachment's creation time and moves forward in steps of 12 hours, so a URL Fluxer returns has more than 12 and at most 24 hours left. Fluxer signs the URL each time it returns the attachment, so a later read of the message returns a URL for the current step. [Refresh attachment URLs](#refresh-attachment-urls) signs a URL again without reading the message.+| ex | string | When the URL expires, as Unix seconds in 8 hex digits |+| is | string | When the URL was issued, as Unix seconds in 8 hex digits |+| hm | string | The signature, as 64 hex digits |+| uc | string | `dp` on a data package URL, absent otherwise |-A client MUST keep `ex`, `is`, `hm`, and `uc` exactly as issued. It MAY add any other query parameter, such as a [transformation](/media-proxy/transformations/), because the signature covers no other parameter. A client SHOULD refresh a URL whose `ex` is absent or less than one hour away. Once the operator enforces signatures, a read with a missing, altered, or expired signature returns 404 from the Media Proxy, as [Signed attachment URLs](/media-proxy/overview/#signed-attachment-urls) defines.--Fluxer never rewrites message `content` or embed text. An attachment URL pasted into either keeps the parameters it was sent with, and it stops working when its own `ex` passes.+A URL is valid for 24 hours from `is`. Keep the four parameters as they are, and add others such as a [transformation](/media-proxy/transformations/) if you need them. When `ex` is less than an hour away, get a new URL from [Refresh attachment URLs](#refresh-attachment-urls) or fetch the message again. An expired or changed URL returns 404 from the [Media Proxy](/media-proxy/overview/#signed-attachment-urls).### Data package attachment URLs-A [data harvest](/http-api/users/data-harvest/) archive records a data package URL for each attachment instead of an ordinary one. It has `uc=dp`, and its `ex` is the single character `0`:--```text-?ex=0&is={issued}&hm={signature}&uc=dp-```--A data package URL does not expire. The Media Proxy checks its signature against every configured secret and skips the expiry check, so it reads its object for as long as the secret that signed it stays in the instance's secret list. Removing that secret is the only thing that ends it, and it ends every data package URL that secret signed at once.--`is` is set the way it is on an ordinary URL, and the signature covers `uc`, so an ordinary URL relabelled `uc=dp` does not verify, and neither does a data package URL with `uc` removed.--A client treats a data package URL as never expiring and does not refresh it before use. A refused read still triggers the same forced refresh as any other attachment URL, and that returns an ordinary URL.+A [data harvest](/http-api/users/data-harvest/) archive links each attachment with `uc=dp` and `ex=0`. These URLs don't expire and work until the instance removes the secret that signed them.### Example@@ -249,9 +185,9 @@ A client treats a data package URL as never expiring and does not refresh it bef| Value | Name | Description || --- | --- | --- |-| 1 << 3 | IS_SPOILER | Attachment is presented as a spoiler |-| 1 << 4 | CONTAINS_EXPLICIT_MEDIA | Attachment contains explicit media |-| 1 << 5 | IS_ANIMATED | Attachment is animated |+| 1 << 3 | IS_SPOILER | The attachment is a spoiler |+| 1 << 4 | CONTAINS_EXPLICIT_MEDIA | The attachment has explicit media |+| 1 << 5 | IS_ANIMATED | The attachment is animated |## Emoji object@@ -259,11 +195,9 @@ A client treats a data package URL as never expiring and does not refresh it bef| Field | Type | Description || --- | --- | --- |-| id? | snowflake | The ID of the custom emoji, absent for a Unicode emoji |-| name<sup>1</sup> | string | Emoji name or Unicode value |-| animated? | boolean | Whether a custom emoji is animated |--<sup>1</sup> Holds the guild emoji name for a custom emoji and the literal Unicode sequence for a standard emoji+| id? | snowflake | The ID of a custom emoji |+| name | string | The custom emoji name, or the Unicode emoji itself |+| animated? | boolean | Whether the custom emoji is animated |## Reaction object@@ -271,29 +205,11 @@ A client treats a data package URL as never expiring and does not refresh it bef| Field | Type | Description || --- | --- | --- |-| emoji | [emoji](#emoji-object) object | The emoji this group counts |-| count<sup>1</sup> | integer | The number of users who added this emoji |-| me?<sup>2</sup> | boolean | Whether the authenticated user has this reaction |+| emoji | [emoji](#emoji-object) object | The emoji |+| count | integer | How many users reacted with it |+| me? | boolean | Present and true when you reacted with it |-<sup>1</sup> Capped by the resolved `max_users_per_message_reaction` limit, which defaults to 1,000,000 users for each group--<sup>2</sup> Present and `true` only when the authenticated user has this reaction, and omitted entirely otherwise, so an absent key must be read as false--Each message has at most the resolved `max_reactions_per_message` distinct groups, which defaults to 30. Groups are ordered by the time each group's earliest reaction was added, then by emoji name, then by emoji ID.--### Example--```json-{- "emoji": {- "id": "1501314428688991234",- "name": "party_parrot",- "animated": true- },- "count": 7,- "me": true-}-```+A message can have up to `max_reactions_per_message` different emoji (default 30), and each up to `max_users_per_message_reaction` users (default 1,000,000).## Message reference object@@ -302,22 +218,16 @@ Each message has at most the resolved `max_reactions_per_message` distinct group| Field | Type | Description || --- | --- | --- || channel_id | snowflake | The ID of the referenced channel |-| message_id?<sup>1</sup> | snowflake | The ID of the referenced message |-| guild_id? | snowflake | The ID of the referenced guild, present only for a guild message |+| message_id? | snowflake | The ID of the referenced message |+| guild_id? | snowflake | The ID of the referenced guild || type | integer | [Message reference type](#message-reference-types) |## Message reference types| Value | Name | Description || --- | --- | --- |-| 0 | DEFAULT<sup>1</sup> <sup>3</sup> | Reply reference, the source of a published copy, or a thread reference |-| 1 | FORWARD<sup>2</sup> | Forward reference represented by snapshots |--<sup>1</sup> The default when a create message request supplies `message_reference` without a `type`--<sup>2</sup> Requires `channel_id` in the create message request, and the created message has `message_snapshots` and no `referenced_message`--<sup>3</sup> On a message with the `IS_CROSSPOST` [flag](#message-flags), the reference names the published message in the announcement channel. The copy is not a reply and never has `referenced_message`+| 0 | DEFAULT | A reply, a published copy's source or a thread |+| 1 | FORWARD | A forward, with the content in `message_snapshots` |## Message reference input object@@ -325,42 +235,34 @@ Each message has at most the resolved `max_reactions_per_message` distinct group| Field | Type | Description || --- | --- | --- |-| message_id | snowflake | The ID of the referenced message |-| channel_id?<sup>1</sup> | snowflake | The ID of the referenced channel, required for a forward reference |-| guild_id? | snowflake | The ID of the referenced guild when applicable |-| type? | integer | [Message reference type](#message-reference-types), defaulting to `DEFAULT` |-| attachment_ids?<sup>2</sup> | array[snowflake] | At most 10 selected attachment IDs for a forward |-| embed_indices?<sup>2</sup> | array[integer] | At most 10 non-negative selected embed indices for a forward |+| message_id | snowflake | The ID of the message to reply to or forward |+| channel_id? | snowflake | The ID of its channel, required for a forward |+| guild_id? | snowflake | The ID of its guild |+| type? | integer | [Message reference type](#message-reference-types) (default `DEFAULT`) |+| attachment_ids? | array[snowflake] | The attachments to forward (at most 10) |+| embed_indices? | array[integer] | The embeds to forward (at most 10) |-<sup>1</sup> A `FORWARD` reference without it fails validation, and a reply reference defaults to the channel the new message is being sent to--<sup>2</sup> Selects a subset of the source message's media to snapshot, and omitting both snapshots everything the source message has+A forward copies all the source's media unless you pick some with `attachment_ids` or `embed_indices`.## Message snapshot object-Each snapshot is a flat immutable copy of one forwarded message. It has no message ID, channel ID, or author, so a client cannot trace a forward back to its source through this object.+A snapshot is a copy of a forwarded message. It doesn't change when the source is edited or deleted.### Structure| Field | Type | Description || --- | --- | --- |-| content? | string | Snapshotted text |-| timestamp | ISO8601 timestamp | Original creation time |-| edited_timestamp? | ISO8601 timestamp | Original edit time, omitted when the original message was never edited |-| mentions?<sup>1</sup> | array[snowflake] | Snapshotted mentioned user IDs |-| mention_roles? | array[snowflake] | Snapshotted mentioned role IDs |-| mention_channels? | array[[channel mention](#channel-mention-object) object] | Snapshotted mentioned channels |-| embeds? | array[[embed](#embed-object) object] | Snapshotted embeds |-| attachments?<sup>2</sup> | array[[message attachment](#message-attachment-object) object] | Snapshotted attachments |-| stickers? | array[[sticker item](#sticker-item-object) object] | Snapshotted stickers |-| type | integer | Original [message type](#message-types) |-| flags | integer | Original [message flags](#message-flags) |--<sup>1</sup> A client resolves each snapshotted ID against the parent message's `users` array--<sup>2</sup> Snapshot attachments are independent stored objects, so deleting the source message leaves them intact--Every optional field above is omitted entirely.+| content? | string | The text |+| timestamp | ISO8601 timestamp | When the source was created |+| edited_timestamp? | ISO8601 timestamp | When the source was last edited |+| mentions? | array[snowflake] | The IDs of mentioned users |+| mention_roles? | array[snowflake] | The IDs of mentioned roles |+| mention_channels? | array[[channel mention](#channel-mention-object) object] | The mentioned channels |+| embeds? | array[[embed](#embed-object) object] | The embeds |+| attachments? | array[[message attachment](#message-attachment-object) object] | The attachments |+| stickers? | array[[sticker item](#sticker-item-object) object] | The stickers |+| type | integer | The source's [message type](#message-types) |+| flags | integer | The source's [message flags](#message-flags) |## Message call object@@ -368,8 +270,8 @@ Every optional field above is omitted entirely.| Field | Type | Description || --- | --- | --- |-| participants | array[snowflake] | Current participant user IDs |-| ended_timestamp | ?ISO8601 timestamp | Call end time, or null while the call is still active |+| participants | array[snowflake] | The IDs of the users in the call |+| ended_timestamp | ?ISO8601 timestamp | When the call ended, or null while it's ongoing |## Channel mention object@@ -377,8 +279,8 @@ Every optional field above is omitted entirely.| Field | Type | Description || --- | --- | --- |-| id | snowflake | The ID of the mentioned channel |-| name | string | Mentioned channel name |+| id | snowflake | The ID of the channel |+| name | string | The channel name || type | integer | [Channel type](/http-api/channels/#channel-types) |## Sticker item object@@ -388,40 +290,38 @@ Every optional field above is omitted entirely.| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the sticker |-| name | string | Sticker name |+| name | string | The sticker name || animated | boolean | Whether the sticker is animated |## Embed object-An embed is a rendered preview on a message, either resolved by the unfurler or supplied as rich input.+An embed is a link preview Fluxer builds, or a rich embed you send.### Structure| Field | Type | Description || --- | --- | --- || type | string | [Embed type](#embed-types) |-| title? | string | Embed title |-| description? | string | Embed description |-| url? | string | Embed destination URL |-| timestamp? | ISO8601 timestamp | Embed timestamp |-| color? | integer | Embed colour |-| author? | [embed author](#embed-author-object) object | Embed author |-| provider?<sup>1</sup> | [embed provider](#embed-provider-object) object | External provider |-| thumbnail? | [embed media](#embed-media-object) object | Thumbnail image |-| image? | [embed media](#embed-media-object) object | Main image |-| video?<sup>1</sup> | [embed media](#embed-media-object) object | Video media |-| audio?<sup>1</sup> | [embed media](#embed-media-object) object | Audio media |-| footer? | [embed footer](#embed-footer-object) object | Embed footer |-| fields? | array[[embed field](#embed-field-object) object] | Embed fields |-| nsfw? | boolean | Whether the embed contains explicit media |-| html?<sup>1</sup> | string | Sanitised oEmbed markup for a trusted specialised renderer |-| html_width?<sup>1</sup> | integer | Preferred pixel width of the sanitised oEmbed markup |-| html_height?<sup>1</sup> | integer | Preferred pixel height of the sanitised oEmbed markup |-| children?<sup>1</sup> | array[[embed](#embed-object) object] | At most one nested unfurler-generated embed, which itself has no `children` field |--<sup>1</sup> Produced only by the unfurler when it resolves a link, and never accepted from a [rich embed input](#rich-embed-input-objects)--Every optional field above is omitted entirely.+| title? | string | The title |+| description? | string | The description |+| url? | string | The link |+| timestamp? | ISO8601 timestamp | The timestamp |+| color? | integer | The color |+| author? | [embed author](#embed-author-object) object | The author |+| provider?<sup>1</sup> | [embed provider](#embed-provider-object) object | The site the link is from |+| thumbnail? | [embed media](#embed-media-object) object | The thumbnail |+| image? | [embed media](#embed-media-object) object | The main image |+| video?<sup>1</sup> | [embed media](#embed-media-object) object | The video |+| audio?<sup>1</sup> | [embed media](#embed-media-object) object | The audio |+| footer? | [embed footer](#embed-footer-object) object | The footer |+| fields? | array[[embed field](#embed-field-object) object] | The fields |+| nsfw? | boolean | Whether the embed has explicit media |+| html?<sup>1</sup> | string | Sanitized oEmbed markup |+| html_width?<sup>1</sup> | integer | The width of the oEmbed markup in pixels |+| html_height?<sup>1</sup> | integer | The height of the oEmbed markup in pixels |+| children?<sup>1</sup> | array[[embed](#embed-object) object] | At most one nested embed |++<sup>1</sup> Only on link previews, and you can't send it### Example@@ -440,13 +340,13 @@ Every optional field above is omitted entirely.| Value | Description || --- | --- |-| rich | An embed the unfurler built itself, and the type of every accepted rich embed input |-| link | A generic link preview with page metadata and no resolved media |-| image | An image preview resolved from a linked URL |-| video | A video preview resolved from a linked URL |-| audio | An audio preview resolved from a linked URL |-| gifv | An animated looping video preview |-| article | An article or encyclopaedia page preview |+| rich | A rich embed, and the type of every embed you send |+| link | A link preview with no media |+| image | An image preview |+| video | A video preview |+| audio | An audio preview |+| gifv | A looping video preview |+| article | An article preview || bluesky | A Bluesky post preview |## Embed author object@@ -455,10 +355,10 @@ Every optional field above is omitted entirely.| Field | Type | Description || --- | --- | --- |-| name | string | Author name |-| url? | string | Author link |-| icon_url? | string | Author icon URL |-| proxy_icon_url? | string | Proxied author icon URL |+| name | string | The author name |+| url? | string | The author link |+| icon_url? | string | The icon URL |+| proxy_icon_url? | string | The icon URL through the Media Proxy |## Embed media object@@ -466,22 +366,18 @@ Every optional field above is omitted entirely.| Field | Type | Description || --- | --- | --- |-| url | string | Media URL |-| proxy_url<sup>1</sup> | string | Media Proxy URL |-| width? | integer | Pixel width |-| height? | integer | Pixel height |-| duration? | integer | Duration in seconds |-| description? | string | Media description |-| content_type? | string | Media type |-| content_hash? | string | Content hash |-| placeholder? | string | Encoded media placeholder |-| flags? | integer | Media flags using `CONTAINS_EXPLICIT_MEDIA` and `IS_ANIMATED` from [attachment flags](#attachment-flags) |--<sup>1</sup> Always derived from `url`, so every serialised media object has it+| url | string | The media URL |+| proxy_url | string | The media URL through the Media Proxy |+| width? | integer | The width in pixels |+| height? | integer | The height in pixels |+| duration? | integer | The length in seconds |+| description? | string | The alt text |+| content_type? | string | The media type |+| content_hash? | string | The content hash |+| placeholder? | string | An encoded placeholder image |+| flags? | integer | `CONTAINS_EXPLICIT_MEDIA` and `IS_ANIMATED` from [attachment flags](#attachment-flags) |-When `url` is an attachment URL of this instance, Fluxer signs both fields, so `url` and `proxy_url` are the same URL with the same fresh [signature](#signed-attachment-urls). A rich embed can name such a URL with or without `ex`, `is`, `hm`, and `uc`. Fluxer removes them before it stores the URL, and signs both fields again each time it returns the embed.--Fluxer signs every other embed field that can hold an attachment URL of this instance the same way. That is `url` on the embed itself, `url`, `icon_url`, and `proxy_icon_url` on an [embed author](#embed-author-object), `icon_url` and `proxy_icon_url` on an [embed footer](#embed-footer-object), and `url` on an [embed provider](#embed-provider-object). An icon URL and its proxy twin are then the same signed URL. A field whose URL is not an attachment URL of this instance is returned as it was stored, and a proxy field of an external URL is the [signed external media](/media-proxy/routes/#get-signed-external-media) path instead.+Fluxer signs every embed URL that points to an attachment on this instance, the same way as [attachment URLs](#signed-attachment-urls).## Embed footer object@@ -489,9 +385,9 @@ Fluxer signs every other embed field that can hold an attachment URL of this ins| Field | Type | Description || --- | --- | --- |-| text | string | Footer text |-| icon_url? | string | Footer icon URL |-| proxy_icon_url? | string | Proxied footer icon URL |+| text | string | The footer text |+| icon_url? | string | The icon URL |+| proxy_icon_url? | string | The icon URL through the Media Proxy |## Embed field object@@ -499,9 +395,9 @@ Fluxer signs every other embed field that can hold an attachment URL of this ins| Field | Type | Description || --- | --- | --- |-| name | string | Field name |-| value | string | Field value |-| inline | boolean | Whether the field can render inline |+| name | string | The field name |+| value | string | The field value |+| inline | boolean | Whether the field shows inline |## Embed provider object@@ -509,43 +405,39 @@ Fluxer signs every other embed field that can hold an attachment URL of this ins| Field | Type | Description || --- | --- | --- |-| name | string | Provider name |-| url? | string | Provider URL |+| name | string | The provider name |+| url? | string | The provider URL |## Allowed mentions object-An allowed mentions object selects which mentions written in the message text become active mentions, meaning the ones that notify a user or role.+An allowed mentions object picks which mentions in the text notify anyone.### Structure| Field | Type | Description || --- | --- | --- |-| parse?<sup>1</sup> <sup>2</sup> | array[string] | Mention categories from [allowed mention parse values](#allowed-mention-parse-values) |-| users?<sup>2</sup> | array[snowflake] | At most 100 user IDs permitted to become active mentions |-| roles?<sup>2</sup> | array[snowflake] | At most 100 role IDs permitted to become active mentions |-| replied_user?<sup>3</sup> | boolean | Whether a reply mentions the referenced message author (default true) |--<sup>1</sup> Defaults to every category when the object is absent, to the empty set when `users` or `roles` is supplied without it, and to the empty set when the object is present with none of its fields+| parse?<sup>1</sup> | array[string] | [Allowed mention parse values](#allowed-mention-parse-values) |+| users? | array[snowflake] | The users who can be mentioned (at most 100) |+| roles? | array[snowflake] | The roles that can be mentioned (at most 100) |+| replied_user? | boolean | Whether a reply mentions the author of the message it replies to (default true) |-<sup>2</sup> A non-empty `parse` combined with a non-empty `users` or `roles` is rejected with the field code `PARSE_AND_USERS_OR_ROLES_CANNOT_BE_USED_TOGETHER`+<sup>1</sup> Leaving out the whole object allows every value. Sending `users` or `roles` without `parse` allows none of them. You can't send `parse` together with `users` or `roles`-<sup>3</sup> Ignored in a one-to-one direct message and in personal notes, and ignored when the referenced message has the same author as the new message--:::caution[An empty object suppresses every mention]-Sending `allowed_mentions` as `{}` resolves to an empty parse set, so no user mention, role mention, `@everyone`, or `@here` becomes active. Omitting the object does the opposite.+:::caution+Sending `allowed_mentions` as `{}` turns off every mention, including `@everyone` and `@here`.:::## Allowed mention parse values| Value | Description || --- | --- |-| users | Parse user mentions |-| roles | Parse role mentions |-| everyone | Parse `@everyone` and `@here` mentions |+| users | User mentions |+| roles | Role mentions |+| everyone | `@everyone` and `@here` |## Message attachment input objects-A new message can refer to a previously uploaded attachment or attach a direct multipart file. An edited message can retain an existing attachment. Attachment IDs in a direct multipart request identify the matching zero-based `files[N]` field.+Each entry in a message's `attachments` array is one of these.### Pre-uploaded attachment object@@ -553,24 +445,18 @@ A new message can refer to a previously uploaded attachment or attach a direct m| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | integer \| integer string | Attachment position |-| filename | string | Attachment filename |-| upload_filename<sup>2</sup> | string | Opaque upload key returned by [Request attachment upload URLs](#request-attachment-upload-urls) |-| file_size<sup>1</sup> | integer | Uploaded byte count |-| content_type | string | Media type of 1 through 255 characters |-| title? | ?string | Display title (1-1,024 characters) |-| description? | ?string | Description (1-4,096 characters) |-| duration?<sup>3</sup> | ?integer | Voice media duration in seconds (0-2,147,483,647) |-| waveform?<sup>3</sup> | ?string | Base64 waveform of 1 through 4,096 characters |-| flags? | integer | [Attachment flags](#attachment-flags), defaulting to `0` |--<sup>1</sup> Accepted either as a JSON number or as a decimal string+| id | integer \| integer string | The attachment's position |+| filename | string | The filename |+| upload_filename | string | The upload key from [Request attachment upload URLs](#request-attachment-upload-urls) |+| file_size | integer | The size in bytes |+| content_type | string | The media type (1-255 characters) |+| title? | ?string | The display title (1-1,024 characters) |+| description? | ?string | The alt text (1-4,096 characters) |+| duration?<sup>1</sup> | ?integer | The voice message length in seconds |+| waveform?<sup>1</sup> | ?string | The base64 voice waveform (1-4,096 characters) |+| flags? | integer | [Attachment flags](#attachment-flags) (default `0`) |-<sup>2</sup> The presence of this key selects this variant over the [direct multipart metadata](#direct-multipart-attachment-metadata-object) variant--<sup>3</sup> Both are required when the message has the `VOICE_MESSAGE` flag. A `waveform` on an attachment whose resolved media type is not `audio/*` fails with the field code `VOICE_MESSAGES_ATTACHMENT_MUST_BE_AUDIO`--Only `IS_SPOILER` and `CONTAINS_EXPLICIT_MEDIA` survive from a caller-supplied `flags` value. `IS_ANIMATED` is set by media inspection alone.+<sup>1</sup> Required for a voice message### Direct multipart attachment metadata object@@ -578,42 +464,36 @@ Only `IS_SPOILER` and `CONTAINS_EXPLICIT_MEDIA` survive from a caller-supplied `| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | integer \| integer string | Zero-based `files[N]` index |-| filename | string | Display filename |-| content_type? | string | Media type of 1 through 255 characters |-| title? | ?string | Display title (1-1,024 characters) |-| description? | ?string | Description (1-4,096 characters) |-| flags? | integer | [Attachment flags](#attachment-flags), defaulting to `0` |-| duration?<sup>2</sup> | ?integer | Voice media duration in seconds (0-2,147,483,647) |-| waveform?<sup>2</sup> | ?string | Base64 waveform of 1 through 4,096 characters |--<sup>1</sup> An entry whose `id` matches no supplied file index and that has a `filename` fails with the field code `NO_FILE_FOR_ATTACHMENT_METADATA`. An entry whose `id` matches no supplied file and that has no `filename` is read as an [existing attachment reference](#existing-attachment-reference-object) instead+| id | integer \| integer string | The index of the `files[N]` field |+| filename | string | The filename |+| content_type? | string | The media type (1-255 characters) |+| title? | ?string | The display title (1-1,024 characters) |+| description? | ?string | The alt text (1-4,096 characters) |+| flags? | integer | [Attachment flags](#attachment-flags) (default `0`) |+| duration?<sup>1</sup> | ?integer | The voice message length in seconds |+| waveform?<sup>1</sup> | ?string | The base64 voice waveform (1-4,096 characters) |-<sup>2</sup> Both are required when the message has the `VOICE_MESSAGE` flag--Fluxer discards a key outside the table above and accepts the rest of the entry.+<sup>1</sup> Required for a voice message### Existing attachment reference object+Use this in [Modify message](#modify-message) to keep an attachment and change its `title` or `description`. When you edit someone else's message, sending `filename`, `duration` or `waveform` returns `INVALID_FORM_BODY` with `CANNOT_EDIT_ATTACHMENT_METADATA`.+#### Structure| Field | Type | Description || --- | --- | --- |-| id | snowflake \| integer | Existing attachment ID or attachment position |-| title? | ?string | Replacement display title (1-1,024 characters) |-| description? | ?string | Replacement description (1-4,096 characters) |-| flags?<sup>1</sup> | integer | [Attachment flags](#attachment-flags), accepted and discarded |-| filename?<sup>1</sup> <sup>2</sup> | string | Display filename, accepted and discarded |-| duration?<sup>1</sup> <sup>2</sup> | ?integer | Duration in seconds (0-2,147,483,647), accepted and discarded |-| waveform?<sup>1</sup> <sup>2</sup> | ?string | Base64 waveform of 1 through 4,096 characters, accepted and discarded |--<sup>1</sup> A retained attachment is rebuilt from its stored record, and only `title` and `description` are written back onto it--<sup>2</sup> Rejected with the field code `CANNOT_EDIT_ATTACHMENT_METADATA` when the caller is a guild moderator editing a message they did not author, because that caller can supply only `id`, `title`, `description`, and `flags`+| id | snowflake \| integer | The ID of the attachment, or its position in the message |+| title? | ?string | A new display title (1-1,024 characters) |+| description? | ?string | New alt text (1-4,096 characters) |+| flags? | integer | Ignored |+| filename? | string | Ignored |+| duration? | ?integer | Ignored |+| waveform? | ?string | Ignored |## Rich embed input objects-A rich embed input is an embed a client supplies on a message, and Fluxer always stores it with the `rich` [embed type](#embed-types). The number of embeds on one message is bounded by the resolved `max_embeds_per_message` limit, which defaults to 10. Exceeding it fails with the field code `TOO_MANY_EMBEDS`.+A message can have up to `max_embeds_per_message` embeds (default 10).### Rich embed object@@ -621,18 +501,16 @@ A rich embed input is an embed a client supplies on a message, and Fluxer always| Field | Type | Description || --- | --- | --- |-| url? | ?string | Embed destination URL (1-2,048 characters) |-| title? | ?string | Title with at most 256 characters |-| color? | ?integer | Embed colour |-| timestamp? | ?ISO8601 timestamp | Embed timestamp |-| description? | ?string | Description (1-4,096 characters, empty string treated as absent) |-| author?<sup>1</sup> | ?[embed author input](#embed-author-input-object) object | Author metadata |-| image?<sup>1</sup> | ?[embed media input](#embed-media-input-object) object | Main image metadata |-| thumbnail?<sup>1</sup> | ?[embed media input](#embed-media-input-object) object | Thumbnail metadata |-| footer?<sup>1</sup> | ?[embed footer input](#embed-footer-input-object) object | Footer metadata |-| fields? | ?array[[embed field input](#embed-field-input-object) object] | At most 25 embed fields |--<sup>1</sup> A nested object that omits its own required field is discarded. An author without `name`, a media object without `url`, and a footer without `text` are read as if the field had not been sent+| url? | ?string | The link (1-2,048 characters) |+| title? | ?string | The title (at most 256 characters) |+| color? | ?integer | The color |+| timestamp? | ?ISO8601 timestamp | The timestamp |+| description? | ?string | The description (1-4,096 characters) |+| author? | ?[embed author input](#embed-author-input-object) object | The author |+| image? | ?[embed media input](#embed-media-input-object) object | The main image |+| thumbnail? | ?[embed media input](#embed-media-input-object) object | The thumbnail |+| footer? | ?[embed footer input](#embed-footer-input-object) object | The footer |+| fields? | ?array[[embed field input](#embed-field-input-object) object] | The fields (at most 25) |### Embed author input object@@ -640,9 +518,9 @@ A rich embed input is an embed a client supplies on a message, and Fluxer always| Field | Type | Description || --- | --- | --- |-| name | string | Author name (1-256 characters) |-| url? | ?string | Author link (1-2,048 characters) |-| icon_url? | ?string | Author icon URL (1-2,048 characters) |+| name | string | The author name (1-256 characters) |+| url? | ?string | The author link (1-2,048 characters) |+| icon_url? | ?string | The icon URL (1-2,048 characters) |### Embed media input object@@ -650,12 +528,10 @@ A rich embed input is an embed a client supplies on a message, and Fluxer always| Field | Type | Description || --- | --- | --- |-| url<sup>1</sup> | string | Media URL or attachment reference |-| description? | ?string | Media description (1-4,096 characters) |--<sup>1</sup> Either an `http` or `https` URL, or an `attachment://<filename>` reference naming a `png`, `jpg`, `jpeg`, `webp`, or `gif` attachment on the same message, and from 1 through 2,048 characters in either form. Only `image` and `thumbnail` accept the `attachment://` form+| url<sup>1</sup> | string | The media URL (1-2,048 characters) |+| description? | ?string | The alt text (1-4,096 characters) |-An `attachment://` reference on a request that has no attachment fails with the field code `CANNOT_REFERENCE_ATTACHMENTS_WITHOUT_ATTACHMENTS`. A reference to a filename that no attachment on the request supplies fails with the field code `REFERENCED_ATTACHMENT_NOT_FOUND`, and a reference to an attachment whose extension is not a supported image extension fails with the field code `ATTACHMENT_MUST_BE_IMAGE`.+<sup>1</sup> An `http` or `https` URL. In `image` and `thumbnail`, it can also be `attachment://<filename>` for a `png`, `jpg`, `jpeg`, `webp` or `gif` file in the same request### Embed footer input object@@ -663,8 +539,8 @@ An `attachment://` reference on a request that has no attachment fails with the| Field | Type | Description || --- | --- | --- |-| text | string | Footer text (1-2,048 characters) |-| icon_url? | ?string | Footer icon URL (1-2,048 characters) |+| text | string | The footer text (1-2,048 characters) |+| icon_url? | ?string | The icon URL (1-2,048 characters) |### Embed field input object@@ -672,17 +548,19 @@ An `attachment://` reference on a request that has no attachment fails with the| Field | Type | Description || --- | --- | --- |-| name | string | Field name (1-256 characters) |-| value | string | Field value with at most 1,024 characters |-| inline? | boolean | Whether the field can render inline, defaulting to `false` |+| name | string | The field name (1-256 characters) |+| value | string | The field value (at most 1,024 characters) |+| inline? | boolean | Whether the field shows inline (default `false`) |## Attachment upload objects-Fluxer issues an upload URL for an attachment before any message can reference it. [Request attachment upload URLs](#request-attachment-upload-urls) plans the upload. A plan whose declared size exceeds 10 MiB is a multipart plan, and [Complete attachment upload](#complete-attachment-upload) finishes it.+To upload a file before you send the message:-An `upload_url` can point to object storage or the Fluxer [upload relay](/media-proxy/upload-relay/). Send it exactly as issued without assuming its shape.+1. Get upload URLs from [Request attachment upload URLs](#request-attachment-upload-urls).+2. `PUT` the file to `upload_url`, or each part to its own URL for a file over 10 MiB, then call [Complete attachment upload](#complete-attachment-upload).+3. Send the `upload_filename` in a [pre-uploaded attachment](#pre-uploaded-attachment-object).-An upload key can be referenced only by a message that the same identity creates in the same channel. An upload key planned for a forum or media channel is referenced by the first message of a post that [Start thread](/http-api/threads/#start-thread) creates in that channel.+The upload only works for a message in the same channel, which in a forum or media channel is the first message of a post from [Start thread](/http-api/threads/#start-thread).### Attachment upload request item object@@ -690,54 +568,46 @@ An upload key can be referenced only by a message that the same identity creates| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | integer | Caller-selected attachment position (0-2,147,483,647) |-| filename | string | Filename to upload |-| file_size<sup>1</sup> | integer | Declared byte count (0-9,007,199,254,740,991) |-| content_type<sup>2</sup> | string | Media type of 1 through 255 characters the client uploads |--<sup>1</sup> A decimal string is converted to the integer--<sup>2</sup> The issued upload URL uses the media type derived from `filename`. The [message attachment object](#message-attachment-object) states how the stored attachment is typed+| id | integer | Your position for the attachment (0-2,147,483,647) |+| filename | string | The filename |+| file_size | integer | The size in bytes |+| content_type | string | The media type (1-255 characters) |### Singlepart attachment upload object-Returned when the declared `file_size` is at most 10 MiB.+Returned for a file of 10 MiB or less.#### Structure| Field | Type | Description || --- | --- | --- |-| id | integer | Caller-selected attachment position echoed from the request |-| filename | string | Filename echoed from the request |-| upload_filename<sup>1</sup> | string | Opaque upload key of 1 through 4,096 characters |-| file_size | integer | Declared byte count echoed from the request |-| content_type | string | Media type derived from `filename` |+| id | integer | The `id` from the request |+| filename | string | The filename from the request |+| upload_filename | string | The upload key to send with the message |+| file_size | integer | The size from the request |+| content_type | string | The media type Fluxer derived from `filename` || upload_mode | string | Always `singlepart` |-| upload_url<sup>2</sup> | string | Presigned URL that accepts the complete file in one `PUT` |--<sup>1</sup> This value is the `upload_filename` of a [pre-uploaded attachment](#pre-uploaded-attachment-object) in a later [Create message](#create-message) or [Modify message](#modify-message) request--<sup>2</sup> The upload URL accepts only the derived media type and exactly `file_size` bytes, so a `PUT` of any other length is rejected+| upload_url | string | The URL to `PUT` the whole file to |### Multipart attachment upload object-Returned when the declared `file_size` exceeds 10 MiB.+Returned for a file over 10 MiB.#### Structure| Field | Type | Description || --- | --- | --- |-| id | integer | Caller-selected attachment position echoed from the request |-| filename | string | Filename echoed from the request |-| upload_filename | string | Opaque upload key of 1 through 4,096 characters |-| file_size | integer | Declared byte count echoed from the request |-| content_type | string | Media type derived from `filename` |+| id | integer | The `id` from the request |+| filename | string | The filename from the request |+| upload_filename | string | The upload key to send with the message |+| file_size | integer | The size from the request |+| content_type | string | The media type Fluxer derived from `filename` || upload_mode | string | Always `multipart` |-| upload_id | string | Object storage multipart upload identifier of 1 through 1,024 characters |-| part_size<sup>1</sup> | integer | Byte size of every part except the last |-| parts | array[[attachment upload part](#attachment-upload-part-object) object] | Presigned part upload URLs in ascending part number (1-10,000 entries) |+| upload_id | string | The ID of the multipart upload |+| part_size | integer | The size of every part except the last, in bytes |+| parts | array[[attachment upload part](#attachment-upload-part-object) object] | The parts in order |-<sup>1</sup> The plan targets 20 parts, so `part_size` is one twentieth of `file_size` rounded up to a whole mebibyte, and it is never smaller than 10 MiB. The last part is the remainder+Each part except the last must be exactly `part_size` bytes, and all parts together must add up to `file_size`.### Attachment upload part object@@ -745,10 +615,8 @@ Returned when the declared `file_size` exceeds 10 MiB.| Field | Type | Description || --- | --- | --- |-| part_number | integer | One-based part number |-| upload_url<sup>1</sup> | string | Presigned URL that accepts exactly this part |--<sup>1</sup> Each part upload URL accepts only the exact byte count of its part, so a `PUT` of any other length is rejected+| part_number | integer | The part number, starting at 1 |+| upload_url | string | The URL to `PUT` this part to |### Multipart upload completion item object@@ -756,8 +624,8 @@ Returned when the declared `file_size` exceeds 10 MiB.| Field | Type | Description || --- | --- | --- |-| upload_filename | string | Opaque upload key returned when the upload was planned |-| upload_id | string | Multipart upload identifier returned when the upload was planned |+| upload_filename | string | The upload key |+| upload_id | string | The ID of the multipart upload |## Refreshed attachment URL object@@ -765,19 +633,10 @@ Returned when the declared `file_size` exceeds 10 MiB.| Field | Type | Description || --- | --- | --- |-| original | string | The URL exactly as it was sent |-| refreshed<sup>1</sup> | string | The URL with a fresh [signature](#signed-attachment-urls), or `original` unchanged |--<sup>1</sup> Equal to `original` when the URL is not an attachment URL of this instance, or when the instance has no attachment URL secrets+| original | string | The URL you sent |+| refreshed | string | The URL with a new [signature](#signed-attachment-urls) |-A URL is an attachment URL of this instance when all of these hold:--- It parses as an absolute URL whose scheme, host, and port equal those of the media endpoint. The host is compared without regard to case, and a default port equals no port.-- Its path, as written in the string, starts with the media endpoint path followed by `/attachments/`.-- The rest of the path, percent-decoded, is valid UTF-8 and a safe storage key with no empty, `.`, or `..` segment.-- That key is `attachments/{channel_id}/{attachment_id}/{filename}`, where both IDs are decimal digits and the filename is not empty.--To sign a URL, Fluxer removes every `ex`, `is`, `hm`, and `uc` parameter and every empty pair, then places the fresh `ex`, `is`, and `hm` first. Every other parameter follows in its original order and bytes, and a fragment is kept. A [data package URL](#data-package-attachment-urls) loses its `uc` this way, so the result is an ordinary URL valid for 24 hours.+`refreshed` is the same as `original` when the URL isn't an attachment URL of this instance.## Channel pin object@@ -785,10 +644,8 @@ To sign a URL, Fluxer removes every `ex`, `is`, `hm`, and `uc` parameter and eve| Field | Type | Description || --- | --- | --- |-| message<sup>1</sup> | [message](#message-object) object | The message the pin points at |-| pinned_at | ISO8601 timestamp | Time at which the message was pinned |--<sup>1</sup> The pinned message omits `referenced_message` and `reactions`, so a client that needs either must read the message through [Get message](#get-message)+| message | [message](#message-object) object | The pinned message, without `referenced_message` and `reactions` |+| pinned_at | ISO8601 timestamp | When the message was pinned |## Channel pins page object@@ -796,12 +653,10 @@ To sign a URL, Fluxer removes every `ex`, `is`, `hm`, and `uc` parameter and eve| Field | Type | Description || --- | --- | --- |-| items<sup>1</sup> | array[[channel pin](#channel-pin-object) object] | Current page of pins |-| has_more | boolean | Whether an older page exists |+| items | array[[channel pin](#channel-pin-object) object] | The pins, newest first |+| has_more | boolean | Whether there are older pins |-<sup>1</sup> Ordered by descending pin time--The page has no cursor field. The next request repeats the operation with `before` set to the `pinned_at` of the last returned item. Continue while `has_more` is true. `has_more` is false only when the channel has no further visible pins.+To get the next page, set `before` to the `pinned_at` of the last item. Skip messages you already have, because two pins can share a timestamp.## Reaction users page object@@ -809,11 +664,9 @@ The page has no cursor field. The next request repeats the operation with `befor| Field | Type | Description || --- | --- | --- |-| items | array[[partial user](/http-api/users/#partial-user-object) object] | Users in ascending user ID order |-| has_more | boolean | Whether another page exists |-| next_after<sup>1</sup> | ?snowflake | User ID cursor for the next page |--<sup>1</sup> Null when no further page exists, and otherwise the ID of the last user in `items`+| items | array[[partial user](/http-api/users/#partial-user-object) object] | The users, by ascending ID |+| has_more | boolean | Whether there's another page |+| next_after | ?snowflake | The `after` value for the next page |## Bulk message request object@@ -822,10 +675,10 @@ The page has no cursor field. The next request repeats the operation with `befor| Field | Type | Description || --- | --- | --- || channel_id | snowflake | The ID of the channel |-| limit | integer | Number of messages to return (1-50) |-| before? | snowflake | Return messages before this message ID |-| after? | snowflake | Return messages after this message ID |-| around? | snowflake | Return a window centred on this message ID |+| limit | integer | The number of messages to return (1-50) |+| before? | snowflake | Get messages before this message ID |+| after? | snowflake | Get messages after this message ID |+| around? | snowflake | Get messages around this message ID |## Bulk message channel object@@ -834,1568 +687,702 @@ The page has no cursor field. The next request repeats the operation with `befor| Field | Type | Description || --- | --- | --- || channel_id | snowflake | The ID of the channel |-| messages | array[[message](#message-object) object] | Reverse-chronological message window |+| messages | array[[message](#message-object) object] | The messages, newest first |-## List channel messages+## Crosspost source object-<RouteHeader method="GET" path="/v1/channels/{channel_id}/messages" bot />--Returns a reverse-chronological array of [message](#message-object) objects. Requires [VIEW_CHANNEL](/http-api/permissions/).+### Structure-### Limitations+| Field | Type | Description |+| --- | --- | --- |+| guild | [crosspost source guild](#crosspost-source-guild-object) object | The guild the message was published from |-- Reading history in a guild channel requires [READ_MESSAGE_HISTORY](/http-api/permissions/).-- A guild caller without `READ_MESSAGE_HISTORY` sees only messages created on or after the guild's message history cutoff.+## Crosspost source guild object-### Path parameters+### Structure| Field | Type | Description || --- | --- | --- |-| channel_id | snowflake | The ID of the channel |+| id | snowflake | The ID of the guild |+| name | string | The guild name |+| icon | ?string | The guild icon hash |+| banner | ?string | The guild banner hash |+| description | ?string | The discovery description, or null when the guild isn't in discovery |+| features | array of strings | `VERIFIED`, `PARTNERED` and `DISCOVERABLE` from [guild features](/http-api/guilds/#guild-features) |+| approximate_member_count | ?integer | About how many members the guild has |+| approximate_presence_count | ?integer | About how many members are online |+| discoverable | boolean | Whether you can join through [Join discovery guild](/http-api/discovery/#join-discovery-guild) |-### Query parameters+## List channel messages-| Field | Type | Description |-| --- | --- | --- |-| limit? | integer | Number of messages to return (1-100, default 50) |-| before?<sup>1</sup> | snowflake | Return messages before this message ID |-| after?<sup>1</sup> | snowflake | Return messages after this message ID |-| around? | snowflake | Return a window centred on this message ID, overriding `before` and `after` |+<RouteHeader method="GET" path="/v1/channels/{channel_id}/messages" bot />-<sup>1</sup> Combining the two selects the page before `before`, then discards entries at or below `after`+Returns messages from a channel, newest first. A page can have fewer than `limit` messages when some are older than your [history cutoff](#access-and-history).-:::caution[A page can hold fewer than `limit` items]-Fluxer selects the page first, then removes messages outside the caller's message history cutoff and messages with neither a stored author nor a stored webhook.-:::+### Query parameters-:::note[Missing history is an empty page]-A caller without `READ_MESSAGE_HISTORY` in a guild channel with no history cutoff receives 200 with an empty array. An unreachable cursor also returns an empty window.-:::+| Field | Type | Description |+| --- | --- | --- |+| limit? | integer | The number of messages to return (1-100, default 50) |+| before? | snowflake | Get messages before this message ID |+| after? | snowflake | Get messages after this message ID |+| around? | snowflake | Get messages around this message ID, ignoring `before` and `after` |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | array[[message](#message-object) object] | Message window was returned |-| 400 | [error response](/http-api/#error-response) | Channel is a forum or media channel and the request returns `INVALID_CHANNEL_TYPE` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` and the request returns `MISSING_PERMISSIONS`, or the caller lacks age verification for the channel and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or the caller is not a recipient of the private channel |--### Rate limit+| 200 | array[[message](#message-object) object] | The messages were returned |+| 400 | [error response](/http-api/#error-response) | `INVALID_CHANNEL_TYPE` for a forum or media channel |-100 requests per 10 seconds for each authenticated user and channel ID, on the `channel:messages:read::channel_id` bucket.+The rate limit is 100 requests per 10 seconds, on the `channel:messages:read::channel_id` bucket.## List messages from multiple channels<RouteHeader method="POST" path="/v1/channels/messages/bulk" />-Returns a bulk message response object holding bounded message windows from several channels.--### Limitations--- This is a user-only operation, and a bot credential is refused with 403 `ACCESS_DENIED`.-- Fluxer resolves and authorises each requested channel independently, with exactly the same channel checks as [List channel messages](#list-channel-messages).-- An inaccessible channel fails the whole request, so the response has no window for any channel.+Returns messages from up to 25 channels in one request. Each channel needs the same access as [List channel messages](#list-channel-messages), and one channel you can't see fails the whole request. Bots can't use this route.### JSON body| Field | Type | Description || --- | --- | --- |-| requests<sup>1</sup> | array[[bulk message request](#bulk-message-request-object) object] | From 1 through 25 channel requests |--<sup>1</sup> The `limit` values across all entries must sum to at most 250, and exceeding that sum fails the whole request+| requests | array[[bulk message request](#bulk-message-request-object) object] | 1-25 channels, with `limit` adding up to at most 250 |### Response body| Field | Type | Description || --- | --- | --- |-| channels<sup>1</sup> | array[[bulk message channel](#bulk-message-channel-object) object] | Results in request order |--<sup>1</sup> Contains exactly one entry for each requested channel, in the order the entries were sent, and a duplicated channel ID therefore produces a duplicated result entry+| channels | array[[bulk message channel](#bulk-message-channel-object) object] | One result for each request, in the same order |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | All requested windows were returned |-| 403 | [error response](/http-api/#error-response) | Caller is a bot and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The caller lacks `VIEW_CHANNEL` for a requested channel and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The caller lacks age verification for a requested channel and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | A requested channel does not exist or the caller is not a recipient of the private channel |+| 200 | response body | The messages were returned |-### Rate limit--20 requests per 10 seconds for each authenticated user, on the `channel:messages:bulk_read` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:messages:bulk_read` bucket.## Get message<RouteHeader method="GET" path="/v1/channels/{channel_id}/messages/{message_id}" bot />-Returns one [message](#message-object) object. Requires [VIEW_CHANNEL](/http-api/permissions/).--### Limitations--- In a guild channel without [READ_MESSAGE_HISTORY](/http-api/permissions/), a message created before the guild's message history cutoff is reported as 404 `UNKNOWN_MESSAGE` rather than 403.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel |-| message_id | snowflake | The ID of the message to return |+Returns one message, or 404 `UNKNOWN_MESSAGE` when it's older than your [history cutoff](#access-and-history).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [message](#message-object) object | Message was returned |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` and the request returns `MISSING_PERMISSIONS`, or the caller lacks age verification for the channel and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel or message does not exist, or the message is outside the caller's message history cutoff |--### Rate limit+| 200 | [message](#message-object) object | The message was returned |-100 requests per 10 seconds for each authenticated user and channel ID, on the `channel:message:read::channel_id` bucket.+The rate limit is 100 requests per 10 seconds, on the `channel:message:read::channel_id` bucket.## Request attachment upload URLs<RouteHeader method="POST" path="/v1/channels/{channel_id}/attachments" bot />-Plans from 1 through 10 attachment uploads. Returns a [singlepart](#singlepart-attachment-upload-object) or [multipart](#multipart-attachment-upload-object) upload object for each declaration.--### Limitations+Returns upload URLs for 1 to 10 files, as described in [Attachment upload objects](#attachment-upload-objects). In a guild channel you need `SEND_MESSAGES` and `ATTACH_FILES`.-- The channel must be a text-bearing type, a forum channel, or a media channel. Any other channel fails with 400 `CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL`.-- A guild channel requires [SEND_MESSAGES](/http-api/permissions/) and [ATTACH_FILES](/http-api/permissions/), and a timed-out member is refused with 403 `COMMUNICATION_DISABLED`.--Fluxer checks each declared `file_size` separately against the attachment size limit it resolves for the caller and the guild context. A declaration above that limit returns 400 `FILE_SIZE_TOO_LARGE` with the resolved ceiling. By default the resolved ceiling is 26214400 bytes (25 MiB) for a caller without premium and 524288000 bytes (500 MiB) for a caller with premium. A bot credential is clamped to 52428800 bytes, the 50 MiB bot ceiling, even when the resolved limit is higher.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the target message channel |+Each file can be up to the [`max_attachment_file_size`](/http-api/instance/#limit-keys) limit, which defaults to 524288000 bytes (500 MiB), or 26214400 bytes (25 MiB) without premium on an instance with premium tiers. Bots get at most 52428800 bytes (50 MiB).### JSON body| Field | Type | Description || --- | --- | --- |-| attachments | array[[attachment upload request item](#attachment-upload-request-item-object) object] | Attachment upload declarations (1-10 entries) |+| attachments | array[[attachment upload request item](#attachment-upload-request-item-object) object] | The files to upload (1-10) |### Response body| Field | Type | Description || --- | --- | --- |-| attachments<sup>1</sup> | array[[singlepart](#singlepart-attachment-upload-object) or [multipart](#multipart-attachment-upload-object) attachment upload object] | Upload plan for each declaration |--<sup>1</sup> Returned in the same order as the request, and each entry echoes the caller's `id` so a client can pair a plan with its declaration. Read `upload_mode` to select the variant+| attachments | array[[singlepart](#singlepart-attachment-upload-object) or [multipart](#multipart-attachment-upload-object) attachment upload object] | One upload for each file, in request order |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Upload plans were issued |-| 400 | [error response](/http-api/#error-response) | Body, attachment declaration, or count is invalid and the request returns `INVALID_FORM_BODY` |-| 400 | [error response](/http-api/#error-response) | The channel does not support messages and the request returns `CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL` |-| 400 | [error response](/http-api/#error-response) | A declared size exceeds the resolved limit and the request returns `FILE_SIZE_TOO_LARGE` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `SEND_MESSAGES` or `ATTACH_FILES` and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The caller is timed out and the request returns `COMMUNICATION_DISABLED` |-| 403 | [error response](/http-api/#error-response) | Presigned attachment uploads are switched off for the instance and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or is unavailable and the request returns `UNKNOWN_CHANNEL`, or the authenticated account does not exist and the request returns `UNKNOWN_USER` |--### Side effects+| 200 | response body | The upload URLs were returned |+| 400 | [error response](/http-api/#error-response) | `FILE_SIZE_TOO_LARGE` when a file is over the size limit |+| 400 | [error response](/http-api/#error-response) | `CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL` when the channel has no messages |+| 403 | [error response](/http-api/#error-response) | `COMMUNICATION_DISABLED` when you're timed out |+| 403 | [error response](/http-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED` when the instance has turned off uploads |-The operation reserves the uploads for the caller and channel. It creates no message.--An issued `upload_filename` becomes an attachment only when a later [Create message](#create-message) or [Modify message](#modify-message) request references it from a [pre-uploaded attachment](#pre-uploaded-attachment-object) entry. A singlepart plan needs no completion step, so a message can reference its key as soon as the `PUT` succeeds.--### Rate limit--10 requests per 10 seconds for each authenticated user and channel ID, on the `channel:attachment:upload::channel_id` bucket.+The rate limit is 10 requests per 10 seconds, on the `channel:attachment:upload::channel_id` bucket.## Complete attachment upload<RouteHeader method="POST" path="/v1/channels/{channel_id}/attachments/complete" bot />-Completes from 1 through 10 multipart uploads after every part has been sent. Returns their upload keys.--### Limitations--- Each upload must have been planned as multipart by the same authenticated identity for the same channel.--The request has no part list and no entity tags.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel bound to the uploads |+Finishes 1 to 10 multipart uploads after you've uploaded every part. If completion fails, Fluxer discards the upload and you have to start again.### JSON body| Field | Type | Description || --- | --- | --- |-| uploads | array[[multipart upload completion item](#multipart-upload-completion-item-object) object] | Uploads to finalise (1-10 entries) |+| uploads | array[[multipart upload completion item](#multipart-upload-completion-item-object) object] | The uploads to finish (1-10) |### Response body| Field | Type | Description || --- | --- | --- |-| uploads | array[object] | One entry for each completed upload, each with `upload_filename` |+| uploads | array[object] | One object with `upload_filename` for each upload |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Every multipart upload was completed |-| 400 | [error response](/http-api/#error-response) | Body is invalid, or an upload is not a pending multipart upload of this caller in this channel and the request returns `INVALID_FORM_BODY` with the code `UPLOADED_ATTACHMENT_NOT_FOUND` on the path `uploads.{index}.upload_filename` |-| 400 | [error response](/http-api/#error-response) | No part was uploaded and the request returns `INVALID_FORM_BODY` with the code `NO_UPLOADED_PARTS_TO_FINALIZE` on the path `parts` |-| 400 | [error response](/http-api/#error-response) | The uploaded bytes exceed the resolved limit and the request returns `FILE_SIZE_TOO_LARGE` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `SEND_MESSAGES` or `ATTACH_FILES` and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The caller is timed out and the request returns `COMMUNICATION_DISABLED` |-| 403 | [error response](/http-api/#error-response) | Presigned attachment uploads are switched off for the instance and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or is unavailable and the request returns `UNKNOWN_CHANNEL`, or the authenticated account does not exist and the request returns `UNKNOWN_USER` |--:::caution[A failed completion aborts the upload]-Fluxer aborts the multipart upload and discards its parts when no part was uploaded, when the uploaded bytes exceed the resolved limit, or when the storage completion fails. Plan the upload again rather than retrying the completion.-:::--:::caution[An unowned upload is reported as invalid input]-Fluxer reports the field code `UPLOADED_ATTACHMENT_NOT_FOUND` for an upload key the identity does not own, one that belongs to another channel, one planned as singlepart, and one a message already consumed. A caller cannot tell them apart, so it cannot probe another identity's upload state.-:::--### Side effects--The operation makes each completed upload available for a message. It creates no message.+| 200 | response body | The uploads were finished |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` with `UPLOADED_ATTACHMENT_NOT_FOUND` for an unknown upload |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` with `NO_UPLOADED_PARTS_TO_FINALIZE` when no part was uploaded |+| 400 | [error response](/http-api/#error-response) | `FILE_SIZE_TOO_LARGE` when the uploaded file is over the size limit |-### Rate limit--10 requests per 10 seconds for each authenticated user and channel ID, on the `channel:attachment:upload::channel_id` bucket, which is shared with [Request attachment upload URLs](#request-attachment-upload-urls).+The rate limit is 10 requests per 10 seconds, on the `channel:attachment:upload::channel_id` bucket.## Refresh attachment URLs<RouteHeader method="POST" path="/v1/attachments/refresh-urls" bot />-Signs from 1 through 50 attachment URLs again. Returns one [refreshed attachment URL](#refreshed-attachment-url-object) object for each URL sent. A [data package URL](#data-package-attachment-urls) is accepted like any other, and its result is an ordinary URL valid for 24 hours.--### Limitations--- An OAuth2 bearer token is refused with 403 `ACCESS_DENIED`.-- Fluxer checks no channel membership, no permission, and no attachment existence, and reads no stored data. A URL is signed whether or not its object exists or the caller can see it.+Signs 1 to 50 attachment URLs again, each valid for another 24 hours. OAuth2 tokens can't use this route.### JSON body| Field | Type | Description || --- | --- | --- |-| attachment_urls<sup>1</sup> | array[string] | URLs to sign again (1-50 entries, each at most 2,048 characters) |--<sup>1</sup> Each entry is read exactly as sent, with no trimming or normalisation+| attachment_urls | array[string] | The URLs to sign (1-50, each at most 2,048 characters) |### Response body| Field | Type | Description || --- | --- | --- |-| refreshed_urls<sup>1</sup> | array[[refreshed attachment URL](#refreshed-attachment-url-object) object] | Results in request order |--<sup>1</sup> Contains exactly one entry for each requested URL, in the order the entries were sent, and a duplicated URL therefore produces a duplicated entry+| refreshed_urls | array[[refreshed attachment URL](#refreshed-attachment-url-object) object] | One result for each URL, in request order |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Every URL was processed |-| 400 | [error response](/http-api/#error-response) | Body, URL count, or a URL length is invalid and the request returns `INVALID_FORM_BODY` |-| 401 | [error response](/http-api/#error-response) | The credential is missing or invalid and the request returns `UNAUTHORIZED` |-| 403 | [error response](/http-api/#error-response) | Caller presents a bearer credential and the request returns `ACCESS_DENIED` |--:::caution[A refreshed URL is not an access check]-Anyone who can authenticate can sign any attachment URL of the instance whose path they know. A signature limits how long a copied URL works. It does not decide who can read the file.-:::+| 200 | response body | The URLs were signed |-### Rate limit--20 requests per 10 seconds for each authenticated user, on the `attachment:refresh_urls` bucket.+The rate limit is 20 requests per 10 seconds, on the `attachment:refresh_urls` bucket.## Create message<RouteHeader method="POST" path="/v1/channels/{channel_id}/messages" bot />-Creates a message from a JSON body or from multipart form data. Returns the created [message](#message-object) object. Emits a [Message Create](/gateway/events/#message-create) Gateway event.--### Limitations--- The channel must be a text-bearing type.-- A guild channel requires [VIEW_CHANNEL](/http-api/permissions/) and [SEND_MESSAGES](/http-api/permissions/), an untimed-out membership, and a membership that meets the guild's [verification level](/http-api/guilds/#verification-levels).-- A thread requires [SEND_MESSAGES_IN_THREADS](/http-api/permissions/) in its parent where a guild channel requires `SEND_MESSAGES`.-- A timed-out member is refused with 403 `COMMUNICATION_DISABLED`.-- Embeds require [EMBED_LINKS](/http-api/permissions/), attachments require [ATTACH_FILES](/http-api/permissions/), a favourite meme requires both, and active everyone mentions require [MENTION_EVERYONE](/http-api/permissions/).-- Slowmode applies to a non-bot caller unless they hold [BYPASS_SLOWMODE](/http-api/permissions/).-- A one-to-one direct message also applies the recipient's direct message policy and relationship state, and a denial returns 400 `CANNOT_SEND_MESSAGES_TO_USER`.-- A message in a one-to-one direct message is refused with 403 `NEW_CONVERSATIONS_LIMITED` when the caller is under a [new conversation limit](/http-api/users/private-channels/#new-conversation-limit), the recipient is not a friend or a bot, and the recipient has not written in that direct message.-- An unclaimed account can send only to its own personal notes channel, and a send to any other channel is refused with 400 `UNCLAIMED_ACCOUNT_CANNOT_SEND_MESSAGES` before the channel is resolved.-- A non-bot caller must have started a session, and one that has not is refused with the field code `MUST_START_SESSION_BEFORE_SENDING`.--The request body is read as a multipart form when `Content-Type` contains `multipart/form-data`, and as JSON otherwise. An empty JSON body is read as `{}`. A JSON body that is neither valid JSON nor valid against the schema fails with the field code `INVALID_MESSAGE_DATA` on the path `message_data`, which has no per-field detail. A multipart body whose merged payload fails the same schema instead fails with a per-field 400 `INVALID_FORM_BODY` naming each offending path.+Sends a message and returns it, and Fluxer sends [Message Create](/gateway/events/#message-create). In a guild channel you need `SEND_MESSAGES`, or `SEND_MESSAGES_IN_THREADS` in a thread. Embeds need `EMBED_LINKS`, files need `ATTACH_FILES` and `@everyone` needs `MENTION_EVERYONE`.-### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the target channel |+A message needs text, an embed, an attachment, a meme or a sticker. Text can be up to the [`max_message_length`](/http-api/instance/#limit-keys) limit, and bots and webhooks always get at least 4,000 characters.### JSON body| Field | Type | Description || --- | --- | --- |-| nonce?<sup>1</sup> | string \| integer | Caller-generated identifier as a string of 1 through 32 characters or a non-negative safe integer |-| content?<sup>2</sup> | ?string | Message text |-| embeds?<sup>6</sup> | array[[rich embed](#rich-embed-object) object] | Rich embed inputs |-| attachments?<sup>7</sup> | array[[pre-uploaded attachment](#pre-uploaded-attachment-object) object] | Attachment references |-| message_reference? | ?[message reference input](#message-reference-input-object) object | Reply or forward reference |-| allowed_mentions? | ?[allowed mentions](#allowed-mentions-object) object | Active mention policy |-| flags?<sup>3</sup> | integer | [Message flags](#message-flags), defaulting to `0` |-| favorite_meme_id?<sup>4</sup> | ?snowflake | Favourite meme to attach |-| sticker_ids? | ?array[snowflake] | At most 3 sticker IDs |-| tts?<sup>5</sup> | boolean | Whether to request text-to-speech |+| nonce?<sup>1</sup> | string \| integer | Your ID for the message (up to 32 characters, or a non-negative integer) |+| content? | ?string | The text |+| embeds? | array[[rich embed](#rich-embed-object) object] | The embeds |+| attachments? | array[[pre-uploaded attachment](#pre-uploaded-attachment-object) object] | The attachments (default limit 10) |+| message_reference? | ?[message reference input](#message-reference-input-object) object | The message to reply to or forward |+| allowed_mentions? | ?[allowed mentions](#allowed-mentions-object) object | Which mentions notify anyone |+| flags? | integer | [Message flags](#message-flags) (default `0`) |+| favorite_meme_id? | ?snowflake | A saved meme to attach |+| sticker_ids? | ?array[snowflake] | The stickers (at most 3) |+| tts? | boolean | Whether to use text-to-speech, which needs `SEND_TTS_MESSAGES` |-<sup>1</sup> Echoed back on the created message and on its [Message Create](/gateway/events/#message-create) Dispatch so a client can match the result to its optimistic entry. An integer is converted to its decimal string form+<sup>1</sup> Fluxer remembers a nonce for 5 minutes, and sending it again in the same channel returns the first message. Reuse the nonce when you retry a send. Reusing it in a different channel within that time returns 404 `UNKNOWN_MESSAGE`-<sup>2</sup> The schema sets no length bound. Exceeding the effective `max_message_length` described below returns 400 `INVALID_FORM_BODY` with `CONTENT_EXCEEDS_MAX_LENGTH` on the path `content`--<sup>3</sup> Fluxer keeps only the bits in [message flags](#message-flags) and silently drops every other bit--<sup>4</sup> The stored meme object is copied into a new attachment on the message, so the message has its own independent copy. A meme the caller does not own returns 400 `INVALID_FORM_BODY` with the code `FAVORITE_MEME_NOT_FOUND`--<sup>5</sup> Fluxer forces the value to false when the caller lacks [SEND_TTS_MESSAGES](/http-api/permissions/) in a guild, and the request still succeeds--<sup>6</sup> Bounded by the resolved `max_embeds_per_message` limit, which defaults to 10. Exceeding it fails with the field code `TOO_MANY_EMBEDS` on the path `embeds`--<sup>7</sup> Bounded by the resolved `max_attachments_per_message` limit, which defaults to 10. Exceeding it fails with the field code `TOO_MANY_FILES` on the path `attachments`--The smallest body that works is one line of text:--```json-{- "content": "hello"-}-```--Fluxer resolves the effective `max_message_length` for the author and guild context, and it defaults to 2,000 characters. A bot or webhook author takes whichever is larger, the resolved value or 4,000 characters.--A message must have at least one of content with visible characters, an embed, an attachment, a favourite meme, or a sticker. An otherwise empty request fails with 400 `CANNOT_SEND_EMPTY_MESSAGE`. `SUPPRESS_NOTIFICATIONS` changes notification generation, and the message still has its mention data.--:::caution[A reused nonce replays the first result]-A nonce is remembered for the authenticated identity for five minutes, so a client that retries a send after a timeout MUST reuse the same nonce to avoid a duplicate.-:::--Reusing a nonce in the same channel inside that window returns the message the first request created. Reusing it in a different channel fails with 404 `UNKNOWN_MESSAGE`. The replay check runs after authorisation and body validation, so a retry that is otherwise invalid still fails, and a retry after the window has passed creates a second message.--A reply from a guild caller without [READ_MESSAGE_HISTORY](/http-api/permissions/) fails with 404 `UNKNOWN_MESSAGE` when its target was created before the guild's message history cutoff, or when the guild has no cutoff. A forward has no cutoff check on its source. A forward whose source is a `THREAD_CREATED` or `THREAD_STARTER_MESSAGE` message fails with the field code `CANNOT_REPLY_TO_SYSTEM_MESSAGE`. A reply whose target is a system message fails with the field code `CANNOT_REPLY_TO_SYSTEM_MESSAGE`, and any other reference that resolves to no message fails with 404 `UNKNOWN_MESSAGE`.--Every `FORWARD` reference has `channel_id`. One that does not is refused by body validation before the operation runs, with 400 `INVALID_MESSAGE_DATA` on a JSON body and a per-field 400 `INVALID_FORM_BODY` on a multipart body.--A forward request has no `content`, `embeds`, `attachments`, or `sticker_ids`, and one that does fails with the field code `FORWARD_MESSAGES_CANNOT_CONTAIN_CONTENT`. A `guild_id` that disagrees with the source channel's guild fails with the field code `GUILD_ID_MUST_MATCH_REFERENCED_MESSAGE`. Reading the source channel requires [VIEW_CHANNEL](/http-api/permissions/) when that channel belongs to a guild.--Snapshots with embeds require `EMBED_LINKS` in the destination guild channel, and snapshots with attachments require `ATTACH_FILES`, each returning 403 `MISSING_PERMISSIONS` when absent.+A forward has only `message_reference`, with `type` `1` and `channel_id`.### Multipart body+Send files as `multipart/form-data`, with the JSON body in `payload_json`. In `payload_json`, `attachments` uses the [direct multipart attachment metadata](#direct-multipart-attachment-metadata-object) object.+| Field | Type | Description || --- | --- | --- |-| payload_json? | string | JSON encoding of the create message body, defaulting to `{}` when the field is absent |-| files[N]?<sup>1</sup> <sup>2</sup> | binary | Direct attachment file at zero-based index `N` |-| content? | string | Overrides `content` in `payload_json` |-| nonce? | string | Overrides `nonce` in `payload_json` |-| tts? | string | Overrides `tts` in `payload_json`, parsed from `true` or `false` |-| flags? | string | Overrides `flags` in `payload_json`, parsed as a decimal integer |-| favorite_meme_id? | string | Overrides `favorite_meme_id` in `payload_json` |-| sticker_ids? | string | Overrides `sticker_ids` in `payload_json`, repeated once per sticker |--<sup>1</sup> The legacy names `file` and `file<N>` are accepted and take the same indices. Any field name not listed above is ignored+| payload_json? | string | The JSON body |+| files[N]? | binary | A file, where `N` starts at 0 |+| content? | string | Replaces `content` in `payload_json` |+| nonce? | string | Replaces `nonce` in `payload_json` |+| tts? | string | Replaces `tts` in `payload_json` (`true` or `false`) |+| flags? | string | Replaces `flags` in `payload_json` |+| favorite_meme_id? | string | Replaces `favorite_meme_id` in `payload_json` |+| sticker_ids? | string | Replaces `sticker_ids` in `payload_json`, once for each sticker |-<sup>2</sup> The index runs from 0 through the resolved `max_attachments_per_message` limit minus one+These field codes come back in a 400 `INVALID_FORM_BODY`.-A body that cannot be parsed as a multipart form fails with the field code `FAILED_TO_PARSE_MULTIPART_FORM_DATA`. A `payload_json` field that is not a JSON string fails with the field code `INVALID_JSON_IN_PAYLOAD_JSON`, and a field name beginning with `files[` that does not match `files[<N>]` fails with the field code `INVALID_FILE_FIELD_NAME`.--| File field condition | Error |+| Condition | Field code || --- | --- |-| Index below 0 or above 10000 | `FILE_INDEX_EXCEEDS_MAXIMUM` |-| Resolved attachment limit is 0 | `ATTACHMENTS_NOT_ALLOWED_FOR_MESSAGE` |-| Index at or above a non-zero resolved limit | `FILE_INDEX_EXCEEDS_MAXIMUM` |-| Index repeated across fields | `DUPLICATE_FILE_INDEX` |-| More than one file under one index | `MULTIPLE_FILES_FOR_INDEX_NOT_ALLOWED` |-| More files than the resolved limit | `TOO_MANY_FILES` |--Each is a field code inside a 400 `INVALID_FORM_BODY` body. A `FILE_INDEX_EXCEEDS_MAXIMUM` element has a `maxIndex` member. It is 10000 when the index is below 0 or above 10000, and the resolved limit minus one when the index is at or above that limit.+| A `files[N]` index is over the attachment limit | `FILE_INDEX_EXCEEDS_MAXIMUM` |+| Two fields use the same index | `DUPLICATE_FILE_INDEX` |+| There are more files than the attachment limit | `TOO_MANY_FILES` |+| An `attachments` entry with a `filename` has no matching file | `NO_FILE_FOR_ATTACHMENT_METADATA` |-The `attachments` array inside `payload_json` uses [direct multipart attachment metadata](#direct-multipart-attachment-metadata-object), and an entry with `upload_filename` is instead read as a [pre-uploaded attachment](#pre-uploaded-attachment-object). An entry whose `id` matches a supplied file index supplies that file's metadata, and two entries claiming the same file fail with the field code `DUPLICATE_ATTACHMENT_IDS_NOT_ALLOWED`.+### Voice messages-Fluxer permits index gaps and attaches the files in ascending index order. A supplied file that no metadata entry claims is attached with its own multipart filename and no title or description, so omitting `attachments` entirely attaches every supplied file that way.+A message with the `VOICE_MESSAGE` flag has one audio attachment with `duration` and `waveform`, and nothing else. It can be up to `max_voice_message_duration` seconds long (default 1200).-A message with `VOICE_MESSAGE` set has exactly one attachment and nothing else.--| Voice message condition | Error |+| Condition | Field code || --- | --- |-| Content present | `VOICE_MESSAGES_CANNOT_HAVE_CONTENT` |-| Embeds present | `VOICE_MESSAGES_CANNOT_HAVE_EMBEDS` |-| Favourite meme present | `VOICE_MESSAGES_CANNOT_HAVE_FAVORITE_MEMES` |-| Stickers present | `VOICE_MESSAGES_CANNOT_HAVE_STICKERS` |-| Any count other than one attachment | `VOICE_MESSAGES_REQUIRE_SINGLE_ATTACHMENT` |-| Missing `waveform` | `VOICE_MESSAGES_ATTACHMENT_WAVEFORM_REQUIRED` |-| Missing `duration` | `VOICE_MESSAGES_ATTACHMENT_DURATION_REQUIRED` |-| Duration above the resolved limit | `VOICE_MESSAGES_DURATION_EXCEEDS_LIMIT` |--The resolved `max_voice_message_duration` limit defaults to 1200 seconds.+| The message has text | `VOICE_MESSAGES_CANNOT_HAVE_CONTENT` |+| The message doesn't have exactly one attachment | `VOICE_MESSAGES_REQUIRE_SINGLE_ATTACHMENT` |+| The attachment has no `waveform` | `VOICE_MESSAGES_ATTACHMENT_WAVEFORM_REQUIRED` |+| The attachment has no `duration` | `VOICE_MESSAGES_ATTACHMENT_DURATION_REQUIRED` |+| The recording is too long | `VOICE_MESSAGES_DURATION_EXCEEDS_LIMIT` |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [message](#message-object) object | Message was created |-| 400 | [error response](/http-api/#error-response) | Body, multipart form, content, reference, mention, attachment, embed, sticker, or voice message contract is invalid |-| 400 | [error response](/http-api/#error-response) | The recipient's direct message policy denies the send and the request returns `CANNOT_SEND_MESSAGES_TO_USER` |-| 400 | [error response](/http-api/#error-response) | Slowmode denies the send and the request returns `SLOWMODE_RATE_LIMITED` |-| 400 | [error response](/http-api/#error-response) | Thread is locked and the caller is not a thread moderator, returning `THREAD_LOCKED` |-| 400 | [error response](/http-api/#error-response) | The send would unarchive a thread while the guild has 1,000 active threads, returning `MAX_ACTIVE_THREADS` |-| 403 | [error response](/http-api/#error-response) | Caller lacks a required permission and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | Is timed out and the request returns `COMMUNICATION_DISABLED` |-| 403 | [error response](/http-api/#error-response) | Is age restricted from the channel and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 403 | [error response](/http-api/#error-response) | Message sending is temporarily disabled for the guild and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 403 | [error response](/http-api/#error-response) | A limited caller messages an account that has not written in the direct message and the request returns `NEW_CONVERSATIONS_LIMITED` |-| 403 | [error response](/http-api/#error-response) | The account is [limited](/http-api/users/#account-limitation), the channel is not its personal notes channel, and the request returns `ACCOUNT_LIMITED` |-| 404 | [error response](/http-api/#error-response) | Channel, referenced message, sticker, or guild does not exist or is unavailable, or the supplied nonce was last used in a different channel and the request returns `UNKNOWN_MESSAGE` |--:::caution[Slowmode denials are 400, not 429]-Slowmode uses no rate limit bucket. The denial returns 400 `SLOWMODE_RATE_LIMITED` with a `Retry-After` header in whole seconds and a top-level `retry_after` member in decimal seconds.-:::--`retry_after` is never more than one second below the `Retry-After` header. The response has no bucket headers and no `X-RateLimit-Scope`, so a client can tell it apart from a route or [global limit](/topics/rate-limits/) denial.--### Side effects+| 200 | [message](#message-object) object | The message was sent |+| 400 | [error response](/http-api/#error-response) | `CANNOT_SEND_EMPTY_MESSAGE` when the message has nothing in it |+| 400 | [error response](/http-api/#error-response) | `CANNOT_SEND_MESSAGES_TO_USER` when the recipient's DM settings block you |+| 400 | [error response](/http-api/#error-response) | `SLOWMODE_RATE_LIMITED` with `retry_after` when slowmode is on |+| 400 | [error response](/http-api/#error-response) | `THREAD_LOCKED` or `MAX_ACTIVE_THREADS` in a thread |+| 403 | [error response](/http-api/#error-response) | `COMMUNICATION_DISABLED` when you're timed out |+| 403 | [error response](/http-api/#error-response) | `NEW_CONVERSATIONS_LIMITED` when you can't start new DMs |+| 403 | [error response](/http-api/#error-response) | `ACCOUNT_LIMITED` when your account is [limited](/http-api/users/#account-limitation) |+| 403 | [error response](/http-api/#error-response) | `UNCLAIMED_ACCOUNT_CANNOT_SEND_MESSAGES` outside personal notes |-The operation creates the message, attaches every referenced upload and direct multipart file, applies attachment decay deadlines, copies forwarded media, updates the channel's last message, and makes the message searchable.--It advances the author's read state unless the author is a bot, reopens a direct message for any recipient who had closed it, and resolves eligible uncached URLs into embeds.--It emits [Message Create](/gateway/events/#message-create) to every session that can see the channel. Mention and reply notifications follow the resolved allowed mentions policy.--In a thread the operation also unarchives an archived thread, as [Thread lifecycle](/http-api/threads/#thread-lifecycle) describes. It adds a user sender and the mentioned users as thread members, as [Thread messages](/http-api/threads/#thread-messages) describes.--It writes no audit log entry.--### Rate limit--20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:message:create::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:message:create::channel_id` bucket.## Modify message<RouteHeader method="PATCH" path="/v1/channels/{channel_id}/messages/{message_id}" bot />-Modifies a message. Returns the updated [message](#message-object) object. Emits a [Message Update](/gateway/events/#message-update) Gateway event.--### Limitations--- The target must be a `DEFAULT` or `REPLY` message, and any other type fails with 400 `CANNOT_MODIFY_SYSTEM_WEBHOOK`.-- A message that has [message snapshots](#message-snapshot-object) cannot be edited by its author and fails with the field code `MESSAGES_WITH_SNAPSHOTS_CANNOT_BE_EDITED`. A non-author moderator holding `MANAGE_MESSAGES` can still toggle `SUPPRESS_EMBEDS` and change existing attachment metadata on a forwarded message.-- The author can modify every supported field, and a timed-out author is refused with 403 `COMMUNICATION_DISABLED`.-- An author edit in a one-to-one direct message is refused with 403 `NEW_CONVERSATIONS_LIMITED` when the author is under a [new conversation limit](/http-api/users/private-channels/#new-conversation-limit), the recipient is not a friend or a bot, and the recipient has not written in that direct message.-- A caller who is not the author can act only in a guild channel, must hold [MANAGE_MESSAGES](/http-api/permissions/), and can change only `SUPPRESS_EMBEDS` and the metadata of attachments that already exist. A non-author edit that does not satisfy all these conditions fails with 403 `CANNOT_EDIT_OTHER_USER_MESSAGE`.-- `MANAGE_MESSAGES` is an [elevated permission](/http-api/permissions/#elevated-permissions), so a caller who holds it with no enrolled authenticator receives 400 [`TWO_FACTOR_REQUIRED`](/http-api/errors/) in a guild whose [MFA level](/http-api/guilds/#mfa-levels) is elevated, unless they own the guild.-- A caller who does not hold the bit at all is treated as any other non-author and receives 403 `CANNOT_EDIT_OTHER_USER_MESSAGE`.-- Embeds require [EMBED_LINKS](/http-api/permissions/) and adding an upload requires [ATTACH_FILES](/http-api/permissions/).-- A concurrent edit can fail with 429 `RESOURCE_LOCKED` and `Retry-After: 1`.-- A [published](#crosspost-message) message has its own edit allowance, described below.+Edits a message and returns it, and Fluxer sends [Message Update](/gateway/events/#message-update). The author can change any field. Someone else with `MANAGE_MESSAGES` can only change `SUPPRESS_EMBEDS` and the title and alt text of existing attachments. The author of a [published](#crosspost-message) message can edit it 3 times in a row, then once every 20 minutes.-Published messages: 3 edits in a row, then one every 20 minutes, code `PUBLISHED_MESSAGE_EDIT_RATE_LIMITED`. Edits by other members with Manage Messages are not limited. The allowance is kept for each message and counts author edits, [Edit webhook message](/http-api/webhooks/#edit-webhook-message) calls, and [Delete message attachment](#delete-message-attachment) calls.--The body is read exactly as it is for [Create message](#create-message), so a `multipart/form-data` request is accepted with the same `payload_json` and `files[N]` fields. A file that is not uploaded directly must first be planned through [Request attachment upload URLs](#request-attachment-upload-urls) and then referenced by its `upload_filename`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel |-| message_id | snowflake | The ID of the message to modify |+The body works like [Create message](#create-message), including multipart. Fields you leave out stay the same.### JSON body| Field | Type | Description || --- | --- | --- |-| content? | ?string | Replacement text under the same effective limits as message creation |-| embeds?<sup>1</sup> | array[[rich embed](#rich-embed-object) object] | Replacement embed collection |-| allowed_mentions?<sup>2</sup> | ?[allowed mentions](#allowed-mentions-object) object | Replacement active mention policy |-| flags?<sup>3</sup> | integer | Replacement [message flags](#message-flags) |-| attachments?<sup>1</sup> | array[[pre-uploaded attachment](#pre-uploaded-attachment-object) object \| [existing attachment reference](#existing-attachment-reference-object) object] | Complete retained and added attachment collection |-| message_snapshots?<sup>4</sup> | array | Declared by the body schema and never accepted |--<sup>1</sup> Replaces the stored collection outright, so an existing embed or attachment that the array omits is removed. Both collections are bounded by the same resolved limits as message creation+| content? | ?string | The new text |+| embeds?<sup>1</sup> | array[[rich embed](#rich-embed-object) object] | The embeds |+| allowed_mentions? | ?[allowed mentions](#allowed-mentions-object) object | Which mentions notify anyone |+| flags? | integer | [Message flags](#message-flags) |+| attachments?<sup>1</sup> | array[[pre-uploaded attachment](#pre-uploaded-attachment-object) object \| [existing attachment reference](#existing-attachment-reference-object) object] | The attachments to keep and add |+| message_snapshots? | array | Not accepted, and returns 403 `MISSING_PERMISSIONS` |-<sup>2</sup> Defaults to the stored reply mention state when omitted, so an edit that does not name a policy neither adds nor removes the reply mention of the referenced author--<sup>3</sup> Only the bits in [message flags](#message-flags) are retained, and the message keeps every other stored bit unchanged--<sup>4</sup> A request that supplies it is rejected with 403 `MISSING_PERMISSIONS`, so snapshot metadata cannot be edited through this route--An omitted field preserves its stored value, and the message's `edited_timestamp` advances only when `content` changes. The request itself must supply at least one of content with visible characters, an embed, an attachment, or `flags`, and one that supplies none of them fails with 400 `CANNOT_SEND_EMPTY_MESSAGE`.--:::caution[Supplying attachments replaces the whole collection]-Any attachment left out is dropped, so list an existing ID again to retain it. The same array adds new attachments as [pre-uploaded attachment](#pre-uploaded-attachment-object) entries. The same rule applies to `embeds`.-:::--An `id` that names no attachment on the message is skipped, and the edit still succeeds.+<sup>1</sup> Replaces the whole list, so include every existing item you want to keep### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [message](#message-object) object | Message was modified |-| 400 | [error response](/http-api/#error-response) | Body, message type, attachment, embed, or resulting payload is invalid, or the author is editing a message that has snapshots and the request returns `MESSAGES_WITH_SNAPSHOTS_CANNOT_BE_EDITED` |-| 400 | [error response](/http-api/#error-response) | Thread is archived and the request returns `THREAD_ARCHIVED` |-| 400 | [error response](/http-api/#error-response) | Thread is locked and the caller is not a thread moderator, returning `THREAD_LOCKED` |-| 403 | [error response](/http-api/#error-response) | Caller is not the author and cannot moderate the message and the request returns `CANNOT_EDIT_OTHER_USER_MESSAGE` |-| 403 | [error response](/http-api/#error-response) | The caller supplied `message_snapshots` or lacks `EMBED_LINKS` or `ATTACH_FILES` and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The caller is timed out and the request returns `COMMUNICATION_DISABLED` |-| 403 | [error response](/http-api/#error-response) | The caller is age restricted from the channel and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 403 | [error response](/http-api/#error-response) | Message sending is temporarily disabled for the guild and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 403 | [error response](/http-api/#error-response) | A limited author edits a direct message the other account has not written in and the request returns `NEW_CONVERSATIONS_LIMITED` |-| 403 | [error response](/http-api/#error-response) | The account is [limited](/http-api/users/#account-limitation), the channel is not its personal notes channel, and the request returns `ACCOUNT_LIMITED` |-| 404 | [error response](/http-api/#error-response) | Channel or message does not exist |-| 429 | [error response](/http-api/#error-response) | The published message edit allowance is used up, returning `PUBLISHED_MESSAGE_EDIT_RATE_LIMITED` |--### Side effects+| 200 | [message](#message-object) object | The message was edited |+| 400 | [error response](/http-api/#error-response) | `CANNOT_MODIFY_SYSTEM_WEBHOOK` for a system message |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` with `MESSAGES_WITH_SNAPSHOTS_CANNOT_BE_EDITED` for a forwarded message |+| 400 | [error response](/http-api/#error-response) | `THREAD_ARCHIVED` or `THREAD_LOCKED` in a thread |+| 403 | [error response](/http-api/#error-response) | `CANNOT_EDIT_OTHER_USER_MESSAGE` when you can't edit someone else's message |+| 429 | [error response](/http-api/#error-response) | `PUBLISHED_MESSAGE_EDIT_RATE_LIMITED` for a published message |-The operation updates the message, advances its edit timestamp when `content` changed, attaches every newly referenced upload, and drops each attachment the request did not retain. It recalculates mentions when `content`, `allowed_mentions`, or `embeds` changed, updates search results when the channel is indexed, and resolves newly added eligible URLs into embeds.--It emits [Message Update](/gateway/events/#message-update) to every session that can see the channel. It writes no audit log entry, even for a moderator edit.--An edit of a published message, including a moderator edit, reaches every copy of it in the background. Fluxer batches the edits of one message into 10-second windows and copies the latest state once per window. A moderator in a following channel can set `SUPPRESS_EMBEDS` on a copy, and the next copied edit of the published message overwrites it.--### Rate limit--20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:message:update::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:message:update::channel_id` bucket.## Crosspost message<RouteHeader method="POST" path="/v1/channels/{channel_id}/messages/{message_id}/crosspost" bot />-Publishes a message in an announcement channel to every channel that follows it, and returns the updated [message](#message-object) object with the `CROSSPOSTED` [flag](#message-flags). Emits a [Message Update](/gateway/events/#message-update) Gateway event. The copies are delivered in the background after the response. [Announcement channels](/topics/announcement-channels/) describes what is copied.--### Limitations--- The channel must be an announcement channel, and the caller needs [VIEW_CHANNEL](/http-api/permissions/) and [SEND_MESSAGES](/http-api/permissions/) in it.-- The author can publish their own message, and a timed-out author is refused with 403 `COMMUNICATION_DISABLED`.-- Publishing another member's message, or a webhook's, also requires [MANAGE_MESSAGES](/http-api/permissions/).-- A caller who publishes another member's message without [READ_MESSAGE_HISTORY](/http-api/permissions/) can publish only a message newer than the guild's message history cutoff.-- Only a `DEFAULT` message with no `message_snapshots` can be published. A reply, a forward, a system message, and a copy of a published message cannot.-- A message is published once.-- Content, rich embed text, and attachment hashes that match the instance blocklists are refused with 403 `CONTENT_BLOCKED`.--`MANAGE_MESSAGES` is an [elevated permission](/http-api/permissions/#elevated-permissions), so a caller who holds it with no enrolled authenticator receives 400 [`TWO_FACTOR_REQUIRED`](/http-api/errors/) in a guild whose [MFA level](/http-api/guilds/#mfa-levels) is elevated, unless they own the guild.+Publishes a message in an announcement channel to every channel that follows it, and returns the message with the `CROSSPOSTED` flag. You need `SEND_MESSAGES`, and `MANAGE_MESSAGES` for someone else's message. Only a `DEFAULT` message that isn't a forward can be published, and only once. [Announcement channels](/topics/announcement-channels/) describes the copies.-Each announcement channel can publish 10 messages in a row, then one every 6 minutes. The allowance is shared by every member, and Fluxer counts a publish only after every other check passes. A denial returns 429 `MESSAGE_CROSSPOST_RATE_LIMITED` with `X-RateLimit-Scope: shared`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the announcement channel |-| message_id | snowflake | The ID of the message to publish |+Each announcement channel can publish 10 messages in a row, then one every 6 minutes.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [message](#message-object) object | Message was published |-| 400 | [error response](/http-api/#error-response) | The channel is not an announcement channel, returning `ANNOUNCEMENT_CHANNEL_REQUIRED` |-| 400 | [error response](/http-api/#error-response) | The message type or shape cannot be published, returning `MESSAGE_NOT_CROSSPOSTABLE` |-| 400 | [error response](/http-api/#error-response) | The message was already published, returning `MESSAGE_ALREADY_CROSSPOSTED` |-| 403 | [error response](/http-api/#error-response) | A required permission is absent, returning `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The author is timed out, returning `COMMUNICATION_DISABLED` |-| 403 | [error response](/http-api/#error-response) | The message matches an instance blocklist, returning `CONTENT_BLOCKED` |-| 403<sup>1</sup> | [error response](/http-api/#error-response) | Publishing is disabled for the guild, returning `FEATURE_TEMPORARILY_DISABLED` |-| 403 | [error response](/http-api/#error-response) | The account is [limited](/http-api/users/#account-limitation) and the request returns `ACCOUNT_LIMITED` |-| 404 | [error response](/http-api/#error-response) | Channel or message does not exist, or is older than the caller's history cutoff |-| 429<sup>2</sup> | [error response](/http-api/#error-response) | The channel publish allowance is used up |-| 429 | [error response](/http-api/#error-response) | A concurrent change holds the message, returning `RESOURCE_LOCKED` |-| 503 | [error response](/http-api/#error-response) | The delivery queue is full, returning `SERVICE_UNAVAILABLE` |--<sup>1</sup> Returned when message sending is disabled for the guild, or the guild has [ANNOUNCEMENT_CHANNELS_DISABLED](/http-api/guilds/#guild-features)--<sup>2</sup> `MESSAGE_CROSSPOST_RATE_LIMITED`, with the [rate limit response](/topics/rate-limits/#rate-limit-response-object) members--A 503 leaves the message unpublished, and the publish it counted stays counted.--### Side effects+| 200 | [message](#message-object) object | The message was published |+| 400 | [error response](/http-api/#error-response) | `ANNOUNCEMENT_CHANNEL_REQUIRED` for another channel type |+| 400 | [error response](/http-api/#error-response) | `MESSAGE_NOT_CROSSPOSTABLE` for a message that can't be published |+| 400 | [error response](/http-api/#error-response) | `MESSAGE_ALREADY_CROSSPOSTED` when it's already published |+| 403 | [error response](/http-api/#error-response) | `CONTENT_BLOCKED` when the message matches an instance blocklist |+| 429 | [error response](/http-api/#error-response) | `MESSAGE_CROSSPOST_RATE_LIMITED` when the channel has published too many |-The operation sets `CROSSPOSTED` on the message without changing its `edited_timestamp`, and emits [Message Update](/gateway/events/#message-update) in the announcement channel. Fluxer then creates one copy in each following channel through its [channel follower webhook](/http-api/webhooks/#webhook-types), each announced by [Message Create](/gateway/events/#message-create) in that channel. A copy has the `IS_CROSSPOST` flag, a `DEFAULT` `message_reference` to the published message, and no mentions.--Publishing writes no audit log entry.--### Rate limit--5 requests per 5 seconds for each authenticated user and channel ID, on the `channel:message:crosspost::channel_id` bucket. The channel publish allowance above applies on top of it.+The rate limit is 5 requests per 5 seconds, on the `channel:message:crosspost::channel_id` bucket.## Get message crosspost source<RouteHeader method="GET" path="/v1/channels/{channel_id}/messages/{message_id}/crosspost-source" bot />-Returns the public profile of the guild a copy of a published message came from, as a [crosspost source](#crosspost-source-object) object. Clients use it to show the source guild of a copy to a reader who is not a member of that guild. Requires [VIEW_CHANNEL](/http-api/permissions/) in the channel of the copy.--### Limitations--- The caller needs the same access as [Get message](#get-message), so a message outside the caller's message history cutoff is reported as 404 `UNKNOWN_MESSAGE`.-- The message must be a copy with the `IS_CROSSPOST` [flag](#message-flags), or the `CHANNEL_FOLLOW_ADD` [system message](#message-types) posted when the channel followed an announcement channel. Any other message returns 404 `UNKNOWN_MESSAGE`.-- The response never says whether the caller is a member of the source guild, and it names no channel of that guild.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel that holds the copy |-| message_id | snowflake | The ID of the copy or of the `CHANNEL_FOLLOW_ADD` message |--### Crosspost source object--| Field | Type | Description |-| --- | --- | --- |-| guild | [crosspost source guild](#crosspost-source-guild-object) object | The guild the message was published from |--### Crosspost source guild object--| Field | Type | Description |-| --- | --- | --- |-| id | snowflake | The ID of the source guild |-| name | string | The name of the source guild |-| icon | ?string | The hash of the source guild icon |-| banner | ?string | The hash of the source guild banner |-| description | ?string | The discovery description of the source guild, or null when the guild is not listed in discovery |-| features | array of strings | The badge [features](/http-api/guilds/#guild-features) of the source guild, limited to `VERIFIED`, `PARTNERED`, and `DISCOVERABLE` |-| approximate_member_count | ?integer | Approximate member count, or null when Fluxer cannot count the guild right now |-| approximate_presence_count | ?integer | Approximate online member count, or null when Fluxer cannot count the guild right now |-| discoverable | boolean | Whether the caller can join the guild through [Join discovery guild](/http-api/discovery/#join-discovery-guild) |--`discoverable` is true when discovery is on for the instance, the guild is listed in discovery, and its invites are not disabled. The counts are cached for 60 seconds per guild.+Returns the guild a published copy came from, for a message with `IS_CROSSPOST` or a `CHANNEL_FOLLOW_ADD` message. You don't need to be a member of that guild.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [crosspost source](#crosspost-source-object) object | The source guild was returned |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL`, returning `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | Caller lacks age verification for the channel, returning `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or the caller cannot see it, returning `UNKNOWN_CHANNEL` |-| 404 | [error response](/http-api/#error-response) | Message does not exist, is outside the caller's history cutoff, or is not eligible, returning `UNKNOWN_MESSAGE` |-| 404 | [error response](/http-api/#error-response) | The source guild was deleted, returning `UNKNOWN_GUILD` |--### Rate limit+| 200 | [crosspost source](#crosspost-source-object) object | The guild was returned |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_MESSAGE` for any other message |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_GUILD` when the guild was deleted |-20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:message:crosspost_source::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:message:crosspost_source::channel_id` bucket.## Clear channel read state<RouteHeader method="DELETE" path="/v1/channels/{channel_id}/messages/ack" bot />-The operation is deprecated and changes no read state. Returns 204 with an empty body.--### Limitations--- Fluxer never checks that the channel exists. An unknown channel ID returns 204.-- The read state entry of the channel stays as it was.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of a channel |+This route is deprecated, and it returns 204 without changing anything.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Request was accepted |-| 403 | [error response](/http-api/#error-response) | Credential type denies the request and it returns `ACCESS_DENIED` |--### Side effects--The operation changes no read state and emits no Gateway Dispatch.--### Rate limit+| 204 | empty | Always |-40 requests per 10 seconds for each authenticated user and channel ID, on the `channel:read_state:delete::channel_id` bucket.+The rate limit is 40 requests per 10 seconds, on the `channel:read_state:delete::channel_id` bucket.## Delete message<RouteHeader method="DELETE" path="/v1/channels/{channel_id}/messages/{message_id}" bot auditReason />-Deletes one message. Returns 204 with an empty body on success. Emits a [Message Delete](/gateway/events/#message-delete) Gateway event.--### Limitations--- The target must be a deletable [message type](#message-types).-- The author can delete their own message anywhere.-- Deleting another user's guild message requires both [SEND_MESSAGES](/http-api/permissions/) and [MANAGE_MESSAGES](/http-api/permissions/), which is an [elevated permission](/http-api/permissions/#elevated-permissions). No caller can delete another user's private channel message.-- A caller who holds `MANAGE_MESSAGES` with no enrolled authenticator receives 400 [`TWO_FACTOR_REQUIRED`](/http-api/errors/) in a guild whose [MFA level](/http-api/guilds/#mfa-levels) is elevated, unless they own the guild.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel |-| message_id | snowflake | The ID of the message to delete |+Deletes a message and its attachments, and Fluxer sends [Message Delete](/gateway/events/#message-delete). You can delete your own messages, and someone else's message in a guild needs `MANAGE_MESSAGES`. Only `DEFAULT`, `REPLY`, `CHANNEL_PINNED_MESSAGE`, `USER_JOIN`, `CHANNEL_FOLLOW_ADD` and `THREAD_CREATED` messages can be deleted. In a guild, every delete adds a `MESSAGE_DELETE` audit log entry.-:::danger[Deleting a message destroys its attachments too]-There is no grace period and no restore operation.-:::+Deleting a [published](#crosspost-message) message replaces each copy with `[Original message deleted]` and sets `SOURCE_MESSAGE_DELETED`.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Message was deleted |-| 403 | [error response](/http-api/#error-response) | Caller lacks authorship or the required guild permissions, or the message type is not deletable, each returning `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The caller lacks age verification for the channel and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 403 | [error response](/http-api/#error-response) | Message sending is temporarily disabled for the guild and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 404 | [error response](/http-api/#error-response) | Channel or message does not exist |--### Side effects--The operation permanently deletes the message, its reactions, and its attachments and removes it from search.--Deleting a message that started a thread keeps the thread, as [Thread messages](/http-api/threads/#thread-messages) describes. Deleting a message in a thread lowers the `message_count` of the thread, except for the first message of a forum or media post.--Deleting a [published](#crosspost-message) message keeps each copy of it in the following channels and turns it into a placeholder in the background. The content of the placeholder is `[Original message deleted]`, its attachments, embeds, and stickers are removed, its `edited_timestamp` is set, and it has the `SOURCE_MESSAGE_DELETED` [flag](#message-flags). Deleting a copy removes that copy alone.--It emits [Message Delete](/gateway/events/#message-delete) to every session that can see the channel. When the message was pinned, it also removes the channel pin entry and emits [Channel Pins Update](/gateway/events/#channel-pins-update) with the channel's unchanged last-pin timestamp.--Every deletion in a guild channel writes one `MESSAGE_DELETE` guild audit log entry with the supplied reason, including deletion of the caller's own message.--### Rate limit+| 204 | empty | The message was deleted |-20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:message:delete::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:message:delete::channel_id` bucket.## Delete message attachment<RouteHeader method="DELETE" path="/v1/channels/{channel_id}/messages/{message_id}/attachments/{attachment_id}" bot />-Deletes one attachment from the caller's own message. Returns 204 with an empty body on success. Emits a [Message Update](/gateway/events/#message-update) Gateway event.--### Limitations--- Only the message author can use this operation, and a guild moderator must use [Modify message](#modify-message) instead.-- This route cannot address an attachment that a resolved embed owns.-- When the attachment is the message's only attachment and the message has no content, embeds, or stickers, Fluxer deletes the whole message with the [Delete message](#delete-message) effects.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel |-| message_id | snowflake | The ID of the owning message |-| attachment_id | snowflake | The ID of the attachment to delete |--:::caution[Removing the last payload deletes the message]-The response is 204 whether the message survives or is deleted, so the emitted Gateway Dispatch is the only signal that tells the two apart.-:::+Deletes one attachment from your own message, and Fluxer sends [Message Update](/gateway/events/#message-update). When it's the last thing in the message, Fluxer deletes the whole message and sends [Message Delete](/gateway/events/#message-delete) instead.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Attachment or resulting empty message was deleted |-| 403 | [error response](/http-api/#error-response) | Caller is not the message author and the request returns `MISSING_PERMISSIONS`, or message sending is temporarily disabled for the guild and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 404 | [error response](/http-api/#error-response) | Channel or message does not exist, or the message has no such addressable attachment |--### Side effects--The operation permanently deletes the stored attachment object, purges it from media delivery, removes it from the message, and advances the message's edit timestamp. On a [published](#crosspost-message) message it counts towards the published message edit allowance described under [Modify message](#modify-message), and a denial returns 429 `PUBLISHED_MESSAGE_EDIT_RATE_LIMITED`. It then emits [Message Update](/gateway/events/#message-update) to every session that can see the channel. When the removed attachment was the message's only attachment and the message has no content, embeds, or stickers, Fluxer deletes the whole message instead, with the complete [Delete message](#delete-message) effect set, including its Dispatches and guild audit log entry.+| 204 | empty | The attachment was deleted |-### Rate limit--20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:message:delete::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:message:delete::channel_id` bucket.## Bulk delete messages<RouteHeader method="POST" path="/v1/channels/{channel_id}/messages/bulk-delete" bot auditReason mfa />-Deletes from 1 through 100 messages in one guild channel. Returns 204 with an empty body on success. Emits one [Message Delete Bulk](/gateway/events/#message-delete-bulk) Gateway event.--### Limitations--- The channel must belong to a guild, and a private channel fails with 400 `CANNOT_EXECUTE_ON_DM`.-- The caller requires [MANAGE_MESSAGES](/http-api/permissions/), which is an [elevated permission](/http-api/permissions/#elevated-permissions).-- A caller who holds `MANAGE_MESSAGES` with no enrolled authenticator receives 400 [`TWO_FACTOR_REQUIRED`](/http-api/errors/) in a guild whose [MFA level](/http-api/guilds/#mfa-levels) is elevated, unless they own the guild.-- The operation applies no age boundary, so a message of any age can be selected.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the guild channel |+Deletes up to 100 messages of any age in a guild channel and skips IDs that match nothing. You need `MANAGE_MESSAGES`. Fluxer sends one [Message Delete Bulk](/gateway/events/#message-delete-bulk) and adds one `MESSAGE_BULK_DELETE` audit log entry.### JSON body| Field | Type | Description || --- | --- | --- |-| message_ids?<sup>1</sup> | array[snowflake] | Message IDs to delete, at most 100 entries |-| messages?<sup>1</sup> | array[snowflake] | Alias for `message_ids` |--<sup>1</sup> An empty array fails with the field code `MESSAGE_IDS_CANNOT_BE_EMPTY` on the path `message_ids`. More than 100 entries is rejected by body validation with 400 `INVALID_FORM_BODY` before the operation runs--:::danger[Bulk deletion removes attachments and search entries]-Every selected message, with its reactions and attachments, is permanently deleted and removed from search.-:::--An ID that names no message in the channel is skipped, so a partially matching request still deletes every matching message. When no ID matches, the request returns 204 without deleting anything, emitting a Dispatch, or writing an audit log entry.+| message_ids? | array[snowflake] | The messages to delete (1-100) |+| messages? | array[snowflake] | Another name for `message_ids` |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Messages were deleted |-| 400 | [error response](/http-api/#error-response) | Body or entry count is invalid, the selection is empty and the request returns `MESSAGE_IDS_CANNOT_BE_EMPTY`, or the channel is a private channel and the request returns `CANNOT_EXECUTE_ON_DM` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `MANAGE_MESSAGES` and the request returns `MISSING_PERMISSIONS`, or the caller lacks age verification for the channel and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist |+| 204 | empty | The messages were deleted |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` with `MESSAGE_IDS_CANNOT_BE_EMPTY` when the list is empty |+| 400 | [error response](/http-api/#error-response) | `CANNOT_EXECUTE_ON_DM` in a private channel |-### Side effects--The operation permanently removes every selected message, attachment, and reaction and removes each message from search.--When at least one ID matched, it emits one [Message Delete Bulk](/gateway/events/#message-delete-bulk) with every requested ID to sessions that can see the channel, including an ID that matched nothing. In a thread the Dispatch has only the IDs that matched a message. It emits no [Channel Pins Update](/gateway/events/#channel-pins-update) and no individual [Message Delete](/gateway/events/#message-delete).--It writes one `MESSAGE_BULK_DELETE` guild audit log entry with the matched count and the supplied reason.--### Rate limit--10 requests per 10 seconds for each authenticated user and channel ID, on the `channel:message:bulk_delete::channel_id` bucket.+The rate limit is 10 requests per 10 seconds, on the `channel:message:bulk_delete::channel_id` bucket.## Purge personal notes<RouteHeader method="POST" path="/v1/channels/{channel_id}/messages/purge" bot />-Deletes every message in the authenticated user's personal notes channel. Returns the number that were removed. Emits a [Message Delete Bulk](/gateway/events/#message-delete-bulk) Gateway event.--### Limitations--- The channel must be the caller's own `DM_PERSONAL_NOTES` channel, and any other channel fails with 400 `INVALID_CHANNEL_TYPE`.--The response is returned only after deletion finishes, which can take longer for a large history.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the personal notes channel |+Deletes every message in your personal notes channel and can't be undone. Fluxer sends [Message Delete Bulk](/gateway/events/#message-delete-bulk) for every 100 messages.### Response body| Field | Type | Description || --- | --- | --- |-| deleted_count | integer | Number of messages removed by this request |--:::danger[Purging personal notes cannot be undone]-Deletion has no age boundary and no confirmation step, and there is no restore once it has started.-:::+| deleted_count | integer | The number of messages deleted |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Every personal note was deleted |-| 403 | [error response](/http-api/#error-response) | Credential type denies the request and it returns `ACCESS_DENIED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or the caller cannot resolve it |+| 200 | response body | The messages were deleted |+| 400 | [error response](/http-api/#error-response) | `INVALID_CHANNEL_TYPE` for any other channel |-### Side effects--The operation permanently deletes every personal note, its attachments, and its reactions and removes each from search. The caller's sessions receive one [Message Delete Bulk](/gateway/events/#message-delete-bulk) Dispatch for each page of at most 100 messages.--It emits no [Channel Pins Update](/gateway/events/#channel-pins-update) and no individual [Message Delete](/gateway/events/#message-delete), and it writes no audit log entry.--### Rate limit--2 requests per minute for each authenticated user and channel ID, on the `channel:message:purge::channel_id` bucket.+The rate limit is 2 requests per minute, on the `channel:message:purge::channel_id` bucket.## Bulk delete own messages<RouteHeader method="POST" path="/v1/channels/{channel_id}/messages/bulk-delete-mine" bot mfa />-Deletes every message the caller authored in one channel and in every thread under it, active or archived. Returns 202 with an empty body. Emits a [Message Delete Bulk](/gateway/events/#message-delete-bulk) Gateway event in each channel and thread that held such messages.--When `channel_id` is a thread, only that thread is cleared. For a forum or media channel, the deleted messages are the ones in its posts.--### Limitations--- User session and bot credentials are accepted, and a bot credential satisfies the sudo requirement without any proof.-- The caller must be able to resolve the channel and be in [sudo mode](/http-api/users/mfa/#sudo-mode), established by the `X-Fluxer-Sudo-Mode-JWT` header or by supplying a proof in the body.-- A caller who satisfies none of those receives 403 `SUDO_MODE_REQUIRED` with `has_mfa` and the available `methods`, which report `totp`, `webauthn`, and `backup_codes`.-- An account that holds no verifiable credential at all, meaning it is not a bot, has no TOTP secret, no registered WebAuthn credential, and no stored password, satisfies the sudo requirement with an empty body.--The deletion runs inside the request despite the 202 status, so every matching message is gone by the time the response is returned.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel or thread whose caller-authored messages are deleted |--### Request headers--| Field | Type | Description |-| --- | --- | --- |-| X-Fluxer-Sudo-Mode-JWT?<sup>1</sup> | string | Existing sudo mode proof |--<sup>1</sup> A valid header satisfies the sudo requirement on its own, and the body fields below are then unnecessary. The accepted proof is echoed back in the same response header+Deletes every message you sent in a channel and its threads, and can't be undone. For a thread, only that thread is cleared. You need [sudo mode](/http-api/users/mfa/#sudo-mode), from the `X-Fluxer-Sudo-Mode-JWT` header or the fields in the JSON body. Fluxer sends [Message Delete Bulk](/gateway/events/#message-delete-bulk) for every 100 messages.### JSON body| Field | Type | Description || --- | --- | --- |-| password?<sup>1</sup> | string | Account password proof |-| mfa_method?<sup>2</sup> | string | MFA method, one of `totp`, `webauthn` or `email_code` |-| mfa_code? | string | Authenticator code (1-32 characters), supplied with the `totp` method |-| webauthn_response? | [WebAuthn assertion](/http-api/authentication/#webauthn-assertion) object | WebAuthn assertion for sudo verification |-| webauthn_challenge? | string | Challenge bound to the sudo mode assertion |+| password? | string | Your password, when you have no MFA |+| mfa_method? | string | `totp`, `webauthn` or `email_code` |+| mfa_code? | string | The authenticator code (1-32 characters) |+| webauthn_response? | [WebAuthn assertion](/http-api/authentication/#webauthn-assertion) object | The WebAuthn assertion |+| webauthn_challenge? | string | The challenge for the assertion || email_code_ticket? | string | The ticket from [send a sudo email code](/http-api/users/mfa/#send-a-sudo-email-code) (1-128 characters) |-| email_code? | string | The 6-digit code from that email |--<sup>1</sup> Accepted only when the account has no enrolled authenticator, and an incorrect password fails with the field code `INVALID_PASSWORD`. An account with neither a stored password nor an enrolled authenticator never reaches this check--<sup>2</sup> Accepted only when the account has an enrolled authenticator. A failed verification returns the field code `INVALID_MFA_CODE`--:::danger[Every message the caller authored is destroyed]-The deletion has no age boundary and no selection. There is no cancellation and no restore.-:::+| email_code? | string | The 6-digit code from the email |### Response| Status | Body | Condition || --- | --- | --- |-| 202 | empty | Every caller-authored message in the channel was deleted |-| 403 | [error response](/http-api/#error-response) | Caller is not in sudo mode and the request returns `SUDO_MODE_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | The caller cannot view the guild channel and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The caller is age restricted from the channel and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or is unavailable |--### Side effects+| 202 | empty | The messages were deleted |+| 403 | [error response](/http-api/#error-response) | `SUDO_MODE_REQUIRED` when you're not in sudo mode |-Each matching message, with its attachments and reactions, is permanently deleted and removed from search. Fluxer emits one [Message Delete Bulk](/gateway/events/#message-delete-bulk) Dispatch for each batch of at most 100 deleted messages.--The operation emits no [Channel Pins Update](/gateway/events/#channel-pins-update) and no individual [Message Delete](/gateway/events/#message-delete), and it writes no guild audit log entry.--### Rate limit--10 requests per 10 seconds for each authenticated user and channel ID, on the `channel:message:bulk_delete::channel_id` bucket.+The rate limit is 10 requests per 10 seconds, on the `channel:message:bulk_delete::channel_id` bucket.## List pinned messages<RouteHeader method="GET" path="/v1/channels/{channel_id}/messages/pins" bot />-Returns a [channel pins page](#channel-pins-page-object) object holding one page of pinned messages and their pin times.--### Limitations--- The caller must be able to view the channel and must satisfy the channel's age verification requirement.-- The channel must be a text-bearing type.-- A guild caller without [READ_MESSAGE_HISTORY](/http-api/permissions/) sees only pins whose message falls on or after the guild's message history cutoff, and receives an empty page when the guild has no cutoff.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel whose pins are returned |+Returns a page of pinned messages, newest pin first.### Query parameters| Field | Type | Description || --- | --- | --- |-| limit? | integer | Number of pins to return (1-50, default 50) |-| before? | ISO8601 timestamp | Return pins pinned before this timestamp, defaulting to the current time |--:::caution[Pin pagination is timestamp-only]-The cursor has no message ID, so a client that pages with the `pinned_at` of the last item can see that item again when another pin shares its exact timestamp. A client must deduplicate pages by message ID.-:::+| limit? | integer | The number of pins to return (1-50, default 50) |+| before? | ISO8601 timestamp | Get pins pinned before this time |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [channel pins page](#channel-pins-page-object) object | Pin page was returned |-| 400 | [error response](/http-api/#error-response) | Path or cursor is invalid, or the channel has no messages and the request returns `CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL` |-| 400 | [error response](/http-api/#error-response) | Channel is a forum or media channel and the request returns `INVALID_CHANNEL_TYPE` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` and the request returns `MISSING_PERMISSIONS`, or the caller lacks age verification for the channel and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or the caller is not a recipient of the private channel |+| 200 | [channel pins page](#channel-pins-page-object) object | The pins were returned |+| 400 | [error response](/http-api/#error-response) | `INVALID_CHANNEL_TYPE` for a forum or media channel |-Acknowledging pins is a separate operation, [Acknowledge pins](#acknowledge-pins).--### Rate limit--20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:pins::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:pins::channel_id` bucket.## Pin message<RouteHeader method="PUT" path="/v1/channels/{channel_id}/pins/{message_id}" bot auditReason />-Pins a `DEFAULT` or `REPLY` message. Returns 204 with an empty body on success. Emits [Message Update](/gateway/events/#message-update), [Channel Pins Update](/gateway/events/#channel-pins-update), and [Message Create](/gateway/events/#message-create) Gateway events.--### Limitations--- A guild caller requires [PIN_MESSAGES](/http-api/permissions/) and channel access.-- A one-to-one direct message caller must satisfy the recipient's direct message policy, and one who may not send fails with 400 `CANNOT_SEND_MESSAGES_TO_USER`.-- A one-to-one direct message pin is refused with 403 `NEW_CONVERSATIONS_LIMITED` when the caller is under a [new conversation limit](/http-api/users/private-channels/#new-conversation-limit), the recipient is not a friend or a bot, and the recipient has not written in that direct message.-- A group direct message and the personal notes channel apply no send policy.-- The operation is idempotent.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel |-| message_id | snowflake | The ID of the message to pin |+Pins a `DEFAULT` or `REPLY` message. In a guild you need `PIN_MESSAGES`, and Fluxer adds a `MESSAGE_PIN` audit log entry. Fluxer posts a `CHANNEL_PINNED_MESSAGE` message and sends [Message Update](/gateway/events/#message-update), [Channel Pins Update](/gateway/events/#channel-pins-update) and [Message Create](/gateway/events/#message-create).### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Message was already pinned or was pinned |-| 400 | [error response](/http-api/#error-response) | Path is invalid and the request returns `INVALID_FORM_BODY` |-| 400 | [error response](/http-api/#error-response) | The channel has no messages and the request returns `CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL` |-| 400 | [error response](/http-api/#error-response) | The target is a system message and the request returns `CANNOT_MODIFY_SYSTEM_WEBHOOK` |-| 400 | [error response](/http-api/#error-response) | The private channel's send policy denies the caller and the request returns `CANNOT_SEND_MESSAGES_TO_USER` |-| 400 | [error response](/http-api/#error-response) | Thread is archived and the request returns `THREAD_ARCHIVED` |-| 400 | [error response](/http-api/#error-response) | Thread is locked and the caller is not a thread moderator, returning `THREAD_LOCKED` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` or `PIN_MESSAGES` and the request returns `MISSING_PERMISSIONS`, or message sending is temporarily disabled for the guild and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 403 | [error response](/http-api/#error-response) | The caller is under a new conversation limit in a direct message the recipient has not written in, and the request returns `NEW_CONVERSATIONS_LIMITED` |-| 403 | [error response](/http-api/#error-response) | Caller is timed out in a thread and the request returns `COMMUNICATION_DISABLED` |-| 404 | [error response](/http-api/#error-response) | Channel or message does not exist |--### Side effects--Pinning a message that is not already pinned sets its pin timestamp, advances the channel's last-pin timestamp, and stores a new `CHANNEL_PINNED_MESSAGE` system message authored by the caller and referencing the pinned message.+| 204 | empty | The message is pinned |+| 400 | [error response](/http-api/#error-response) | `CANNOT_MODIFY_SYSTEM_WEBHOOK` for a system message |+| 400 | [error response](/http-api/#error-response) | `CANNOT_SEND_MESSAGES_TO_USER` when the recipient's DM settings block you |-It emits [Message Update](/gateway/events/#message-update) for the target, [Channel Pins Update](/gateway/events/#channel-pins-update) for the channel, and [Message Create](/gateway/events/#message-create) for the system message, each to every session that can see the channel.--A guild pin also writes one `MESSAGE_PIN` guild audit log entry with the supplied reason. Pinning an already pinned message changes nothing and emits no Dispatch.--### Rate limit--20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:pins::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:pins::channel_id` bucket.## Unpin message<RouteHeader method="DELETE" path="/v1/channels/{channel_id}/pins/{message_id}" bot auditReason />-Unpins a message. Returns 204 with an empty body on success. Emits [Message Update](/gateway/events/#message-update) and [Channel Pins Update](/gateway/events/#channel-pins-update) Gateway events.--### Limitations--- Authorisation is exactly the same as [Pin message](#pin-message).-- The operation is idempotent.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel |-| message_id | snowflake | The ID of the message to unpin |+Unpins a message, with the same permissions as [Pin message](#pin-message). Fluxer sends [Message Update](/gateway/events/#message-update) and [Channel Pins Update](/gateway/events/#channel-pins-update), and in a guild adds a `MESSAGE_UNPIN` audit log entry.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Message was already unpinned or was unpinned |-| 400 | [error response](/http-api/#error-response) | Path is invalid and the request returns `INVALID_FORM_BODY` |-| 400 | [error response](/http-api/#error-response) | The channel has no messages and the request returns `CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL` |-| 400 | [error response](/http-api/#error-response) | The target is a system message and the request returns `CANNOT_MODIFY_SYSTEM_WEBHOOK` |-| 400 | [error response](/http-api/#error-response) | The private channel's send policy denies the caller and the request returns `CANNOT_SEND_MESSAGES_TO_USER` |-| 400 | [error response](/http-api/#error-response) | Thread is archived and the request returns `THREAD_ARCHIVED` |-| 400 | [error response](/http-api/#error-response) | Thread is locked and the caller is not a thread moderator, returning `THREAD_LOCKED` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` or `PIN_MESSAGES` and the request returns `MISSING_PERMISSIONS`, or message sending is temporarily disabled for the guild and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 403 | [error response](/http-api/#error-response) | Caller is timed out in a thread and the request returns `COMMUNICATION_DISABLED` |-| 404 | [error response](/http-api/#error-response) | Channel or message does not exist |--### Side effects--Unpinning a pinned message clears its pin timestamp and emits [Message Update](/gateway/events/#message-update) and [Channel Pins Update](/gateway/events/#channel-pins-update) to every session that can see the channel. A guild unpin also writes one `MESSAGE_UNPIN` guild audit log entry with the supplied reason.--It creates no system message. The `CHANNEL_PINNED_MESSAGE` system message the original pin created stays in the channel, and the channel's last-pin timestamp is unchanged.--### Rate limit+| 204 | empty | The message isn't pinned |+| 400 | [error response](/http-api/#error-response) | `CANNOT_MODIFY_SYSTEM_WEBHOOK` for a system message |-20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:pins::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:pins::channel_id` bucket.## Acknowledge pins<RouteHeader method="POST" path="/v1/channels/{channel_id}/pins/ack" bot />-Records the channel's current pin timestamp in the authenticated identity's read state. Returns 204 with an empty body. Emits a [Channel Pins ACK](/gateway/events/#channel-pins-ack) Gateway event.--The request has no body. Fluxer acknowledges the channel's own stored last-pin timestamp.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel whose current pin state is acknowledged |--:::note[The channel is read without an access check]-A channel the caller cannot see is acknowledged like any other whenever it stores a last-pin timestamp.-:::--A thread is the exception. Fluxer checks that the caller can view it, as [Channel resolution](#channel-resolution) describes. A forum or media channel returns 400 `INVALID_CHANNEL_TYPE`. A user request without the [`channel_threads` client capability](/http-api/threads/#client-capability) returns 204 for a thread, a forum channel, or a media channel and writes nothing.+Marks the channel's pins as seen, and Fluxer sends [Channel Pins ACK](/gateway/events/#channel-pins-ack) to your sessions.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Pin state was absent or acknowledged |-| 400 | [error response](/http-api/#error-response) | Channel is a forum or media channel and the request returns `INVALID_CHANNEL_TYPE` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` in the parent of a thread, or cannot view a private thread, each returning `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | Credential type denies the request and it returns `ACCESS_DENIED` |+| 204 | empty | The pins were acknowledged |+| 400 | [error response](/http-api/#error-response) | `INVALID_CHANNEL_TYPE` for a forum or media channel |-### Side effects--When the channel stores a last-pin timestamp, Fluxer writes that exact instant to the caller's read state. It then emits one [Channel Pins ACK](/gateway/events/#channel-pins-ack) with the channel ID and that timestamp to the caller's own sessions. The write replaces the stored value. Fluxer writes nothing and emits nothing when the channel does not exist or has never held a pin.--When the Dispatch fails, the request returns 502, 503, or 504 after the read-state write has landed. A client treats those statuses as unknown and reconciles from a later read.--### Rate limit--20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:pins::channel_id` bucket, which is shared with [List pinned messages](#list-pinned-messages), [Pin message](#pin-message), and [Unpin message](#unpin-message).+The rate limit is 20 requests per 10 seconds, on the `channel:pins::channel_id` bucket.## Reaction emoji path value-The `emoji` path value is URI-encoded and is 1 through 64 characters. A custom emoji uses `name:id`, where `id` is the trailing decimal custom emoji snowflake and `name` is everything before the final colon. Any other decoded value is read as a Unicode emoji.--Fluxer validates the emoji in full only when a request would create a new reaction group on the message. At that point a Unicode value must be exactly one valid emoji, and one that is not fails with the field code `NOT_A_VALID_UNICODE_EMOJI`. A custom emoji must exist, and one that does not fails with the field code `CUSTOM_EMOJI_NOT_FOUND`. Every other reaction operation parses the value without validating it, so removing a reaction with an invalid emoji succeeds silently.--Every reaction operation is idempotent and writes no audit log entry. Every removal route emits its Dispatch whether or not the message held the reaction, group, or reactions the request names. [Add own reaction](#add-own-reaction), [Remove own reaction](#remove-own-reaction), and [Remove another user's reaction](#remove-another-users-reaction) each accept a `session_id` query parameter, which is echoed in that route's Dispatch so the originating session can match its own optimistic update, and it never affects authorisation or the stored reaction.+The `{emoji}` path value is URL-encoded and 1-64 characters long. Use `name:id` for a custom emoji and the emoji itself for a Unicode emoji.## List reaction users unpaged<RouteHeader method="GET" path="/v1/channels/{channel_id}/messages/{message_id}/reactions/{emoji}" bot />-Returns a bare array of [partial user](/http-api/users/#partial-user-object) objects for one reaction.--### Limitations--- Authorisation, query parameters, and ordering are exactly those of [List reaction users](#list-reaction-users), and the array is the same page that operation returns in its `items` field.--The pagination signal is in the response headers. `X-Has-More` is `true` or `false`. `X-Next-After` is the ID of the last user in the array, and it is absent when no further page exists. [List reaction users](#list-reaction-users) returns the same users with both values in the body.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel |-| message_id | snowflake | The ID of the message |-| emoji | string | URI-encoded [reaction emoji path value](#reaction-emoji-path-value) |+Returns the users who reacted with an emoji, as a plain array. The `X-Has-More` and `X-Next-After` headers have the paging values that [List reaction users](#list-reaction-users) returns in the body.### Query parameters| Field | Type | Description || --- | --- | --- |-| limit? | integer | Number of users to return (1-100, default 25) |-| after? | snowflake | Return users after this user ID cursor |+| limit? | integer | The number of users to return (1-100, default 25) |+| after? | snowflake | Get users after this user ID |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | array[[partial user](/http-api/users/#partial-user-object) object] | Reaction users were returned |-| 400 | [error response](/http-api/#error-response) | Path, emoji, or pagination input is invalid, or the channel has no messages and the request returns `CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` and the request returns `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Channel or message does not exist, or the message is outside the caller's message history cutoff |+| 200 | array[[partial user](/http-api/users/#partial-user-object) object] | The users were returned |-An emoji with no reaction group on the message returns 200 with an empty array.--### Rate limit--30 requests per 10 seconds for each authenticated user and channel ID, on the `channel:reactions::channel_id` bucket.+The rate limit is 30 requests per 10 seconds, on the `channel:reactions::channel_id` bucket.## List reaction users<RouteHeader method="GET" path="/v1/channels/{channel_id}/messages/{message_id}/reactions/{emoji}/users" bot />-Returns a [reaction users page](#reaction-users-page-object) object holding the users who added one reaction.--### Limitations--- The caller must be able to view the channel, and the channel must be a text-bearing type.-- A guild caller without [READ_MESSAGE_HISTORY](/http-api/permissions/) can read only a message on or after the guild's message history cutoff.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel |-| message_id | snowflake | The ID of the message |-| emoji | string | URI-encoded [reaction emoji path value](#reaction-emoji-path-value) |+Returns a page of the users who reacted with an emoji.### Query parameters| Field | Type | Description || --- | --- | --- |-| limit? | integer | Number of users to return (1-100, default 25) |-| after? | snowflake | Return users after this user ID cursor |+| limit? | integer | The number of users to return (1-100, default 25) |+| after? | snowflake | Get users after this user ID |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [reaction users page](#reaction-users-page-object) object | Reaction users were returned |-| 400 | [error response](/http-api/#error-response) | Path, emoji, or pagination input is invalid, or the channel has no messages and the request returns `CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` and the request returns `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Channel or message does not exist, or the message is outside the caller's message history cutoff |--An emoji with no reaction group on the message returns 200 with an empty `items` array, `has_more` false, and a null `next_after`.--### Rate limit+| 200 | [reaction users page](#reaction-users-page-object) object | The users were returned |-30 requests per 10 seconds for each authenticated user and channel ID, on the `channel:reactions::channel_id` bucket.+The rate limit is 30 requests per 10 seconds, on the `channel:reactions::channel_id` bucket.## Add own reaction<RouteHeader method="PUT" path="/v1/channels/{channel_id}/messages/{message_id}/reactions/{emoji}/@me" bot />-Adds the authenticated identity's reaction. Returns 204 with an empty body. Emits a [Message Reaction Add](/gateway/events/#message-reaction-add) Gateway event.--### Limitations--- The caller must be able to view the text-bearing channel, must not be timed out. A guild caller without [READ_MESSAGE_HISTORY](/http-api/permissions/) can react only to a message on or after the guild's message history cutoff, and to no message when the guild has no cutoff.-- A non-bot caller must have a verified email, and one that does not receives 403 `REACTION_EMAIL_VERIFICATION_REQUIRED`.-- Creating a new emoji reaction group in a guild requires [ADD_REACTIONS](/http-api/permissions/), while adding to an existing group does not.-- A custom emoji whose source guild is not the channel's guild requires the `feature_global_expressions` entitlement, and a caller without it receives the field code `CUSTOM_EMOJIS_REQUIRE_PREMIUM_OUTSIDE_SOURCE`.-- In a guild channel a custom emoji also requires [USE_EXTERNAL_EMOJIS](/http-api/permissions/).-- A non-bot caller must have started a session, and one that has not receives the field code `MUST_START_SESSION_BEFORE_SENDING`.-- An unclaimed account can react only in its personal notes channel, and elsewhere receives 400 `UNCLAIMED_ACCOUNT_CANNOT_ADD_REACTIONS`.-- This route applies no direct message send policy. A one-to-one direct message reaction is still refused with 403 `NEW_CONVERSATIONS_LIMITED` when the caller is under a [new conversation limit](/http-api/users/private-channels/#new-conversation-limit), the recipient is not a friend or a bot, and the recipient has not written in that direct message.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel |-| message_id | snowflake | The ID of the message |-| emoji | string | URI-encoded [reaction emoji path value](#reaction-emoji-path-value) |+Adds your reaction, and Fluxer sends [Message Reaction Add](/gateway/events/#message-reaction-add). In a guild, adding a new emoji needs `ADD_REACTIONS`, and a custom emoji also needs `USE_EXTERNAL_EMOJIS`. Using another guild's emoji needs the `feature_global_expressions` limit. Your account needs a verified email.### Query parameters| Field | Type | Description || --- | --- | --- |-| session_id?<sup>1</sup> | string | Originating Gateway session ID (1-64 characters) |--<sup>1</sup> See [reaction session correlation](#reaction-emoji-path-value)--:::note[Permission is checked only for a new group]-`ADD_REACTIONS`, Unicode emoji validation, custom emoji existence, and the external emoji checks apply only when the request would open a new group. Joining an existing group skips them. Every other check in the list above still runs, including the timeout, the message history cutoff, and email verification.-:::--[Reaction object](#reaction-object) states the group and user ceilings for a message, and reaching either returns 400 `MAX_REACTIONS`.+| session_id? | string | Your Gateway session ID (1-64 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Reaction already existed or was added |-| 400 | [error response](/http-api/#error-response) | Path, emoji, or session is invalid, the channel has no messages and the request returns `CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL` |-| 400 | [error response](/http-api/#error-response) | The account has not started a session and the request returns `MUST_START_SESSION_BEFORE_SENDING` |-| 400 | [error response](/http-api/#error-response) | The account is unclaimed and the request returns `UNCLAIMED_ACCOUNT_CANNOT_ADD_REACTIONS` |-| 400 | [error response](/http-api/#error-response) | The emoji is not a valid single Unicode emoji and the request returns `NOT_A_VALID_UNICODE_EMOJI` |-| 400 | [error response](/http-api/#error-response) | The custom emoji is unknown and the request returns `CUSTOM_EMOJI_NOT_FOUND` |-| 400 | [error response](/http-api/#error-response) | The external emoji requires the entitlement and the request returns `CUSTOM_EMOJIS_REQUIRE_PREMIUM_OUTSIDE_SOURCE` |-| 400 | [error response](/http-api/#error-response) | The message has reached a reaction ceiling and the request returns `MAX_REACTIONS` |-| 400 | [error response](/http-api/#error-response) | Thread is archived and the request returns `THREAD_ARCHIVED` |-| 400 | [error response](/http-api/#error-response) | Thread is locked and the caller is not a thread moderator, returning `THREAD_LOCKED` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL`, `ADD_REACTIONS`, or `USE_EXTERNAL_EMOJIS` and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The caller is timed out and the request returns `COMMUNICATION_DISABLED` |-| 403 | [error response](/http-api/#error-response) | The caller has an unverified email and the request returns `REACTION_EMAIL_VERIFICATION_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | The caller is under a new conversation limit in a direct message the recipient has not written in, and the request returns `NEW_CONVERSATIONS_LIMITED` |-| 403 | [error response](/http-api/#error-response) | Reactions are temporarily disabled for the guild and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 403 | [error response](/http-api/#error-response) | The account is [limited](/http-api/users/#account-limitation) and the request returns `ACCOUNT_LIMITED` |-| 404 | [error response](/http-api/#error-response) | Channel or message does not exist, or the message is outside the caller's message history cutoff |+| 204 | empty | The reaction was added |+| 400 | [error response](/http-api/#error-response) | `MAX_REACTIONS` when the message has too many reactions |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` with `NOT_A_VALID_UNICODE_EMOJI` or `CUSTOM_EMOJI_NOT_FOUND` for a bad emoji |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` with `CUSTOM_EMOJIS_REQUIRE_PREMIUM_OUTSIDE_SOURCE` for another guild's emoji |+| 403 | [error response](/http-api/#error-response) | `REACTION_EMAIL_VERIFICATION_REQUIRED` when your email isn't verified |+| 403 | [error response](/http-api/#error-response) | `UNCLAIMED_ACCOUNT_CANNOT_ADD_REACTIONS` outside personal notes |+| 403 | [error response](/http-api/#error-response) | `COMMUNICATION_DISABLED` when you're timed out |-### Side effects--Adding a reaction the caller does not already hold creates it and emits [Message Reaction Add](/gateway/events/#message-reaction-add) to every session that can see the channel, with `session_id` for originating session correlation. Adding a reaction the caller already has changes nothing and emits no Dispatch.--### Rate limit--30 requests per 10 seconds for each authenticated user and channel ID, on the `channel:reactions::channel_id` bucket.+The rate limit is 30 requests per 10 seconds, on the `channel:reactions::channel_id` bucket.## Remove own reaction<RouteHeader method="DELETE" path="/v1/channels/{channel_id}/messages/{message_id}/reactions/{emoji}/@me" bot />-Removes the authenticated identity's own reaction. Returns 204 with an empty body. Emits a [Message Reaction Remove](/gateway/events/#message-reaction-remove) Gateway event.--### Limitations--- The caller must be able to view the text-bearing channel and reach the message under the message history cutoff.-- A removal re-runs none of the timeout, email verification, and emoji validity checks.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel |-| message_id | snowflake | The ID of the message |-| emoji | string | URI-encoded [reaction emoji path value](#reaction-emoji-path-value) |+Removes your reaction, and Fluxer sends [Message Reaction Remove](/gateway/events/#message-reaction-remove).### Query parameters| Field | Type | Description || --- | --- | --- |-| session_id?<sup>1</sup> | string | Originating Gateway session ID (1-64 characters) |--<sup>1</sup> See [reaction session correlation](#reaction-emoji-path-value)+| session_id? | string | Your Gateway session ID (1-64 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Reaction was absent or removed |-| 400 | [error response](/http-api/#error-response) | Path, emoji, or session input is invalid, or the channel has no messages and the request returns `CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL` |-| 400 | [error response](/http-api/#error-response) | Thread is archived and the request returns `THREAD_ARCHIVED` |-| 400 | [error response](/http-api/#error-response) | Thread is locked and the caller is not a thread moderator, returning `THREAD_LOCKED` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` and the request returns `MISSING_PERMISSIONS`, or reactions are temporarily disabled for the guild and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist, or the message is outside the caller's message history cutoff |--A message that does not exist returns 204 rather than 404.--### Side effects--Fluxer deletes the reaction and emits [Message Reaction Remove](/gateway/events/#message-reaction-remove) to every session that can see the channel, with `session_id` for originating session correlation.+| 204 | empty | The reaction was removed |-### Rate limit--30 requests per 10 seconds for each authenticated user and channel ID, on the `channel:reactions::channel_id` bucket.+The rate limit is 30 requests per 10 seconds, on the `channel:reactions::channel_id` bucket.## Remove another user's reaction<RouteHeader method="DELETE" path="/v1/channels/{channel_id}/messages/{message_id}/reactions/{emoji}/{target_id}" bot />-Removes one named user's reaction. Returns 204 with an empty body. Emits a [Message Reaction Remove](/gateway/events/#message-reaction-remove) Gateway event.--### Limitations--- The caller must be able to view the text-bearing channel and reach the message under the message history cutoff.-- The caller must be in a guild channel and must hold [MANAGE_MESSAGES](/http-api/permissions/), so a caller in a private channel is refused with 403 `MISSING_PERMISSIONS`.-- `MANAGE_MESSAGES` is an [elevated permission](/http-api/permissions/#elevated-permissions), so a caller who holds it with no enrolled authenticator receives 400 [`TWO_FACTOR_REQUIRED`](/http-api/errors/) in a guild whose [MFA level](/http-api/guilds/#mfa-levels) is elevated, unless they own the guild.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel |-| message_id | snowflake | The ID of the message |-| emoji | string | URI-encoded [reaction emoji path value](#reaction-emoji-path-value) |-| target_id<sup>1</sup> | snowflake | The ID of the user whose reaction is removed |--<sup>1</sup> Naming the authenticated user skips the moderation check entirely, so `MANAGE_MESSAGES` is not required in that case+Removes the reaction of the user `target_id`, and Fluxer sends [Message Reaction Remove](/gateway/events/#message-reaction-remove). Unless `target_id` is you, this only works in a guild channel and needs `MANAGE_MESSAGES`.### Query parameters| Field | Type | Description || --- | --- | --- |-| session_id?<sup>1</sup> | string | Originating Gateway session ID (1-64 characters) |--<sup>1</sup> See [reaction session correlation](#reaction-emoji-path-value)+| session_id? | string | Your Gateway session ID (1-64 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Target reaction was absent or removed |-| 400 | [error response](/http-api/#error-response) | Path, emoji, or session input is invalid, or the channel has no messages and the request returns `CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL` |-| 400 | [error response](/http-api/#error-response) | Thread is archived and the request returns `THREAD_ARCHIVED` |-| 400 | [error response](/http-api/#error-response) | Thread is locked and the caller is not a thread moderator, returning `THREAD_LOCKED` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` or `MANAGE_MESSAGES`, or the channel is private, each returning `MISSING_PERMISSIONS`, or reactions are temporarily disabled for the guild and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist, or the message is outside the caller's message history cutoff |--A message that does not exist returns 204 before the `MANAGE_MESSAGES` check. A request naming a target user with no such reaction also returns 204.--### Side effects+| 204 | empty | The reaction was removed |-Fluxer deletes the target user's reaction and emits [Message Reaction Remove](/gateway/events/#message-reaction-remove) with the target user ID to every session that can see the channel, plus `session_id` when the request supplied one.--### Rate limit--30 requests per 10 seconds for each authenticated user and channel ID, on the `channel:reactions::channel_id` bucket.+The rate limit is 30 requests per 10 seconds, on the `channel:reactions::channel_id` bucket.## Remove all reactions for emoji<RouteHeader method="DELETE" path="/v1/channels/{channel_id}/messages/{message_id}/reactions/{emoji}" bot />-Removes every reaction for one emoji. Returns 204 with an empty body. Emits a [Message Reaction Remove Emoji](/gateway/events/#message-reaction-remove-emoji) Gateway event.--### Limitations--- The caller must be able to view the text-bearing channel and reach the message under the message history cutoff.-- The caller must be in a guild channel and must hold [MANAGE_MESSAGES](/http-api/permissions/), an [elevated permission](/http-api/permissions/#elevated-permissions).-- A caller who holds `MANAGE_MESSAGES` with no enrolled authenticator receives 400 [`TWO_FACTOR_REQUIRED`](/http-api/errors/) in a guild whose [MFA level](/http-api/guilds/#mfa-levels) is elevated, unless they own the guild.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel |-| message_id | snowflake | The ID of the message |-| emoji | string | URI-encoded [reaction emoji path value](#reaction-emoji-path-value) |+Removes every reaction with one emoji, and Fluxer sends [Message Reaction Remove Emoji](/gateway/events/#message-reaction-remove-emoji). This only works in a guild channel, where you need `MANAGE_MESSAGES`. A private channel returns 403 `MISSING_PERMISSIONS`.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Emoji reactions were absent or removed |-| 400 | [error response](/http-api/#error-response) | Path or emoji is invalid, or the channel has no messages and the request returns `CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL` |-| 400 | [error response](/http-api/#error-response) | Thread is archived and the request returns `THREAD_ARCHIVED` |-| 400 | [error response](/http-api/#error-response) | Thread is locked and the caller is not a thread moderator, returning `THREAD_LOCKED` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` or `MANAGE_MESSAGES`, or the channel is private, each returning `MISSING_PERMISSIONS`, or reactions are temporarily disabled for the guild and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist, or the message is outside the caller's message history cutoff |--### Side effects+| 204 | empty | The reactions were removed |-Fluxer deletes every reaction for the emoji and emits one [Message Reaction Remove Emoji](/gateway/events/#message-reaction-remove-emoji) to every session that can see the channel. Fluxer emits no [Message Reaction Remove](/gateway/events/#message-reaction-remove) for the individual users.--### Rate limit--30 requests per 10 seconds for each authenticated user and channel ID, on the `channel:reactions::channel_id` bucket.+The rate limit is 30 requests per 10 seconds, on the `channel:reactions::channel_id` bucket.## Remove all reactions<RouteHeader method="DELETE" path="/v1/channels/{channel_id}/messages/{message_id}/reactions" bot />-Removes every reaction from a message. Returns 204 with an empty body. Emits a [Message Reaction Remove All](/gateway/events/#message-reaction-remove-all) Gateway event.--### Limitations--- The caller must be able to view the text-bearing channel and reach the message under the message history cutoff.-- The caller must be in a guild channel and must hold [MANAGE_MESSAGES](/http-api/permissions/), an [elevated permission](/http-api/permissions/#elevated-permissions).-- A caller who holds `MANAGE_MESSAGES` with no enrolled authenticator receives 400 [`TWO_FACTOR_REQUIRED`](/http-api/errors/) in a guild whose [MFA level](/http-api/guilds/#mfa-levels) is elevated, unless they own the guild.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel |-| message_id | snowflake | The ID of the message |+Removes every reaction from a message, and Fluxer sends [Message Reaction Remove All](/gateway/events/#message-reaction-remove-all). This only works in a guild channel, where you need `MANAGE_MESSAGES`. A private channel returns 403 `MISSING_PERMISSIONS`.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Reactions were absent or removed |-| 400 | [error response](/http-api/#error-response) | Path parameters are invalid, or the channel has no messages and the request returns `CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL` |-| 400 | [error response](/http-api/#error-response) | Thread is archived and the request returns `THREAD_ARCHIVED` |-| 400 | [error response](/http-api/#error-response) | Thread is locked and the caller is not a thread moderator, returning `THREAD_LOCKED` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` or `MANAGE_MESSAGES`, or the channel is private, each returning `MISSING_PERMISSIONS`, or reactions are temporarily disabled for the guild and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist, or the message is outside the caller's message history cutoff |--### Side effects--Fluxer deletes every reaction on the message and emits one [Message Reaction Remove All](/gateway/events/#message-reaction-remove-all) to every session that can see the channel. Fluxer emits no event for the individual groups or users.+| 204 | empty | The reactions were removed |-### Rate limit--30 requests per 10 seconds for each authenticated user and channel ID, on the `channel:reactions::channel_id` bucket.+The rate limit is 30 requests per 10 seconds, on the `channel:reactions::channel_id` bucket.## Indicate typing<RouteHeader method="POST" path="/v1/channels/{channel_id}/typing" bot />-Publishes typing activity in a text-bearing channel. Returns 204 with an empty body, or 200 with the cooldown body below. Emits a [Typing Start](/gateway/events/#typing-start) Gateway event.--### Limitations--- The caller must hold [SEND_MESSAGES](/http-api/permissions/) in a guild channel and must not be timed out.-- A thread requires [SEND_MESSAGES_IN_THREADS](/http-api/permissions/) in its parent where a guild channel requires `SEND_MESSAGES`.-- A private channel caller needs only recipient access, because this route applies no direct message send policy.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel where typing is shown |+Shows that you're typing, and Fluxer sends [Typing Start](/gateway/events/#typing-start). In a guild channel you need `SEND_MESSAGES`, or `SEND_MESSAGES_IN_THREADS` in a thread.### Response body| Field | Type | Description || --- | --- | --- |-| message_send_cooldown_ms?<sup>1</sup> | integer | The milliseconds until the channel slowmode accepts a message from the caller |-| thread_create_cooldown_ms?<sup>1</sup> | integer | The milliseconds until the channel slowmode accepts a new thread from the caller |--<sup>1</sup> The OpenAPI schema does not declare a response body for this route+| message_send_cooldown_ms?<sup>1</sup> | integer | Milliseconds until slowmode lets you send a message |+| thread_create_cooldown_ms?<sup>1</sup> | integer | Milliseconds until slowmode lets you create a thread |-`thread_create_cooldown_ms` is present only for a guild text or announcement channel.+<sup>1</sup> The schema does not declare this body-Fluxer returns 200 only to a user session that declares the [`channel_threads` client capability](/http-api/threads/#client-capability), in a guild channel with slowmode, while a cooldown is running and the caller lacks `BYPASS_SLOWMODE`.+Fluxer only returns this body during a slowmode cooldown, and only to a session with the [`channel_threads` client capability](/http-api/threads/#client-capability).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | cooldown body | Typing operation was accepted and a slowmode cooldown is running |-| 204 | empty | Typing operation was accepted |-| 400 | [error response](/http-api/#error-response) | Path parameter is invalid, or the channel has no messages and the request returns `CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL` |-| 400 | [error response](/http-api/#error-response) | Channel is a forum or media channel and the request returns `INVALID_CHANNEL_TYPE` |-| 400 | [error response](/http-api/#error-response) | Thread is locked and the caller is not a thread moderator, returning `THREAD_LOCKED` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `SEND_MESSAGES` and the request returns `MISSING_PERMISSIONS`, or the caller is timed out and the request returns `COMMUNICATION_DISABLED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or the caller is not a recipient of the private channel |--### Side effects--The operation emits [Typing Start](/gateway/events/#typing-start) to every session that can see the channel, with the channel ID, the caller's user ID, and a Unix timestamp in seconds. It creates no durable state, so no read operation reports a typing indicator, and the indicator expires on the client. When the guild has typing events disabled, the response is still 204 and no Dispatch is emitted.--### Rate limit+| 200 | response body | You're typing and slowmode is counting down |+| 204 | empty | You're typing |+| 400 | [error response](/http-api/#error-response) | `INVALID_CHANNEL_TYPE` for a forum or media channel |-20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:typing::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:typing::channel_id` bucket.## Acknowledge message<RouteHeader method="POST" path="/v1/channels/{channel_id}/messages/{message_id}/ack" />-Advances the authenticated user's read state through one message. Returns 204 with an empty body. Emits a [Message ACK](/gateway/events/#message-ack) Gateway event.--### Limitations--- This is a user-only operation, and a bot credential is refused with 403 `ACCESS_DENIED`.-- Fluxer never checks that the channel or the message exists. The operation writes the supplied identifiers into the caller's own read state and changes nothing else.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id<sup>1</sup> | snowflake | The ID of the channel |-| message_id<sup>1</sup> | snowflake | Message ID through which the channel is acknowledged |--<sup>1</sup> Neither identifier needs to name something that exists, because both are stored as read-state keys and watermarks+Marks a channel as read up to a message, and Fluxer sends [Message ACK](/gateway/events/#message-ack) to your sessions. Bots can't use this route.### JSON body| Field | Type | Description || --- | --- | --- |-| mention_count?<sup>1</sup> | integer | Mention count to store for the channel (0-2,147,483,647, default `0`) |-| manual?<sup>2</sup> | boolean | Whether the acknowledgement was explicitly started by the user (default false) |+| mention_count? | integer | The number of unread mentions left (default `0`) |+| manual? | boolean | Whether to move the read marker back to this message (default false) |-<sup>1</sup> Fluxer stores the value verbatim. A client that acknowledges partway through a channel must send the number of mentions that remain above the watermark, and one that omits the field resets the stored count to `0`--<sup>2</sup> Selects the watermark rule described below--:::note[Manual acknowledgement can move the marker backwards]-Without `manual`, the marker advances to the larger of its current value and `message_id`. With `manual` true, Fluxer sets it to exactly `message_id`, which is how a user marks a channel unread from an earlier point.-:::+Setting `manual` to true marks the messages after `message_id` unread.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Message was acknowledged |-| 403 | [error response](/http-api/#error-response) | Caller is a bot and the request returns `ACCESS_DENIED` |--### Side effects--The operation updates the caller's read-through marker and mention count, clears delivered notifications through the acknowledged watermark, and emits [Message ACK](/gateway/events/#message-ack) to the caller's own sessions only.--A non-manual acknowledgement whose `message_id` is below the stored watermark leaves the stored watermark and mention count unchanged. The Dispatch reports the stored values.--### Rate limit+| 204 | empty | The message was acknowledged |-100 requests per 10 seconds for each authenticated user and channel ID, on the `channel:message:ack::channel_id` bucket.+The rate limit is 100 requests per 10 seconds, on the `channel:message:ack::channel_id` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/oauth2.mdx b/fluxer_docs/src/content/docs/http-api/oauth2.mdxindex d5f27528a..67bee2d2c 100644--- a/fluxer_docs/src/content/docs/http-api/oauth2.mdx+++ b/fluxer_docs/src/content/docs/http-api/oauth2.mdx@@ -1,92 +1,66 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: OAuth2-description: OAuth2 authorisation, token, identity, introspection, and revocation operations.+description: The OAuth2 authorization code grant, tokens, scopes and the routes a user uses to manage authorized applications.---import RouteHeader from '@/components/RouteHeader.astro';-OAuth2 is how a user grants an application access to their account. The same consent step can install the application's bot into a guild or group direct message. Application records, client secrets, and bot credentials belong to the [Applications resource](/http-api/applications/).+OAuth2 lets a user give an application access to their account, and the same consent step can install the application's bot into a guild or group DM. You create applications and client secrets with the [Applications](/http-api/applications/) routes.-## Authorisation code grant+## Authorization code grant-The grant begins at [Authorise application](#authorise-application). That route redirects the browser to the Fluxer consent interface, unless the request sets `prompt=none`. [Grant OAuth2 consent](#grant-oauth2-consent) records the decision, issues one authorisation code, and returns the callback URL that has it. The client presents that code to [Exchange OAuth2 token](#exchange-oauth2-token) with its client credentials and receives an access and refresh token pair.+1. Send the user's browser to [Authorize application](#authorize-application). When the user approves on the consent screen, Fluxer sends the browser to your `redirect_uri` with a `code` and your `state`.+2. Exchange the code at [Exchange OAuth2 token](#exchange-oauth2-token) with your client credentials to get an access token and a refresh token.+3. Send the access token as `Authorization: Bearer <token>`. Before the access token expires, exchange the refresh token for a new pair.-Proof Key for Code Exchange, or PKCE, supports the `S256` and `plain` challenge methods, and Fluxer binds the challenge to the code when it issues the code. A `code_challenge` supplied without a `code_challenge_method` is treated as `plain`. An exchange for a code that has a challenge supplies a matching `code_verifier`, and an exchange for a code that has none ignores any verifier it is given.--## Credentials and lifetimes--Treat authorisation codes, client secrets, and tokens as opaque credentials. Retrying an interrupted exchange with the same inputs is rejected as an invalid grant. Restart the grant instead.--An authorisation code expires 10 minutes after it is issued, an access token after 7 days, and a refresh token after 30 days. Every refresh exchange issues a new refresh token that expires 30 days after it is issued, so a grant ends 30 days after its last refresh.--## Route authentication+| Credential | Lifetime |+| --- | --- |+| Authorization code | 10 minutes, single use |+| Access token | 7 days |+| Refresh token | 30 days, single use. Each refresh returns a new one |-Every route on this page that authenticates a user is user-only unless the operation says otherwise. Fluxer rejects a bot token and an OAuth2 bearer with 403 `ACCESS_DENIED`. The token, introspection, and revocation routes authenticate the client application instead, so their [rate limit](/topics/rate-limits/) is keyed by client IP address.+PKCE supports the `S256` and `plain` methods. A `code_challenge` with no `code_challenge_method` uses `plain`. When the code has a challenge, the token exchange needs a matching `code_verifier`.-## OAuth2 string normalisation+The token, introspection and revocation routes take an `application/x-www-form-urlencoded` or `multipart/form-data` body. Authenticate your application with HTTP Basic or with the `client_id` and `client_secret` fields. Introspection and revocation return `invalid_request` when credentials are in both the `Authorization` header and the body.-Fluxer trims every bounded OAuth2 string field before it checks its length. Each such field accepts 1 to 256 UTF-16 code units, `redirect_uri` included.+[Grant OAuth2 consent](#grant-oauth2-consent) and the routes under `/oauth2/@me/authorizations` need the user's own token. A bot token or OAuth2 access token gets 403 `ACCESS_DENIED`.-Fluxer validates, stores, compares, forwards, and returns the normalised value. The `permissions` field and the [Grant OAuth2 consent](#grant-oauth2-consent) `response_type` field are read verbatim and have no length bound of their own. HTTP Basic client credentials do not pass through this request field normalisation. The PKCE `code_challenge` and `code_verifier` are normalised too, so a client MUST NOT rely on surrounding whitespace surviving.+String fields such as `state`, `redirect_uri` and `code` can be at most 256 characters.## OAuth2 scopes-A scope names one thing the application may read or do on the user's behalf.-| Value | Description || --- | --- |-| identify<sup>1</sup> | Read the authorised user's account identity |-| email<sup>2</sup> | Include the authorised user's email address and email verification state |-| guilds<sup>3</sup> | Read the guilds the authorised user is a member of |-| connections<sup>4</sup> | Read the authorised user's [connections](/http-api/connections/) |-| bot<sup>5</sup> | Install the application's bot account into a selected guild or group direct message |--<sup>1</sup> Grants [Get OAuth2 user information](#get-oauth2-user-information) and the reduced bearer representation from [Get current user](/http-api/users/current-user/#get-current-user), and is also required before [Get current OAuth2 authorisation](#get-current-oauth2-authorisation) includes a user object--<sup>2</sup> Has no observable effect unless identify is granted as well, because every route that exposes the address also requires identify--<sup>3</sup> Grants [List current user guilds](/http-api/guilds/#list-current-user-guilds), [Get guild](/http-api/guilds/#get-guild), and [List guild roles](/http-api/permissions/#list-guild-roles)--<sup>4</sup> Grants [List connections](/http-api/connections/#list-connections)+| identify | Read the user's account through [Get OAuth2 user information](#get-oauth2-user-information) and [Get current user](/http-api/users/current-user/#get-current-user) |+| email<sup>1</sup> | Adds `email` and `verified` to the user information |+| guilds | Use [List current user guilds](/http-api/guilds/#list-current-user-guilds), [Get guild](/http-api/guilds/#get-guild) and [List guild roles](/http-api/permissions/#list-guild-roles) |+| connections | Use [List connections](/http-api/connections/#list-connections) |+| bot<sup>2</sup> | Install the application's bot into a guild or group DM |-<sup>5</sup> Installs a bot account and grants no bearer access of its own, so an application whose grants are bot alone is never presented as an authorisation by [List OAuth2 authorisations](#list-oauth2-authorisations)+<sup>1</sup> Only works together with `identify`-An unrecognised scope value is rejected when the authorisation request is completed. Fluxer splits a scope string on runs of whitespace and `+` characters, and discards empty segments. A repeated scope value is granted once.+<sup>2</sup> The access token gets no access from this scope-:::note[Scope ordering differs by response]-Scope order has no semantic meaning, so a client MUST compare scopes as a set.-:::--Fluxer sorts the `scope` string of an [OAuth2 token](#oauth2-token-object) and of an [OAuth2 introspection](#oauth2-introspection-object) into the registry order above. The `scopes` array of a [current OAuth2 authorisation](#current-oauth2-authorisation-object) has the stored scopes in no defined order, with unrecognised values removed. The `scopes` array of an [OAuth2 authorisation](#oauth2-authorisation-object) is in no defined order, and it can hold `bot` or an unrecognised value when the user holds more than one live refresh token for the application.+Separate scopes with spaces. Fluxer rejects an unknown scope with `invalid_scope`, and the order of scopes in a response isn't fixed.## OAuth2 error response object-The failure envelope the OAuth2 routes return.+The token, consent, introspection and revocation routes return this body with status 400 when the grant, client, scope, redirect URI or permission mask is rejected. Other failures use the ordinary [error response](/http-api/#error-response).### Structure| Field | Type | Description || --- | --- | --- |-| error | string | The [OAuth2 error code](#oauth2-error-codes) naming the failure |-| error_description<sup>1</sup> | string | The human-readable description of the failure |--<sup>1</sup> Always present, and some descriptions are a bare API error code identifier--These members are the whole body, so the body has none of the `code` and `message` members of the ordinary [error response](/http-api/#error-response). Fluxer returns every OAuth2 failure with status 400. A client MUST key on `error` and never on `error_description`.--The consent, token, introspection, and revocation routes return this object for a grant, client authentication, scope, redirect, response type, or permission mask failure. Every other failure, including request validation, authentication, authorisation, and rate limiting, uses the ordinary [error response](/http-api/#error-response) with an [API error code](/http-api/errors/).--:::note[Both error envelopes share status 400]-The same route can return either one. [Authorise application](#authorise-application) returns neither, because it reports an OAuth2 failure as a query parameter on a redirect.-:::+| error | string | The [OAuth2 error code](#oauth2-error-codes) |+| error_description | string | A description for people, which you shouldn't parse |### Example```json{"error": "invalid_grant",- "error_description": "Authorization code is invalid or expired"+ "error_description": "The provided authorization grant is invalid, expired, or revoked"}```@@ -94,34 +68,24 @@ The same route can return either one. [Authorise application](#authorise-applica| Value | Description || --- | --- |-| invalid_request<sup>2</sup> | The request itself is malformed |-| invalid_client<sup>3</sup> | Client authentication failed |-| invalid_grant<sup>4</sup> | The presented grant is not usable |-| invalid_scope | The requested scope contains a value that is not in the [scope registry](#oauth2-scopes) |--<sup>2</sup> The redirect URI is missing, unregistered, or unparseable, the response type is not `code` on a request that asks for a non-bot scope, the requested permission mask is not a non-negative integer literal, or client credentials are supplied in both an `Authorization` header and the form--<sup>3</sup> The client application is unknown, supplied no client secret, or supplied a client secret that does not match the stored hash--<sup>4</sup> The authorisation code or refresh token is unknown, expired, already used, bound to another application, or bound to another redirect URI, or the authorisation code has a PKCE challenge the presented verifier does not match+| invalid_request | The redirect URI, response type or permission mask is wrong, or credentials were sent in both places |+| invalid_client | The application is unknown or the client secret is missing or wrong |+| invalid_grant | The code, refresh token, redirect URI or PKCE verifier doesn't match a valid grant |+| invalid_scope | A requested scope isn't in [OAuth2 scopes](#oauth2-scopes) |## OAuth2 token object-The access and refresh token pair a successful token exchange returns.+The token pair a successful exchange returns.### Structure| Field | Type | Description || --- | --- | --- |-| access_token | string | The bearer token the application presents in the `Authorization` header |-| token_type | string | The token type, always `Bearer` |-| expires_in<sup>1</sup> | integer | The access token lifetime in seconds, always 604800 |-| refresh_token<sup>2</sup> | string | The refresh token that replaces this pair when it is exchanged |-| scope | string | The granted scopes, space separated in registry order |--<sup>1</sup> The configured access token lifetime, repeated in every successful response--<sup>2</sup> Every grant Fluxer issues is bound to a user, so a successful exchange always returns a refresh token+| access_token | string | The bearer token |+| token_type | string | Always `Bearer` |+| expires_in | integer | The access token lifetime in seconds, 604800 |+| refresh_token | string | The refresh token for the next exchange |+| scope | string | The granted scopes, separated by spaces |### Example@@ -137,82 +101,62 @@ The access and refresh token pair a successful token exchange returns.## OAuth2 user information object-The account identity an application reads with the `identify` scope.+The user that [Get OAuth2 user information](#get-oauth2-user-information) returns.### Structure| Field | Type | Description || --- | --- | --- |-| sub | snowflake | The ID of the subject user, equal to `id` |-| id | snowflake | The ID of the account |-| username | string | The username of the account |-| discriminator | string | The four-digit discriminator tag |-| global_name | ?string | The display name of the account, or null when unset |-| avatar<sup>1</sup> | ?string | The avatar hash of the account, or null when it has none |-| email?<sup>2</sup> | ?string | The email address of the account, null unless the `email` scope is granted and an address is set |-| verified?<sup>3</sup> | ?boolean | Whether the address has been verified |-| flags?<sup>4</sup> | integer | The [public user flags](/http-api/users/#public-user-flags) on the account |-| avatar_color<sup>5</sup> | ?integer | The default avatar colour |-| bot<sup>5</sup> | boolean | Whether the account is a bot |-| system<sup>5</sup> | boolean | Whether the account is a system user |--<sup>1</sup> An animated avatar hash has the `a_` prefix, and the prefix is removed while the account has no animated avatar entitlement--<sup>2</sup> Always emitted--<sup>3</sup> Emitted only when the `email` scope is granted and the account has an address. An unverified address reports false--<sup>4</sup> Declared optional by the response schema and emitted on every response--<sup>5</sup> Emitted on every response although the response schema does not declare it, so a client MUST NOT depend on it+| sub | snowflake | The ID of the user, the same as `id` |+| id | snowflake | The ID of the user |+| username | string | The username |+| discriminator | string | The four-digit discriminator |+| global_name | ?string | The display name |+| avatar | ?string | The avatar hash |+| email? | ?string | The email address, null without the `email` scope |+| verified? | ?boolean | Whether the email address is verified, sent only with the `email` scope |+| flags? | integer | The [public user flags](/http-api/users/#public-user-flags) |+| avatar_color<sup>1</sup> | ?integer | The default avatar color |+| bot<sup>1</sup> | boolean | Whether the account is a bot |+| system<sup>1</sup> | boolean | Whether the account is a system user |++<sup>1</sup> Always sent, but the response schema does not declare it## OAuth2 introspection object-The liveness and scope report Fluxer returns for one presented token.+Whether a token is active, and what it grants.### Structure| Field | Type | Description || --- | --- | --- |-| active | boolean | Whether the presented token is live and belongs to the authenticated client |-| scope? | string | The granted scopes, space separated in registry order |-| client_id? | snowflake | The ID of the application the token was issued to |-| username?<sup>1</sup> | string | A reserved member that Fluxer never sets |-| token_type? | string | The kind of token presented, `Bearer` for an access token and `refresh_token` for a refresh token |-| exp?<sup>2</sup> | integer | The access token expiry time in Unix seconds |-| iat? | integer | The issue time in Unix seconds |-| sub?<sup>3</sup> | snowflake | The ID of the subject user |--<sup>1</sup> Absent from every response--<sup>2</sup> Absent for a refresh token, which still expires 30 days after it is issued--<sup>3</sup> Every token Fluxer issues is bound to a user, so an active result always has a subject+| active | boolean | Whether the token is valid and was issued to your application |+| scope? | string | The granted scopes, separated by spaces |+| client_id? | snowflake | The ID of the application |+| username? | string | Never sent |+| token_type? | string | The token type, `Bearer` for an access token or `refresh_token` for a refresh token |+| exp? | integer | When the access token expires, in Unix seconds |+| iat? | integer | When the token was issued, in Unix seconds |+| sub? | snowflake | The ID of the user |-Apart from `username` and `exp`, every optional field above is present when `active` is true and absent when it is false. An active access token has `exp` and an active refresh token does not.+An inactive token returns only `active: false`. An active token has every other field except `username`, and a refresh token has no `exp`.-Fluxer reports an unknown token, an expired token, and a token issued to another application as inactive. An inactive body has only `active` set to false, and names no reason. Fluxer does not look up the user account during introspection, so an active result describes the token only and says nothing about the state of that account.+## Current OAuth2 authorization object-## Current OAuth2 authorisation object--The application, scopes, and expiry behind the access token the caller presented.+The application, scopes and expiry of the access token you sent.### Structure| Field | Type | Description || --- | --- | --- |-| application | [OAuth2 application summary](#oauth2-application-summary-object) object | The application the access token was issued to |-| scopes<sup>1</sup> | array[string] | The granted scopes, with unrecognised values removed |-| expires | ISO8601 timestamp | The expiry time of the access token |-| user?<sup>2</sup> | [OAuth2 authorised user](#oauth2-authorised-user-object) object | The account the access token was issued for |--<sup>1</sup> Emitted in no defined order, and `bot` stays in the array even though it grants no bearer access--<sup>2</sup> Present only when the token grants `identify` and the account still exists, so a token restricted to `bot` never has one+| application | [OAuth2 application summary](#oauth2-application-summary-object) object | The application the token was issued to |+| scopes | array[string] | The granted scopes |+| expires | ISO8601 timestamp | When the access token expires |+| user? | [OAuth2 authorized user](#oauth2-authorized-user-object) object | The user, sent only when the token has `identify` |## OAuth2 application summary object-The reduced application record in a [current OAuth2 authorisation](#current-oauth2-authorisation-object).+The application in a [current OAuth2 authorization](#current-oauth2-authorization-object).### Structure@@ -220,68 +164,52 @@ The reduced application record in a [current OAuth2 authorisation](#current-oaut| --- | --- | --- || id | snowflake | The ID of the application || name | string | The name of the application |-| icon<sup>1</sup> | ?string | The icon hash, always null on this object |-| description<sup>1</sup> | ?string | The description, always null on this object |-| bot_public | boolean | Whether any eligible user can install the bot |-| bot_require_code_grant | boolean | Whether bot installation requires an OAuth2 code grant |-| flags<sup>2</sup> | integer | The application flags, always 0 |--<sup>1</sup> Null even when the application's bot has an avatar or bio--<sup>2</sup> No application flag bit is defined+| icon | ?string | Always null |+| description | ?string | Always null |+| bot_public | boolean | Whether anyone can install the bot |+| bot_require_code_grant | boolean | Whether installing the bot needs a full code grant |+| flags | integer | Always 0 |-## OAuth2 authorised user object+## OAuth2 authorized user object-The account a [current OAuth2 authorisation](#current-oauth2-authorisation-object) was issued for.+The user in a [current OAuth2 authorization](#current-oauth2-authorization-object).### Structure| Field | Type | Description || --- | --- | --- |-| id | snowflake | The ID of the account |-| username | string | The username of the account |-| discriminator | string | The four-digit discriminator tag |-| global_name | ?string | The display name of the account, or null when unset |-| avatar<sup>1</sup> | ?string | The avatar hash of the account, or null when it has none |-| avatar_color | ?integer | The default avatar colour |-| bot?<sup>2</sup> | boolean | Whether the account is a bot |-| system?<sup>2</sup> | boolean | Whether the account is a system user |-| flags | integer | The [public user flags](/http-api/users/#public-user-flags) on the account |-| email?<sup>3</sup> | ?string | The email address of the account, null unless the `email` scope is granted and an address is set |-| verified?<sup>4</sup> | ?boolean | Whether the address has been verified |-| sub<sup>5</sup> | snowflake | The ID of the subject user, equal to `id` |+| id | snowflake | The ID of the user |+| username | string | The username |+| discriminator | string | The four-digit discriminator |+| global_name | ?string | The display name |+| avatar | ?string | The avatar hash |+| avatar_color | ?integer | The default avatar color |+| bot? | boolean | Whether the account is a bot |+| system? | boolean | Whether the account is a system user |+| flags | integer | The [public user flags](/http-api/users/#public-user-flags) |+| email? | ?string | The email address, null without the `email` scope |+| verified? | ?boolean | Whether the email address is verified, sent only with the `email` scope |+| sub<sup>1</sup> | snowflake | The ID of the user, the same as `id` |-<sup>1</sup> An animated avatar hash has the `a_` prefix, and the prefix is removed while the account has no animated avatar entitlement+<sup>1</sup> Always sent, but the response schema does not declare it-<sup>2</sup> Emitted on every response, and false when the account is neither+## OAuth2 authorization object-<sup>3</sup> Always emitted--<sup>4</sup> Emitted only when the `email` scope is granted and the account has an address--<sup>5</sup> Emitted on every response although the response schema does not declare it, so a client MUST NOT depend on it--## OAuth2 authorisation object--One application the current user has authorised, aggregated across its live refresh tokens.+One application the current user has authorized.### Structure| Field | Type | Description || --- | --- | --- |-| application | [authorised application](#authorised-application-object) object | The application the user has granted access to |-| scopes<sup>1</sup> | array[string] | The scopes aggregated across the user's live refresh tokens for the application |-| authorized_at<sup>2</sup> | ISO8601 timestamp | The earliest creation time among the refresh tokens that contributed to this entry |--<sup>1</sup> Scopes have no defined order and can include `bot` or an unrecognised value. Ignore unrecognised values+| application | [authorized application](#authorized-application-object) object | The application |+| scopes<sup>1</sup> | array[string] | The scopes the user granted to it |+| authorized_at | ISO8601 timestamp | When the oldest current refresh token for the application was issued |-<sup>2</sup> The earliest issue time among the application's current refresh grants+<sup>1</sup> Can include `bot` or values you don't recognize, which you should ignore-An authorisation appears only while the application holds a live refresh grant with a recognised scope other than `bot`.+## Authorized application object-## Authorised application object--The application named by an [OAuth2 authorisation](#oauth2-authorisation-object) entry.+The application in an [OAuth2 authorization](#oauth2-authorization-object).### Structure@@ -289,487 +217,251 @@ The application named by an [OAuth2 authorisation](#oauth2-authorisation-object)| --- | --- | --- || id | snowflake | The ID of the application || name | string | The name of the application |-| icon<sup>1</sup> | ?string | The avatar hash of the application's bot account |-| description<sup>2</sup> | ?string | The description, always null on this object |-| bot_public | boolean | Whether any eligible user can install the bot |--<sup>1</sup> Null when the application has no bot account or that account has no avatar. The stored hash is reported unfiltered, so an animated hash retains its `a_` prefix--<sup>2</sup> An application record has no description field, so this value is always null+| icon | ?string | The avatar hash of the application's bot |+| description | ?string | Always null |+| bot_public | boolean | Whether anyone can install the bot |## OAuth2 consent response object-The callback URL [Grant OAuth2 consent](#grant-oauth2-consent) returns after it records the decision.+The callback URL from [Grant OAuth2 consent](#grant-oauth2-consent).### Structure| Field | Type | Description || --- | --- | --- |-| redirect_to<sup>1</sup> | string | The absolute URL with the authorisation result |--<sup>1</sup> The URL has the `code` query parameter, and the normalised caller `state` when one was supplied--Fluxer builds the URL from the registered redirect URI the request resolved to, which is the configured Fluxer web app URL when a bot-only authorisation supplied none. The code records the URL serialisation of that resolved URI, and the client later presents that exact serialisation to [Exchange OAuth2 token](#exchange-oauth2-token).+| redirect_to | string | The redirect URI with `code` and your `state` added |-## Authorise application+## Authorize application<RouteHeader method="GET" path="/v1/oauth2/authorize" unauthenticated />-Starts an authorisation request. Fluxer returns a redirect for every query that passes request validation. Authentication is optional.+Starts the grant and redirects the browser to the Fluxer consent screen with the same parameters.### Query parameters| Field | Type | Description || --- | --- | --- |-| response_type? | string | The OAuth2 response type, `code` when supplied |-| client_id | snowflake | The ID of the application being authorised |-| redirect_uri?<sup>1</sup> | string | The absolute redirect URI registered by the application (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |-| scope | string | The requested [OAuth2 scopes](#oauth2-scopes), space separated (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |-| state?<sup>4</sup> | string | The caller state (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |-| prompt? | string | The prompt mode, either `consent` or `none` |-| guild_id?<sup>2</sup> | snowflake | The guild pre-selected for the `bot` scope |-| channel_id?<sup>2</sup> | snowflake | The group direct message pre-selected for the `bot` scope |-| permissions?<sup>3</sup> | string | The bot permission integer literal |-| disable_guild_select? | string | Whether the consent interface suppresses guild selection, as the literal `true` or `false` |-| code_challenge? | string | The PKCE challenge bound to the issued code (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |-| code_challenge_method? | string | The PKCE method, either `S256` or `plain`, defaulting to `plain` when a challenge is supplied without it |--<sup>1</sup> The value must parse as an absolute URL with a scheme and a host, and must match a registered redirect URI before a code is issued--<sup>2</sup> Both values are forwarded to the consent interface unchanged, and only [Grant OAuth2 consent](#grant-oauth2-consent) rejects a request that supplies both--<sup>3</sup> The value is forwarded to the consent interface unchanged and is parsed as an integer only by [Grant OAuth2 consent](#grant-oauth2-consent)--<sup>4</sup> The value is returned unchanged after normalisation, on both the success redirect and the error redirect+| response_type? | string | The response type, `code` |+| client_id | snowflake | The ID of the application |+| redirect_uri? | string | A redirect URI registered on the application |+| scope | string | The requested [scopes](#oauth2-scopes), separated by spaces |+| state? | string | A value Fluxer returns unchanged on the redirect |+| prompt? | string | The prompt mode, `consent` or `none` |+| guild_id? | snowflake | The guild to preselect for the `bot` scope |+| channel_id? | snowflake | The group DM to preselect for the `bot` scope |+| permissions? | string | The permissions to give the bot, as an integer string |+| disable_guild_select? | string | `true` to stop the user from picking another guild |+| code_challenge? | string | The PKCE challenge |+| code_challenge_method? | string | The PKCE method, `S256` or `plain` |### Response| Status | Body | Condition || --- | --- | --- |-| 302 | empty | The consent interface, a successful client callback, or an OAuth2 error callback was selected |--The 302 `Location` header is the selected redirect.+| 302 | empty | The `Location` header has the consent screen or your callback |-Without `prompt=none`, the redirect targets the Fluxer consent interface and forwards every supplied parameter, so no application, scope, or redirect validation happens yet.+With `prompt=none`, Fluxer skips the consent screen when the signed-in user has already granted every requested scope, and redirects to your `redirect_uri` with a `code`. Otherwise it redirects with `error=login_required` when nobody is signed in, or `error=consent_required`. If `redirect_uri` isn't registered on the application, the error goes to the Fluxer web app.-With `prompt=none`, a request that resolves no user redirects with `error=login_required`. Every other silent failure redirects with `error=consent_required`. That covers every failure to issue a code, including an unknown application, an unrecognised scope, a missing or unregistered redirect URI, and a private bot the caller does not own. It also covers a requested non-bot scope the user has not already granted to this application. A silent request that asks only for `bot` skips the prior-grant test.--An error redirect has `error` and the normalised `state` when the caller supplied one, but no `error_description` and never the more specific [OAuth2 error code](#oauth2-error-codes) the underlying failure raised.--:::caution[An unregistered redirect URI never receives the error]-The error redirect targets the supplied `redirect_uri` only when the named application has registered that exact string, so this route cannot bounce a browser to an arbitrary origin.-:::--Fluxer compares the two strings byte for byte, so a differing scheme, port, trailing slash, query, or fragment does not match. Every other case redirects to the configured Fluxer web app URL. That covers an omitted redirect URI, an unknown application, and an application with no registered URI at all.--### Side effects--A successful `prompt=none` request issues one authorisation code bound to the application, user, resolved redirect URI, granted scopes, and PKCE challenge. The code expires after 10 minutes. Nothing else changes. Only [Grant OAuth2 consent](#grant-oauth2-consent) installs a bot.--### Rate limit--60 requests per minute for each authenticated user, or for each client IP address when the request has no credential, on the `oauth:authorize` bucket.+The rate limit is 60 requests per minute, on the `oauth:authorize` bucket.## Grant OAuth2 consent<RouteHeader method="POST" path="/v1/oauth2/authorize/consent" />-Completes an authorisation request. Returns an [OAuth2 consent response](#oauth2-consent-response-object) object with the callback URL.--Installing a bot into a guild requires [MANAGE_GUILD or ADMINISTRATOR](/http-api/permissions/) in that guild. Installing it into a group direct message requires the caller to be a recipient of that channel.--A guild installation emits [Guild Create](/gateway/events/#guild-create), [Guild Member Add](/gateway/events/#guild-member-add), and, unless the guild suppresses join notifications, [Message Create](/gateway/events/#message-create). When a non-zero permission mask is requested it also emits [Guild Role Create](/gateway/events/#guild-role-create) and [Guild Member Update](/gateway/events/#guild-member-update). A group direct message installation emits [Channel Create](/gateway/events/#channel-create) to the bot, [Channel Recipient Add](/gateway/events/#channel-recipient-add) to the existing recipients, and [Message Create](/gateway/events/#message-create).--### Request headers--| Field | Type | Description |-| --- | --- | --- |-| X-Fluxer-Features? | string | A comma-separated [feature declaration](/http-api/permissions/#feature-gated-permission-bits) |+Records the user's consent and returns an [OAuth2 consent response](#oauth2-consent-response-object) with the callback URL. With the `bot` scope it also installs the bot. In a guild you need [MANAGE_GUILD or ADMINISTRATOR](/http-api/permissions/), and in a group DM you need to be a recipient.### JSON body| Field | Type | Description || --- | --- | --- |-| response_type?<sup>1</sup> | string | The OAuth2 response type |-| client_id | snowflake | The ID of the application being authorised |-| redirect_uri?<sup>2</sup> | string | The absolute redirect URI registered by the application (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |-| scope | string | The requested [OAuth2 scopes](#oauth2-scopes), space separated (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |-| state? | string | The caller state appended to the callback URL (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |-| permissions?<sup>3</sup> | string | The bot permission integer literal requested for the installed bot |-| guild_id?<sup>4</sup> | snowflake | The guild the bot is installed into |-| channel_id?<sup>4</sup> | snowflake | The group direct message the bot is installed into |-| code_challenge? | string | The PKCE challenge bound to the issued code (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |-| code_challenge_method? | string | The PKCE method, either `S256` or `plain`, defaulting to `plain` when a challenge is supplied without it |--<sup>1</sup> On a request that asks for any scope other than `bot`, an omitted value defaults to `code` and a supplied value must be `code`. On a request that asks for the `bot` scope alone the field is ignored+| response_type? | string | The response type, `code`. Ignored when the only scope is `bot` |+| client_id | snowflake | The ID of the application |+| redirect_uri?<sup>1</sup> | string | A redirect URI registered on the application |+| scope | string | The requested [scopes](#oauth2-scopes), separated by spaces |+| state? | string | A value Fluxer adds to the callback URL |+| permissions?<sup>2</sup> | string | The permissions to give the bot, as an integer string |+| guild_id?<sup>3</sup> | snowflake | The guild to install the bot into |+| channel_id?<sup>3</sup> | snowflake | The group DM to install the bot into |+| code_challenge? | string | The PKCE challenge |+| code_challenge_method? | string | The PKCE method, `S256` or `plain` |-<sup>2</sup> Required unless the request asks for the `bot` scope alone, and it must match a registered redirect URI. A bot-only request still requires it when the application sets `bot_require_code_grant`+<sup>1</sup> Required unless the only scope is `bot` and the application doesn't set `bot_require_code_grant`-<sup>3</sup> The value must parse as a non-negative integer literal. Every bit outside the defined [permission](/http-api/permissions/) mask is cleared before use, and a caller without ADMINISTRATOR cannot request a retained bit it does not itself hold+<sup>2</sup> You can only request permissions you have. Thread permissions need the [`channel_threads` client capability](/http-api/threads/#client-capability)-<sup>4</sup> The fields are mutually exclusive--Fluxer clears the four thread permission bits from `permissions` unless the request declares the [`channel_threads` client capability](/http-api/threads/#client-capability). [Feature-gated permission bits](/http-api/permissions/#feature-gated-permission-bits) lists them.+<sup>3</sup> Send one or the other### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [OAuth2 consent response](#oauth2-consent-response-object) object | Consent completed |-| 400<sup>5</sup> | [error response](/http-api/#error-response) | The body fails validation, or the bot installation target is not usable |-| 400<sup>6</sup> | [OAuth2 error](#oauth2-error-response-object) object | The application, scope, redirect URI, response type, or permission mask is rejected |-| 403<sup>7</sup> | [error response](/http-api/#error-response) | The credential or the caller's permissions do not allow the installation |-| 404 | [error response](/http-api/#error-response) | The selected channel does not exist (`UNKNOWN_CHANNEL`), or the selected guild does not exist (`UNKNOWN_GUILD`) |--<sup>5</sup> Both installation targets are supplied, the selected channel is not a group direct message (`INVALID_CHANNEL_TYPE`), the application has no bot (`NOT_A_BOT_APPLICATION`), the bot is already a member of the selected guild (`BOT_ALREADY_IN_GUILD`), the guild has reached its member limit (`MAX_GUILD_MEMBERS`) or its role limit (`MAX_GUILD_ROLES`), or the group direct message has reached its recipient limit (`MAX_GROUP_DM_RECIPIENTS`)--<sup>6</sup> The application is unknown, a scope is unrecognised, the redirect URI is missing or unregistered, the response type is not `code` on a request that asks for a non-bot scope, or the permission mask is not a non-negative integer literal--<sup>7</sup> The credential is a bot token or an OAuth2 bearer (`ACCESS_DENIED`), the bot is private and the caller does not own the application (`BOT_IS_PRIVATE`), the caller holds neither MANAGE_GUILD nor ADMINISTRATOR in the selected guild, or requests a permission bit it does not itself hold (`MISSING_PERMISSIONS`), or the caller is not a recipient of the selected channel (`MISSING_ACCESS`)--### Side effects+| 200 | [OAuth2 consent response](#oauth2-consent-response-object) object | Consent was recorded |+| 400 | [OAuth2 error](#oauth2-error-response-object) object | The application, scope, redirect URI, response type or permission mask was rejected |+| 400 | [error response](/http-api/#error-response) | `NOT_A_BOT_APPLICATION`, `BOT_ALREADY_IN_GUILD` or `INVALID_CHANNEL_TYPE` |+| 400 | [error response](/http-api/#error-response) | `MAX_GUILD_MEMBERS`, `MAX_GUILD_ROLES` or `MAX_GROUP_DM_RECIPIENTS` |+| 403 | [error response](/http-api/#error-response) | `BOT_IS_PRIVATE` when you don't own a private bot's application |+| 403 | [error response](/http-api/#error-response) | `MISSING_PERMISSIONS` when you lack the guild permissions, or `MISSING_ACCESS` when you aren't in the group DM |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_CHANNEL` when the group DM doesn't exist |-Consent issues one authorisation code bound to the application, user, resolved redirect URI, granted scopes, and PKCE challenge, and returns the callback URL that has it.+When a guild install has a non-zero `permissions` value, Fluxer creates a role with the application's name with those permissions and gives it to the bot. A guild install sends [Guild Create](/gateway/events/#guild-create) and [Guild Member Add](/gateway/events/#guild-member-add), and a group DM install sends [Channel Recipient Add](/gateway/events/#channel-recipient-add). If the install fails, Fluxer deletes the code and returns the error.-With the `bot` scope and a guild target, consent adds the bot to the guild with the bot-invite join source and the caller recorded as inviter. Consent bypasses both the bot account's own guild count limit and the guild ban list. The guild member limit still applies. When a non-zero permission mask is requested, consent also creates one role with exactly the filtered permission mask, names the role after the application, and assigns it to the bot. The installation either succeeds with exactly that mask or fails with a missing-permissions error. The filter includes the thread bit rule above.--That role is created at position 1 with no colour and is neither hoisted nor mentionable. It consumes a guild role slot and is not removed when the bot leaves. The installation records bot add, role create, and member role update [audit log](/http-api/guild-audit-logs/) entries.--With the `bot` scope and a group direct message target, consent adds the bot as a recipient and stores the recipient-add system message.--When any part of the installation fails, Fluxer cancels the newly issued authorisation code, so the caller never receives a usable code.--### Rate limit--60 requests per minute for each authenticated user, on the `oauth:authorize` bucket.+The rate limit is 60 requests per minute, on the `oauth:authorize` bucket.## Exchange OAuth2 token<RouteHeader method="POST" path="/v1/oauth2/token" />-Exchanges an authorisation code or a refresh token. Returns an [OAuth2 token](#oauth2-token-object) object on success.+Exchanges an authorization code or a refresh token for an [OAuth2 token](#oauth2-token-object) object.-The request body is `application/x-www-form-urlencoded` or `multipart/form-data`. The client application authenticates with HTTP Basic or with the `client_id` and `client_secret` form fields. No user credential is accepted.--:::caution[Refresh rotates the token pair]-A refresh exchange consumes the presented refresh token, so a client that loses the response MUST restart the authorisation code grant.+:::caution[Refreshing uses up the refresh token]+If you lose the response to a refresh, the user has to authorize your application again. Earlier access tokens stay valid until they expire.:::-Access tokens issued earlier for the same user and application stay valid after a refresh. Each one expires 7 days after it is issued.--### Request headers--| Field | Type | Description |-| --- | --- | --- |-| Authorization?<sup>1</sup> | string | The HTTP Basic client credentials |-| Content-Type | string | The request media type, either `application/x-www-form-urlencoded` or `multipart/form-data` |--<sup>1</sup> This route resolves the client from the form first and falls back to the header, so supplying both is accepted. The introspection and revocation routes reject that combination as `invalid_request`-### Form body-#### Authorisation code fields--| Field | Type | Description |-| --- | --- | --- |-| grant_type | string | The grant type, always `authorization_code` on this variant |-| code | string | The authorisation code returned by the callback (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |-| redirect_uri<sup>1</sup> | string | The redirect URI the authorisation request resolved to (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |-| client_id?<sup>2</sup> | snowflake | The client ID, which takes precedence over the HTTP Basic value |-| client_secret?<sup>2</sup> | string | The client secret, which takes precedence over the HTTP Basic value (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |-| code_verifier?<sup>3</sup> | string | The PKCE verifier proving the challenge stored on the code (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |--<sup>1</sup> Compared as an exact string against the URI recorded on the code, which the [OAuth2 consent response](#oauth2-consent-response-object) describes. A trailing slash, host casing, or percent-encoding difference is rejected as an invalid grant--<sup>2</sup> Each credential field is resolved on its own, so a form value is used when it is supplied and the HTTP Basic value is used otherwise, and a form `client_id` can be combined with an HTTP Basic client secret. A request that resolves no client ID or no client secret is rejected as `invalid_client`--<sup>3</sup> Required when the authorisation code has a PKCE challenge. For the `S256` method it is hashed with SHA-256 and base64url-encoded before comparison with the challenge stored on the code, and for `plain` it is compared unchanged--When the code is PKCE-bound, an omitted or incorrect verifier is rejected as `invalid_grant` in the OAuth2 error response.--#### Refresh token fields-| Field | Type | Description || --- | --- | --- |-| grant_type | string | The grant type, always `refresh_token` on this variant |-| refresh_token | string | The refresh token to exchange (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |-| client_id?<sup>1</sup> | snowflake | The client ID, which takes precedence over the HTTP Basic value |-| client_secret?<sup>1</sup> | string | The client secret, which takes precedence over the HTTP Basic value (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |--<sup>1</sup> Each credential field is resolved on its own, so a form value is used when it is supplied and the HTTP Basic value is used otherwise, and a form `client_id` can be combined with an HTTP Basic client secret. A request that resolves no client ID or no client secret is rejected as `invalid_client`+| grant_type | string | The grant type, `authorization_code` or `refresh_token` |+| code | string | The code from the callback, for `authorization_code` |+| redirect_uri | string | The code's redirect URI, normalized, so `https://example.com` is sent as `https://example.com/` |+| code_verifier? | string | The PKCE verifier, when the code has a challenge |+| refresh_token | string | The refresh token, for `refresh_token` |+| client_id? | snowflake | The ID of the application, if you don't use HTTP Basic |+| client_secret? | string | The client secret, if you don't use HTTP Basic |### Response| Status | Body | Condition || --- | --- | --- || 200 | [OAuth2 token](#oauth2-token-object) object | A token pair was issued |-| 400 | [error response](/http-api/#error-response) | The form fails validation, including an unsupported `grant_type` |-| 400<sup>2</sup> | [OAuth2 error](#oauth2-error-response-object) object | Client authentication or the presented grant fails |--<sup>2</sup> Client authentication, the authorisation code, the refresh token, the redirect URI, or a required PKCE verifier is missing or does not match the grant--An authorisation code is single-use. Fluxer consumes it before it issues the token pair. A replayed code is rejected as an invalid grant. Deleting an account purges every OAuth2 access and refresh token it holds, so a refresh exchange for a deleted account is rejected as an invalid grant as well. An authorisation code issued before the deletion still exchanges until it expires.--Fluxer verifies client authentication before it checks the grant, so an unknown application, an absent client secret, and a wrong client secret are all reported as `invalid_client`.--:::note[No client credentials grant]-Only `authorization_code` and `refresh_token` exist, and Fluxer issues no token that is unbound to a user.-:::--Any other `grant_type`, `client_credentials` included, fails request validation with the ordinary [error response](/http-api/#error-response).--### Side effects--A successful exchange issues one access token that expires after 7 days and one refresh token that expires after 30 days. An authorisation code exchange consumes the code, and a refresh exchange consumes the presented refresh token. Nothing else changes and no Gateway Dispatch is emitted.+| 400 | [OAuth2 error](#oauth2-error-response-object) object | Client authentication or the grant failed |-### Rate limit--120 requests per minute for each client IP address, on the `oauth:token` bucket.+The rate limit is 120 requests per minute, on the `oauth:token` bucket.## Get OAuth2 user information<RouteHeader method="GET" path="/v1/oauth2/userinfo" oauth2="identify" />-Returns the [OAuth2 user information](#oauth2-user-information-object) object for the account the token was issued to. Requires the `identify` [scope](#oauth2-scopes).--An OAuth2 bearer access token is required. The `email` scope fills in the address fields.--### Request headers--| Field | Type | Description |-| --- | --- | --- |-| Authorization | string | The OAuth2 bearer access token |+Returns the [OAuth2 user information](#oauth2-user-information-object) for the access token's user.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [OAuth2 user information](#oauth2-user-information-object) object | User information was returned |-| 401<sup>1</sup> | [error response](/http-api/#error-response) | The bearer token is missing, unusable, or expired |-| 403 | [error response](/http-api/#error-response) | The token lacks `identify` (`MISSING_OAUTH_SCOPE`) |--<sup>1</sup> The credential is missing, is not an OAuth2 bearer access token, or has expired (`UNAUTHORIZED`), or the bearer no longer resolves to a user and an application (`INVALID_TOKEN`)--A missing scope failure has the required scope as a top-level `required_scope` member of the [error response](/http-api/#error-response), so a client can request the correct authorisation without parsing the message text.+| 200 | [OAuth2 user information](#oauth2-user-information-object) object | The user was returned |+| 403 | [error response](/http-api/#error-response) | `MISSING_OAUTH_SCOPE` when the token lacks `identify`, with the scope in `required_scope` |-### Rate limit--120 requests per minute for each pair of authenticated user and bearer application, on the `oauth:introspect` bucket.+The rate limit is 120 requests per minute, on the `oauth:introspect` bucket.## Introspect OAuth2 token<RouteHeader method="POST" path="/v1/oauth2/introspect" />-Returns an [OAuth2 introspection](#oauth2-introspection-object) object describing one access or refresh token.--The request body is `application/x-www-form-urlencoded` or `multipart/form-data`. The client application authenticates with HTTP Basic or with the `client_id` and `client_secret` form fields. No user credential is accepted.--### Request headers--| Field | Type | Description |-| --- | --- | --- |-| Authorization? | string | The HTTP Basic client credentials |-| Content-Type | string | The request media type, either `application/x-www-form-urlencoded` or `multipart/form-data` |+Returns an [OAuth2 introspection](#oauth2-introspection-object) object for an access or refresh token. A token is inactive when it was issued to another application or its user can't sign in.### Form body| Field | Type | Description || --- | --- | --- |-| token | string | The access or refresh token to inspect (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |-| client_id?<sup>1</sup> | snowflake | The client ID, supplied when HTTP Basic is not used |-| client_secret?<sup>1</sup> | string | The client secret, supplied when HTTP Basic is not used (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |--<sup>1</sup> Supplying either field together with a well-formed HTTP Basic `Authorization` header is rejected as `invalid_request`+| token | string | The access or refresh token |+| client_id? | snowflake | The ID of the application, if you don't use HTTP Basic |+| client_secret? | string | The client secret, if you don't use HTTP Basic |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [OAuth2 introspection](#oauth2-introspection-object) object | Introspection completed, including a token reported as inactive |-| 400 | [error response](/http-api/#error-response) | The form fails validation |-| 400<sup>2</sup> | [OAuth2 error](#oauth2-error-response-object) object | Client authentication failed |+| 200 | [OAuth2 introspection](#oauth2-introspection-object) object | The token was checked, including an inactive one |+| 400 | [OAuth2 error](#oauth2-error-response-object) object | Client authentication failed |-<sup>2</sup> Client credentials are supplied in both the header and the form (`invalid_request`), no client secret is supplied, the client is unknown, or the client secret is wrong (`invalid_client`)--Fluxer ignores an `Authorization` header that is not well-formed HTTP Basic and reads the client credentials from the form.--Only a token issued to the authenticated client is reported as active.--### Rate limit--120 requests per minute for each client IP address, on the `oauth:introspect` bucket.+The rate limit is 120 requests per minute, on the `oauth:introspect` bucket.## Revoke OAuth2 token<RouteHeader method="POST" path="/v1/oauth2/token/revoke" />-Revokes a presented access or refresh token.--The request body is `application/x-www-form-urlencoded` or `multipart/form-data`. The client application authenticates with HTTP Basic or with the `client_id` and `client_secret` form fields. No user credential is accepted.--:::caution[Revocation clears the whole grant]-Revoking a token deletes every access token and every refresh token its user holds for the authenticated application.-:::--### Request headers--| Field | Type | Description |-| --- | --- | --- |-| Authorization? | string | The HTTP Basic client credentials |-| Content-Type | string | The request media type, either `application/x-www-form-urlencoded` or `multipart/form-data` |+Deletes every access and refresh token the token's user has for your application.### Form body| Field | Type | Description || --- | --- | --- |-| token | string | The access or refresh token to revoke (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |-| token_type_hint?<sup>1</sup> | string | The kind of token presented, either `access_token` or `refresh_token` |-| client_id?<sup>2</sup> | snowflake | The client ID, supplied when HTTP Basic is not used |-| client_secret?<sup>2</sup> | string | The client secret, supplied when HTTP Basic is not used (1-256 UTF-16 code units after [normalisation](#oauth2-string-normalisation)) |--<sup>1</sup> A `refresh_token` hint makes Fluxer look for a matching refresh token first, then for a matching access token when no refresh token matches. An absent hint and an `access_token` hint make Fluxer look for a matching access token only--<sup>2</sup> Supplying either field together with a well-formed HTTP Basic `Authorization` header is rejected as `invalid_request`+| token | string | The access or refresh token |+| token_type_hint?<sup>1</sup> | string | The token type, `access_token` or `refresh_token` |+| client_id? | snowflake | The ID of the application, if you don't use HTTP Basic |+| client_secret? | string | The client secret, if you don't use HTTP Basic |-A client that presents a refresh token MUST send `token_type_hint=refresh_token`, or Fluxer matches no token and deletes nothing.+<sup>1</sup> Send `refresh_token` when the token is a refresh token, or Fluxer won't find it### Response| Status | Body | Condition || --- | --- | --- |-| 200 | empty | The revocation request was processed, including a token that matched nothing |-| 400 | [error response](/http-api/#error-response) | The form fails validation |-| 400<sup>3</sup> | [OAuth2 error](#oauth2-error-response-object) object | Client authentication failed |--<sup>3</sup> Client credentials are supplied in both the header and the form (`invalid_request`), no client secret is supplied, the client is unknown, or the client secret is wrong (`invalid_client`)--Fluxer ignores an `Authorization` header that is not well-formed HTTP Basic and reads the client credentials from the form.+| 200 | empty | The tokens were deleted, or the token matched nothing |+| 400 | [OAuth2 error](#oauth2-error-response-object) object | Client authentication failed |-An unknown token and a token issued to another application both return 200, so the response never shows whether a token exists.+The rate limit is 120 requests per minute, on the `oauth:revoke` bucket.-### Side effects--On a match, Fluxer deletes the user's complete token set for the authenticated application. Those tokens stop authenticating requests at once. A token that matched nothing changes no state.--No Gateway Dispatch is emitted, so a client holding a revoked token learns of the revocation from its next rejected request.--### Rate limit--120 requests per minute for each client IP address, on the `oauth:revoke` bucket.--## Get current OAuth2 authorisation+## Get current OAuth2 authorization<RouteHeader method="GET" path="/v1/oauth2/@me" />-Returns the [current OAuth2 authorisation](#current-oauth2-authorisation-object) object for the presented access token. Requires no scope.--An OAuth2 bearer access token is required, and the token must belong to a non-bot account. The response has a user object only when the token holds `identify`.--### Request headers--| Field | Type | Description |-| --- | --- | --- |-| Authorization | string | The OAuth2 bearer access token |+Returns the [current OAuth2 authorization](#current-oauth2-authorization-object) for the OAuth2 access token you send. It needs no scope.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [current OAuth2 authorisation](#current-oauth2-authorisation-object) object | The authorisation was returned |-| 401<sup>1</sup> | [error response](/http-api/#error-response) | The bearer token is missing, unusable, or expired |-| 403 | [error response](/http-api/#error-response) | The token belongs to a bot account (`ACCESS_DENIED`) |+| 200 | [current OAuth2 authorization](#current-oauth2-authorization-object) object | The authorization was returned |+| 401 | [error response](/http-api/#error-response) | `UNAUTHORIZED` when the token isn't an OAuth2 access token |-<sup>1</sup> The credential is missing, is not an OAuth2 bearer access token, or has expired (`UNAUTHORIZED`), the bearer has no user identity (`UNAUTHORIZED`), or it names an application that no longer exists (`INVALID_TOKEN`)+The rate limit is 120 requests per minute, on the `oauth:introspect` bucket.-### Rate limit--120 requests per minute for each pair of authenticated user and bearer application, on the `oauth:introspect` bucket.--## List OAuth2 authorisations+## List OAuth2 authorizations<RouteHeader method="GET" path="/v1/oauth2/@me/authorizations" />-Returns the [OAuth2 authorisation](#oauth2-authorisation-object) objects the current user has granted to applications.+Returns an array of [OAuth2 authorization](#oauth2-authorization-object) objects for the applications the current user has authorized with a scope other than `bot`.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | array[[OAuth2 authorisation](#oauth2-authorisation-object) object] | The authorisations were returned |-| 403 | [error response](/http-api/#error-response) | The credential is a bot token or an OAuth2 bearer (`ACCESS_DENIED`) |--An application appears in the listing only while it holds a live refresh grant with a recognised scope other than `bot`. A deleted application is omitted. The listing is unpaginated.+| 200 | array[[OAuth2 authorization](#oauth2-authorization-object) object] | The authorizations were returned |-### Rate limit+The rate limit is 60 requests per minute, on the `oauth_dev:clients:list` bucket.-60 requests per minute for each authenticated user, on the `oauth_dev:clients:list` bucket.--## Revoke OAuth2 authorisation+## Revoke OAuth2 authorization<RouteHeader method="DELETE" path="/v1/oauth2/@me/authorizations/{applicationId}" />-Revokes the current user's authorisation for one application.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| applicationId | snowflake | The ID of the application whose authorisation is revoked |+Deletes every token the current user has for one application. A bot the application installed stays where it is.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | The authorisation was revoked, including when no grant remained |-| 400 | [error response](/http-api/#error-response) | The application ID is not a valid snowflake |-| 403 | [error response](/http-api/#error-response) | The credential is a bot token or an OAuth2 bearer (`ACCESS_DENIED`) |-| 404 | [error response](/http-api/#error-response) | The application does not exist (`UNKNOWN_APPLICATION`) |--Fluxer resolves the application before it deletes any token, so a 404 leaves the grant untouched.--:::caution[Revocation cannot be undone]-The user completes the [authorisation code grant](#authorise-application) again before the application can act on the account, and the application receives no notice that its access has ended.-:::--### Side effects--Revocation deletes every access token and refresh token the current user holds for the named application. Those tokens stop authenticating requests at once.--A bot the application installed stays in every guild and group direct message it joined. No Gateway Dispatch is emitted.--### Rate limit+| 204 | empty | The authorization was revoked |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_APPLICATION` when the application doesn't exist |-120 requests per minute for each authenticated user, on the `oauth:introspect` bucket.+The rate limit is 120 requests per minute, on the `oauth:introspect` bucket.-## Bulk revoke OAuth2 authorisations+## Bulk revoke OAuth2 authorizations<RouteHeader method="POST" path="/v1/oauth2/@me/authorizations/revoke" />-Revokes the current user's authorisations for several applications.+Deletes every token the current user has for several applications. If any application is unknown, the request returns 404 `UNKNOWN_APPLICATION` and revokes nothing.### JSON body| Field | Type | Description || --- | --- | --- |-| application_ids<sup>1</sup> | array[snowflake] | The IDs of the applications to revoke (1-100) |--<sup>1</sup> Repeated IDs are collapsed before any revocation is done+| application_ids | array[snowflake] | The IDs of the applications (1-100) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | The authorisations were revoked |-| 400 | [error response](/http-api/#error-response) | The body fails validation, including an empty or oversized ID array |-| 403 | [error response](/http-api/#error-response) | The credential is a bot token or an OAuth2 bearer (`ACCESS_DENIED`) |-| 404 | [error response](/http-api/#error-response) | One of the named applications does not exist (`UNKNOWN_APPLICATION`) |--Fluxer resolves every named application before it deletes any token. One unknown application leaves every named application untouched.--### Side effects--Revocation deletes every access token and refresh token the current user holds for each named application. Those tokens stop authenticating requests at once. Bot memberships are unaffected and no Gateway Dispatch is emitted.--### Rate limit+| 204 | empty | The authorizations were revoked |-120 requests per minute for each authenticated user, on the `oauth:introspect` bucket.+The rate limit is 120 requests per minute, on the `oauth:introspect` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/peer-to-peer-voice.mdx b/fluxer_docs/src/content/docs/http-api/peer-to-peer-voice.mdxindex 583f54f65..635ba9618 100644--- a/fluxer_docs/src/content/docs/http-api/peer-to-peer-voice.mdx+++ b/fluxer_docs/src/content/docs/http-api/peer-to-peer-voice.mdx@@ -1,42 +1,32 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Peer-to-peer voice-description: Connection outcome reports for the peer connections of a peer-to-peer voice call.+description: Reporting whether each connection in a peer-to-peer voice call connected or failed.---import RouteHeader from '@/components/RouteHeader.astro';-A peer-to-peer voice call connects its participants directly, as [Peer-to-peer voice](/gateway/events/#peer-to-peer-voice) describes. Fluxer hands out STUN servers only and never relays media, so whether two participants connect depends on their networks. Clients report how each peer connection settled, so an operator can see which networks connect directly.--The route on this page is user-only. Fluxer rejects a bot or OAuth2 credential with 403 `ACCESS_DENIED`.+In a [peer-to-peer voice](/gateway/events/#peer-to-peer-voice) call, Fluxer gives clients STUN servers only and never relays media. Clients send a report for each peer connection once it connects or fails. Fluxer stores the reports, and no API returns them.## Connection report object-The outcome of one peer connection, as seen from the reporting client. A client sends one report for each remote peer of a call, once the connection to that peer reaches connected or fails.+The outcome of one peer connection, as the reporting client saw it.### Structure| Field | Type | Description || --- | --- | --- |-| channel_id<sup>1</sup> | snowflake | The ID of the guild voice channel or private channel of the call |-| guild_id | ?snowflake | The ID of the guild of the channel, null for a call |-| participant_count | integer | Participants in the call when the connection settled (2-4) |+| channel_id | snowflake | The ID of the voice channel or private channel |+| guild_id | ?snowflake | The ID of the guild, null in a private channel |+| participant_count | integer | Number of people in the call when the connection connected or failed (2-4) || outcome | string | `connected` or `failed` |-| local_candidate_type<sup>2</sup> | ?string | Candidate type of the local end of the selected pair |-| remote_candidate_type<sup>2</sup> | ?string | Candidate type of the remote end of the selected pair |-| ip_family<sup>3</sup> | ?string | `ipv4` or `ipv6`, the address family of the selected pair |-| protocol<sup>3</sup> | ?string | `udp` or `tcp`, the transport of the selected pair |-| setup_ms<sup>4</sup> | ?integer | Milliseconds from creating the connection to its first connected state (0-2,147,483,647) |+| local_candidate_type | ?string | `host`, `srflx`, `prflx` or `relay` for the local end of the selected pair, null without one |+| remote_candidate_type | ?string | `host`, `srflx`, `prflx` or `relay` for the remote end of the selected pair, null without one |+| ip_family | ?string | `ipv4` or `ipv6`, null without a selected pair |+| protocol | ?string | `udp` or `tcp`, null without a selected pair |+| setup_ms | ?integer | Milliseconds from creating the connection until it first connected, null if it never connected || ice_restarted | boolean | Whether the connection ran an ICE restart |-<sup>1</sup> Fluxer stores the value with no check that the channel exists or that the caller was in its call--<sup>2</sup> One of `host`, `srflx`, `prflx`, or `relay`, and null when the connection has no selected candidate pair--<sup>3</sup> Null when the connection has no selected candidate pair--<sup>4</sup> Null for a connection that never reached connected-### Example```json@@ -58,32 +48,20 @@ The outcome of one peer connection, as seen from the reporting client. A client<RouteHeader method="POST" path="/v1/voice/p2p/connection-reports" />-Records 1 through 8 [connection report objects](#connection-report-object) and returns 204 with an empty body. User-only. Emits no Gateway event.--A client batches its reports and sends them best effort. A failed or rate-limited request changes nothing about the call, and a client drops the batch rather than retrying more than once.+Records [connection reports](#connection-report-object). Fluxer keeps each report for 180 days, together with your user ID, your IP address and its country, and your session's platform and operating system. When peer-to-peer voice is off on the instance, the request returns 204 and stores nothing.### JSON body| Field | Type | Description || --- | --- | --- |-| reports<sup>1</sup> | array[[connection report](#connection-report-object) object] | The reports to record (1-8) |--<sup>1</sup> A list of fewer than 1 or more than 8 entries, or any invalid entry, fails with 400 `INVALID_FORM_BODY` and records nothing+| reports | array[[connection report](#connection-report-object) object] | The reports to record (1-8) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Every report was recorded, or peer-to-peer voice is disabled on the instance and nothing was recorded |-| 400 | [error response](/http-api/#error-response) | The body is invalid and the request returns `INVALID_FORM_BODY` |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |--### Side effects--Fluxer stores each report with the caller's user ID, the time of the request, the request address and its country, and the client platform and operating system of the caller's session. The country is null when the address resolves to none. Reports expire after 180 days.--Fluxer keeps each report for 180 days. No route reads reports back.--### Rate limit+| 204 | empty | The reports were recorded |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` when any report is invalid, and nothing is recorded |+| 403 | [error response](/http-api/#error-response) | `ACCESS_DENIED` when the caller is a bot or uses an OAuth2 bearer token |-10 requests per minute for each authenticated user, on the `voice:p2p:connection_reports` bucket.+The rate limit is 10 requests per minute, on the `voice:p2p:connection_reports` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/permissions.mdx b/fluxer_docs/src/content/docs/http-api/permissions.mdxindex 1a3aaf66c..2e0abc776 100644--- a/fluxer_docs/src/content/docs/http-api/permissions.mdx+++ b/fluxer_docs/src/content/docs/http-api/permissions.mdx@@ -1,193 +1,112 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Roles and permissions-description: The guild permission bitfield, permission computation, role hierarchy, and role operations.+description: The permission bits, how Fluxer computes a member's permissions and the routes that manage guild roles.---import RouteHeader from '@/components/RouteHeader.astro';-A permission grants a member one ability in a guild, such as sending a message or banning another member. A role has a set of them as an unsigned 64-bit mask, and a [permission overwrite](/http-api/channels/#permission-overwrite-object) stored on a channel adjusts that set for that channel.--Only [List guild roles](#list-guild-roles) accepts an OAuth2 bearer credential, and every other route here rejects one with 403 `ACCESS_DENIED`. A guild with [UNAVAILABLE_FOR_EVERYONE](/http-api/guilds/#guild-features) rejects an authenticated request with 403 `MISSING_ACCESS`, and [UNAVAILABLE_FOR_EVERYONE_BUT_STAFF](/http-api/guilds/#guild-features) does the same for an account without the instance staff flag.--Fluxer resolves the guild before any role. A guild that does not exist returns 404 `UNKNOWN_GUILD`. When the guild exists and the caller is not a member, the request returns 403 `MISSING_PERMISSIONS`, so guild existence is visible to any authenticated caller. Every route that names a role asserts `MANAGE_ROLES` before it reads the role. A caller without the permission receives 403 `MISSING_PERMISSIONS` even for a role that does not exist.+A permission lets a member do one thing in a guild, such as send a message or ban another member. Each role grants a set of permissions as a 64-bit mask, and a [permission overwrite](/http-api/channels/#permission-overwrite-object) on a channel changes that set for one channel.## Permissions-Every bit Fluxer defines appears below.-| Value | Name | Description || --- | --- | --- || 1 << 0 | CREATE_INSTANT_INVITE | Create an invite to a guild channel || 1 << 1 | KICK_MEMBERS | Remove a member from the guild |-| 1 << 2 | BAN_MEMBERS | Create and revoke a guild ban |-| 1 << 3 | ADMINISTRATOR<sup>1</sup> | Hold every permission and bypass every channel permission overwrite |-| 1 << 4 | MANAGE_CHANNELS | Create, modify, reorder, and delete a guild channel |-| 1 << 5 | MANAGE_GUILD | Modify guild settings and manage guild-level resources such as invites, the vanity URL, and discovery |-| 1 << 6 | ADD_REACTIONS | Add a reaction to a message in a guild channel |+| 1 << 2 | BAN_MEMBERS | Ban and unban members |+| 1 << 3 | ADMINISTRATOR | Grants every permission and ignores every channel overwrite |+| 1 << 4 | MANAGE_CHANNELS | Create, modify, reorder and delete guild channels |+| 1 << 5 | MANAGE_GUILD | Modify guild settings, invites, the vanity URL and discovery |+| 1 << 6 | ADD_REACTIONS | Add a reaction to a message || 1 << 7 | VIEW_AUDIT_LOG | Read the guild audit log |-| 1 << 8 | PRIORITY_SPEAKER | Use priority speaker in a guild voice channel, evaluated by the client |-| 1 << 9 | STREAM<sup>2</sup> | Publish a screenshare track on a guild voice connection |-| 1 << 10 | VIEW_CHANNEL<sup>3</sup> | View a guild channel |-| 1 << 11 | SEND_MESSAGES | Send a message in a guild text, announcement, or voice channel, create a post in a forum or media channel, and publish the caller's own announcement |-| 1 << 12 | SEND_TTS_MESSAGES | Send a message that requests text-to-speech playback |-| 1 << 13 | MANAGE_MESSAGES<sup>4</sup> | Delete another member's message, bulk delete messages, remove another member's reaction, and edit the flags and attachments of another member's message |-| 1 << 14 | EMBED_LINKS | Have a link in the caller's own message expanded into an embed |-| 1 << 15 | ATTACH_FILES | Attach a file to a message |-| 1 << 16 | READ_MESSAGE_HISTORY | Read messages sent before the guild's `message_history_cutoff`, or any message when the guild has no cutoff |-| 1 << 17 | MENTION_EVERYONE | Use the everyone and here mentions in a guild channel |-| 1 << 18 | USE_EXTERNAL_EMOJIS | Use an emoji owned by another guild in a message or a reaction |-| 1 << 20 | CONNECT | Connect to a guild voice channel |-| 1 << 21 | SPEAK | Transmit audio in a guild voice channel |-| 1 << 22 | MUTE_MEMBERS | Apply and clear a moderator mute in a guild voice channel |-| 1 << 23 | DEAFEN_MEMBERS | Apply and clear a moderator deafen in a guild voice channel |-| 1 << 24 | MOVE_MEMBERS | Move a member between guild voice channels or disconnect a member |-| 1 << 25 | USE_VAD | Use voice activity detection rather than push-to-talk in a guild voice channel, evaluated by the client |-| 1 << 26 | CHANGE_NICKNAME | Change the caller's own nickname in the guild |-| 1 << 27 | MANAGE_NICKNAMES | Change another member's nickname in the guild |-| 1 << 28 | MANAGE_ROLES<sup>5</sup> | Create, modify, position, and delete a role, assign a role to a member, and set a channel permission overwrite |-| 1 << 29 | MANAGE_WEBHOOKS | Create, modify, and delete a webhook on a guild channel, and follow an announcement channel into it |-| 1 << 30 | MANAGE_EXPRESSIONS<sup>6</sup> | Modify and delete an emoji or sticker created by another member |-| 1 << 34 | MANAGE_THREADS<sup>8</sup> | Archive, lock, rename, and delete a thread, view every private thread, and act in a locked thread |-| 1 << 35 | CREATE_PUBLIC_THREADS<sup>8</sup> | Start a public thread or an announcement thread |-| 1 << 36 | CREATE_PRIVATE_THREADS<sup>8</sup> | Start a private thread in a guild text channel |-| 1 << 37 | USE_EXTERNAL_STICKERS | Use a sticker owned by another guild |-| 1 << 38 | SEND_MESSAGES_IN_THREADS<sup>8</sup> | Send a message in a thread, and add another member to a thread |-| 1 << 40 | MODERATE_MEMBERS | Apply and clear a member communication timeout |-| 1 << 43 | CREATE_EXPRESSIONS<sup>6</sup> | Create an emoji or sticker, and modify or delete the ones the caller created |-| 1 << 51 | PIN_MESSAGES | Pin and unpin a message in a guild channel |-| 1 << 52 | BYPASS_SLOWMODE | Send a message, start a thread, or create a forum post without waiting for the channel slowmode interval |-| 1 << 53 | UPDATE_RTC_REGION | Change the voice region of a guild voice channel |-| 1 << 54 | VIEW_CHANNEL_MEMBERS<sup>7</sup> | View the member list of a guild channel |--<sup>1</sup> A member who holds the bit through any assigned role receives the complete 64-bit mask, and Fluxer applies no channel overwrite afterwards--<sup>2</sup> The same bit gates the camera track, so a member without it publishes neither screenshare nor video--<sup>3</sup> Fluxer also treats a category as visible when at least one channel inside it is visible--<sup>4</sup> Deleting or editing the caller's own message does not require the bit--<sup>5</sup> A role mutation also needs [role hierarchy](#role-hierarchy) authority over the target role--<sup>6</sup> Modifying or deleting an expression created by the caller requires `CREATE_EXPRESSIONS`, and the same operation on an expression created by another member requires `MANAGE_EXPRESSIONS`--<sup>7</sup> The bit is [feature-gated on write](#feature-gated-permission-bits), so a request that does not declare the feature cannot change it--<sup>8</sup> The bit is [feature-gated](#feature-gated-permission-bits). [Thread permissions](/http-api/threads/#thread-permissions) describes how Fluxer evaluates it--Bits 19, 31 through 33, 39, 41, 42, 44 through 50, and 55 through 63 are unassigned.--:::note[`STREAM` authorises a track on the existing connection]-The track is a screenshare or a camera. Fluxer opens no second connection for it, and losing the bit mutes the published tracks while the voice connection stays up.-:::--:::note[Permission masks are decimal strings on the wire]-Every permission response field uses the decimal representation of an unsigned 64-bit integer inside a JSON string. A permission request field accepts that decimal string or a JSON number that is a safe integer, and the value is a non-negative integer no greater than 9223372036854775807.-:::--A value that is not a run of decimal digits is rejected with the validation code `INVALID_INTEGER_FORMAT`, and one above the maximum with `INTEGER_OUT_OF_INT64_RANGE`. A JSON number cannot represent the full 64-bit range, so a client MUST parse and combine masks with unsigned 64-bit integer arithmetic and MUST NOT compare them with string equality.--Fluxer discards a bit it does not define. A role mutation intersects the requested mask with the set of defined bits before authorisation. An unassigned bit never appears in a response. A channel permission overwrite uses the same mask and the same defined-bit set. Fluxer does not filter bits by channel type, so an overwrite can name a permission its channel does not use.+| 1 << 8 | PRIORITY_SPEAKER | Use priority speaker in a voice channel, enforced by the client |+| 1 << 9 | STREAM | Share your screen or camera in a voice channel |+| 1 << 10 | VIEW_CHANNEL | View a channel |+| 1 << 11 | SEND_MESSAGES | Send messages, create forum posts and publish your own announcements |+| 1 << 12 | SEND_TTS_MESSAGES | Send a text-to-speech message |+| 1 << 13 | MANAGE_MESSAGES | Delete other members' messages and reactions, bulk delete messages and edit other members' message flags and attachments |+| 1 << 14 | EMBED_LINKS | Have links in your messages expanded into embeds |+| 1 << 15 | ATTACH_FILES | Attach files to a message |+| 1 << 16 | READ_MESSAGE_HISTORY | Read messages older than the guild's `message_history_cutoff`, or any message when the guild has no cutoff |+| 1 << 17 | MENTION_EVERYONE | Use the everyone and here mentions |+| 1 << 18 | USE_EXTERNAL_EMOJIS | Use emojis from other guilds |+| 1 << 20 | CONNECT | Connect to a voice channel |+| 1 << 21 | SPEAK | Talk in a voice channel |+| 1 << 22 | MUTE_MEMBERS | Mute other members in a voice channel |+| 1 << 23 | DEAFEN_MEMBERS | Deafen other members in a voice channel |+| 1 << 24 | MOVE_MEMBERS | Move members between voice channels or disconnect them |+| 1 << 25 | USE_VAD | Use voice activity detection, enforced by the client |+| 1 << 26 | CHANGE_NICKNAME | Change your own nickname |+| 1 << 27 | MANAGE_NICKNAMES | Change other members' nicknames |+| 1 << 28 | MANAGE_ROLES | Manage roles below your highest role, assign them and set channel overwrites |+| 1 << 29 | MANAGE_WEBHOOKS | Create, modify and delete webhooks and follow announcement channels |+| 1 << 30 | MANAGE_EXPRESSIONS | Modify and delete emojis and stickers that other members created |+| 1 << 34 | MANAGE_THREADS<sup>1</sup> | Archive, lock, rename and delete threads and see every private thread |+| 1 << 35 | CREATE_PUBLIC_THREADS<sup>1</sup> | Start public and announcement threads |+| 1 << 36 | CREATE_PRIVATE_THREADS<sup>1</sup> | Start private threads |+| 1 << 37 | USE_EXTERNAL_STICKERS | Use stickers from other guilds |+| 1 << 38 | SEND_MESSAGES_IN_THREADS<sup>1</sup> | Send messages in threads and add members to them |+| 1 << 40 | MODERATE_MEMBERS | Time out members |+| 1 << 43 | CREATE_EXPRESSIONS | Create emojis and stickers and edit or delete your own |+| 1 << 51 | PIN_MESSAGES | Pin and unpin messages |+| 1 << 52 | BYPASS_SLOWMODE | Ignore the channel slowmode |+| 1 << 53 | UPDATE_RTC_REGION | Change the voice region of a voice channel |+| 1 << 54 | VIEW_CHANNEL_MEMBERS<sup>1</sup> | View the member list of a channel |++<sup>1</sup> The bit is [feature-gated](#feature-gated-permission-bits). [Thread permissions](/http-api/threads/#thread-permissions) explains how the thread bits apply.++Responses send a permission mask as a decimal string. Requests accept a decimal string up to 9223372036854775807, or a JSON number that is a safe integer. Parse masks as unsigned 64-bit integers. Fluxer drops any bit it doesn't define.### Feature-gated permission bits-Fluxer gates some permission bits on a feature declaration, which a client sends in the `X-Fluxer-Features` request header as a comma-separated list.--Two features gate bits. `VIEW_CHANNEL_MEMBERS` requires the feature name `view_channel_members_permission`. `MANAGE_THREADS`, `CREATE_PUBLIC_THREADS`, `CREATE_PRIVATE_THREADS`, and `SEND_MESSAGES_IN_THREADS` require the [`channel_threads` client capability](/http-api/threads/#client-capability) from a user session token. An OAuth2 bearer token cannot write them even when it declares the feature. A bot writes them without declaring the feature.--On a role or overwrite write by a caller that cannot write a gated bit, Fluxer keeps that bit at its stored value. Every other bit in the same mask is written normally.--A caller other than a bot or a user session that declares `channel_threads` also receives role masks, overwrite masks, and guild `permissions` values without the four thread bits. `channels` on [Get guild](/http-api/guilds/#get-guild) is the exception.--Fluxer trims and lowercases each name in the header before matching it. A name that is empty, longer than 64 characters, or containing a character outside `a-z`, `0-9`, and `_` is ignored. Fluxer reads at most 64 names from one header. An absent or empty header declares no features.+You can only write a gated bit when your request declares the feature it needs, in the `X-Fluxer-Features` header as a comma-separated list.-On [Create guild role](#create-guild-role), a request that supplies `permissions` creates the role with `VIEW_CHANNEL_MEMBERS` cleared unless it declares `view_channel_members_permission`. It clears the four thread bits unless the caller is a bot or a user session that declares `channel_threads`. A request that omits `permissions` copies the everyone role mask without applying the gate.+| Bits | Who can write them |+| --- | --- |+| `VIEW_CHANNEL_MEMBERS` | A request that declares `view_channel_members_permission` |+| The four thread bits | A bot, or a user session that declares the [`channel_threads`](/http-api/threads/#client-capability) feature |-## Announcement channel permissions--[Crosspost message](/http-api/messages/#crosspost-message) publishes a message from an announcement channel. The author needs `VIEW_CHANNEL` and `SEND_MESSAGES` in the channel. Publishing another member's message, or a webhook's, needs `MANAGE_MESSAGES` as well, and a caller without `READ_MESSAGE_HISTORY` can publish only a message newer than the guild's message history cutoff.--[Follow announcement channel](/http-api/channels/#follow-announcement-channel) needs `VIEW_CHANNEL` on the announcement channel alone, so any member who can read it can follow it. The follow is created in the target guild, which needs `MANAGE_WEBHOOKS` at guild level and `VIEW_CHANNEL` and `MANAGE_WEBHOOKS` in the target channel. A guild receives copies only in a channel that one of its webhook managers chose.--Delivery rechecks access. While the account that created a follow cannot view the announcement channel, no new copy is delivered through it.+When you can't write a gated bit, Fluxer keeps that bit at its stored value and writes the rest of the mask. A new role created with `permissions` starts with the bit cleared. One created without `permissions` copies the everyone role's mask, gated bits included. Callers that can't write the thread bits also don't see them in role masks, overwrite masks or `permissions` values.## Elevated permissions-`KICK_MEMBERS`, `BAN_MEMBERS`, `ADMINISTRATOR`, `MANAGE_CHANNELS`, `MANAGE_GUILD`, `MANAGE_MESSAGES`, `MANAGE_ROLES`, `MANAGE_WEBHOOKS`, `MODERATE_MEMBERS`, and `MANAGE_THREADS` are elevated permissions. In a guild whose [MFA level](/http-api/guilds/#mfa-levels) is elevated, only the guild owner uses them without an enrolled authenticator.--An operation that asserts an elevated permission the caller holds but cannot use returns 400 `TWO_FACTOR_REQUIRED`. The check runs after Fluxer has confirmed the permission itself, so a caller who lacks the permission outright receives 403 `MISSING_PERMISSIONS` instead.--[List guild roles](#list-guild-roles) asserts no permission, so it never produces `TWO_FACTOR_REQUIRED`.--:::note[The reported mask keeps every elevated bit]-The MFA requirement blocks the operation and leaves the mask unchanged. A `permissions` field reports what the caller's roles grant, so a client hiding an action must compare the guild [MFA level](/http-api/guilds/#mfa-levels) and its own enrolment state.-:::+`KICK_MEMBERS`, `BAN_MEMBERS`, `ADMINISTRATOR`, `MANAGE_CHANNELS`, `MANAGE_GUILD`, `MANAGE_MESSAGES`, `MANAGE_ROLES`, `MANAGE_WEBHOOKS`, `MODERATE_MEMBERS` and `MANAGE_THREADS` are elevated. In a guild with the elevated [MFA level](/http-api/guilds/#mfa-levels), a member other than the owner needs two-factor authentication to use them, and gets 400 `TWO_FACTOR_REQUIRED` without it. Computed `permissions` values still include these bits.## Permission computation-Fluxer computes a permission set for one member in one guild, and optionally in one channel of that guild. The result is the complete effective mask for that member at that moment.--The guild owner receives the complete 64-bit mask. A user who is not a member receives an empty mask.+The guild owner has every permission, and a user who isn't a member has none. For anyone else, Fluxer starts with the everyone role, whose ID is the guild ID, and adds every role the member has. If the result has `ADMINISTRATOR`, the member has every permission and no overwrite applies.-Otherwise Fluxer starts from the permissions of the everyone role, whose [snowflake](/snowflakes/) equals the guild snowflake, then adds the permissions of every role assigned to the member with a bitwise union. If the result contains `ADMINISTRATOR` at that point, Fluxer returns the complete 64-bit mask and runs no further step.+In a channel, Fluxer then applies the channel's overwrites in this order, removing denied bits before adding allowed bits at each step.-When no channel was named, the union is the final result. When a channel was named, Fluxer applies that channel's stored [permission overwrites](/http-api/channels/#permission-overwrite-object) to the union in this order:+1. The everyone role overwrite.+2. The overwrites for the member's roles, combined, where an allow on one role beats a deny on another.+3. The member's own overwrite.-1. The everyone role overwrite, by removing its denied bits and then adding its allowed bits.-2. The overwrites targeting roles assigned to the member, combined into one union of allowed bits and one union of denied bits and applied as a single step in the same order. An allow on any one of the member's roles defeats a deny on another.-3. The member overwrite, again denied bits first and allowed bits second.--When the named channel does not exist in the guild, Fluxer leaves the guild-level union unchanged.--:::caution[`ADMINISTRATOR` grants every bit and skips overwrites]-No deny overwrite in any channel restricts a member who holds the bit. Removing `ADMINISTRATOR` from every role they hold is the only fix.-:::--A guild channel is visible when its channel-scoped mask contains `VIEW_CHANNEL`, or when the member holds temporary access through an in-flight voice or call transition. A category is also visible when the mask of at least one child channel contains `VIEW_CHANNEL`. Temporary access applies only to the channel it was granted on.--A thread stores no overwrites. [Thread permissions](/http-api/threads/#thread-permissions) describes how Fluxer derives its mask from the parent channel.+A category is visible when you can view at least one channel in it. A thread has no overwrites of its own, and [Thread permissions](/http-api/threads/#thread-permissions) explains how its permissions work.## Communication timeout-A communication timeout stops a member from communicating in a guild until it expires. It does not change the computed mask. A member whose [communication_disabled_until](/http-api/guild-members/#guild-member-object) is in the future keeps every permission their roles grant, and Fluxer applies the restriction as a separate precondition on each communicating operation.--A timed-out member who holds `MANAGE_THREADS` without `ADMINISTRATOR` is not a [thread moderator](/http-api/threads/#thread-moderators) until the timeout ends. That member receives 403 `MISSING_ACCESS` for a private thread they have not joined.--While the timeout is in the future, these operations fail with 403 `COMMUNICATION_DISABLED`:--- Sending a message-- Editing the caller's own message-- Publishing the caller's own message in an announcement channel-- Adding a reaction-- Requesting an attachment upload-- Starting a typing indicator-- Changing the caller's own nickname-- Starting, changing, or deleting a thread-- Adding or removing a thread member-- Pinning or unpinning a message in a thread+In a guild channel, a member whose [`communication_disabled_until`](/http-api/guild-members/#guild-member-object) is in the future keeps their permissions, but gets 403 `COMMUNICATION_DISABLED` when they try any of these.-[Thread permissions](/http-api/threads/#thread-permissions) states the thread cases. A timeout has no effect in a private channel.+- Send, edit or publish their own message+- Add a reaction or request an attachment upload+- Start typing+- Change their own nickname+- Start, change or delete a thread, or add or remove its members+- Pin or unpin a message in a thread-The order of the timeout precondition and the permission check varies by operation, so a caller who is both timed out and short of the permission can receive either `COMMUNICATION_DISABLED` or `MISSING_PERMISSIONS`.--A client that gates its interface on the computed mask MUST also compare `communication_disabled_until` against the current time, because the mask still reports `SEND_MESSAGES` for a timed-out member.+Check `communication_disabled_until` as well as the mask before you show these actions.## Role hierarchy-Roles are ranked by `position`, and the highest position ranks first. Two roles sharing a position are ranked by snowflake, and the lower snowflake ranks first. A member's rank is the rank of their highest assigned role, and a member with no assigned role ranks below every role.--A caller manages a role when the caller's rank is strictly above the role's rank. The guild owner manages every role. The everyone role sits at position 0, so any caller holding a role above it outranks it and can modify it. It is never a valid target for a position or hoist position mutation.+Roles rank by `position`, and your rank is the rank of your highest role. You can manage a role only when you rank above it, even with `MANAGE_ROLES`, and the guild owner can manage every role.-Fluxer enforces hierarchy independently of `MANAGE_ROLES`. A caller who holds the permission without outranking the target role receives 403 `MISSING_PERMISSIONS`. A caller whose only `MANAGE_ROLES` comes from the everyone role has no assigned role, so they can manage no role.--:::caution[A non-owner cannot grant a permission they lack]-A requested bit outside the caller's own effective guild permissions fails the whole request with `MISSING_PERMISSIONS`. Fluxer runs that check after it discards unassigned bits and handles feature-gated bits as [Feature-gated permission bits](#feature-gated-permission-bits) describes.-:::+A role or overwrite write that grants a permission you don't have fails with `MISSING_PERMISSIONS`, unless you're the guild owner.## Guild role object-Roles are named permission masks that a guild assigns to any number of its members.+A role is a permission mask that a guild assigns to its members.### Structure@@ -195,21 +114,15 @@ Roles are named permission masks that a guild assigns to any number of its membe| --- | --- | --- || id | snowflake | The ID of the role || name | string | The name of the role (1-100 characters) |-| color | integer | The colour of the role as an RGB integer, which every operation on this resource writes in the range 0 through 16777215 |-| position<sup>1</sup> | integer | The rank of the role in the permission hierarchy, where a larger value ranks higher |-| hoist_position<sup>2</sup> | ?integer | The rank of the role among the separately displayed member list groups |-| permissions | decimal string | The [permission](#permissions) bitfield the role grants |-| hoist | boolean | Whether members holding the role are displayed as their own member list group |-| mentionable | boolean | Whether a member without `MENTION_EVERYONE` can mention the role |-| unicode_emoji?<sup>3</sup> | ?string | The Unicode emoji shown beside the role name |--<sup>1</sup> The everyone role is always at position 0, and every other role has a dense position from 1 through the number of remaining roles after any hierarchy mutation+| color | integer | The color of the role as an RGB integer (0-16777215) |+| position | integer | The rank of the role, where a larger value ranks higher |+| hoist_position | ?integer | The position of the role's group in the member list, or null to follow `position` |+| permissions | decimal string | The [permission](#permissions) mask the role grants |+| hoist | boolean | Whether the role's members show as their own group in the member list |+| mentionable | boolean | Whether members without `MENTION_EVERYONE` can mention the role |+| unicode_emoji? | ?string | The Unicode emoji shown beside the role name (not returned by the role routes) |-<sup>2</sup> A null value means the role has no explicit member list position, and the role is then ordered by its hierarchy `position` instead--<sup>3</sup> The field is absent from every role these operations return and from every role in a role Gateway Dispatch--The everyone role has the same snowflake as its guild and is named `@everyone`. It defines the base permission set for every member, and it cannot be deleted, reordered, or given a hoist position. Its colour and its permissions remain mutable.+The everyone role has the guild's ID, is called `@everyone` and is always at position 0. You can change its color and permissions, but you can't delete it, move it or give it a hoist position.### Example@@ -228,29 +141,18 @@ The everyone role has the same snowflake as its guild and is named `@everyone`.## Role position object-Each entry names one role and the rank the caller requests for it.+One entry in a [Modify guild role positions](#modify-guild-role-positions) request.### Structure| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the role |-| position?<sup>1</sup> | integer | The rank the caller requests for the role, where a larger value ranks higher |--<sup>1</sup> Fluxer sorts a role whose entry omits the field by its stored `position`, in the same sort as the other entries. A role whose entry requests a higher position than that stored value is placed above it--### Example--```json-[- {"id": "1489002177550843904", "position": 3},- {"id": "1489002177550843905", "position": 2}-]-```+| position? | integer | The rank you want for the role, where a larger value ranks higher |## Role hoist position object-Each entry names one role and the member list position it receives.+One entry in a [Modify role hoist positions](#modify-role-hoist-positions) request.### Structure@@ -259,60 +161,25 @@ Each entry names one role and the member list position it receives.| id | snowflake | The ID of the role || hoist_position | integer | The member list position to give the role |-### Example--```json-[- {"id": "1489002177550843904", "hoist_position": 1}-]-```-## List guild roles<RouteHeader method="GET" path="/v1/guilds/{guild_id}/roles" bot oauth2="guilds" />-Returns every [guild role object](#guild-role-object) in the guild, in descending `position` order, with a tie resolved by ascending role ID.--### Limitations--- The caller must be a member of the guild, and no permission is required.-- A bearer credential requires the [guilds](/http-api/oauth2/#oauth2-scopes) OAuth2 scope.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns every [guild role object](#guild-role-object) in the guild, highest `position` first. You need to be a member of the guild, and an OAuth2 token needs the `guilds` scope.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | array[[guild role](#guild-role-object) object] | Roles were returned |-| 403 | [error response](/http-api/#error-response) | Bearer credential lacks the `guilds` scope and returns `MISSING_OAUTH_SCOPE`, the guild is unavailable and returns `MISSING_ACCESS`, or the caller is not a member and returns `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and returns `UNKNOWN_GUILD` |+| 200 | array[[guild role](#guild-role-object) object] | The roles were returned |-### Rate limit--60 requests per 10 seconds for each authenticated identity and guild ID, on the `guild:role:list::guild_id` bucket.+The rate limit is 60 requests per 10 seconds, on the `guild:role:list::guild_id` bucket.## Create guild role<RouteHeader method="POST" path="/v1/guilds/{guild_id}/roles" bot auditReason />-Creates a role and returns its [guild role object](#guild-role-object). Requires [MANAGE_ROLES](#permissions), which is an [elevated permission](#elevated-permissions). Emits a [Guild Role Create](/gateway/events/#guild-role-create) Gateway event.--### Limitations--- A caller who is not the guild owner cannot grant a permission absent from their own effective guild permissions.--[Role hierarchy](#role-hierarchy) is not evaluated. The new role receives hierarchy position 1 and ranks below every existing role at that position. No other role is renumbered. The role is created without a hoist position or Unicode emoji and with `hoist` and `mentionable` set to false.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Creates a role at position 1 and returns its [guild role object](#guild-role-object). You need [MANAGE_ROLES](#elevated-permissions). Fluxer sends a [Guild Role Create](/gateway/events/#guild-role-create) event.### Request headers@@ -325,46 +192,23 @@ Creates a role and returns its [guild role object](#guild-role-object). Requires| Field | Type | Description || --- | --- | --- || name | string | The name of the role (1-100 characters) |-| color? | integer | The colour of the role as a 24-bit RGB integer (0-16777215, default 0) |-| permissions?<sup>1</sup> | decimal string \| integer | The [permission](#permissions) bitfield the role grants |--<sup>1</sup> An omitted field copies the current permissions of the everyone role unchanged. A supplied value is intersected with the set of defined bits, Fluxer clears `VIEW_CHANNEL_MEMBERS` unless the caller's [feature declaration](#feature-gated-permission-bits) includes `view_channel_members_permission`, clears the four thread bits unless the caller is a bot or a user session that declares `channel_threads`, then checks the value against the caller's own permissions+| color? | integer | The color of the role as an RGB integer (0-16777215, default 0) |+| permissions? | decimal string \| integer | The [permission](#permissions) mask, which defaults to the everyone role's mask |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [guild role object](#guild-role-object) | Role was created |-| 400 | [error response](/http-api/#error-response) | The caller cannot use `MANAGE_ROLES` because of the guild MFA level and the request returns `TWO_FACTOR_REQUIRED`, or the guild role limit is reached and the request returns `MAX_GUILD_ROLES` |-| 403 | [error response](/http-api/#error-response) | Bearer credential is used and returns `ACCESS_DENIED`, the guild is unavailable and returns `MISSING_ACCESS`, or the caller is not a member, lacks `MANAGE_ROLES`, or requested a permission they do not hold, each returning `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and returns `UNKNOWN_GUILD` |--### Side effects--The operation consumes one guild role slot and creates a [ROLE_CREATE](/http-api/guild-audit-logs/#audit-actions) guild audit log entry with the supplied reason. It emits [Guild Role Create](/gateway/events/#guild-role-create) to every session that can see the guild, including the acting session. A request that reaches the configured role limit fails with `MAX_GUILD_ROLES` and consumes no slot. The response body has the limit in a top-level `max_guild_roles` member. The default limit is 250 roles for each guild and counts the everyone role.--### Rate limit+| 200 | [guild role object](#guild-role-object) | The role was created |+| 400 | [error response](/http-api/#error-response) | `MAX_GUILD_ROLES` when the guild is at its role limit, 250 by default, counting the everyone role |-10 requests per minute for each authenticated identity and guild ID, on the `guild:role:create::guild_id` bucket.+The rate limit is 10 requests per minute, on the `guild:role:create::guild_id` bucket.## Modify guild role<RouteHeader method="PATCH" path="/v1/guilds/{guild_id}/roles/{role_id}" bot auditReason />-Modifies one role and returns its [guild role object](#guild-role-object). Requires [MANAGE_ROLES](#permissions), which is an [elevated permission](#elevated-permissions). Emits a [Guild Role Update](/gateway/events/#guild-role-update) Gateway event.--### Limitations--- A caller who is not the guild owner also requires [hierarchy authority](#role-hierarchy) over the target role and cannot grant a permission absent from their own effective guild permissions.--The everyone role is a valid target.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |-| role_id | snowflake | The ID of the role |+Modifies a role and returns its [guild role object](#guild-role-object). You need [MANAGE_ROLES](#elevated-permissions) and must [outrank](#role-hierarchy) the role. Fluxer sends a [Guild Role Update](/gateway/events/#guild-role-update) event.### Request headers@@ -374,201 +218,92 @@ The everyone role is a valid target.### JSON body-Every field is optional, and an omitted field leaves the stored value unchanged. `position` is not accepted here, because only [Modify guild role positions](#modify-guild-role-positions) writes the hierarchy.+Fields you leave out keep their value. On the everyone role, Fluxer ignores every field except `color` and `permissions`.| Field | Type | Description || --- | --- | --- |-| name?<sup>1</sup> | string | The name of the role (1-100 characters) |-| color? | integer | The colour of the role as a 24-bit RGB integer (0-16777215) |-| permissions?<sup>2</sup> | decimal string \| integer | The complete replacement [permission](#permissions) bitfield |-| hoist?<sup>1</sup> | boolean | Whether members holding the role are displayed as their own member list group |-| hoist_position?<sup>1</sup> | ?integer | The member list position to give the role, or null to clear it |-| mentionable?<sup>1</sup> | boolean | Whether a member without `MENTION_EVERYONE` can mention the role |--<sup>1</sup> The field is accepted and then ignored when the target is the everyone role, which cannot be renamed, hoisted, given a member list position, or made mentionable--<sup>2</sup> The supplied value becomes the complete stored mask. Before it checks the caller's authority, Fluxer intersects it with the set of defined bits and keeps each feature-gated bit the caller cannot write at its stored value, as [Feature-gated permission bits](#feature-gated-permission-bits) describes+| name? | string | The name of the role (1-100 characters) |+| color? | integer | The color of the role as an RGB integer (0-16777215) |+| permissions? | decimal string \| integer | The new [permission](#permissions) mask, which replaces the old one |+| hoist? | boolean | Whether the role's members show as their own group in the member list |+| hoist_position? | ?integer | The member list position to give the role, or null to clear it |+| mentionable? | boolean | Whether members without `MENTION_EVERYONE` can mention the role |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [guild role object](#guild-role-object) | Role was modified, or every supplied value already matched the stored value |-| 400 | [error response](/http-api/#error-response) | The caller cannot use `MANAGE_ROLES` because of the guild MFA level and the request returns `TWO_FACTOR_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Bearer credential is used and returns `ACCESS_DENIED`, the guild is unavailable and returns `MISSING_ACCESS`, or the caller is not a member, lacks `MANAGE_ROLES`, does not outrank the target role, or requested a permission they do not hold, each returning `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and returns `UNKNOWN_GUILD`, or the role does not exist and returns `UNKNOWN_ROLE` |--### Side effects--The operation creates a [ROLE_UPDATE](/http-api/guild-audit-logs/#audit-actions) guild audit log entry with the supplied reason and emits [Guild Role Update](/gateway/events/#guild-role-update) to every session that can see the guild. A permission change adds a [permissions_diff](/http-api/guild-audit-logs/#guild-role-change-fields) change entry recording the exact added and removed permission names. A request whose values all match the current role still emits the Dispatch and records no entry.+| 200 | [guild role object](#guild-role-object) | The role was modified |-### Rate limit--20 requests per 10 seconds for each authenticated identity and guild ID, on the `guild:role:update::guild_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `guild:role:update::guild_id` bucket.## Modify guild role positions<RouteHeader method="PATCH" path="/v1/guilds/{guild_id}/roles" bot auditReason />-Reorders the role hierarchy and returns 204 with an empty body. Requires [MANAGE_ROLES](#permissions), which is an [elevated permission](#elevated-permissions). Emits a [Guild Role Update Bulk](/gateway/events/#guild-role-update-bulk) Gateway event.--### Limitations--- The caller needs [hierarchy authority](#role-hierarchy) over every role whose entry supplies a position differing from that role's stored `position`.-- An entry that omits the field or repeats the stored value is accepted without that check.+Reorders roles and returns 204. You need [MANAGE_ROLES](#elevated-permissions) and must [outrank](#role-hierarchy) every role whose position you change. Fluxer sends a [Guild Role Update Bulk](/gateway/events/#guild-role-update-bulk) event with the stored positions.-A concurrent role position change in the same guild can return 423 `GENERAL_ERROR`.--Every role the caller can manage is sorted by its requested position in descending order. A role that supplied no position keeps its stored position as the sort key, and any remaining tie is resolved by the current order. Fluxer then puts those roles back into the same set of slots they held before, so a role the caller cannot manage never moves. Every role other than the everyone role is then renumbered to a dense position. The highest-ranked role receives the number of roles other than the everyone role, the lowest-ranked role receives 1, and the everyone role stays at 0.--:::note[A requested position is an ordering key]-Dense renumbering after the sort decides the stored value, so it can differ from the one requested. A client reads the resulting `position` from the [Guild Role Update Bulk](/gateway/events/#guild-role-update-bulk) payload.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Fluxer sorts the roles you can manage by the positions you send and keeps roles you can't manage at their rank. It then renumbers every role except the everyone role from 1, so the stored `position` can differ from the one you sent.### JSON body-The top-level body is an array of [role position objects](#role-position-object). An entry naming the everyone role is rejected with the validation code `CANNOT_REORDER_EVERYONE_ROLE`, and a role that does not exist in the guild is rejected with `INVALID_ROLE_ID`. Both checks run over the whole array before the hierarchy check and before any write.+An array of [role position objects](#role-position-object). The everyone role can't be in it.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Positions were applied|-| 400 | [error response](/http-api/#error-response) | An entry names the everyone role or a role that does not exist, or the caller cannot use `MANAGE_ROLES` because of the guild MFA level|-| 403 | [error response](/http-api/#error-response) | Bearer credential is used and returns `ACCESS_DENIED`, the guild is unavailable and returns `MISSING_ACCESS`, or the caller is not a member, lacks `MANAGE_ROLES`, or supplied a position differing from the stored `position` of a role they do not outrank, each returning `MISSING_PERMISSIONS`|-| 404 | [error response](/http-api/#error-response) | Guild does not exist and returns `UNKNOWN_GUILD`|-| 423 | [error response](/http-api/#error-response) | Another position write holds the guild lock, returning `GENERAL_ERROR` with `Retry-After: 2` |--### Side effects+| 204 | empty | The positions were applied |+| 400 | [error response](/http-api/#error-response) | An entry is the everyone role or a role that doesn't exist |+| 423 | [error response](/http-api/#error-response) | Another position change is still running |-The operation creates one [ROLE_UPDATE](/http-api/guild-audit-logs/#audit-actions) guild audit log entry for each role that moved, under the [ordering rule](/http-api/guild-audit-logs/#guild-role-change-fields) the audit log defines. It emits one [Guild Role Update Bulk](/gateway/events/#guild-role-update-bulk) with every role whose stored position changed to every session that can see the guild. A request that produces no positional change creates no audit entry and emits no Dispatch. Dense renumbering can change the numeric `position` of an unnamed role without changing its rank, and such a role is included in the Dispatch and records no audit entry.--### Rate limit--20 requests per 10 seconds for each authenticated identity and guild ID, on the `guild:role:positions::guild_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `guild:role:positions::guild_id` bucket.## Modify role hoist positions<RouteHeader method="PATCH" path="/v1/guilds/{guild_id}/roles/hoist-positions" bot auditReason />-Sets the member list position of one or more roles and returns 204 with an empty body. Requires [MANAGE_ROLES](#permissions), which is an [elevated permission](#elevated-permissions). Emits a [Guild Role Update Bulk](/gateway/events/#guild-role-update-bulk) Gateway event.--### Limitations--- The caller needs [hierarchy authority](#role-hierarchy) over every named role.-- The everyone role cannot receive a hoist position.--A hoist position orders the separately displayed member list groups independently of the permission hierarchy. A concurrent hoist position change in the same guild can return 423 `GENERAL_ERROR`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Sets the member list position of one or more roles and returns 204. You need [MANAGE_ROLES](#elevated-permissions) and must [outrank](#role-hierarchy) every role you name. Fluxer sends a [Guild Role Update Bulk](/gateway/events/#guild-role-update-bulk) event.### JSON body-The top-level body is an array of [role hoist position objects](#role-hoist-position-object). Every entry supplies a hoist position, because this operation cannot clear one. The everyone role cannot appear in the array and is rejected with the validation code `CANNOT_SET_HOIST_FOR_EVERYONE_ROLE`, and a role that does not exist in the guild is rejected with `INVALID_ROLE_ID`. Every check runs over the whole array before any write.+An array of [role hoist position objects](#role-hoist-position-object). The everyone role can't be in it.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Hoist positions were applied|-| 400 | [error response](/http-api/#error-response) | An entry names the everyone role or a role that does not exist, or the caller cannot use `MANAGE_ROLES` because of the guild MFA level|-| 403 | [error response](/http-api/#error-response) | Bearer credential is used and returns `ACCESS_DENIED`, the guild is unavailable and returns `MISSING_ACCESS`, or the caller is not a member, lacks `MANAGE_ROLES`, or does not outrank a named role, each returning `MISSING_PERMISSIONS`|-| 404 | [error response](/http-api/#error-response) | Guild does not exist and returns `UNKNOWN_GUILD`|-| 423 | [error response](/http-api/#error-response) | Another hoist position write holds the guild lock, returning `GENERAL_ERROR` with `Retry-After: 2` |--### Side effects--The operation creates one [ROLE_UPDATE](/http-api/guild-audit-logs/#audit-actions) guild audit log entry for each named role that moved in the member list order, under the [ordering rule](/http-api/guild-audit-logs/#guild-role-change-fields) the audit log defines, and for each changed role that is not hoisted. It emits one [Guild Role Update Bulk](/gateway/events/#guild-role-update-bulk) with every role whose hoist position changed to every session that can see the guild. Setting the current positions again changes nothing, creates no audit entry, and emits no Dispatch.+| 204 | empty | The hoist positions were applied |+| 400 | [error response](/http-api/#error-response) | An entry is the everyone role or a role that doesn't exist |+| 423 | [error response](/http-api/#error-response) | Another hoist position change is still running |-### Rate limit--20 requests per 10 seconds for each authenticated identity and guild ID, on the `guild:role:hoist_positions::guild_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `guild:role:hoist_positions::guild_id` bucket.## Reset role hoist positions<RouteHeader method="DELETE" path="/v1/guilds/{guild_id}/roles/hoist-positions" bot auditReason />-Clears the member list position of every role in the guild and returns 204 with an empty body. Requires [MANAGE_ROLES](#permissions), which is an [elevated permission](#elevated-permissions). Emits a [Guild Role Update Bulk](/gateway/events/#guild-role-update-bulk) Gateway event.--### Limitations--- [Role hierarchy](#role-hierarchy) is not evaluated. The permission alone clears the hoist position of every role in the guild, including roles the caller does not outrank.--A concurrent hoist position change in the same guild can return 423 `GENERAL_ERROR`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |--The request has no body.+Clears the member list position of every role in the guild, including roles you don't outrank, and returns 204. You need [MANAGE_ROLES](#elevated-permissions). Fluxer sends a [Guild Role Update Bulk](/gateway/events/#guild-role-update-bulk) event.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Hoist positions were cleared, or no role had one|-| 400 | [error response](/http-api/#error-response) | The caller cannot use `MANAGE_ROLES` because of the guild MFA level and the request returns `TWO_FACTOR_REQUIRED`|-| 403 | [error response](/http-api/#error-response) | Bearer credential is used and returns `ACCESS_DENIED`, the guild is unavailable and returns `MISSING_ACCESS`, or the caller is not a member or lacks `MANAGE_ROLES`, each returning `MISSING_PERMISSIONS`|-| 404 | [error response](/http-api/#error-response) | Guild does not exist and returns `UNKNOWN_GUILD`|-| 423 | [error response](/http-api/#error-response) | Another hoist position write holds the guild lock, returning `GENERAL_ERROR` with `Retry-After: 2` |--### Side effects+| 204 | empty | The hoist positions were cleared |+| 423 | [error response](/http-api/#error-response) | Another hoist position change is still running |-The operation creates one [ROLE_UPDATE](/http-api/guild-audit-logs/#audit-actions) guild audit log entry for each cleared role that moved in the member list order, under the [ordering rule](/http-api/guild-audit-logs/#guild-role-change-fields) the audit log defines, and for each cleared role that is not hoisted. It emits one [Guild Role Update Bulk](/gateway/events/#guild-role-update-bulk) with every cleared role to every session that can see the guild. When no role held a hoist position, no audit entry is created and no Dispatch is emitted.--### Rate limit--10 requests per minute for each authenticated identity and guild ID, on the `guild:role:hoist_positions_reset::guild_id` bucket.+The rate limit is 10 requests per minute, on the `guild:role:hoist_positions_reset::guild_id` bucket.## Delete guild role<RouteHeader method="DELETE" path="/v1/guilds/{guild_id}/roles/{role_id}" bot auditReason />-Deletes one role and returns 204 with an empty body. Requires [MANAGE_ROLES](#permissions), which is an [elevated permission](#elevated-permissions). Emits a [Guild Role Delete](/gateway/events/#guild-role-delete) Gateway event.--### Limitations--- A caller who is not the guild owner also requires [hierarchy authority](#role-hierarchy) over the target role.-- The everyone role cannot be deleted.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |-| role_id | snowflake | The ID of the role |--The request has no body.+Deletes a role, removes it from every member who has it and returns 204. You need [MANAGE_ROLES](#elevated-permissions) and must [outrank](#role-hierarchy) the role. You can't delete the everyone role. Fluxer sends a [Guild Role Delete](/gateway/events/#guild-role-delete) event.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Role was deleted |-| 400 | [error response](/http-api/#error-response) | The caller cannot use `MANAGE_ROLES` because of the guild MFA level and the request returns `TWO_FACTOR_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Bearer credential is used and returns `ACCESS_DENIED`, the guild is unavailable and returns `MISSING_ACCESS`, or the caller is not a member, lacks `MANAGE_ROLES`, or does not outrank the target role, each returning `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and returns `UNKNOWN_GUILD`, or the role does not exist or is the everyone role, each returning `UNKNOWN_ROLE` |--:::caution[Deletion is irreversible and rewrites every affected member]-A deleted role cannot be restored, and its permissions, colour, and hoist state go with it. An overwrite naming it no longer affects any computed mask. Every member who held the role loses it in the same operation, so anyone relying on it for channel access loses that access immediately.-:::--### Side effects--The operation removes the role from every member that held it, removes the role record, and frees the guild role slot it occupied. It creates a [ROLE_DELETE](/http-api/guild-audit-logs/#audit-actions) guild audit log entry with the supplied audit reason and emits [Guild Role Delete](/gateway/events/#guild-role-delete) to every session that can see the guild. The deleted role no longer appears in `roles` on a later member read or [Guild Member Update](/gateway/events/#guild-member-update) payload.--### Rate limit+| 204 | empty | The role was deleted |-10 requests per minute for each authenticated identity and guild ID, on the `guild:role:delete::guild_id` bucket.+The rate limit is 10 requests per minute, on the `guild:role:delete::guild_id` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/premium.mdx b/fluxer_docs/src/content/docs/http-api/premium.mdxindex 301a3e8b1..b8dfddb34 100644--- a/fluxer_docs/src/content/docs/http-api/premium.mdx+++ b/fluxer_docs/src/content/docs/http-api/premium.mdx@@ -1,97 +1,54 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Premium-description: Premium pricing, entitlement state, billing data, and subscription self-service.+description: Premium prices, entitlement state, billing data and subscription self-service.---import RouteHeader from '@/components/RouteHeader.astro';-Premium is the paid tier of a Fluxer account. A recurring subscription, a redeemed gift, or a lifetime entitlement pays for it. The routes here read that entitlement and run the subscription self-service operations, while [Billing](/http-api/billing/) owns purchase creation and the payment provider webhook.+Premium is the paid tier of a Fluxer account. Use these routes to read an account's entitlement and to manage its Stripe subscription. To buy premium, use the [Billing](/http-api/billing/) routes.-Every route except [get price IDs](#get-price-ids) is user-only. A [self-hosted deployment](/http-api/deployment-availability/) always serves [get premium state](#get-premium-state) and [set premium perks disabled](#set-premium-perks-disabled), serves [get price IDs](#get-price-ids) only while billing is active, and serves the subscription management routes while Stripe is serviceable.--| Object | Purpose |-| --- | --- |-| [Price IDs](#price-ids-object) | The recurring and gift prices resolved for one country |-| [Current subscription price](#current-subscription-price-object) | The price the account is billed against, and the current list price |-| [Pending subscription change](#pending-subscription-change-object) | A billing cycle change scheduled for the end of the period |-| [Premium state](#premium-state-object) | The single read behind a billing screen |-| [Actual premium state](#actual-premium-state-object) | The entitlement backed by billing alone |-| [Effective premium state](#effective-premium-state-object) | The entitlement every premium feature check reads |-| [Premium billing state](#premium-billing-state-object) | Mirrored payment provider data for the account |-| [Billing subscription](#billing-subscription-object) | One mirrored subscription |-| [Billing invoice](#billing-invoice-object) | One mirrored invoice |-| [Billing payment method](#billing-payment-method-object) | One mirrored payment method |-| [Premium pricing state](#premium-pricing-state-object) | The resolved checkout catalogue |--:::note[Manage billing through the customer portal]-[Get premium state](#get-premium-state) returns invoices, payment methods and subscription details. Use [Create customer portal](#create-customer-portal) to open the billing interface.-:::+Every route except [get price IDs](#get-price-ids) needs a user token. On a [self-hosted instance](/http-api/deployment-availability/), [get premium state](#get-premium-state) and [set premium perks disabled](#set-premium-perks-disabled) always work, and the other routes need Stripe billing to be set up.## Premium types| Value | Name | Description || --- | --- | --- || 0 | NONE | No premium entitlement |-| 1 | SUBSCRIPTION | Recurring or gift-funded premium entitlement |-| 2 | LIFETIME | Lifetime entitlement |+| 1 | SUBSCRIPTION | A subscription or a gift |+| 2 | LIFETIME | Premium for life |## Billing cycles| Value | Description || --- | --- |-| monthly | The recurring price bills every month |-| yearly | The recurring price bills every year |+| monthly | Billed every month |+| yearly | Billed every year |## Display currencies-Every amount field is in the minor unit of the currency field its description names, and two amounts in one object can have different currencies.--ISK has no minor unit in ISO 4217, but its amounts still use two decimals, so divide them by 100. ISK 590 is `59000`.--Currency codes are the three-letter ISO 4217 codes the operator configured.+Currency fields are three-letter ISO 4217 codes. Each amount field is an integer in the minor unit of the currency field its description gives. ISK amounts also use two decimals, as in `59000` for ISK 590.## Price IDs object-The checkout prices resolved for one country: monthly and yearly recurring, and one-month and one-year gift.+The recurring and gift checkout prices for one country.### Structure| Field | Type | Description || --- | --- | --- |-| monthly?<sup>1</sup> | ?string | The payment provider price ID of the monthly recurring plan |-| yearly?<sup>1</sup> | ?string | The payment provider price ID of the yearly recurring plan |-| gift_1_month?<sup>1</sup> | ?string | The payment provider price ID of the one-month gift |-| gift_1_year?<sup>1</sup> | ?string | The payment provider price ID of the one-year gift |-| monthly_amount_minor?<sup>2</sup> | ?integer | The monthly recurring amount, in the minor unit of `currency` |-| yearly_amount_minor?<sup>2</sup> | ?integer | The yearly recurring amount, in the minor unit of `currency` |-| gift_1_month_amount_minor?<sup>2</sup> | ?integer | The one-month gift amount, in the minor unit of `gift_currency` |-| gift_1_year_amount_minor?<sup>2</sup> | ?integer | The one-year gift amount, in the minor unit of `gift_currency` |+| monthly? | ?string | The Stripe price ID of the monthly plan |+| yearly? | ?string | The Stripe price ID of the yearly plan |+| gift_1_month? | ?string | The Stripe price ID of the one-month gift |+| gift_1_year? | ?string | The Stripe price ID of the one-year gift |+| monthly_amount_minor? | ?integer | The monthly amount, in the minor unit of `currency` |+| yearly_amount_minor? | ?integer | The yearly amount, in the minor unit of `currency` |+| gift_1_month_amount_minor? | ?integer | The one-month gift amount, in the minor unit of `gift_currency` |+| gift_1_year_amount_minor? | ?integer | The one-year gift amount, in the minor unit of `gift_currency` || currency | string | [Display currency](#display-currencies) of the recurring prices |-| gift_currency<sup>3</sup> | ?string | [Display currency](#display-currencies) of the gift prices |--<sup>1</sup> Fluxer resolves the recurring pair and the gift pair separately. Each pair takes the first currency for which both of its prices are configured, so the pairs can resolve to different currencies--<sup>2</sup> Null when the amount is unavailable. Price changes can take up to one hour to appear+| gift_currency<sup>1</sup> | ?string | [Display currency](#display-currencies) of the gift prices |-<sup>3</sup> Null on a self-hosted deployment with no currency that has both gift prices. The gift price IDs and amounts are null too, and gift checkout is unavailable--### Example--```json-{- "monthly": "price_1QaMonthlyUsd",- "yearly": "price_1QaYearlyUsd",- "gift_1_month": "price_1QaGift1MonthUsd",- "gift_1_year": "price_1QaGift1YearUsd",- "monthly_amount_minor": 499,- "yearly_amount_minor": 4999,- "gift_1_month_amount_minor": 499,- "gift_1_year_amount_minor": 4999,- "currency": "USD",- "gift_currency": "USD"-}-```+<sup>1</sup> Null when no currency has both gift prices set up, and gift checkout is unavailable then.## Current subscription price object@@ -101,97 +58,38 @@ The price the account is billed against, and the current list price for the same| Field | Type | Description || --- | --- | --- |-| price_id<sup>1</sup> | string | The price the account is billed against |+| price_id | string | The price the account is billed against || amount_minor | integer | The amount charged, in the minor unit of `currency` |-| currency<sup>2</sup> | string | [Display currency](#display-currencies) of the charged amount |-| billing_cycle | string | [Billing cycle](#billing-cycles) of the active subscription |-| is_grandfathered<sup>3</sup> | boolean | Whether the account is billed against a price other than the current list price |-| list_amount_minor<sup>4</sup> | ?integer | The current list amount, in the minor unit of `currency` |-| list_price_id<sup>4</sup> | ?string | The current list price ID for the same billing cycle and currency |--<sup>1</sup> The copy in [Get premium state](#get-premium-state) reports an empty string when the price identifier is unavailable--<sup>2</sup> The subscription's currency in upper case, including unlisted currencies. The copy in [Get premium state](#get-premium-state) defaults to `USD` when unavailable--<sup>3</sup> True only when a list price is configured for the same billing cycle and currency and its identifier differs from `price_id`, so an unconfigured currency reports false--<sup>4</sup> Both are null when the deployment configures no list price for the subscription's billing cycle and currency. `list_amount_minor` is also null on its own when that list price is configured but its amount cannot be read--### Example--```json-{- "price_id": "price_1QaLegacyMonthlyUsd",- "amount_minor": 399,- "currency": "USD",- "billing_cycle": "monthly",- "is_grandfathered": true,- "list_amount_minor": 499,- "list_price_id": "price_1QaMonthlyUsd"-}-```+| currency | string | [Display currency](#display-currencies) of the charged amount |+| billing_cycle | string | [Billing cycle](#billing-cycles) of the subscription |+| is_grandfathered | boolean | Whether the account is billed against a price other than the current list price |+| list_amount_minor | ?integer | The current list amount, in the minor unit of `currency` |+| list_price_id | ?string | The current list price ID for the same billing cycle and currency |## Pending subscription change object-A billing cycle change scheduled for the end of the current period. It is returned in [Premium billing state](#premium-billing-state-object), not through a separate route.+A billing cycle change scheduled for the end of the current period.### Structure| Field | Type | Description || --- | --- | --- |-| schedule_id | string | The payment provider subscription schedule ID that has the change |-| change_kind | string | The kind of scheduled change, always `billing_cycle` here |-| current_billing_cycle<sup>1</sup> | ?string | The current [billing cycle](#billing-cycles) |-| target_billing_cycle | string | [Billing cycle](#billing-cycles) that takes effect at `effective_at` |-| effective_at | ISO8601 timestamp | The start of the scheduled future phase |-| current_price_id | ?string | The price ID of the active subscription item, or null when it cannot be resolved |-| target_price_id | ?string | The price ID of the scheduled future phase, or null when it cannot be resolved |-| target_amount_minor | ?integer | The unit amount of the target price, in the minor unit of `currency`, or null when it cannot be resolved |-| currency | ?string | [Display currency](#display-currencies) of the target price, or null when it is unresolved or unsupported |-| initial_amount_minor<sup>2</sup> | ?integer | The amount of the first invoice after the change, in the minor unit of `currency` |+| schedule_id | string | The Stripe subscription schedule ID |+| change_kind | string | Always `billing_cycle` |+| current_billing_cycle | ?string | The current [billing cycle](#billing-cycles) |+| target_billing_cycle | string | The [billing cycle](#billing-cycles) that starts at `effective_at` |+| effective_at | ISO8601 timestamp | When the change takes effect |+| current_price_id | ?string | The current price ID |+| target_price_id | ?string | The price ID after the change |+| target_amount_minor | ?integer | The amount of the target price, in the minor unit of `currency` |+| currency | ?string | [Display currency](#display-currencies) of the target price |+| initial_amount_minor | ?integer | The amount of the first invoice after the change, in the minor unit of `currency` || recurring_amount_minor | ?integer | The amount of each later invoice, in the minor unit of `currency` |-| credit_amount_minor<sup>3</sup> | ?integer | The credit applied to the first invoice, in the minor unit of `currency` |--<sup>1</sup> Resolved from the live subscription item, and falls back to the billing cycle stored on the account when the live price cannot be resolved--<sup>2</sup> The recurring amount plus any scheduled invoice adjustment, clamped at zero, and null when the target amount cannot be resolved--<sup>3</sup> Null unless the scheduled adjustment is a credit. A monthly to yearly change credits the smaller of the two amounts, each multiplied by the subscription item quantity, and no credit is scheduled during a trial--The complete value is null in each of these cases.--| Condition | Detail |-| --- | --- |-| No payment provider | The deployment configures none |-| No subscription | The account has no stored subscription identifier |-| No usable schedule | The subscription has no schedule, or the schedule is neither active nor waiting to start |-| No future phase | The schedule has no phase starting after now |-| No target cycle | Neither the future phase price nor the schedule metadata resolves it |-| No change | The resolved target billing cycle equals the current one |-| Read failed | The payment provider read failed, and the request still succeeds |--### Example--```json-{- "schedule_id": "sub_sched_1QaBcDeFgHiJ",- "change_kind": "billing_cycle",- "current_billing_cycle": "monthly",- "target_billing_cycle": "yearly",- "effective_at": "2026-09-28T08:15:00.000Z",- "current_price_id": "price_1QaMonthlyUsd",- "target_price_id": "price_1QaYearlyUsd",- "target_amount_minor": 4999,- "currency": "USD",- "initial_amount_minor": 4500,- "recurring_amount_minor": 4999,- "credit_amount_minor": 499-}-```+| credit_amount_minor | ?integer | The credit applied to the first invoice, in the minor unit of `currency` |## List price switch object-Returned in [Premium billing state](#premium-billing-state-object). A self-hosted deployment offers no switch to the list price, so `available` and `pending` are false and `reason` is `feature_unavailable`.+Whether the subscription can move to the current list price. A self-hosted instance never offers this switch.### Structure@@ -210,376 +108,178 @@ Returned in [Premium billing state](#premium-billing-state-object). A self-hoste## Premium state object-The account's entitlement, the effective entitlement that premium feature checks read, and the billing and pricing data behind both. [Get premium state](#get-premium-state) and [set premium perks disabled](#set-premium-perks-disabled) both return it.--A client gates a premium feature on `effective.is_premium`.+The account's entitlement and the billing and pricing data behind it. Gate premium features on `effective.is_premium`.### Structure| Field | Type | Description || --- | --- | --- |-| actual | [actual premium state](#actual-premium-state-object) object | The entitlement backed by billing, before local perk disabling |-| effective | [effective premium state](#effective-premium-state-object) object | The entitlement every premium feature check reads |-| billing | [premium billing state](#premium-billing-state-object) object | The mirrored payment provider data for the account |-| pricing | [premium pricing state](#premium-pricing-state-object) object | The resolved checkout prices for the requested country |+| actual | [actual premium state](#actual-premium-state-object) object | The entitlement from billing alone |+| effective | [effective premium state](#effective-premium-state-object) object | The entitlement premium feature checks read |+| billing | [premium billing state](#premium-billing-state-object) object | The account's Stripe billing data |+| pricing | [premium pricing state](#premium-pricing-state-object) object | The checkout prices for the request's country || store | null | Always null |-| subscription_provider<sup>1</sup> | ?string | `stripe` when Stripe owns the current recurring subscription, or null |--<sup>1</sup> Null for a gift, a lifetime entitlement, or no subscription. `stripe` needs a Stripe subscription with a billing cycle and a paid period that has not ended. A client sends a `stripe` subscriber to [create customer portal](#create-customer-portal)--### Example--```json-{- "actual": {- "premium_type": 1,- "premium_since": "2026-09-19T09:00:00.000Z",- "premium_until": "2026-10-19T09:00:00.000Z",- "premium_will_cancel": false,- "premium_billing_cycle": null,- "premium_lifetime_sequence": null,- "premium_grace_ends_at": null,- "has_active_paid_premium": true,- "is_visionary": false,- "has_ever_purchased": true- },- "effective": {- "is_premium": true,- "premium_type": 1,- "premium_since": "2026-09-19T09:00:00.000Z",- "premium_until": "2026-10-19T09:00:00.000Z",- "premium_will_cancel": false,- "premium_billing_cycle": null,- "premium_lifetime_sequence": null,- "premium_grace_ends_at": null,- "premium_enabled_override": false,- "premium_purchase_disabled": false,- "payment_dispute_open": false,- "premium_perks_disabled": false,- "self_hosted": true,- "bot": false- },- "billing": {- "stripe_customer_id": null,- "current_subscription_price": null,- "pending_subscription_change": null,- "list_price_switch": {- "available": false,- "reason": "feature_unavailable",- "pending": false,- "current_price_id": null,- "current_amount_minor": null,- "list_price_id": null,- "list_amount_minor": null,- "currency": null,- "billing_cycle": null,- "effective_at": null- },- "subscription": null,- "invoices": [],- "invoices_has_more": false,- "payment_methods": [],- "refund_eligibility": {- "eligible": false,- "reason": "feature_unavailable",- "invoice_id": null,- "invoice_amount_paid_cents": null,- "currency": null,- "paid_at": null,- "refund_window_expires_at": null,- "cooldown_expires_at": null,- "cancels_subscription": false,- "provider": null- }- },- "pricing": {- "country_code": "US",- "localized": {- "monthly": "price_1QaMonthlyUsd",- "yearly": "price_1QaYearlyUsd",- "gift_1_month": "price_1QaGift1MonthUsd",- "gift_1_year": "price_1QaGift1YearUsd",- "monthly_amount_minor": 499,- "yearly_amount_minor": 4999,- "gift_1_month_amount_minor": 499,- "gift_1_year_amount_minor": 4999,- "currency": "USD",- "gift_currency": "USD"- }- },- "store": null,- "subscription_provider": null-}-```+| subscription_provider | ?string | `stripe` when the account has an active Stripe subscription, or null |## Actual premium state object-The entitlement the account holds from billing alone. Nothing here reacts to the perks-disabled flag, to an operator override, or to the instance premium mode.+The entitlement the account has from billing, before disabled perks, operator overrides and the instance premium mode apply.### Structure| Field | Type | Description || --- | --- | --- |-| premium_type<sup>1</sup> | ?integer | [Premium type](#premium-types) |-| premium_since | ?ISO8601 timestamp | The time premium access first started, or null when it never has |-| premium_until<sup>2</sup> | ?ISO8601 timestamp | The time premium access ends, or null for a lifetime entitlement |-| premium_will_cancel | boolean | Whether the subscription is set to cancel at the end of the current period |-| premium_billing_cycle | ?string | [Billing cycle](#billing-cycles), or null when no recurring cycle is known |-| premium_lifetime_sequence | ?integer | Always null, because a self-hosted instance allocates no lifetime sequence number |-| premium_grace_ends_at | ?ISO8601 timestamp | The end of grace access after a failed renewal, or a subscription end, or null if none is recorded |-| has_active_paid_premium<sup>3</sup> | boolean | Whether paid premium access is active before local disabling |-| is_visionary | boolean | Whether the entitlement is lifetime access |-| has_ever_purchased | boolean | Whether the account has ever completed a premium purchase |--<sup>1</sup> An account that holds no stored premium type reports `0`--<sup>2</sup> The later of the subscription period end and any stacked gift extension, so redeeming a gift on an active subscription moves this value--<sup>3</sup> Still true throughout the post-expiry grace window, which runs to `premium_grace_ends_at` when one is recorded and otherwise to exactly 3 days after `premium_until`--### Example--```json-{- "premium_type": 1,- "premium_since": "2026-02-14T09:00:00.000Z",- "premium_until": "2026-09-14T09:00:00.000Z",- "premium_will_cancel": false,- "premium_billing_cycle": "monthly",- "premium_lifetime_sequence": null,- "premium_grace_ends_at": null,- "has_active_paid_premium": true,- "is_visionary": false,- "has_ever_purchased": true-}-```+| premium_type | ?integer | [Premium type](#premium-types) |+| premium_since | ?ISO8601 timestamp | When premium access first started |+| premium_until | ?ISO8601 timestamp | When premium access ends, including gift extensions, or null for lifetime |+| premium_will_cancel | boolean | Whether the subscription cancels at the end of the current period |+| premium_billing_cycle | ?string | [Billing cycle](#billing-cycles) |+| premium_lifetime_sequence | ?integer | Always null |+| premium_grace_ends_at | ?ISO8601 timestamp | The end of grace access after a failed renewal or a subscription end |+| has_active_paid_premium | boolean | Whether paid premium access is active, including the grace period |+| is_visionary | boolean | Whether the entitlement is lifetime |+| has_ever_purchased | boolean | Whether the account has ever bought premium |## Effective premium state object-The effective state decides whether premium features are available. It differs from the actual state when the account has disabled its own perks, when an operator override grants access, and when a self-hosted deployment uses the `everyone` [premium mode](/admin-api/instance/#premium-modes).+The state that decides whether premium features are available. `is_premium` is always true when the instance [premium mode](/admin-api/instance/#premium-modes) is `everyone`. Otherwise it is false when the account has disabled its perks, true when an operator override applies, and in every other case it matches `actual.has_active_paid_premium`.### Structure| Field | Type | Description || --- | --- | --- |-| is_premium<sup>1</sup> | boolean | Whether premium features are available to the account |-| premium_type<sup>2</sup> | ?integer | The effective [premium type](#premium-types) |-| premium_since<sup>2</sup> | ?ISO8601 timestamp | The effective time premium access started |-| premium_until<sup>3</sup> | ?ISO8601 timestamp | The time premium access ends, including any stacked gift extension, or null for a lifetime entitlement |-| premium_will_cancel<sup>3</sup> | boolean | Whether the subscription is set to cancel at the end of the current period |-| premium_billing_cycle<sup>3</sup> | ?string | [Billing cycle](#billing-cycles) |-| premium_lifetime_sequence<sup>3</sup> | ?integer | Always null, because a self-hosted instance allocates no lifetime sequence number |-| premium_grace_ends_at<sup>3</sup> | ?ISO8601 timestamp | The end of grace access after a failed renewal, or a subscription end, or null if none is recorded |-| premium_enabled_override<sup>4</sup> | boolean | Whether an operator premium override applies to the account |-| premium_purchase_disabled<sup>4</sup> | boolean | Whether purchases are disabled for the account |-| payment_dispute_open | boolean | Whether a payment dispute the account made is open. Every checkout is refused until it closes |-| premium_perks_disabled<sup>4</sup> | boolean | Whether the account has the perks-disabled flag |-| self_hosted<sup>5</sup> | boolean | Whether the deployment is self-hosted |-| bot<sup>6</sup> | boolean | Whether the credential is a bot account with premium-equivalent service access |--<sup>1</sup> Decided in a fixed order. A self-hosted deployment in the `everyone` [premium mode](/admin-api/instance/#premium-modes) reports true, then a bot account reports true, then `premium_perks_disabled` reports false, then `premium_enabled_override` reports true, and otherwise the value follows `actual.has_active_paid_premium`--<sup>2</sup> The only fields the effective state gates. They report the account value while `is_premium` is true, and `0` and null respectively while it is false--<sup>3</sup> Copied from the [actual premium state](#actual-premium-state-object) unchanged, so the value does not react to `is_premium`--<sup>4</sup> True when the account has the matching [premium flag](/admin-api/users/#premium-flags), or when the deployment has no active billing--<sup>5</sup> `is_premium` follows this only while the instance [premium mode](/admin-api/instance/#premium-modes) is `everyone`--<sup>6</sup> Always false through this API, because both operations that return this object reject a bot credential with 403 `ACCESS_DENIED`+| is_premium | boolean | Whether premium features are available to the account |+| premium_type | ?integer | The [premium type](#premium-types), or `0` while `is_premium` is false |+| premium_since | ?ISO8601 timestamp | When premium access started, or null while `is_premium` is false |+| premium_until | ?ISO8601 timestamp | Same as in the [actual premium state](#actual-premium-state-object) |+| premium_will_cancel | boolean | Same as in the [actual premium state](#actual-premium-state-object) |+| premium_billing_cycle | ?string | Same as in the [actual premium state](#actual-premium-state-object) |+| premium_lifetime_sequence | ?integer | Always null |+| premium_grace_ends_at | ?ISO8601 timestamp | Same as in the [actual premium state](#actual-premium-state-object) |+| premium_enabled_override | boolean | Whether an operator [premium flag](/admin-api/users/#premium-flags) grants premium |+| premium_purchase_disabled | boolean | Whether purchases are disabled for the account, or billing isn't set up |+| premium_perks_disabled | boolean | Whether the account has disabled its own perks |+| self_hosted | boolean | Whether the instance is self-hosted |+| bot | boolean | Always false |## Premium billing state object-The account's billing data behind a premium screen.--Billing details can lag behind changes made through the payment provider.+The account's Stripe customer, subscription, invoices and payment methods.### Structure| Field | Type | Description || --- | --- | --- |-| stripe_customer_id | ?string | The payment provider customer ID, or null when none was ever created |+| stripe_customer_id | ?string | The Stripe customer ID || current_subscription_price | ?[current subscription price](#current-subscription-price-object) object | The price the account is billed against || pending_subscription_change | ?[pending subscription change](#pending-subscription-change-object) object | The scheduled billing cycle change |-| list_price_switch | [list price switch](#list-price-switch-object) object | Whether the subscription can move to the current list price |-| subscription | ?[billing subscription](#billing-subscription-object) object | The mirrored subscription Fluxer selects by the rule below this table |-| invoices<sup>1</sup> | array[[billing invoice](#billing-invoice-object)] | The most recent invoices, newest first |-| invoices_has_more<sup>2</sup> | boolean | Whether the account has invoices beyond the returned page |-| payment_methods<sup>3</sup> | array[[billing payment method](#billing-payment-method-object)] | The stored payment methods |-| refund_eligibility | [refund eligibility](/http-api/billing/#refund-eligibility-object) object | The self-service refund state, which always reports `feature_unavailable` |--<sup>1</sup> At most 12 distinct invoices across the account's billing history, newest first--<sup>2</sup> True when the account has more invoices than the 12 returned. No route pages past the first 12, so use [create customer portal](#create-customer-portal) for the rest--<sup>3</sup> The default payment method sorts first, then the rest by provider creation time descending--Fluxer selects the subscription by preferring an `active` or `trialing` mirror, then a `past_due`, `unpaid` or `incomplete` one, then anything else. Ties break on the latest current period end.+| list_price_switch | [list price switch](#list-price-switch-object) object | Whether the subscription can move to the list price |+| subscription | ?[billing subscription](#billing-subscription-object) object | The current subscription |+| invoices | array[[billing invoice](#billing-invoice-object)] | Up to 12 recent invoices, newest first |+| invoices_has_more | boolean | Whether there are older invoices, which the [customer portal](#create-customer-portal) shows |+| payment_methods | array[[billing payment method](#billing-payment-method-object)] | The stored payment methods, default first |+| refund_eligibility | [refund eligibility](/http-api/billing/#refund-eligibility-object) object | Always ineligible, with `reason` set to `feature_unavailable` |## Billing subscription object-One mirrored payment provider subscription. Fluxer passes every member through, so `status`, `plan_interval` and `plan_currency` are the provider's own values.+A Stripe subscription, with `status`, `plan_interval` and `plan_currency` in Stripe's own values.### Structure| Field | Type | Description || --- | --- | --- |-| id | string | The payment provider subscription ID |-| status | ?string | The provider subscription status |+| id | string | The Stripe subscription ID |+| status | ?string | The subscription status || current_period_start | ?ISO8601 timestamp | The start of the current billing period || current_period_end | ?ISO8601 timestamp | The end of the current billing period || cancel_at_period_end | boolean | Whether the subscription cancels at the period end || cancel_at | ?ISO8601 timestamp | The scheduled cancellation time |-| canceled_at | ?ISO8601 timestamp | The time the cancellation was requested |-| plan_interval<sup>1</sup> | ?string | The provider recurring interval of the primary price |-| plan_amount_minor | ?integer | The primary price amount, in the minor unit of `plan_currency` |-| plan_currency | ?string | The provider currency of the primary price, as the provider spells it |+| canceled_at | ?ISO8601 timestamp | When the cancellation was requested |+| plan_interval | ?string | `month` or `year` |+| plan_amount_minor | ?integer | The price amount, in the minor unit of `plan_currency` |+| plan_currency | ?string | The lowercase currency of the price || default_payment_method_id | ?string | The payment method the subscription bills |## Billing invoice object-One mirrored payment provider invoice. `hosted_invoice_url` and `invoice_pdf` are the only links to the invoice document.+A Stripe invoice.### Structure| Field | Type | Description || --- | --- | --- |-| id | string | The payment provider invoice ID |-| number | ?string | The human-readable invoice number |-| amount_due<sup>1</sup> | integer | The amount due, in the minor unit of `currency` |-| amount_paid<sup>1</sup> | integer | The amount paid, in the minor unit of `currency` |-| currency<sup>2</sup> | string | The provider currency of the invoice, as the provider spells it |-| status | ?string | The provider invoice status |-| created_at | ?ISO8601 timestamp | The provider creation time |-| paid_at | ?ISO8601 timestamp | The settlement time |-| billing_reason | ?string | The provider reason the invoice was created |+| id | string | The Stripe invoice ID |+| number | ?string | The invoice number |+| amount_due | integer | The amount due, in the minor unit of `currency` |+| amount_paid | integer | The amount paid, in the minor unit of `currency` |+| currency | string | The lowercase currency of the invoice |+| status | ?string | The invoice status |+| created_at | ?ISO8601 timestamp | When the invoice was created |+| paid_at | ?ISO8601 timestamp | When the invoice was paid |+| billing_reason | ?string | Why Stripe created the invoice || subscription_id | ?string | The subscription that produced the invoice, or null for a one-off purchase |-| hosted_invoice_url | ?string | The externally hosted invoice page |-| invoice_pdf | ?string | The externally hosted invoice PDF |--<sup>1</sup> Reported as `0` when the mirror records no amount--<sup>2</sup> Falls back to `usd` when the mirror records no currency--### Example--```json-{- "id": "in_1QaBcDeFgHiJkLmN",- "number": "A1B2C3D4-0007",- "amount_due": 499,- "amount_paid": 499,- "currency": "usd",- "status": "paid",- "created_at": "2026-08-14T09:00:00.000Z",- "paid_at": "2026-08-14T09:00:04.000Z",- "billing_reason": "subscription_cycle",- "subscription_id": "sub_1QaBcDeFgHiJkLmN",- "hosted_invoice_url": "https://invoice.example.com/i/acct_1/live_1",- "invoice_pdf": "https://invoice.example.com/i/acct_1/live_1.pdf"-}-```+| hosted_invoice_url | ?string | The hosted invoice page |+| invoice_pdf | ?string | The invoice PDF |## Billing payment method object-One mirrored stored payment method. A non-card method reports every card member as null and still reports `type`.+A stored payment method, where the card fields are null for anything that isn't a card.### Structure| Field | Type | Description || --- | --- | --- |-| id | string | The payment provider payment method ID |-| type | ?string | The provider payment method type |-| card_brand | ?string | The card brand, or null when the method is not a card |-| card_last4 | ?string | The last four digits of the card, or null when the method is not a card |-| card_exp_month | ?integer | The expiry month of the card, or null when the method is not a card |-| card_exp_year | ?integer | The expiry year of the card, or null when the method is not a card |-| is_default<sup>1</sup> | boolean | Whether the method is the customer's default |--<sup>1</sup> An account with more than one billing customer can report more than one default--### Example--```json-{- "id": "pm_1QaBcDeFgHiJkLmN",- "type": "card",- "card_brand": "visa",- "card_last4": "4242",- "card_exp_month": 11,- "card_exp_year": 2029,- "is_default": true-}-```+| id | string | The Stripe payment method ID |+| type | ?string | The payment method type |+| card_brand | ?string | The card brand |+| card_last4 | ?string | The last four digits of the card |+| card_exp_month | ?integer | The card's expiry month |+| card_exp_year | ?integer | The card's expiry year |+| is_default | boolean | Whether the method is the customer's default |## Premium pricing state object-The checkout catalogue resolved for the request. A client can render prices without a second call to [get price IDs](#get-price-ids). Fluxer resolves one catalogue on every request, and a country with its own localised currency always resolves to that currency.+The checkout prices for the request's country.### Structure| Field | Type | Description || --- | --- | --- |-| country_code<sup>1</sup> | ?string | The country used to resolve the prices |-| localized<sup>2</sup> | ?[price IDs](#price-ids-object) object | The localised catalogue, or null when it cannot be resolved |--<sup>1</sup> The request-time geolocation country, falling back to the `country_code` query value uppercased, or null when neither resolves--<sup>2</sup> Null unless the deployment configures a complete recurring pair and a complete gift pair for a currency in the currency preference order of `country_code`, which is the default order when `country_code` is null, so one missing gift price nulls the whole catalogue. The amounts come from the mirrored price rows--Fluxer reports an unresolvable catalogue as null here, and the request still succeeds. [Get price IDs](#get-price-ids) answers 400 `STRIPE_ERROR` for the same condition.+| country_code | ?string | The country used to pick the prices |+| localized | ?[price IDs](#price-ids-object) object | The prices, or null when no currency for the country has both a monthly and a yearly price set up |## Get price IDs<RouteHeader method="GET" path="/v1/premium/price-ids" unauthenticated />-Returns the [price IDs](#price-ids-object) object for a country. Fluxer uses a supplied credential only to count the request against that user's rate limit, so an unrecognised credential falls back to the client IP address.--The deployment must configure a complete recurring pair and a complete gift pair for at least one currency that the requested country prefers. Fluxer answers 400 `STRIPE_ERROR` when it does not.+Returns the [price IDs](#price-ids-object) object for the request's country.### Query parameters| Field | Type | Description || --- | --- | --- |-| country_code?<sup>1</sup> | string | The two-letter country used to select the regional price catalogue |--<sup>1</sup> Fluxer trims surrounding whitespace and requires exactly two characters, and any other length fails validation with `STRING_LENGTH_EXACT`. The request-time geolocation country wins, so this value is read only when Fluxer cannot geolocate the request, and the default currency preference order applies when neither resolves+| country_code? | string | A two-letter country code, used when Fluxer can't locate the request |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [price IDs](#price-ids-object) object | The catalogue was resolved |-| 400 | [error response](/http-api/#error-response) | No configured currency satisfies the request and the request returns `STRIPE_ERROR` |+| 200 | [price IDs](#price-ids-object) object | The prices were returned |+| 400 | [error response](/http-api/#error-response) | `STRIPE_ERROR` when no currency for the country has both a monthly and a yearly price set up |-### Rate limit--40 requests per 10 seconds for each authenticated user or client IP address, on the `stripe:price:ids` bucket.+The rate limit is 40 requests per 10 seconds, on the `stripe:price:ids` bucket.## Get premium state<RouteHeader method="GET" path="/v1/premium/state" />-Returns the [premium state](#premium-state-object) object for the authenticated account.--The route is available even when no payment provider is configured.--:::note[One read serves the whole billing screen]-`billing.current_subscription_price` is the same object returned by [get current subscription price](#get-current-subscription-price), and `billing.pending_subscription_change` has no route of its own.-:::--:::note[Billing details may take time to update]-`current_subscription_price` can temporarily differ from [get current subscription price](#get-current-subscription-price) after a billing change.-:::+Returns the [premium state](#premium-state-object) object for the current account. This request can also update the Stripe default payment method so that the customer and the subscription use the same one.### Query parameters| Field | Type | Description || --- | --- | --- |-| country_code?<sup>1</sup> | string | The two-letter country used to resolve `pricing` |--<sup>1</sup> Fluxer trims surrounding whitespace and requires exactly two characters. The request-time geolocation country wins, so this value is read only when Fluxer cannot geolocate the request. When neither resolves, `pricing` falls back to the default currency preference order and `pricing.country_code` is null+| country_code? | string | A two-letter country code for `pricing`, used when Fluxer can't locate the request |### Response@@ -587,42 +287,27 @@ The route is available even when no payment provider is configured.| --- | --- | --- || 200 | [premium state](#premium-state-object) object | The state was returned |-### Side effects--The read can change a default payment method. When the customer has a default that differs from the subscription's, Fluxer sets the subscription's default to the customer's. When only the subscription has a default, Fluxer sets it as the customer's default. It does not change entitlement.--### Rate limit--30 requests per 10 seconds for each authenticated user, on the `stripe:premium:state` bucket.+The rate limit is 30 requests per 10 seconds, on the `stripe:premium:state` bucket.## Get current subscription price<RouteHeader method="GET" path="/v1/premium/current-subscription-price" />-Returns the [current subscription price](#current-subscription-price-object) object for the authenticated account, or null when no price can be resolved.--Returns null when no payment provider or subscription is configured, or when the price lookup fails.--Subscription price changes can take 5 minutes to appear. List price amount changes can take one hour.+Returns the [current subscription price](#current-subscription-price-object) object, or null when the account has no subscription or Fluxer can't look up its price.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | ?[current subscription price](#current-subscription-price-object) object | The current price or null was returned |-| 404 | [error response](/http-api/#error-response) | The authenticated account record no longer exists and the request returns `UNKNOWN_USER` |--### Rate limit+| 200 | ?[current subscription price](#current-subscription-price-object) object | The price was returned, or null |-20 requests per 10 seconds for each authenticated user, on the `stripe:subscription:current_price` bucket.+The rate limit is 20 requests per 10 seconds, on the `stripe:subscription:current_price` bucket.## Set premium perks disabled<RouteHeader method="PATCH" path="/v1/premium/perks-disabled" />-Turns the account's own premium perks off or on without changing billing state, and returns the resulting [premium state](#premium-state-object) object. Emits a [User Update](/gateway/events/#user-update) Gateway event when the requested value differs from the stored one.--The response is built exactly as [get premium state](#get-premium-state) builds it, except that it always resolves pricing without a country code.+Turns the account's premium perks off or on without changing billing, and returns the [premium state](#premium-state-object) object. Fluxer sends [User Update](/gateway/events/#user-update) when the value changes.### JSON body@@ -634,63 +319,30 @@ The response is built exactly as [get premium state](#get-premium-state) builds| Status | Body | Condition || --- | --- | --- |-| 200 | [premium state](#premium-state-object) object | The current state was returned, whether or not the flag changed |-| 404 | [error response](/http-api/#error-response) | The authenticated account record no longer exists and the request returns `UNKNOWN_USER` |--### Side effects--When the requested value changes, every account session receives [User Update](/gateway/events/#user-update). Repeating the current value leaves the flag untouched. The returned `actual` state never changes. The response has the same billing side effects as [Get premium state](#get-premium-state).--### Rate limit+| 200 | [premium state](#premium-state-object) object | The state was returned |-10 requests per minute for each authenticated user, on the `stripe:premium:perks_disabled` bucket.+The rate limit is 10 requests per minute, on the `stripe:premium:perks_disabled` bucket.## Create customer portal<RouteHeader method="POST" path="/v1/premium/customer-portal" />-Creates a billing portal session for the authenticated account and returns a [redirect URL](/http-api/billing/#redirect-url-object) object. The object has no session identifier, so the returned URL is the only way to open the session.--An account that never had a payment provider customer receives 400 `STRIPE_NO_PURCHASE_HISTORY`. A deployment that configures no payment provider receives 400 `STRIPE_PAYMENT_NOT_AVAILABLE`, and a provider call that fails or answers without a URL receives 400 `STRIPE_ERROR`.+Creates a Stripe billing portal session and returns a [redirect URL](/http-api/billing/#redirect-url-object) object. Send the user to the URL to manage their payment methods, invoices and subscription.### Response| Status | Body | Condition || --- | --- | --- || 200 | [redirect URL](/http-api/billing/#redirect-url-object) object | The portal session was created |-| 400 | [error response](/http-api/#error-response) | The account has no payment provider customer, or the provider is not configured or rejected the request |-| 404 | [error response](/http-api/#error-response) | The authenticated account record no longer exists and the request returns `UNKNOWN_USER` |--### Side effects--The operation creates an externally hosted billing portal session that returns to the Fluxer premium callback when the user closes it. Nothing is written to Fluxer state, and any change the user makes in the portal reaches Fluxer through [receive Stripe webhook](/http-api/billing/#receive-stripe-webhook).--### Rate limit+| 400 | [error response](/http-api/#error-response) | `STRIPE_NO_PURCHASE_HISTORY` when the account has no Stripe customer |-5 requests per minute for each authenticated user, on the `stripe:customer_portal` bucket.+The rate limit is 5 requests per minute, on the `stripe:customer_portal` bucket.## End premium grace period<RouteHeader method="POST" path="/v1/premium/grace/end" />-Ends an active grace period immediately. Emits a [User Update](/gateway/events/#user-update) Gateway event when a grace period was ended.--The operation is idempotent and reports success without changing anything when no grace deadline is recorded, when the account holds a lifetime entitlement, and when the account's premium end has not yet passed.--The window this operation ends runs to `premium_grace_ends_at`. [Receive Stripe webhook](/http-api/billing/#receive-stripe-webhook) records that deadline when a renewal payment fails and when a subscription is deleted, for an account whose stored premium type is subscription.--| Condition | Recorded deadline |-| --- | --- |-| A renewal payment fails | The start of the unpaid period plus 7 days for a monthly plan or 14 days for a yearly plan |-| The subscription was cancelled for non-payment | The same deadline, never extended |-| The subscription ended for any other reason | The subscription end itself, which leaves no window for this route to close |-| The early cancellation is already recorded | Nothing |--This route requires an explicit `premium_grace_ends_at`. It does not end the default 3-day grace period used when that field is absent.--:::caution[The downgrade is immediate]-Premium features become unavailable before the recorded grace deadline arrives. The grace period cannot be restarted through this API.-:::+Ends the grace period after a failed renewal, and premium features stop at once. It does nothing when the account isn't in a grace period. Fluxer sends [User Update](/gateway/events/#user-update) when the grace period ends.### Response body@@ -702,140 +354,74 @@ Premium features become unavailable before the recorded grace deadline arrives.| Status | Body | Condition || --- | --- | --- |-| 200 | response body | The grace period was ended, or no applicable grace state existed |-| 404 | [error response](/http-api/#error-response) | The authenticated account record no longer exists and the request returns `UNKNOWN_USER` |+| 200 | response body | The grace period ended, or there was none |-### Side effects--For an active grace period on a non-lifetime account, the operation clears the premium type, premium start, premium end, gift extension end, cancellation flag, billing cycle and grace deadline together. Every account session receives [User Update](/gateway/events/#user-update). A call with no applicable grace state changes nothing. Fluxer contacts no payment provider.--### Rate limit--3 requests per minute for each authenticated user, on the `stripe:premium:grace:end` bucket.+The rate limit is 3 requests per minute, on the `stripe:premium:grace:end` bucket.## Cancel subscription<RouteHeader method="POST" path="/v1/premium/cancel-subscription" />-Marks the active recurring subscription to cancel at the end of the current period and returns 204 with an empty body. Emits a [User Update](/gateway/events/#user-update) Gateway event.--A deployment that configures no payment provider receives 400 `STRIPE_PAYMENT_NOT_AVAILABLE`, an account with no stored subscription receives 400 `STRIPE_NO_ACTIVE_SUBSCRIPTION`, and a subscription already set to cancel receives 400 `STRIPE_SUBSCRIPTION_ALREADY_CANCELING`. Every other failure, including a subscription that has a schedule but no future period end, is reported as 400 `STRIPE_ERROR`.+Sets the subscription to cancel at the end of the current period and discards any pending billing cycle change. Premium stays active until then. Fluxer sends [User Update](/gateway/events/#user-update).### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | The subscription was marked to cancel at period end |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The subscription cannot be marked to cancel |-| 404 | [error response](/http-api/#error-response) | The authenticated account record no longer exists and the request returns `UNKNOWN_USER` |--<sup>1</sup> The account has no stored subscription, the subscription is already cancelling, the subscription has a schedule but no future period end, the payment provider is not configured, or the payment provider rejected the request+| 204 | empty | The subscription will cancel at the period end |+| 400 | [error response](/http-api/#error-response) | `STRIPE_NO_ACTIVE_SUBSCRIPTION` or `STRIPE_SUBSCRIPTION_ALREADY_CANCELING` |-### Side effects--Fluxer sets the subscription to cancel at the current period end, sets the account's cancellation flag, and refreshes the mirrored subscription row. Every account session receives [User Update](/gateway/events/#user-update). For a subscription with no schedule, Fluxer writes no premium end, so the recorded end is whatever the account already has.--A subscription that has a schedule discards its pending billing cycle change and ends in cancellation at the current period end. Fluxer then rewrites the premium end from the refreshed subscription. Premium access continues through the recorded end, and [receive Stripe webhook](/http-api/billing/#receive-stripe-webhook) later applies the final downgrade.--### Rate limit--5 requests per minute for each authenticated user, on the `stripe:subscription:cancel` bucket.+The rate limit is 5 requests per minute, on the `stripe:subscription:cancel` bucket.## Reactivate subscription<RouteHeader method="POST" path="/v1/premium/reactivate-subscription" />-Removes period end cancellation from a subscription that is set to cancel and returns 204 with an empty body. Emits a [User Update](/gateway/events/#user-update) Gateway event.--A deployment that configures no payment provider receives 400 `STRIPE_PAYMENT_NOT_AVAILABLE`, an account with no stored subscription receives 400 `STRIPE_NO_SUBSCRIPTION`, and a subscription that is not set to cancel receives 400 `STRIPE_SUBSCRIPTION_NOT_CANCELING`. Every other failure is reported as 400 `STRIPE_ERROR`.+Undoes a pending cancellation and discards any pending billing cycle change. Fluxer sends [User Update](/gateway/events/#user-update).### Response| Status | Body | Condition || --- | --- | --- || 204 | empty | The subscription was reactivated |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The subscription cannot be reactivated |-| 403 | [error response](/http-api/#error-response) | `PREMIUM_PURCHASE_BLOCKED` with the reason `payment_dispute_open`, because a payment dispute the account made is open |-| 404 | [error response](/http-api/#error-response) | The authenticated account record no longer exists and the request returns `UNKNOWN_USER` |--<sup>1</sup> The account has no stored subscription, the subscription is not set to cancel, the payment provider is not configured, or the payment provider rejected the request+| 400 | [error response](/http-api/#error-response) | `STRIPE_NO_SUBSCRIPTION` or `STRIPE_SUBSCRIPTION_NOT_CANCELING` |-### Side effects--Fluxer releases any subscription schedule, which discards a pending billing cycle change, then clears period end cancellation. The account's cancellation flag becomes false. Every account session receives [User Update](/gateway/events/#user-update).--### Rate limit--5 requests per minute for each authenticated user, on the `stripe:subscription:reactivate` bucket.+The rate limit is 5 requests per minute, on the `stripe:subscription:reactivate` bucket.## Change subscription billing cycle<RouteHeader method="POST" path="/v1/premium/change-subscription" />-Moves the active subscription between the monthly and yearly billing cycles, either immediately or at the end of the current period, and returns 204 with an empty body. Emits a [User Update](/gateway/events/#user-update) Gateway event when the account state changes.--A deployment that configures no payment provider receives 400 `STRIPE_PAYMENT_NOT_AVAILABLE`, an account with no stored subscription receives 400 `STRIPE_NO_ACTIVE_SUBSCRIPTION`, and a deployment with no configured price for the target cycle in the subscription's currency receives 400 `STRIPE_INVALID_PRODUCT_CONFIGURATION`. A subscription with no recurring primary item, an unsupported recurring interval, a period end change with no future period end, and any other provider failure are all reported as 400 `STRIPE_ERROR`.--The operation reports success without changing anything when the subscription already bills on the requested cycle. When a future schedule phase already has the target price, the operation sends nothing further to the payment provider and writes only the account's cancellation flag, premium end and stored payment provider customer identifier.--:::caution[An immediate change invoices at once]-An immediate change swaps the subscription item to the target price and always invoices the proration, so the account is charged or credited. An incomplete payment fails the request without leaving the subscription in the `incomplete` status.-:::--:::note[A period end change can credit the first invoice]-A monthly to yearly change credits the first invoice of the new phase with the smaller of the two amounts. A trial adds no credit, and a yearly to monthly change has none.-:::+Moves the subscription between monthly and yearly and clears a pending cancellation. With `effective_at` set to `now`, Fluxer charges or credits the prorated difference at once, and a change at `period_end` shows up as `billing.pending_subscription_change` in [get premium state](#get-premium-state). Requesting the current cycle does nothing. Fluxer sends [User Update](/gateway/events/#user-update).### JSON body| Field | Type | Description || --- | --- | --- |-| billing_cycle | string | The target [billing cycle](#billing-cycles), either `monthly` or `yearly` |-| effective_at? | string | Either `now` or `period_end` (default `now`) |+| billing_cycle | string | The target [billing cycle](#billing-cycles) |+| effective_at? | string | `now` or `period_end` (default `now`) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | The change was applied, scheduled, or already in effect |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The billing cycle cannot be changed |-| 403 | [error response](/http-api/#error-response) | `PREMIUM_PURCHASE_BLOCKED` with the reason `payment_dispute_open`, because a payment dispute the account made is open |-| 404 | [error response](/http-api/#error-response) | The authenticated account record no longer exists and the request returns `UNKNOWN_USER` |--<sup>1</sup> The account has no stored subscription, the subscription has no usable recurring item or future period end, no price is configured for the target cycle and currency, the payment provider is not configured, or the payment provider rejected the request--### Side effects--An immediate change clears pending cancellation, replaces the subscription price, and updates the billing cycle and premium end. A period end change clears pending cancellation and schedules the target cycle to begin at the current period end without proration. A monthly to yearly change credits the first invoice of the scheduled phase with the smaller of the two amounts, except during a trial.--A scheduled change becomes visible as `billing.pending_subscription_change` in [get premium state](#get-premium-state). Every account session receives [User Update](/gateway/events/#user-update). Requesting the already active cycle changes nothing.--### Rate limit+| 204 | empty | The change was applied or scheduled |+| 400 | [error response](/http-api/#error-response) | `STRIPE_NO_ACTIVE_SUBSCRIPTION` when the account has no subscription |+| 400 | [error response](/http-api/#error-response) | `STRIPE_INVALID_PRODUCT_CONFIGURATION` when the cycle has no price in the subscription's currency |-5 requests per minute for each authenticated user, on the `stripe:subscription:change` bucket.+The rate limit is 5 requests per minute, on the `stripe:subscription:change` bucket.## Cancel pending subscription change<RouteHeader method="POST" path="/v1/premium/cancel-pending-subscription-change" />-Cancels a scheduled billing cycle change and returns 204 with an empty body. Emits a [User Update](/gateway/events/#user-update) Gateway event when a scheduled change was cancelled.--A deployment that configures no payment provider receives 400 `STRIPE_PAYMENT_NOT_AVAILABLE`, an account with no stored subscription receives 400 `STRIPE_NO_ACTIVE_SUBSCRIPTION`, and a provider failure receives 400 `STRIPE_ERROR`.--The operation is idempotent and reports success without changing anything when the subscription has no schedule and when the schedule has no pending billing cycle change.+Cancels a scheduled billing cycle change. Fluxer sends [User Update](/gateway/events/#user-update) when it cancels one.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | The pending change was cancelled, or none existed |-| 400 | [error response](/http-api/#error-response) | The account has no stored subscription, or the provider is not configured or rejected the request |-| 404 | [error response](/http-api/#error-response) | The authenticated account record no longer exists and the request returns `UNKNOWN_USER` |--### Side effects--Fluxer releases the subscription schedule, which removes the scheduled cycle change. The account's cancellation flag becomes false, and Fluxer refreshes its premium end. Every account session receives [User Update](/gateway/events/#user-update). Afterwards `billing.pending_subscription_change` in [get premium state](#get-premium-state) is null.--### Rate limit+| 204 | empty | The pending change was cancelled, or there was none |+| 400 | [error response](/http-api/#error-response) | `STRIPE_NO_ACTIVE_SUBSCRIPTION` when the account has no subscription |-5 requests per minute for each authenticated user, on the `stripe:subscription:change` bucket, shared with [change subscription billing cycle](#change-subscription-billing-cycle).+The rate limit is 5 requests per minute, on the `stripe:subscription:change` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/read-states.mdx b/fluxer_docs/src/content/docs/http-api/read-states.mdxindex fa72a09f4..f1b217ce4 100644--- a/fluxer_docs/src/content/docs/http-api/read-states.mdx+++ b/fluxer_docs/src/content/docs/http-api/read-states.mdx@@ -1,47 +1,27 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Read states-description: Current account message read states and the batch acknowledgement operations.+description: Per-channel read states and the routes that acknowledge them in bulk.---import RouteHeader from '@/components/RouteHeader.astro';-A read state records how far the current account has read in one channel. It holds the highest message read through, the mention count, and the last acknowledged pin timestamp. The [Messages resource](/http-api/messages/) defines single-channel acknowledgement and pin acknowledgement.+A read state records how far you have read in one channel. Only user accounts can call the routes on this page. To acknowledge a single message, use [Acknowledge message](/http-api/messages/#acknowledge-message).-Both routes on this page are user-only. Fluxer rejects a bot or OAuth2 credential with 403 `ACCESS_DENIED`.+No HTTP route lists read states. You get them as `read_states` in the [Ready](/gateway/events/#ready) payload, and [Message ACK](/gateway/events/#message-ack) events send changes after that.## Read state object-An account holds at most one read state per channel, keyed by the account and the channel.-### Structure| Field | Type | Description || --- | --- | --- |-| id | snowflake | The ID of the channel the read state belongs to |-| mention_count<sup>1</sup> | integer | The number of mentions stored for the channel (0-2,147,483,647) |-| last_message_id | ?snowflake | The highest message ID the account has read through, or null when the entry stores no watermark |-| last_pin_timestamp<sup>2</sup> | ?ISO8601 timestamp | The time of the last acknowledged pin, or null when pins have never been acknowledged |-| version?<sup>3</sup> | string | The read state version as a canonical decimal unsigned 64-bit string |-| flags?<sup>4</sup> | integer | The [read state flags](#read-state-flags) |--<sup>1</sup> The value the last acknowledgement stored, incremented by the server as new mentions arrive and never recomputed from message history--<sup>2</sup> Neither operation on this page writes it, so an acknowledged pin timestamp survives every message acknowledgement--<sup>3</sup> Present on every entry the API returns. The value is always `0`--<sup>4</sup> Present only on the entry of a thread, a forum channel, or a media channel, and set by Fluxer--An acknowledgement creates an entry. So does [Acknowledge pins](/http-api/messages/#acknowledge-pins), and so does the server when a mention arrives in a channel the account has no entry for. Creating a post in a forum or media channel acknowledges that channel through the post ID for a user caller, as [Start thread](/http-api/threads/#start-thread) describes. A pin acknowledgement writes `last_pin_timestamp` and the flags that [Read state flags](#read-state-flags) describes, and the entry it creates reports `last_message_id` as null. The entry the server creates for a mention starts from the channel's own baseline watermark, the snowflake of the channel ID itself, or one below it for a thread. Every message already in the channel stays unread.--[Clear channel read state](/http-api/messages/#clear-channel-read-state) is deprecated and changes no read state.--:::note[The aggregate is delivered through the Gateway]-There is no HTTP read for the read state aggregate. The complete entry array arrives once as `read_states` in the main Gateway [Ready](/gateway/events/#ready) payload.-:::--Only an acknowledgement produces a later Dispatch. A message acknowledgement emits [Message ACK](/gateway/events/#message-ack), and a pin acknowledgement emits [Channel Pins ACK](/gateway/events/#channel-pins-ack). A post a user creates in a forum or media channel also emits Message ACK for that channel. A server-side mention increment changes the stored entry and emits nothing. The Dispatch stream is not a complete change feed. A client that needs the authoritative aggregate reconciles from a new Ready, or from the entries [Acknowledge read states](#acknowledge-read-states) returns.+| id | snowflake | The ID of the channel |+| mention_count | integer | The number of unread mentions (0-2,147,483,647) |+| last_message_id | ?snowflake | The highest message ID the account has read through |+| last_pin_timestamp | ?ISO8601 timestamp | The time of the last acknowledged pin |+| version? | string | Always `0` |+| flags? | integer | The [read state flags](#read-state-flags), only on threads, forum channels and media channels |### Example@@ -62,140 +42,76 @@ Only an acknowledgement produces a later Dispatch. A message acknowledgement emi| 1 << 0 | IS_GUILD_CHANNEL | The entry belongs to a guild channel || 1 << 1 | IS_THREAD | The entry belongs to a thread |-Fluxer sets the flags on an entry written by a user session that declares the [`channel_threads` client capability](/http-api/threads/#client-capability). The entry Fluxer creates for a mention in a thread also has both flags. A session that does not declare it never receives an entry that has flags.+A session that doesn't declare the [`channel_threads` client capability](/http-api/threads/#client-capability) gets no read states for threads, forum channels or media channels.## Read state acknowledgement object-One entry in the body of [Acknowledge read states](#acknowledge-read-states). It names the channel whose entry changes, the message the account has read through, and the mention count to store for the channel.+One entry in the body of [Acknowledge read states](#acknowledge-read-states).### Structure| Field | Type | Description || --- | --- | --- |-| channel_id<sup>1</sup> | snowflake | The ID of the channel whose read watermark changes |-| message_id<sup>2</sup> | snowflake | The ID of the message watermark to acknowledge |-| mention_count?<sup>3</sup> | integer | The number of mentions to store for the channel (0-2,147,483,647, default `0`) |-| manual?<sup>4</sup> | boolean | Whether the stored watermark becomes exactly `message_id` |--<sup>1</sup> Fluxer stores the value as the read state key with no check that the channel exists or that the account can see it+| channel_id | snowflake | The ID of the channel to acknowledge |+| message_id | snowflake | The ID of the message to read through |+| mention_count? | integer | The number of mentions to store (0-2,147,483,647, default `0`) |+| manual? | boolean | Whether to set `last_message_id` to `message_id` even when it is lower |-<sup>2</sup> Fluxer does not resolve the message either. An entry equal to the stored watermark still produces a write, so it resets the stored mention count--<sup>3</sup> Fluxer stores the submitted value verbatim, so a client that leaves unread mentions after `message_id` must send the number of those mentions--<sup>4</sup> With `manual` false an entry strictly below the stored watermark is discarded whole--:::caution[A manual acknowledgement can rewind the watermark]-A lower `message_id` marks later messages unread again. Fluxer replaces the stored mention count at the same time, so a rewinding acknowledgement that omits `mention_count` clears it.-:::--### Example--```json-{- "channel_id": "1501314428688998182",- "message_id": "1501320000000000000",- "mention_count": 0-}-```+Without `manual`, an entry whose `message_id` is below the current `last_message_id` changes nothing. With `manual`, a lower `message_id` marks the later messages unread again.## Bulk read state acknowledgement object-One entry in the body of [Mark channels as read](#mark-channels-as-read). It names the channel and the message to read through.+One entry in the body of [Mark channels as read](#mark-channels-as-read).### Structure| Field | Type | Description || --- | --- | --- |-| channel_id<sup>1</sup> | snowflake | The ID of the channel whose read watermark changes |-| message_id<sup>1</sup> | snowflake | The ID of the message watermark to acknowledge |--<sup>1</sup> Neither identifier is resolved, so an entry may name a channel or a message that does not exist+| channel_id | snowflake | The ID of the channel to acknowledge |+| message_id | snowflake | The ID of the message to read through |## Acknowledge read states<RouteHeader method="POST" path="/v1/read-states/ack" />-Applies 1 through 100 [read state acknowledgement objects](#read-state-acknowledgement-object) to the current account's aggregate and returns the resulting [read state](#read-state-object) entries. User-only. Emits one [Message ACK](/gateway/events/#message-ack) Gateway event to the caller's own sessions for each submitted entry.--The route never checks that a channel exists and evaluates no permission. The write changes only the caller's own read states.+Applies the [read state acknowledgements](#read-state-acknowledgement-object) and returns the [read states](#read-state-object) that result, in the order you sent them. The response leaves out thread, forum channel and media channel read states that your session can't receive. Sends a [Message ACK](/gateway/events/#message-ack) event to your sessions for each entry. Each entry also clears delivered push notifications for its channel up to the submitted `message_id`.### JSON body| Field | Type | Description || --- | --- | --- |-| read_states<sup>1</sup> | array[[read state acknowledgement](#read-state-acknowledgement-object) object] | The acknowledgements to apply (1-100) |--<sup>1</sup> A list of fewer than 1 or more than 100 entries fails with 400 `INVALID_FORM_BODY`+| read_states | array[[read state acknowledgement](#read-state-acknowledgement-object) object] | The acknowledgements to apply (1-100) |### Response body| Field | Type | Description || --- | --- | --- |-| read_states<sup>1</sup> | array[[read state](#read-state-object) object] | The authoritative entries after the write |--<sup>1</sup> One entry for each submitted acknowledgement, in the submitted order, less any entry with flags that the session cannot receive. An entry whose watermark did not move reports the values already stored--When any entry is manual or has a positive mention count, entries for the same channel apply in submitted order. Otherwise, each entry is evaluated against the state before the request.+| read_states | array[[read state](#read-state-object) object] | The read states after the acknowledgements |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Acknowledgements were processed and the resulting entries returned |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |--### Side effects--With `manual` true, an entry sets the channel watermark to `message_id`. With `manual` false, Fluxer discards an entry strictly below the stored watermark and leaves the stored entry unchanged. Every entry that is not discarded sets the watermark to `message_id` and stores the submitted mention count.--One [Message ACK](/gateway/events/#message-ack) goes to the caller's sessions for every submitted entry, including an unchanged one. It reports the resulting `message_id`, `mention_count`, and `version`. It also includes the submitted `manual` value when any entry is manual or has a positive mention count.--A session without [thread access](/gateway/threads/#session-flag) receives no Message ACK for an entry that has `flags`.--When Fluxer fails to send a Message ACK, the request still succeeds and no Dispatch arrives for that entry. A client reconciles from the entries this route returns or from a new Ready.+| 200 | response body | The acknowledgements were applied |-Every entry also clears delivered push notifications for its channel through the submitted `message_id`. Fluxer uses the submitted value even when it discards the entry and keeps a higher stored watermark.--### Rate limit--20 requests per 10 seconds for each authenticated user, on the `read_state:ack_bulk` bucket, shared with [Mark channels as read](#mark-channels-as-read).+The rate limit is 20 requests per 10 seconds, on the `read_state:ack_bulk` bucket.## Mark channels as read<RouteHeader method="POST" path="/v1/read-states/ack-bulk" />-Applies 1 through 100 [bulk read state acknowledgement objects](#bulk-read-state-acknowledgement-object) and returns 204 with an empty body. User-only. Emits one [Message ACK](/gateway/events/#message-ack) Gateway event to the caller's own sessions for each submitted entry.--Every entry advances its channel watermark monotonically and sets the channel's stored mention count to `0`. An entry whose `message_id` is strictly below the stored watermark is skipped and leaves the stored entry untouched. Like [Acknowledge read states](#acknowledge-read-states), the operation never checks that a channel exists and evaluates no permission.+Marks each channel as read through `message_id` and sets its mention count to `0`. It works like [Acknowledge read states](#acknowledge-read-states) without `mention_count` or `manual` and returns no body. An entry whose `message_id` is below the current `last_message_id` changes nothing. Sends a [Message ACK](/gateway/events/#message-ack) event to your sessions for each entry. Each entry also clears delivered push notifications for its channel up to the submitted `message_id`.### JSON body| Field | Type | Description || --- | --- | --- |-| read_states<sup>1</sup> | array[[bulk read state acknowledgement](#bulk-read-state-acknowledgement-object) object] | The channel and message pairs to acknowledge (1-100) |--<sup>1</sup> Two entries naming the same channel are both evaluated against the value stored before the request+| read_states | array[[bulk read state acknowledgement](#bulk-read-state-acknowledgement-object) object] | The channel and message pairs to acknowledge (1-100) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Acknowledgements were processed |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |--### Side effects--An entry equal to the current watermark resets the mention count to `0`.--One [Message ACK](/gateway/events/#message-ack) goes to the caller's own sessions for every submitted entry, including a skipped one. Every entry clears delivered notifications for its channel through the submitted `message_id`. The Dispatch has no `manual`, and a skipped entry reports the stored watermark and mention count.--A successful acknowledgement can have no corresponding Dispatch.--:::note[A failed request can leave some entries written]-A request that fails partway leaves the entries already written in place. A retry is safe, because a repeated monotonic acknowledgement is idempotent.-:::--### Rate limit+| 204 | empty | The acknowledgements were applied |-20 requests per 10 seconds for each authenticated user, on the `read_state:ack_bulk` bucket, shared with [Acknowledge read states](#acknowledge-read-states).+The rate limit is 20 requests per 10 seconds, on the `read_state:ack_bulk` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/reports.mdx b/fluxer_docs/src/content/docs/http-api/reports.mdxindex e0cb923f2..ee329010b 100644--- a/fluxer_docs/src/content/docs/http-api/reports.mdx+++ b/fluxer_docs/src/content/docs/http-api/reports.mdx@@ -1,129 +1,38 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Reports-description: Report flows, safety report submission, the reason catalogue, and the DSA notice flow.+description: Report flows, report submission, the reason catalog and Digital Services Act notices.---import RouteHeader from '@/components/RouteHeader.astro';-A safety report tells moderators that a message or a user profile broke the rules, and any user account can file one. Before a report is filed, the reporter answers a short series of questions. Fluxer serves those questions as a [report flow](#report-flows), and the answers decide the [reason](#report-reasons) the report is filed under. Digital Services Act notices need no account, only a verified email address, and they can also name a guild. The [Admin Reports API](/admin-api/reports/) covers reading, triaging, and closing a stored report.+A report tells the instance's moderators that a message, a user profile or a guild breaks the rules. A signed-in user reports a message or a profile by answering a [report flow](#report-flows), and anyone with a verified email address can file a Digital Services Act notice without an account. Moderators work with stored reports through the [Admin Reports API](/admin-api/reports/).-| Operation | Credential | Target |-| --- | --- | --- |-| [Get report flow](#get-report-flow) | None | The questions for one target type |-| [Submit message report flow](#submit-message-report-flow) | User session | One message the reporter can read |-| [Submit user report flow](#submit-user-report-flow) | User session | One user profile, optionally with a guild for context |-| [Send DSA report email](#send-dsa-report-email) | None | An email address to verify |-| [Verify DSA report email](#verify-dsa-report-email) | None | A verification code, exchanged for a ticket |-| [Create DSA report](#create-dsa-report) | A ticket | A message, user, or guild |--Fluxer discards a body member that no schema here defines, so a misspelt member is dropped without an error. A body that is not parseable JSON returns 400 `INVALID_FORM_BODY` with the validation code `INVALID_FORMAT` at the `body` path.--:::caution[A submitted report is durable evidence]-Fluxer copies the reported content when the report is submitted. A message report also copies the surrounding conversation and the bytes of every attachment in it, and every report copies the reported profile with its images. Deleting the message, editing the profile, or leaving the guild afterwards does not remove that snapshot. The snapshot is kept until [report retention](/admin-api/reports/#report-retention) removes it, which happens no sooner than 184 days after the report is resolved.-:::--## Access rules--[Submit message report flow](#submit-message-report-flow) and [Submit user report flow](#submit-user-report-flow) accept a user session token only. A bot token and an OAuth2 bearer credential are both rejected with 403 `ACCESS_DENIED`. The account must also be claimed and email-verified. An account holding no password and no SSO identity is rejected with 400 `UNCLAIMED_ACCOUNT_CANNOT_SUBMIT_REPORTS`, and one whose address is unverified with 403 `REPORT_EMAIL_VERIFICATION_REQUIRED`. An account with the report ban flag is rejected with 403 `REPORT_BANNED`.--[Get report flow](#get-report-flow) and the Digital Services Act routes require no credential. Fluxer still resolves a valid credential presented anyway, so the request draws on that account's rate limit allowance, and Get report flow renders the copy in that account's saved locale unless the request names one.--Every route bucket is keyed by the authenticated user ID when a credential resolves and by client IP address otherwise. Report creation also limits how many reports one reporter creates each hour. The rate limit section of each route that creates a report lists those limits.--## Content screening--The instance-wide content filter screens the JSON body of [Submit message report flow](#submit-message-report-flow) and [Submit user report flow](#submit-user-report-flow) before the route runs. A string of at least 3 characters matching the instance phrase blocklist, or a URL matching the instance URL blocklist, is rejected with 403 `CONTENT_BLOCKED`. Every string those two bodies define is an ID, a hash, or a locale, and the filter exempts all of them, so only a member the schema does not define can be blocked.--Every route under `/reports/dsa` is exempt by path, so Fluxer never screens a Digital Services Act notice. A notice about hate speech or a phishing link has to quote the slur or the URL it reports.--:::note[Screening precedes bucket and credential checks]-A blocked body returns `CONTENT_BLOCKED`, not `RATE_LIMITED` or `UNAUTHORIZED`.-:::--## Submission side effects--Every accepted submission writes one report and returns it as a [report object](#report-object). A report filed through a flow also stores its reason, the [category](#report-categories) that reason maps to, the submitted steps, the revision hash, and the resolved locale. Submission emits no Gateway Dispatch.--Two kinds of repeat are refused with 409 `CONFLICT`:--- The same reporter reporting the same message again within 365 days of the earlier report, unless that report was deleted.-- The same reporter reporting the same user again within 24 hours of the earlier report.--Nothing deduplicates a Digital Services Act notice.--Fluxer tells the reporter when a moderator resolves the report. A reporter with an account receives a system direct message, and an email when the account has an address. A Digital Services Act notice gets a receipt email at its verified address as soon as it is filed, and a decision email at the same address when it is resolved. [Update report](/admin-api/reports/#update-report) describes when no notice is sent.--### Profile snapshot--Every report about a user, a guild, or a message an account sent also keeps a copy of the reported profile as it was at submission:+A Digital Services Act notice takes three calls, [Send DSA report email](#send-dsa-report-email), [Verify DSA report email](#verify-dsa-report-email) and [Create DSA report](#create-dsa-report), and the reporter gets a receipt email with the report ID when the notice is filed.-- The account's username, discriminator, display name, bio, pronouns, avatar, and banner.-- The account's guild nickname, bio, pronouns, join time, avatar, and banner, when the report names a guild the account is a member of.-- The guild's name, vanity URL code, icon, banner, and splash, for a report about a guild.--Fluxer copies each image into report storage. An image whose copy fails keeps only its hash, and the report is still filed. An account whose deletion has started is recorded by ID alone. Moderators read the snapshot as the [report profile snapshot object](/admin-api/reports/#report-profile-snapshot-object).+Fluxer keeps a copy of the reported content and profile when a report is filed, and editing or deleting the content afterwards doesn't change it.## Report flows-A report flow is the set of screens a reporter moves through before a report is filed. Fluxer serves one flow for each [target type](#report-flow-target-types). [Get report flow](#get-report-flow) returns every screen of it in one response, already translated, so a client renders the whole flow from that response and hard-codes no question.--### Screens--Each [screen](#report-flow-screen-object) is one of three kinds, told apart by the member that is set.+A report flow is the set of screens a reporter answers before a report is filed. [Get report flow](#get-report-flow) returns every screen of one flow, already translated, and a client renders the flow from that response.-| Kind | Member | What the reporter does |+| Screen kind | Field that is set | What the reporter does || --- | --- | --- |-| Choice | `options` | Picks one option. At least one option is not a link |-| Checklist | `checklist` | Ticks at least `min_checked` items, then continues |-| Info | `next_screen_id` | Reads the text and continues, optionally opening a link option first |--An option's [outcome](#report-flow-outcome-object) says what choosing it does. A checklist has one outcome for the whole screen. A screen with `urgent` set covers one of the most serious harms, such as threats, self-harm, sexual content, or a risk to a minor. A client shows an urgency notice on it and on the summary of every walk that passes through it.--### Surfaces--A flow has up to two variants, one for each [surface](#report-flow-surfaces). `in_app` is the variant a signed-in client shows. `dsa` is the variant the public Digital Services Act form shows before it calls [Create DSA report](#create-dsa-report).--The two variants share their screens and differ in a few options. Only `in_app` has the options that end on the thank-you screen without a report, the options for a reporter worried about someone's safety, and a copyright option that links to the copyright help page. Its user flow also starts with an info screen. On `dsa` the copyright option files a report instead. The `guild` flow exists on the `dsa` surface alone.--A self-hosted instance drops the copyright link. It keeps the crisis line, and keeps the guidelines links only when its operator has set a [guidelines URL](/http-api/instance/#public-legal-configuration-object). Without one its flow has a null `guidelines_url`. Its `in_app` revision hashes therefore differ from those of the hosted instance, and differ again between a self-hosted instance with a guidelines URL and one without. Its `dsa` revision hashes match the hosted ones.--### Walking a flow--A walk starts at `start_screen_id`. Each screen the reporter passes through adds one [step](#report-flow-step-object):+| Choice | `options` | Picks one option |+| Checklist | `checklist` | Ticks at least `min_checked` items and continues |+| Info | `next_screen_id` | Reads the text and continues |-- A choice screen records the chosen `option_id`.-- A checklist screen records the ticked `item_ids`.-- An info screen records its `screen_id` alone.--The walk follows `screen` outcomes and `next_screen_id` until an option or a checklist reaches a `submit` outcome. The client then shows a summary and submits every step in order. A `link` outcome opens its `url` and adds no step.--An `end` outcome finishes the walk without a report. The client shows the [notice](#report-flow-notice-object) it names, or a thank-you screen when it names none. Such a walk is never submitted, and Fluxer rejects a submission that contains one.--The report is filed under the `reason` of the final `submit` outcome. A few checklist items name a more specific reason of their own, which takes precedence, and the flow object does not expose it.--Fluxer checks a submitted walk against the current variant. The first step must be the start screen, each later step must be the screen the previous answer led to, every answer must exist on its screen, and the last answer must reach a `submit` outcome.+The reporter starts at `start_screen_id` and follows each [outcome](#report-flow-outcome-object) until one has the type `submit`, and this path is the walk. Each screen on the walk adds one [step](#report-flow-step-object) to the submission, and the report is filed under the `reason` of the final `submit` outcome. An `end` outcome finishes the walk without a report.### Revision hash-`revision_hash` identifies the structure of one variant: its screens, options, items, and outcomes. It does not depend on the locale or the product name, and it changes whenever a screen, option, item, or outcome changes. A submission sends back the hash of the flow the reporter answered.+`revision_hash` identifies the structure of one flow variant and changes whenever a screen, option, item or outcome changes. A submission sends back the hash of the flow the reporter answered.| Walk | Hash | Result || --- | --- | --- |-| Valid | Current | The report is filed |-| Valid | Outdated | The report is filed with the hash that was sent |+| Valid | Current or outdated | The report is filed || Invalid | Current | 400 `INVALID_REPORT_FLOW_ANSWERS` with `step_index` |-| Invalid | Outdated | 409 `REPORT_FLOW_OUTDATED` |--An option or item ID never changes meaning once it ships, so a valid walk from an outdated flow still means what the reporter saw. `step_index` is the zero-based index of the first step that does not fit the current flow. After `REPORT_FLOW_OUTDATED`, fetch the flow again and restart the walk.--### Locale--Fluxer renders the copy in one [supported locale](/topics/locales/#supported-locales). [Get report flow](#get-report-flow) uses its `locale` query parameter when one is sent, and the [negotiated](/topics/locales/#negotiation) request locale otherwise. The response `locale` names the locale used, and the copy names the instance's own product name.--Resolving a tag never fails. Matching ignores case and accepts underscores in place of hyphens, `nb` and `nn` resolve to `no`, and a bare language resolves to its preferred regional locale, so `pt` becomes `pt-BR`. A tag that matches nothing resolves to `en-US`.--A submission stores the locale the reporter saw, resolved the same way from its `locale` member, or the request locale when that member is omitted. The [Admin Reports API](/admin-api/reports/) describes a stored walk in English whatever that locale is.+| Invalid | Outdated | 409 `REPORT_FLOW_OUTDATED`, and the client fetches the flow again and restarts the walk |## Report flow object@@ -133,26 +42,22 @@ A submission stores the locale the reporter saw, resolved the same way from its| --- | --- | --- || target_type | string | [Report flow target type](#report-flow-target-types) || surface | string | [Report flow surface](#report-flow-surfaces) |-| revision_hash<sup>1</sup> | string | The [revision hash](#revision-hash) of this variant |+| revision_hash | string | The [revision hash](#revision-hash) of this variant (16 hexadecimal characters) || locale | string | The [locale](/topics/locales/) the copy was rendered in || start_screen_id | string | The ID of the screen a walk starts on |-| guidelines_url<sup>2</sup> | ?string | The instance's community guidelines page |+| guidelines_url | ?string | The instance's community guidelines page, or null when the instance has none || screens | array[[report flow screen](#report-flow-screen-object) object] | Every screen of the variant |-| notices | array[[report flow notice](#report-flow-notice-object) object] | Every notice an `end` outcome in the variant names |--<sup>1</sup> 16 lowercase hexadecimal characters--<sup>2</sup> The guidelines URL the operator set, or null without one. A client links its summary disclaimer to it+| notices | array[[report flow notice](#report-flow-notice-object) object] | Every notice an `end` outcome lists |### Example```json{"target_type": "user",- "surface": "in_app",+ "surface": "dsa","revision_hash": "9c41d2a07e5b18f3","locale": "en-US",- "start_screen_id": "profile_intro",+ "start_screen_id": "profile_parts","guidelines_url": "https://example.com/guidelines","screens": [{@@ -165,8 +70,7 @@ A submission stores the locale the reporter saw, resolved the same way from its"checklist": {"items": [{"id": "photo", "label": "Pictures", "description": "What they use as avatar and banner"},- {"id": "name", "label": "Names", "description": "Username, display name or community nickname"},- {"id": "profile_text", "label": "Profile text", "description": "Bio, custom status or pronouns"}+ {"id": "name", "label": "Names", "description": "Username, display name or community nickname"}],"min_checked": 1,"outcome": {"type": "screen", "screen_id": "root_user", "reason": null, "notice_id": null, "url": null}@@ -174,13 +78,7 @@ A submission stores the locale the reporter saw, resolved the same way from its"next_screen_id": null}],- "notices": [- {- "id": "need_more_info_profile",- "title": "We can't act on this yet",- "body": "To review this, we need to see where they say how old they are or make it clear they're under Fluxer's minimum age. Report that message or profile instead."- }- ]+ "notices": []}```@@ -192,9 +90,9 @@ A submission stores the locale the reporter saw, resolved the same way from its| --- | --- | --- || id | string | The screen ID, unique within the flow || title | string | The question or heading |-| subtitle | ?string | Supporting text shown under the title |-| urgent | boolean | Whether the screen covers one of the most serious harms |-| options<sup>1</sup> | array[[report flow option](#report-flow-option-object) object] | The options, in display order |+| subtitle | ?string | Text shown under the title |+| urgent | boolean | Whether the screen covers threats, self-harm, a risk to a minor or another serious harm, and needs an urgency notice |+| options | array[[report flow option](#report-flow-option-object) object] | The options in display order, empty on a checklist screen || options_heading | ?string | A heading shown above the options || checklist | ?[report flow checklist](#report-flow-checklist-object) object | The checklist, set only on a checklist screen || next_screen_id | ?string | The screen the Next button leads to, set only on an info screen |@@ -211,7 +109,7 @@ A submission stores the locale the reporter saw, resolved the same way from its## Report flow outcome object-Every member is always present. The members that do not apply to `type` are null.+Every field is present, and the ones that don't apply to `type` are null.### Structure@@ -219,7 +117,7 @@ Every member is always present. The members that do not apply to `type` are null| --- | --- | --- || type | string | [Report flow outcome type](#report-flow-outcome-types) || screen_id | ?string | The next screen when `type` is `screen` |-| reason<sup>1</sup> | ?string | The [report reason](#report-reasons) when `type` is `submit` |+| reason | ?string | The [report reason](#report-reasons) when `type` is `submit` || notice_id | ?string | The notice to show when `type` is `end`, or null for the thank-you screen || url | ?string | The page to open when `type` is `link` |@@ -229,9 +127,9 @@ Every member is always present. The members that do not apply to `type` are null| Field | Type | Description || --- | --- | --- |-| items | array[[report flow checklist item](#report-flow-checklist-item-object) object] | The items, in display order |-| min_checked | integer | The fewest items the reporter must tick before continuing |-| outcome | [report flow outcome](#report-flow-outcome-object) object | Where the screen leads, always a `screen` or `submit` outcome |+| items | array[[report flow checklist item](#report-flow-checklist-item-object) object] | The items in display order |+| min_checked | integer | The fewest items the reporter must tick |+| outcome | [report flow outcome](#report-flow-outcome-object) object | Where the screen leads, a `screen` or `submit` outcome |## Report flow checklist item object@@ -245,7 +143,7 @@ Every member is always present. The members that do not apply to `type` are null## Report flow notice object-A notice explains why a walk ended without a report, for example when a specific message has to be reported instead.+A notice says why a walk ended without a report.### Structure@@ -257,28 +155,15 @@ A notice explains why a walk ended without a report, for example when a specific## Report flow step object-One answered screen in a submission. A submission lists its steps in walk order.+A step is one answered screen in a submission. A choice screen's step sends `option_id`, a checklist screen's step sends `item_ids` and an info screen's step sends neither.### Structure| Field | Type | Description || --- | --- | --- || screen_id | string | The ID of the screen (1-48 characters) |-| option_id?<sup>1</sup> | string | The ID of the chosen option (1-48 characters) |-| item_ids?<sup>1</sup> | array[string] | The IDs of the ticked items, 1-32 unique IDs of 1-48 characters each |--<sup>1</sup> Sent on a choice screen and a checklist screen respectively. An info screen's step sends neither, and a step that sends the member its screen does not use is invalid--### Example--```json-[- {"screen_id": "profile_intro"},- {"screen_id": "profile_parts", "item_ids": ["photo"]},- {"screen_id": "root_user", "option_id": "abuse"},- {"screen_id": "profile_abuse", "option_id": "harassment"}-]-```+| option_id? | string | The ID of the chosen option (1-48 characters) |+| item_ids? | array[string] | The IDs of the ticked items (1-32 IDs of 1-48 characters) |## Report object@@ -286,23 +171,9 @@ One answered screen in a submission. A submission lists its steps in walk order.| Field | Type | Description || --- | --- | --- |-| report_id | snowflake | The [snowflake](/snowflakes/) identifying this report |-| status<sup>1</sup> | string | [Report status](#report-status-values) |-| reported_at<sup>2</sup> | ISO8601 timestamp | Time the report row was written |--<sup>1</sup> Always `pending`--<sup>2</sup> For a Digital Services Act notice, this is the time the notice was filed, even when its verification code was issued much earlier--### Example--```json-{- "report_id": "1501314428688998182",- "status": "pending",- "reported_at": "2026-08-04T11:22:19.000Z"-}-```+| report_id | snowflake | The ID of the report |+| status | string | [Report status](#report-status-values), always `pending` on a new report |+| reported_at | ISO8601 timestamp | When the report was filed |## Success object@@ -310,15 +181,7 @@ One answered screen in a submission. A submission lists its steps in walk order.| Field | Type | Description || --- | --- | --- |-| ok | boolean | Always true, because a failure is reported as an error status instead |--### Example--```json-{- "ok": true-}-```+| ok | boolean | Always true |## Ticket object@@ -326,145 +189,127 @@ One answered screen in a submission. A submission lists its steps in walk order.| Field | Type | Description || --- | --- | --- |-| ticket<sup>1</sup> | string | The opaque credential [Create DSA report](#create-dsa-report) consumes |--<sup>1</sup> 64 lowercase hexadecimal characters encoding 32 random bytes, valid for one hour from verification, and consumed by the first [Create DSA report](#create-dsa-report) that writes a notice with it--### Example--```json-{- "ticket": "6b1f0a92c73d4e58a0b1c2d3e4f5061728394a5b6c7d8e9f0a1b2c3d4e5f6071"-}-```+| ticket | string | The credential for [Create DSA report](#create-dsa-report), valid for one hour |## Report status values| Value | Description || --- | --- |-| pending | The report has been recorded and no moderator decision exists yet |-| resolved | A moderator has closed the report |-| unknown | The stored status is neither of the two values above |--Only `pending` and `resolved` are ever stored. A client MUST still tolerate a status it does not recognise.+| pending | No moderator has resolved the report |+| resolved | A moderator closed the report |+| unknown | A status this API version doesn't know |## Report flow target types| Value | Description || --- | --- |-| message | A message, on both surfaces |-| user | A user profile, on both surfaces |+| message | A message |+| user | A user profile || guild | A guild, on the `dsa` surface only |## Report flow surfaces| Value | Description || --- | --- |-| in_app | The flow a signed-in client shows, and the default |+| in_app | The flow a signed-in client shows (the default) || dsa | The flow the public Digital Services Act form shows |## Report flow outcome types| Value | Description || --- | --- |-| screen | Go to the screen named by `screen_id` |-| submit | Show the summary, then file a report under `reason` |-| end | Finish without a report and show the notice named by `notice_id`, or a thank-you screen |+| screen | Go to the screen in `screen_id` |+| submit | Show a summary, then file a report under `reason` |+| end | Finish without a report and show the notice in `notice_id`, or a thank-you screen || link | Open `url` and stay on the current screen |## Report reasons-A report filed through a flow stores a reason, together with the [category](#report-categories) that reason maps to for the report's target type. Moderators can filter on both. The catalogue grows over time, so a client MUST tolerate a reason it does not list.--The second column gives the reason value, then the category it stores on a message report, a user report, and a guild report, in that order.+A report filed through a flow stores one of these reasons. Each reason maps to a [category](#report-categories) for each target type, and [List report reasons](/admin-api/reports/#list-report-reasons) returns that mapping. Handle a reason value you don't know, because new reasons can appear.-| Reason | Value: message, user, guild category |+| Value | Description || --- | --- |-| Spam | `spam`: `spam`, `spam_account`, `spam` |-| Fake or deceptive account | `fake_account`: `spam`, `spam_account`, `spam` |-| Scraping, automation or other platform abuse | `platform_abuse`: `spam`, `spam_account`, `spam` |-| Buying or selling accounts, logins or card details | `account_trading`: `illegal_activity`, `spam_account`, `illegal_activity` |-| Faked member or reaction counts | `metric_manipulation`: `spam`, `spam_account`, `spam` |-| Harassment or bullying | `harassment`: `harassment`, `harassment`, `harassment` |-| Stalking or unwanted contact | `unwanted_contact`: `harassment`, `harassment`, `harassment` |-| Raid or coordinated attack | `raid`: `harassment`, `harassment`, `raid_coordination` |-| False claims used to target a person | `false_claims_about_person`: `harassment`, `harassment`, `harassment` |-| Slurs, hateful symbols or stereotypes | `hate_slurs`: `hate_speech`, `hate_speech`, `hate_speech` |-| Dehumanizing a group | `hate_dehumanizing`: `hate_speech`, `hate_speech`, `hate_speech` |-| Calls for violence or exclusion against a group<sup>1</sup> | `hate_incitement`: `hate_speech`, `hate_speech`, `hate_speech` |-| Genocide or atrocity denial or celebration | `atrocity_denial`: `hate_speech`, `hate_speech`, `hate_speech` |-| Misgendering, deadnaming, outing or identity denial | `lgbtq_targeting`: `hate_speech`, `hate_speech`, `hate_speech` |-| Promoting conversion therapy | `conversion_therapy`: `hate_speech`, `hate_speech`, `hate_speech` |-| Other attacks on people for who they are | `hate_other`: `hate_speech`, `hate_speech`, `hate_speech` |-| Threat of violence<sup>1</sup> | `violent_threat`: `violent_content`, `harassment`, `harassment` |-| Encouraging violence or instructions to harm<sup>1</sup> | `violence_incitement`: `violent_content`, `inappropriate_profile`, `violent_content` |-| Glorifying real-world violence | `violence_glorification`: `violent_content`, `inappropriate_profile`, `violent_content` |-| Real violence shown to shock | `graphic_violence`: `violent_content`, `inappropriate_profile`, `violent_content` |-| Terrorism or violent extremism | `terrorism_extremism`: `violent_content`, `inappropriate_profile`, `extremist_community` |-| False claims likely to cause serious harm | `harmful_false_claims`: `other`, `other`, `other` |-| Fake or AI media presented as real | `deceptive_synthetic_media`: `other`, `other`, `other` |-| Sexual images or messages nobody asked for | `sexual_unwanted`: `harassment`, `harassment`, `harassment` |-| Adult content outside an 18+ space | `adult_content_unmarked`: `nsfw_violation`, `inappropriate_profile`, `nsfw_violation` |-| Intimate images shared without consent<sup>1</sup> | `intimate_image_abuse`: `doxxing`, `inappropriate_profile`, `harassment` |-| Sexual exploitation, coercion or trafficking<sup>1</sup> | `sexual_exploitation`: `illegal_activity`, `inappropriate_profile`, `illegal_activity` |-| Sexualized fictional child<sup>1</sup> | `minor_fictional_sexualization`: `child_safety`, `child_safety`, `child_safety` |-| Sexual comments about minors<sup>1</sup> | `minor_sexualization`: `child_safety`, `child_safety`, `child_safety` |-| Flirting with or sexually messaging a minor<sup>1</sup> | `minor_sexual_contact`: `child_safety`, `child_safety`, `child_safety` |-| A minor sharing sexual content themselves<sup>1</sup> | `minor_sexual_content`: `child_safety`, `child_safety`, `child_safety` |-| Child sexual abuse material<sup>1</sup> | `csam`: `child_safety`, `child_safety`, `child_safety` |-| Grooming a minor<sup>1</sup> | `minor_grooming`: `child_safety`, `child_safety`, `child_safety` |-| Predatory contact with a minor<sup>1</sup> | `minor_contact`: `child_safety`, `child_safety`, `child_safety` |-| A minor in an 18+ space | `minor_in_adult_space`: `child_safety`, `child_safety`, `child_safety` |-| Community for dating between minors<sup>1</sup> | `minor_dating_community`: `child_safety`, `child_safety`, `child_safety` |-| Private information shared without consent | `doxxing`: `doxxing`, `inappropriate_profile`, `harassment` |-| Under the minimum age | `underage`: `underage_user`, `underage_user`, `underage_user` |-| Worried about someone's safety<sup>1</sup> | `wellbeing_concern`: `self_harm`, `other`, `self_harm` |-| Encouraging self-harm or sharing methods | `self_harm_promotion`: `self_harm`, `inappropriate_profile`, `self_harm` |-| Encouraging suicide | `suicide_promotion`: `self_harm`, `inappropriate_profile`, `self_harm` |-| Encouraging disordered eating | `eating_disorder_promotion`: `self_harm`, `inappropriate_profile`, `self_harm` |-| Graphic self-harm images | `self_harm_graphic`: `self_harm`, `inappropriate_profile`, `self_harm` |-| Pressuring someone to harm themselves | `self_harm_pressure`: `self_harm`, `inappropriate_profile`, `self_harm` |-| Pretending to be staff or support | `impersonation_staff`: `impersonation`, `impersonation`, `impersonation` |-| Impersonating a person | `impersonation_person`: `impersonation`, `impersonation`, `impersonation` |-| Impersonating a well-known person | `impersonation_public_figure`: `impersonation`, `impersonation`, `impersonation` |-| Impersonating a company, brand or group | `impersonation_organization`: `impersonation`, `impersonation`, `impersonation` |-| Conning people out of money or accounts | `fraud`: `illegal_activity`, `spam_account`, `illegal_activity` |-| Drug, weapon or other illegal sales | `illegal_goods`: `illegal_activity`, `inappropriate_profile`, `illegal_activity` |-| Other illegal activity | `illegal_activity`: `illegal_activity`, `inappropriate_profile`, `illegal_activity` |-| Phishing, malware or hacking attempts | `malware_phishing`: `malicious_links`, `spam_account`, `malware_distribution` |-| Getting around a ban | `ban_evasion`: `other`, `other`, `other` |-| Community allows serious rule-breaking | `permits_violations`: `other`, `other`, `other` |-| Copyright or trademark complaint | `copyright`: `other`, `other`, `other` |-| Something not listed | `other`: `other`, `other`, `other` |--<sup>1</sup> Highest priority, so moderators see a report with this reason first+| spam | Spam |+| fake_account | Fake or deceptive account |+| platform_abuse | Scraping, automation or other platform abuse |+| account_trading | Buying or selling accounts, logins or card details |+| metric_manipulation | Faked member or reaction counts |+| harassment | Harassment or bullying |+| unwanted_contact | Stalking or unwanted contact |+| raid | Raid or coordinated attack |+| false_claims_about_person | False claims used to target a person |+| hate_slurs | Slurs, hateful symbols or stereotypes |+| hate_dehumanizing | Dehumanizing a group |+| hate_incitement | Calls for violence or exclusion against a group |+| atrocity_denial | Genocide or atrocity denial or celebration |+| lgbtq_targeting | Misgendering, deadnaming, outing or identity denial |+| conversion_therapy | Promoting conversion therapy |+| hate_other | Other attacks on people for who they are |+| violent_threat | Threat of violence |+| violence_incitement | Encouraging violence or instructions to harm |+| violence_glorification | Glorifying real-world violence |+| graphic_violence | Real violence shown to shock |+| terrorism_extremism | Terrorism or violent extremism |+| harmful_false_claims | False claims likely to cause serious harm |+| deceptive_synthetic_media | Fake or AI media presented as real |+| sexual_unwanted | Sexual images or messages nobody asked for |+| adult_content_unmarked | Adult content outside an 18+ space |+| intimate_image_abuse | Intimate images shared without consent |+| sexual_exploitation | Sexual exploitation, coercion or trafficking |+| minor_fictional_sexualization | Sexualized fictional child |+| minor_sexualization | Sexual comments about minors |+| minor_sexual_contact | Flirting with or sexually messaging a minor |+| minor_sexual_content | A minor sharing sexual content themselves |+| csam | Child sexual abuse material |+| minor_grooming | Grooming a minor |+| minor_contact | Predatory contact with a minor |+| minor_in_adult_space | A minor in an 18+ space |+| minor_dating_community | Community for dating between minors |+| doxxing | Private information shared without consent |+| underage | Under the minimum age |+| wellbeing_concern | Worried about someone's safety |+| self_harm_promotion | Encouraging self-harm or sharing methods |+| suicide_promotion | Encouraging suicide |+| eating_disorder_promotion | Encouraging disordered eating |+| self_harm_graphic | Graphic self-harm images |+| self_harm_pressure | Pressuring someone to harm themselves |+| impersonation_staff | Pretending to be staff or support |+| impersonation_person | Impersonating a person |+| impersonation_public_figure | Impersonating a well-known person |+| impersonation_organization | Impersonating a company, brand or group |+| fraud | Conning people out of money or accounts |+| illegal_goods | Drug, weapon or other illegal sales |+| illegal_activity | Other illegal activity |+| malware_phishing | Phishing, malware or hacking attempts |+| ban_evasion | Getting around a ban |+| permits_violations | Community allows serious rule-breaking |+| copyright | Copyright or trademark complaint |+| other | Something not listed |## Report categories-Every report stores one category from this registry. A report filed through a flow stores the category its [reason](#report-reasons) maps to for the target type.+Every report stores one of these categories.| Value | Description || --- | --- |-| harassment | Harassment, bullying, or intimidation |+| harassment | Harassment, bullying or intimidation || hate_speech | Hatred against protected groups |-| violent_content | Content depicting or promoting violence |+| violent_content | Content showing or promoting violence || extremist_community | A guild promoting extremist or terrorist ideologies || raid_coordination | A guild coordinating attacks on other communities || spam | Unsolicited bulk messages or promotional content |-| spam_account | An account used for spamming or bulk messaging |-| nsfw_violation | Adult content posted outside age-restricted channels |+| spam_account | An account used for spamming |+| nsfw_violation | Adult content outside age-restricted channels || inappropriate_profile | Inappropriate or offensive profile content || illegal_activity | Content promoting or facilitating illegal activities || doxxing | Content revealing private personal information || self_harm | Content promoting self-harm or suicide |-| child_safety | Content that endangers minors or depicts child abuse |-| underage_user | Someone who appears to be under the minimum required age |-| malicious_links | Links to malware, phishing, or other malicious sites |-| malware_distribution | Distribution of malware or malicious software |+| child_safety | Content that endangers minors or shows child abuse |+| underage_user | Someone who appears to be under the minimum age |+| malicious_links | Links to malware, phishing or other malicious sites |+| malware_distribution | Distribution of malware || impersonation | Falsely claiming to be another person or entity |-| other | Anything the other categories do not cover |--A user report only ever stores `harassment`, `hate_speech`, `spam_account`, `impersonation`, `underage_user`, `inappropriate_profile`, `child_safety`, or `other`.+| other | Anything the other categories don't cover |## EU country codes@@ -502,277 +347,142 @@ A user report only ever stores `harassment`, `hate_speech`, `spam_account`, `imp<RouteHeader method="GET" path="/v1/reports/flows/{target_type}" unauthenticated />-Returns the [report flow object](#report-flow-object) for one target type and surface, with its copy rendered in one locale.--The response has `Cache-Control: private, no-cache` and `Vary: Accept-Language`. A client can keep the flow for a session, and `no-cache` makes the refetch after 409 `REPORT_FLOW_OUTDATED` reach Fluxer instead of a stored copy.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| target_type | string | [Report flow target type](#report-flow-target-types) |+Returns the [report flow object](#report-flow-object) for one [target type](#report-flow-target-types) and surface, translated into one locale.### Query parameters| Field | Type | Description || --- | --- | --- || surface? | string | [Report flow surface](#report-flow-surfaces) (default `in_app`) |-| locale?<sup>1</sup> | string | The language tag of the client UI (1-35 characters) |--<sup>1</sup> Resolved as [Locale](#locale) describes, and the request locale is used when it is omitted. A client SHOULD send it, because the language of its UI can differ from the account's saved locale+| locale? | string | The language tag to translate into (1-35 characters), defaulting to the [request locale](/topics/locales/#negotiation) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [report flow](#report-flow-object) object | The flow was rendered |-| 400 | [error response](/http-api/#error-response) | The target type or surface is unknown and the request returns `INVALID_FORM_BODY` |-| 400 | [error response](/http-api/#error-response) | `guild` was requested on a surface other than `dsa` and the request returns `INVALID_FORM_BODY` |--### Rate limit+| 200 | [report flow](#report-flow-object) object | The flow was returned |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` for an unknown target type or surface, or `guild` outside the `dsa` surface |-40 requests per 10 seconds, on the `report:list` bucket.--<a id="report-message"></a>+The rate limit is 40 requests per 10 seconds, on the `report:list` bucket.## Submit message report flow<RouteHeader method="POST" path="/v1/reports/flows/message/submissions" />-Files a report about a message from the reporter's answers to the `message` flow on the `in_app` surface, and returns a [report object](#report-object). The reporter must be able to read the message.--A message a bot sent is reported as the bot account, like any other account. A message a [webhook](/http-api/webhooks/) sent has no author account, so the report records the webhook instead, with the name and avatar the message was sent with.--### Limitations--- The reporter must be able to open the containing channel and read the message.-- A reporter who authored the message receives 400 `CANNOT_REPORT_OWN_MESSAGE`.-- A channel that does not exist and a direct message the reporter is not a recipient of both return 404 `UNKNOWN_CHANNEL`.-- A guild channel the reporter is not a member of returns 403 `ACCESS_DENIED`, and a member without [VIEW_CHANNEL](/http-api/permissions/) receives 403 `MISSING_PERMISSIONS`.-- A thread the reporter cannot view returns 403 `MISSING_ACCESS`, as [Channel resolution](/http-api/messages/#channel-resolution) describes. A thread, a forum channel, or a media channel returns 404 `UNKNOWN_CHANNEL` to a user request without the [`channel_threads` client capability](/http-api/threads/#client-capability).-- An age-restricted guild channel returns 403 `NSFW_CONTENT_AGE_RESTRICTED` for an account that is not age verified.-- A message not stored under `channel_id`, a message with neither an author account nor a webhook, and any message a reporter without [READ_MESSAGE_HISTORY](/http-api/permissions/) cannot reach all return 404 `UNKNOWN_MESSAGE`.-- An author whose account no longer exists returns 404 `UNKNOWN_USER`.--Fluxer checks the answers right after the claimed account and verified email checks, before the report ban check and before it reads the channel. An invalid walk still counts against the `report:create` bucket but uses none of the further allowances below.--:::note[Reporting without Read Message History]-A reporter without `READ_MESSAGE_HISTORY` can report a message sent at or after the earlier of two points: the guild's message history cutoff and the time the reporter joined the guild. Every message since the join reached the reporter live, so a guild that sets no cutoff still leaves those messages reportable. This window applies to reports only, and message history reads keep their own rules.-:::+Files a report about a message from the reporter's answers to the `in_app` message flow and returns a [report object](#report-object). It needs a user session token, and the reporter must be able to read the message.### JSON body| Field | Type | Description || --- | --- | --- |-| channel_id | snowflake | The ID of the channel containing the reported message |+| channel_id | snowflake | The ID of the channel the message is in || message_id | snowflake | The ID of the reported message |-| revision_hash | string | The `revision_hash` of the flow the reporter answered (1-64 characters) |+| revision_hash | string | The [revision hash](#revision-hash) of the flow the reporter answered (1-64 characters) || steps | array[[report flow step](#report-flow-step-object) object] | The answered screens in walk order (1-16 steps) |-| locale?<sup>1</sup> | string | The language tag the reporter saw the flow in (1-35 characters) |--<sup>1</sup> Stored with the report after it is resolved as [Locale](#locale) describes. The request locale is stored when it is omitted+| locale? | string | The language tag the reporter saw the flow in (1-35 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [report](#report-object) object | Report was created |-| 400 | [error response](/http-api/#error-response) | The answers do not fit the current flow and the request returns `INVALID_REPORT_FLOW_ANSWERS` |-| 400 | [error response](/http-api/#error-response) | The account is unclaimed and the request returns `UNCLAIMED_ACCOUNT_CANNOT_SUBMIT_REPORTS` |-| 400 | [error response](/http-api/#error-response) | The reporter is the message author and the request returns `CANNOT_REPORT_OWN_MESSAGE` |-| 403 | [error response](/http-api/#error-response) | A body string is blocked and the request returns `CONTENT_BLOCKED` |-| 403 | [error response](/http-api/#error-response) | The credential is a bot token or OAuth2 bearer and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The reporter is not a member of the guild and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | Its email is unverified and the request returns `REPORT_EMAIL_VERIFICATION_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | The account is report banned and the request returns `REPORT_BANNED` |-| 403 | [error response](/http-api/#error-response) | The reporter lacks `VIEW_CHANNEL` and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The reporter cannot view the thread and the request returns `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The channel is age restricted and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | The channel, the message, or the message author is not visible to the reporter |-| 409 | [error response](/http-api/#error-response) | The answers came from an outdated flow and do not fit the current one, returning `REPORT_FLOW_OUTDATED` |-| 409<sup>1</sup> | [error response](/http-api/#error-response) | The reporter already reported this message, returning `CONFLICT` |--<sup>1</sup> The reporter, the channel, and the message form a submission key that expires 365 days after the report. A second report of the same message by the same reporter within that time is refused whichever answers it sends. A submission that fails or is rate limited releases the key, and so does [deleting the report](/admin-api/reports/#delete-report)--### Side effects--The operation writes one report with a frozen evidence snapshot. The snapshot records the reporter's account ID, the message author's identity and avatar hash, the channel and guild identity, and the guild and channel NSFW and content warning state. For a message a webhook sent it records the webhook's ID and the name and avatar hash the message was sent with in place of the author. It also records the webhook's own name, avatar hash, type, channel, guild, and creation time, and the ID, username, discriminator, display name, and avatar hash of the account that created the webhook. Only the creator ID is recorded when that account has been deleted. The creator is recorded for moderators and is not the reported account. The report also stores the reason, its category, the steps, the revision hash, and the resolved locale.--For a message an account sent, the report also keeps a [profile snapshot](#profile-snapshot) of the author, with the author's guild profile when the channel is in a guild.--The snapshot also records a conversation window of up to 25 messages before the reported message, the reported message itself, and up to 25 messages after it. Each context message records its author identity, content, timestamps, type, flags, mentions, embeds, and sticker items, and each attachment is copied byte for byte. A message a webhook sent is recorded under its webhook. A context message whose author account no longer exists stays in the window under a deleted user identity that keeps the author ID. An attachment whose copy fails, and an embedded file that is no longer stored, is listed as missing on its context message with its metadata, and the request still succeeds. When the reporter lacks `READ_MESSAGE_HISTORY`, the window holds only messages created at or after the earlier of the guild's message history cutoff and the time the reporter joined the guild.--### Rate limit--10 requests per hour, on the `report:create` bucket, which is shared with [Submit user report flow](#submit-user-report-flow).--Further allowances apply, each counted over one hour:--- One reporter creates at most 5 reports across all report types.-- One reporter creates at most 3 message reports in one channel.-- One message receives at most 20 reports across all reporters.-- When the reported message is in a guild, one reporter creates at most 4 message reports in that guild.--A duplicate submission returns 409 `CONFLICT` before any of them is consumed.--<a id="report-user"></a>+| 200 | [report](#report-object) object | The report was filed |+| 400 | [error response](/http-api/#error-response) | `INVALID_REPORT_FLOW_ANSWERS` when the answers don't fit the current flow |+| 400 | [error response](/http-api/#error-response) | `UNCLAIMED_ACCOUNT_CANNOT_SUBMIT_REPORTS` for an unclaimed account while `interaction_tier` is `legacy` |+| 400 | [error response](/http-api/#error-response) | `CANNOT_REPORT_OWN_MESSAGE` when the reporter wrote the message |+| 403 | [error response](/http-api/#error-response) | `REPORT_EMAIL_VERIFICATION_REQUIRED` for an unverified email while `interaction_tier` is `legacy` |+| 403 | [error response](/http-api/#error-response) | `REPORT_BANNED` when the account is banned from reporting |+| 403 | [error response](/http-api/#error-response) | `MISSING_PERMISSIONS` when the reporter can't view the channel |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_CHANNEL` or `UNKNOWN_MESSAGE` when the reporter can't see the channel or message |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_USER` when the author's account no longer exists |+| 409 | [error response](/http-api/#error-response) | `REPORT_FLOW_OUTDATED` when the answers came from an outdated flow |+| 409 | [error response](/http-api/#error-response) | `CONFLICT` when the reporter reported this message in the last 365 days |++The rate limit is 10 requests per hour, on the `report:create` bucket. One reporter can file at most 5 reports an hour across the report routes, and [Rate limits](/topics/rate-limits/#limits-that-return-429) lists the lower limits for one channel, guild or message. When [`interaction_tier`](/http-api/users/#account-tiers) is `enforced`, an account that isn't verified can still report, up to 5 reports a day for the account and 10 a day from one IP address.## Submit user report flow<RouteHeader method="POST" path="/v1/reports/flows/user/submissions" />-Files a report about another user's profile from the reporter's answers to the `user` flow on the `in_app` surface, and returns a [report object](#report-object). The report can name the guild the reporter saw the profile in.--### Limitations--- A reporter naming their own account receives 400 `CANNOT_REPORT_YOURSELF`.-- A `user_id` that resolves to no account, or to the system account, returns 404 `UNKNOWN_USER`.-- A `guild_id` that resolves to no guild, or to a guild the reporter is not a member of, returns 404 `UNKNOWN_GUILD`.--Fluxer checks the answers right after the claimed account and verified email checks, before the report ban check and before it looks up the user. An invalid walk still counts against the `report:create` bucket but not against the per-reporter allowance below.+Files a report about a user's profile from the reporter's answers to the `in_app` user flow and returns a [report object](#report-object). It needs a user session token.### JSON body| Field | Type | Description || --- | --- | --- || user_id | snowflake | The ID of the reported user |-| guild_id? | snowflake | The ID of the guild in which the reporter saw the profile |-| revision_hash | string | The `revision_hash` of the flow the reporter answered (1-64 characters) |+| guild_id? | snowflake | The ID of the guild the reporter saw the profile in |+| revision_hash | string | The [revision hash](#revision-hash) of the flow the reporter answered (1-64 characters) || steps | array[[report flow step](#report-flow-step-object) object] | The answered screens in walk order (1-16 steps) |-| locale?<sup>1</sup> | string | The language tag the reporter saw the flow in (1-35 characters) |--<sup>1</sup> Stored with the report after it is resolved as [Locale](#locale) describes. The request locale is stored when it is omitted+| locale? | string | The language tag the reporter saw the flow in (1-35 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [report](#report-object) object | Report was created |-| 400 | [error response](/http-api/#error-response) | The answers do not fit the current flow and the request returns `INVALID_REPORT_FLOW_ANSWERS` |-| 400 | [error response](/http-api/#error-response) | The account is unclaimed and the request returns `UNCLAIMED_ACCOUNT_CANNOT_SUBMIT_REPORTS` |-| 400 | [error response](/http-api/#error-response) | The reporter is the reported user and the request returns `CANNOT_REPORT_YOURSELF` |-| 403 | [error response](/http-api/#error-response) | A body string is blocked and the request returns `CONTENT_BLOCKED` |-| 403 | [error response](/http-api/#error-response) | The credential is a bot token or OAuth2 bearer and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | Its email is unverified and the request returns `REPORT_EMAIL_VERIFICATION_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | The account is report banned and the request returns `REPORT_BANNED` |-| 404 | [error response](/http-api/#error-response) | The reported user does not exist or is the system account, and the request returns `UNKNOWN_USER` |-| 404 | [error response](/http-api/#error-response) | The supplied `guild_id` is not a guild the reporter is in and the request returns `UNKNOWN_GUILD` |-| 409 | [error response](/http-api/#error-response) | The answers came from an outdated flow and do not fit the current one, returning `REPORT_FLOW_OUTDATED` |-| 409<sup>1</sup> | [error response](/http-api/#error-response) | The reporter already reported this user within 24 hours, returning `CONFLICT` |--<sup>1</sup> The reporter and the reported user form a submission key that expires 24 hours after the report. A submission that fails or is rate limited releases the key, and so does [deleting the report](/admin-api/reports/#delete-report)--### Side effects--The operation writes one report. It records the reporter's account ID, and the reported user's ID and avatar hash. A supplied `guild_id` adds the guild's ID, name, icon hash, NSFW flag, and content warning state. The report also stores the reason, its category, the steps, the revision hash, and the resolved locale. The steps name the profile parts the reporter selected, and the report keeps a [profile snapshot](#profile-snapshot) of the account, with its guild profile when `guild_id` is supplied. No message evidence is captured.--### Rate limit--10 requests per hour, on the `report:create` bucket, which is shared with [Submit message report flow](#submit-message-report-flow).--One reporter creates at most 5 reports each hour across all report types. Fluxer checks that allowance right after the report ban check and before it looks up the user, so a reporter who has used it up receives 429 even for a duplicate. Otherwise a duplicate submission returns 409 `CONFLICT` without consuming it.+| 200 | [report](#report-object) object | The report was filed |+| 400 | [error response](/http-api/#error-response) | `INVALID_REPORT_FLOW_ANSWERS` when the answers don't fit the current flow |+| 400 | [error response](/http-api/#error-response) | `UNCLAIMED_ACCOUNT_CANNOT_SUBMIT_REPORTS` for an unclaimed account while `interaction_tier` is `legacy` |+| 400 | [error response](/http-api/#error-response) | `CANNOT_REPORT_YOURSELF` when the report is about the reporter's own account |+| 403 | [error response](/http-api/#error-response) | `REPORT_EMAIL_VERIFICATION_REQUIRED` for an unverified email while `interaction_tier` is `legacy` |+| 403 | [error response](/http-api/#error-response) | `REPORT_BANNED` when the account is banned from reporting |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_USER` when `user_id` isn't an account, or is the system account |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_GUILD` when `guild_id` isn't a guild the reporter is in |+| 409 | [error response](/http-api/#error-response) | `REPORT_FLOW_OUTDATED` when the answers came from an outdated flow |+| 409 | [error response](/http-api/#error-response) | `CONFLICT` when the reporter reported this user in the last 24 hours |++The rate limit is 10 requests per hour, on the `report:create` bucket. One reporter can file at most 5 reports an hour across the report routes. When [`interaction_tier`](/http-api/users/#account-tiers) is `enforced`, an account that isn't verified can still report, up to 5 reports a day for the account and 10 a day from one IP address.## Send DSA report email<RouteHeader method="POST" path="/v1/reports/dsa/email/send" unauthenticated />-Issues a Digital Services Act verification code for an email address and returns a [success object](#success-object).--An instance where members sign in with a username sends no email, and returns 400 `EMAIL_UNAVAILABLE_ON_INSTANCE` before it issues a code.--The address must be deliverable. A domain with no MX, A, or AAAA record returns 400 `INVALID_FORM_BODY` with `EMAIL_DOMAIN_CANNOT_RECEIVE_MAIL` on `email`. A temporary DNS failure does not reject the address.+Sends a Digital Services Act verification code to an email address and returns a [success object](#success-object). The code expires after 10 minutes, and one address can get one code per minute and 3 per hour.### JSON body| Field | Type | Description || --- | --- | --- |-| email<sup>1</sup> | string | The address that receives the verification code (1-254 characters) |--<sup>1</sup> Trimmed and lowercased before use, so two spellings that differ only in case address the same verification record+| email | string | The address that gets the code (1-254 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200<sup>1</sup> | [success](#success-object) object | The code was generated and handed to the email provider |-| 400 | [error response](/http-api/#error-response) | The address failed validation and the request returns `INVALID_FORM_BODY` |-| 400 | [error response](/http-api/#error-response) | The domain publishes no usable mail DNS record and the request returns `INVALID_FORM_BODY` |-| 429 | [error response](/http-api/#error-response) | The address was sent a code in the last minute, or used its 3 sends this hour |-| 503 | [error response](/http-api/#error-response) | The email could not be sent and the request returns `SERVICE_UNAVAILABLE` |--<sup>1</sup> Also returned on an instance with email delivery switched off, where no email leaves the instance--### Side effects--The code expires after 10 minutes. Codes use uppercase letters and digits in `XXXX-XXXX` form.--A new code can go to the same address once a minute has passed since the last one, or once that code has expired. It replaces the previous code and restarts the 10 minute window. A request within the minute returns 429 with `retry_after` and leaves the code already sent usable.+| 200 | [success](#success-object) object | The code was sent |+| 400 | [error response](/http-api/#error-response) | `EMAIL_UNAVAILABLE_ON_INSTANCE` when the instance uses username sign-in |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` when the address is invalid or its domain can't receive mail |+| 503 | [error response](/http-api/#error-response) | `SERVICE_UNAVAILABLE` when the email couldn't be sent |-When the provider refuses the message, or the address is recorded as a hard bounce, Fluxer keeps no code for the address, so a code sent to it earlier stops working too, and returns 503 `SERVICE_UNAVAILABLE`. That attempt still counts towards the 3 sends an address gets each hour.--The operation creates no ticket and emits no Gateway Dispatch.--### Rate limit--5 requests per hour, on the `dsa:report:email:send` bucket.--One address gets at most 3 sends each hour, and at most one each minute while its last code is unexpired. The minute check runs first, so a request it refuses does not count towards the hourly 3. Both return 429 `RATE_LIMITED` with `retry_after`.+The rate limit is 5 requests per hour, on the `dsa:report:email:send` bucket.## Verify DSA report email<RouteHeader method="POST" path="/v1/reports/dsa/email/verify" unauthenticated />-Consumes a verification code and returns the [ticket object](#ticket-object) that [Create DSA report](#create-dsa-report) requires. An instance where members sign in with a username returns 400 `EMAIL_UNAVAILABLE_ON_INSTANCE`.+Exchanges a verification code for a [ticket object](#ticket-object). Each address gets 5 attempts in 10 minutes, and a sixth attempt deletes the code until you send a new one.### JSON body| Field | Type | Description || --- | --- | --- |-| email<sup>1</sup> | string | The address that received the verification code (1-254 characters) |-| code | string | The nine-character code in `XXXX-XXXX` form, using uppercase letters and digits |--<sup>1</sup> Trimmed and lowercased before the verification record is looked up, exactly as [Send DSA report email](#send-dsa-report-email) normalises it+| email | string | The address that got the code (1-254 characters) |+| code | string | The code in `XXXX-XXXX` form |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [ticket](#ticket-object) object | The code matched the unexpired verification record for the address |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The address or code failed validation, or no unexpired record matches, returning `INVALID_DSA_VERIFICATION_CODE` |+| 200 | [ticket](#ticket-object) object | The code matched |+| 400 | [error response](/http-api/#error-response) | `INVALID_DSA_VERIFICATION_CODE` when the code is wrong or expired, or attempts ran out |+| 400 | [error response](/http-api/#error-response) | `EMAIL_UNAVAILABLE_ON_INSTANCE` when the instance uses username sign-in |-<sup>1</sup> An address with no verification record, an expired record, a wrong code, and an attempt over the per-address limit all produce the same error code. A malformed address or code fails schema validation and returns 400 `INVALID_FORM_BODY`.--### Side effects--The operation deletes the verification record and writes one ticket that expires one hour later. A wrong code leaves the outstanding code usable until it expires or the address reaches the attempt limit below. The operation emits no Gateway Dispatch.--Each address has 5 verification attempts in 10 minutes, counted across letter case, and right and wrong codes both count. The attempt over that limit deletes the outstanding code and returns 400 `INVALID_DSA_VERIFICATION_CODE`. Sending a new code starts a new count.--### Rate limit--10 requests per hour, on the `dsa:report:email:verify` bucket.---<a id="report-guild"></a>+The rate limit is 10 requests per hour, on the `dsa:report:email:verify` bucket.## Create DSA report<RouteHeader method="POST" path="/v1/reports/dsa" unauthenticated />-Consumes a ticket, files the notice from the reporter's answers to the flow on the `dsa` surface, and returns a [report object](#report-object). This is the only way to report a guild.--Fetch the flow with [Get report flow](#get-report-flow) and `surface=dsa` for the target type the notice is about, walk it as [Walking a flow](#walking-a-flow) describes, and send the steps with the details below. `report_type` selects which target fields the body has.--A ticket that is unknown or past its one hour expiry returns 400 `INVALID_DSA_TICKET` before the answers are checked. The ticket is consumed when the notice is written, so a notice that is rejected or rate limited leaves it usable. Nothing deduplicates a repeat notice.--| Article 16(2) | Fields |-| --- | --- |-| (a) An explanation of the problem | `additional_info` |-| (b) The exact location of the content | `message_link`, `user_id`, `user_tag`, `guild_id`, `invite_code` |-| (c) The name and email address of the reporter | `reporter_full_legal_name`, `ticket` |-| (d) A statement of good faith | `good_faith_confirmed` |--A notice whose walk resolves to the `child_safety` [category](#report-categories) may omit the legal name, as Article 16(2)(c) allows for child sexual abuse material. Every other notice needs one, and Fluxer checks this after it resolves the walk.+Files a Digital Services Act notice about a message, user or guild and returns a [report object](#report-object). This is the only way to report a guild. Walk the flow with `surface=dsa` and send the fields for your `report_type`. The ticket is used up only when the notice is filed.### JSON body@@ -780,84 +490,53 @@ A notice whose walk resolves to the `child_safety` [category](#report-categories| Field | Type | Description || --- | --- | --- |-| ticket | string | The ticket returned by [Verify DSA report email](#verify-dsa-report-email) (1-128 characters) |-| report_type | string | The discriminator selecting the variant, one of `message`, `user`, or `guild` |-| revision_hash | string | The `revision_hash` of the `dsa` flow the reporter answered (1-64 characters) |+| ticket | string | The ticket from [Verify DSA report email](#verify-dsa-report-email) (1-128 characters) |+| report_type | string | The [target type](#report-flow-target-types) of the notice |+| revision_hash | string | The [revision hash](#revision-hash) of the `dsa` flow the reporter answered (1-64 characters) || steps | array[[report flow step](#report-flow-step-object) object] | The answered screens in walk order (1-16 steps) |-| additional_info<sup>1</sup> | string | The reporter's explanation of the problem (1-1000 characters) |-| good_faith_confirmed | boolean | Always `true`, confirming the notice is accurate and complete to the reporter's knowledge |-| reporter_full_legal_name?<sup>2</sup> | string | The full legal name of the person filing the notice (1-160 characters) |-| reporter_country_of_residence | string | [EU country code](#eu-country-codes) of the reporter's residence |-| locale?<sup>3</sup> | string | The language tag the reporter saw the flow in (1-35 characters) |--<sup>1</sup> A value that is empty or only whitespace returns 400 `INVALID_FORM_BODY`. When the reporter believes the content is illegal, the explanation says which law it breaks and why--<sup>2</sup> Required unless the walk resolves to the `child_safety` category. A missing name otherwise returns 400 `INVALID_FORM_BODY` on `reporter_full_legal_name`+| additional_info | string | The reporter's explanation of the problem (1-1000 characters) |+| good_faith_confirmed | boolean | Must be `true`, confirming the notice is accurate and complete |+| reporter_full_legal_name?<sup>1</sup> | string | The reporter's full legal name (1-160 characters) |+| reporter_country_of_residence | string | The reporter's [EU country code](#eu-country-codes) |+| locale? | string | The language tag the reporter saw the flow in (1-35 characters) |-<sup>3</sup> Stored with the notice after it is resolved as [Locale](#locale) describes. The request locale is stored when it is omitted+<sup>1</sup> Required unless the walk ends in the `child_safety` category#### Message fields| Field | Type | Description || --- | --- | --- || message_link<sup>1</sup> | string | The link to the reported message (1-2048 characters) |-| reported_user_tag?<sup>2</sup> | string | The message author's tag in `username#1234` form, or the bare username on an instance without user tags (1-37 characters) |+| reported_user_tag? | string | The author's tag in `username#1234` form, or the username (1-37 characters) |-<sup>1</sup> Parsed as an absolute URL whose path is `/channels/<guild_id>/<channel_id>/<message_id>`, with `@me` in place of the guild ID for a direct message or group DM. Fluxer ignores the origin--<sup>2</sup> When supplied it must be the tag of the account that authored the linked message. A message a webhook sent has no author account, so no tag matches it--The link must name a message that exists, in the channel it names, and in the guild that channel belongs to. Every link or tag that does not resolve returns the same 404 `UNKNOWN_MESSAGE`, and the ticket stays usable. That covers a value that is not an absolute URL, a path with fewer than four segments, a first segment other than `channels`, a channel or message segment that is not a decimal snowflake, and a guild segment that does not match the channel. It also covers a missing channel or message, a message stored in another channel, a message whose author account no longer exists, and a tag that does not match the author.+<sup>1</sup> An absolute URL with the path `/channels/{guild_id}/{channel_id}/{message_id}`, with `@me` in place of the guild ID for a direct message#### User fields| Field | Type | Description || --- | --- | --- || user_id?<sup>1</sup> | snowflake | The ID of the reported user |-| user_tag?<sup>1</sup> | string | The reported user's tag in `username#1234` form, or the bare username on an instance without user tags (1-37 characters) |+| user_tag?<sup>1</sup> | string | The user's tag in `username#1234` form, or the username (1-37 characters) |-<sup>1</sup> Supply at least one of the two. A body that supplies neither returns 400 `INVALID_FORM_BODY`, and an ID or tag that resolves to no account returns 404 `UNKNOWN_USER`--When both are supplied they must resolve to the same account. A mismatch returns 400 `INVALID_DSA_REPORT_TARGET`.+<sup>1</sup> Send at least one, and when you send both they must be the same account#### Guild fields| Field | Type | Description || --- | --- | --- || guild_id | snowflake | The ID of the reported guild |-| invite_code?<sup>1</sup> | string | [Invite](/http-api/invites/) code or invite URL for the reported guild (1-64 characters) |--<sup>1</sup> This variant checks no access to the guild, so the code is never required. When supplied it is reduced to its final `/` separated segment, and a complete invite URL is accepted--An unknown code returns 404 `UNKNOWN_INVITE`. A code that resolves to an invite of another type, or to an invite for another guild, returns 400 `INVALID_DSA_REPORT_TARGET`.+| invite_code? | string | An [invite](/http-api/invites/) code or URL for the guild (1-64 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [report](#report-object) object | The notice was recorded |-| 400 | [error response](/http-api/#error-response) | The ticket is unknown or expired and the request returns `INVALID_DSA_TICKET` |-| 400 | [error response](/http-api/#error-response) | A user ID and tag name different accounts, and the request returns `INVALID_DSA_REPORT_TARGET` |-| 400 | [error response](/http-api/#error-response) | A user tag is malformed and the request returns `INVALID_DSA_REPORT_TARGET` |-| 400 | [error response](/http-api/#error-response) | The invite code belongs to another guild or type and the request returns `INVALID_DSA_REPORT_TARGET` |-| 400 | [error response](/http-api/#error-response) | The answers do not fit the current `dsa` flow and the request returns `INVALID_REPORT_FLOW_ANSWERS` |-| 400 | [error response](/http-api/#error-response) | A required field is missing or malformed and the request returns `INVALID_FORM_BODY` |-| 404 | [error response](/http-api/#error-response) | The message link or author tag does not resolve and the request returns `UNKNOWN_MESSAGE` |-| 404 | [error response](/http-api/#error-response) | The reported user, guild, or invite does not exist |-| 409 | [error response](/http-api/#error-response) | The answers came from an outdated flow and do not fit the current one, returning `REPORT_FLOW_OUTDATED` |--### Side effects--The operation resolves the target, deletes the ticket, and writes one report under a newly generated [snowflake](/snowflakes/).--A message notice about a guild channel that @everyone can view and read the history of captures the same conversation window as [Submit message report flow](#submit-message-report-flow), including the byte copy of every attachment. For any other guild channel, and for a direct message or group DM, it captures only the reported message and its attachments. A message notice also keeps a [profile snapshot](#profile-snapshot) of an author account, with the author's guild profile in a guild channel.--A user notice records the reported user's ID, avatar hash, and [profile snapshot](#profile-snapshot). A guild notice records the guild's ID, name, icon hash, NSFW flag, content warning state, and the sanitised invite code when one was supplied, together with the guild's [profile snapshot](#profile-snapshot).--Every notice also records `additional_info`, the reporter's legal name when one was supplied, the country of residence, the good faith confirmation, and the verified address behind the ticket. It stores the reason, its category, the steps, the revision hash, and the resolved locale like any flow report. A notice has no account ID even when the request presented a credential.--Once the notice is stored, Fluxer emails a receipt with the report ID to the verified address. A receipt that cannot be sent is logged and does not fail the request. When a moderator resolves the notice, the same address receives the decision.--### Rate limit--5 requests per hour, on the `dsa:report:create` bucket. The verified address behind the ticket files at most 5 reports each hour.+| 200 | [report](#report-object) object | The notice was filed |+| 400 | [error response](/http-api/#error-response) | `INVALID_DSA_TICKET` when the ticket is unknown or expired |+| 400 | [error response](/http-api/#error-response) | `INVALID_DSA_REPORT_TARGET` when the user ID and tag point to different accounts, or the invite isn't for `guild_id` |+| 400 | [error response](/http-api/#error-response) | `INVALID_REPORT_FLOW_ANSWERS` when the answers don't fit the current `dsa` flow |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_MESSAGE` when the message link or author tag doesn't match a message |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_USER`, `UNKNOWN_GUILD` or `UNKNOWN_INVITE` when the reported user, guild or invite doesn't exist |+| 409 | [error response](/http-api/#error-response) | `REPORT_FLOW_OUTDATED` when the answers came from an outdated flow |++The rate limit is 5 requests per hour, on the `dsa:report:create` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/search.mdx b/fluxer_docs/src/content/docs/http-api/search.mdxindex 376778fc5..cdf443b83 100644--- a/fluxer_docs/src/content/docs/http-api/search.mdx+++ b/fluxer_docs/src/content/docs/http-api/search.mdx@@ -1,156 +1,102 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Search-description: Global message search, its scope resolution, filter vocabulary, and result envelope.+description: Message search across a channel, a guild or your private channels, with its filters and result objects.---import RouteHeader from '@/components/RouteHeader.astro';-Message search matches indexed messages against a text query and a filter set. One request covers a single channel, one guild, the caller's private channels, or several of those at once. The [Guild member search resource](/http-api/guild-member-search/) defines guild member search, and the [Discovery resource](/http-api/discovery/) defines discoverable guild search. [Search threads](/http-api/threads/#search-threads) defines searching the threads of one channel by name and tag.+Message search finds indexed messages that match a text query and filters. One request can search a channel, a guild, your direct messages or several of these.-Fluxer resolves the requested scope to the set of channels the caller may search, then runs the query over that set. A private channel search covers the authenticated account alone, and the set holds a guild channel only while the caller can read its history.--Term matching and typo tolerance depend on the instance's search backend, Elasticsearch or Meilisearch. Filter matching is exact.+How the text query matches words and typos depends on the instance's search backend (Elasticsearch or Meilisearch), but filters always match exactly.## Message search result object-The body a completed search returns, holding one page of matching messages.+One page of matching messages.### Structure| Field | Type | Description || --- | --- | --- |-| messages<sup>1</sup> | array[[message](/http-api/messages/#message-object) object] | The matching messages on the requested page |-| channels<sup>2</sup> | array[[channel](/http-api/channels/#channel-object) object] | The channels the returned messages belong to |-| total<sup>3</sup> | integer | The number of messages matching the query |-| hits_per_page | integer | The page size that was applied, echoed from the request |-| page | integer | The page number that was applied, echoed from the request |-| cursor?<sup>4</sup> | array[string] | The opaque cursor the backend produced, which no backend accepts back |-| threads?<sup>5</sup> | array[[thread](/http-api/threads/#thread-object) object] | The threads that contain a returned message |-| members?<sup>5</sup> | array[[thread member](/http-api/thread-members/#thread-member-object) object] | A thread member object for each of those threads the caller joined |--<sup>1</sup> Each entry is an ordinary message object with the `referenced_message` field removed, so a reply is returned without its resolved parent even though the reply's own `message_reference` is preserved--<sup>2</sup> Contains one entry for each distinct channel represented in `messages` that is not a thread, and never contains a channel with no returned message. A single channel context that names a thread returns that thread here as a channel object--<sup>3</sup> Counted over the whole resolved scope. In a single channel context without [READ_MESSAGE_HISTORY](/http-api/permissions/), `total` is the number of messages in `messages`--<sup>4</sup> Present only when the backend produced a cursor. A single channel context, a Meilisearch instance, and a page Fluxer rebuilt after it found deleted messages in the backend results each return none--<sup>5</sup> Present only when a returned message is in a thread and the request is not a single channel context+| messages<sup>1</sup> | array[[message](/http-api/messages/#message-object) object] | The matching messages on the page |+| channels | array[[channel](/http-api/channels/#channel-object) object] | The channels the returned messages belong to |+| total<sup>2</sup> | integer | The number of messages matching the query |+| hits_per_page | integer | The page size that was applied |+| page | integer | The page number that was applied |+| cursor? | array[string] | Not used for paging |+| threads?<sup>3</sup> | array[[thread](/http-api/threads/#thread-object) object] | The threads that contain a returned message |+| members?<sup>3</sup> | array[[thread member](/http-api/thread-members/#thread-member-object) object] | Your thread member object for each of those threads you joined |-[Search messages](#search-messages) never honours a supplied cursor, so page through a result set with `page` alone.+<sup>1</sup> Messages have no `referenced_message` field-Deleted messages are omitted. When using `page`, the total counts only existing messages. Supplying a `cursor` can leave shorter pages even when more results exist.+<sup>2</sup> In a channel context without [READ_MESSAGE_HISTORY](/http-api/permissions/), this is the number of messages in `messages`-### Example--```json-{- "messages": [],- "channels": [],- "total": 0,- "hits_per_page": 25,- "page": 1-}-```+<sup>3</sup> Present only when a returned message is in a thread and the request is not a single channel search## Search indexing object-The other 200 body. Fluxer returns it when a channel the search needs has never been indexed, or when that channel was last indexed before 2026-05-23 17:30:00 UTC, a fixed date built into Fluxer.+Fluxer returns this object with status 200 when a channel in the search isn't indexed yet or its index is out of date. Fluxer starts indexing it, and you can retry the same request later to get results. Check for `indexing` to tell this object apart from a result. In the `all_guilds`, `all` and `open_dms_and_all_guilds` scopes, this happens when any guild channel you can read needs indexing, even one you left out of `channel_ids`.### Structure| Field | Type | Description || --- | --- | --- |-| indexing | boolean | Whether an index the search needed is not queryable yet, always true on this body |--Tell the bodies apart by the presence of `indexing`, which the result object never has. The request queues the missing indexing work, and a later identical request returns ordinary results once that work completes.--### Example--```json-{- "indexing": true-}-```--:::caution[One stale channel blocks a whole multi-guild search]-The `all_guilds`, `all`, and `open_dms_and_all_guilds` scopes check the index of every guild channel the caller can read. A request narrowed to particular channels still receives the search indexing object when any other readable guild channel is unindexed.-:::+| indexing | boolean | Always `true` |## Search scopes| Value | Description || --- | --- |-| current | The single guild named by context_guild_id, or the single channel named by context_channel_id when no guild context is supplied |-| open_dms<sup>1</sup> | Every direct message and group direct message channel the caller has open |-| all_dms | Every direct message and group direct message channel the caller has ever been a recipient of |-| all_guilds | Every guild the caller is a member of |-| all | Every guild the caller is a member of together with the all_dms channel set |-| open_dms_and_all_guilds | Every guild the caller is a member of together with the open_dms channel set |+| current | The guild in context_guild_id, or the channel in context_channel_id when no guild is given |+| open_dms | Your open direct message and group direct message channels |+| all_dms | Every direct message and group direct message channel you are a recipient of |+| all_guilds | Every guild you are a member of |+| all | All guilds plus all_dms |+| open_dms_and_all_guilds | All guilds plus open_dms |-<sup>1</sup> A private channel is open when the caller has not closed it, and a channel named by `context_channel_id` is added to the open set for this request even when it is closed+A bot can only use `current`, and any other value returns 400 `INVALID_FORM_BODY` with the field code [BOT_SEARCH_SCOPE_UNAVAILABLE](/http-api/errors/) on `scope`.-A bot uses `current`. Supplying any other value with a bot token returns 400 `INVALID_FORM_BODY` on the path `scope` with the field code [BOT_SEARCH_SCOPE_UNAVAILABLE](/http-api/errors/).+To search members, communities or threads, see [Guild member search](/http-api/guild-member-search/), [Discovery](/http-api/discovery/) and [Search threads](/http-api/threads/#search-threads).## Search author types| Value | Description || --- | --- |-| user | Authored by an ordinary user account |-| bot | Authored by a bot account |-| webhook<sup>1</sup> | Authored by a webhook |--<sup>1</sup> A webhook message is indexed as webhook even when the executing application is a bot+| user | An ordinary user account |+| bot | A bot account |+| webhook | A webhook |## Search content types| Value | Description || --- | --- |-| image | Has an uploaded attachment whose media type begins with `image/` |-| sound | Has an uploaded attachment whose media type begins with `audio/` |-| video | Has an uploaded attachment whose media type begins with `video/` |-| file | Has at least one uploaded attachment of any media type |+| image | Has an attachment with an `image/` media type |+| sound | Has an attachment with an `audio/` media type |+| video | Has an attachment with a `video/` media type |+| file | Has at least one attachment || sticker | Has at least one sticker |-| embed<sup>1</sup> | Has at least one generated preview or supplied rich embed |-| link<sup>2</sup> | Has an HTTP or HTTPS URL in its own text |-| poll<sup>3</sup> | Has a poll |-| snapshot<sup>4</sup> | Is a forward and therefore has at least one message snapshot |--<sup>1</sup> Derived from the message's own embed list, so an uploaded attachment never satisfies it--<sup>2</sup> Derived from the message text alone, so a message that only has a link inside an embed does not match--<sup>3</sup> `has` never matches on this value, and `exclude_has` with this value excludes nothing--<sup>4</sup> A forward also merges the content, embeds, attachments, stickers, and mentions of its snapshots into its own indexed document, so the other attributes can be satisfied by forwarded content+| embed | Has at least one preview or rich embed |+| link | Has an HTTP or HTTPS URL in its text |+| poll | Accepted but matches nothing |+| snapshot | Is a forward |## Search embed types| Value | Description || --- | --- |-| image<sup>1</sup> | An image preview embed |-| video<sup>1</sup> | A video preview embed |-| sound<sup>2</sup> | A value the filter accepts that matches no document |-| article<sup>1</sup> | An article or webpage preview embed |--<sup>1</sup> Compared against the embed's own type string, which is one of `rich`, `link`, `article`, `image`, `video`, `audio`, `gifv`, or `bluesky`--<sup>2</sup> An audio preview is indexed as `audio`. Use the `sound` [content type](#search-content-types) to find uploaded audio attachments--The values above are the only ones this filter accepts, so a rich, link, gifv, or bluesky embed cannot be selected or excluded by embed type.+| image | An image preview embed |+| video | A video preview embed |+| sound | Accepted but matches nothing. Use the `sound` [content type](#search-content-types) |+| article | An article or webpage preview embed |## Search sort fields| Value | Description || --- | --- |-| timestamp | Order by creation time, tie-broken by descending message ID |-| relevance<sup>1</sup> | Order by whatever the configured search backend produces when no explicit sort field is submitted |--<sup>1</sup> `sort_order` is not applied to this value+| timestamp | Creation time |+| relevance<sup>1</sup> | The search backend's own order |-A Meilisearch instance orders `relevance` by its own ranking rules. An Elasticsearch instance applies its descending message ID tiebreak as the only sort key, so `relevance` there is equivalent to `timestamp` with a `sort_order` of `desc`.+<sup>1</sup> `sort_order` doesn't apply, and on Elasticsearch this is the same as `timestamp` with `desc`## Search sort orders@@ -163,141 +109,80 @@ A Meilisearch instance orders `relevance` by its own ranking rules. An Elasticse<RouteHeader method="POST" path="/v1/search/messages" bot />-Searches indexed messages in the resolved scope. Returns a [message search result](#message-search-result-object) object on success, or a [search indexing](#search-indexing-object) object when an index the search needs is not queryable yet.+Searches indexed messages in the resolved scope. Returns a [message search result](#message-search-result-object) object, or a [search indexing](#search-indexing-object) object when an index isn't ready.-### Limitations+A guild search only includes channels where you have [VIEW_CHANNEL](/http-api/permissions/) and [READ_MESSAGE_HISTORY](/http-api/permissions/). To search a single guild channel through `context_channel_id`, you need `VIEW_CHANNEL`, and without `READ_MESSAGE_HISTORY` you only get messages after the guild's history cutoff.-- A bot is restricted to the `current` scope.-- The caller must be a recipient of every private channel that contributes to the search.-- A guild scope includes a guild channel only when the caller holds both [VIEW_CHANNEL](/http-api/permissions/) and [READ_MESSAGE_HISTORY](/http-api/permissions/) in it.-- A guild scope includes threads only for a bot or a user session that declares the [`channel_threads` client capability](/http-api/threads/#client-capability).-- A single channel context requires guild membership and [VIEW_CHANNEL](/http-api/permissions/) alone. Without `READ_MESSAGE_HISTORY` the guild's message history cutoff applies to each returned message.-- An age-restricted guild or single channel context requires an account old enough for age-restricted content, and otherwise returns 403 `NSFW_CONTENT_AGE_RESTRICTED`.-- An instance with no search backend configured returns 403 `FEATURE_TEMPORARILY_DISABLED`.--Every scope that can include a guild channel calls the main Gateway. A Gateway call that times out returns 504 `GATEWAY_TIMEOUT`, a reply that cannot be interpreted returns 502 `BAD_GATEWAY`, and a Gateway that is overloaded or unreachable returns 503 `SERVICE_UNAVAILABLE`.+Threads are only searched for bots and for sessions with the [`channel_threads` client capability](/http-api/threads/#client-capability). The same applies to a thread, forum or media channel in `channel_ids`.### JSON body-Every field is optional, though the default `current` scope requires `context_guild_id` or `context_channel_id`. An omitted filter is not applied.+Every field is optional, but the default `current` scope needs `context_guild_id` or `context_channel_id`. Without either, it returns 400 with the field code [CONTEXT_CHANNEL_OR_GUILD_ID_REQUIRED](/http-api/errors/).| Field | Type | Description || --- | --- | --- |-| scope?<sup>1</sup> | string | [Search scope](#search-scopes) to resolve (default `current`) |-| context_channel_id?<sup>2</sup> | snowflake | The ID of the channel that supplies the channel context |-| context_guild_id?<sup>2</sup> | snowflake | The ID of the guild that supplies the guild context |-| channel_ids?<sup>3</sup> | array[snowflake] | The channel IDs to narrow the resolved scope to (at most 500) |-| channel_id?<sup>4</sup> | array[snowflake] | An alias of `channel_ids` (at most 500) |+| scope? | string | [Search scope](#search-scopes) (default `current`) |+| context_channel_id? | snowflake | The ID of the channel to search |+| context_guild_id? | snowflake | The ID of the guild to search |+| channel_ids?<sup>1</sup> | array[snowflake] | The channel IDs to narrow the scope to (at most 500) |+| channel_id?<sup>1</sup> | array[snowflake] | An alias of `channel_ids` (at most 500) || hits_per_page? | integer | The number of messages on each page (1-25, default 25) |-| page?<sup>5</sup> | integer | The page number (1-9007199254740991, default 1) |-| cursor?<sup>6</sup> | array[string] | The opaque cursor returned by a previous page, accepted and then discarded |-| min_id?<sup>7</sup> | snowflake | The lowest message ID to match, applied exclusively |-| max_id?<sup>7</sup> | snowflake | The highest message ID to match, applied exclusively |-| content?<sup>8</sup> | string | The free-text query (1-1024 characters) |-| contents?<sup>9</sup> | array[string] | The alternative free-text queries (at most 100, 1-1024 characters each) |-| exact_phrases?<sup>10</sup> | array[string] | The phrases that must all match (at most 10, 1-1024 characters each) |-| exclude_channel_id? | array[snowflake] | The channel IDs, any of which excludes a message (at most 500) |-| author_id?<sup>11</sup> | array[snowflake] | The author user IDs, any of which can match (at most 100) |-| exclude_author_id? | array[snowflake] | The author user IDs, any of which excludes a message (at most 100) |-| author_type?<sup>11</sup> | array[string] | [Author types](#search-author-types), any of which can match (at most 20) |-| exclude_author_type? | array[string] | [Author types](#search-author-types), any of which excludes a message (at most 20) |-| mentions?<sup>12</sup> | array[snowflake] | The user IDs, all of which must be mentioned (at most 100) |-| exclude_mentions? | array[snowflake] | The user IDs, any of which excludes a message (at most 100) |+| page? | integer | The page number (1-400, default 1) |+| cursor? | array[string] | Leave this out. Outside a channel context, a non-empty value returns the first page |+| min_id?<sup>2</sup> | snowflake | The lowest message ID to match, exclusive |+| max_id?<sup>2</sup> | snowflake | The highest message ID to match, exclusive |+| content?<sup>3</sup> | string | The free-text query (1-1024 characters) |+| contents?<sup>3</sup> | array[string] | Alternative free-text queries (at most 100, 1-1024 characters each) |+| exact_phrases?<sup>4</sup> | array[string] | Phrases that must all match (at most 10, 1-1024 characters each) |+| exclude_channel_id? | array[snowflake] | Channel IDs to exclude (at most 500) |+| author_id? | array[snowflake] | Author user IDs, any of which can match (at most 100) |+| exclude_author_id? | array[snowflake] | Author user IDs to exclude (at most 100) |+| author_type? | array[string] | [Author types](#search-author-types), any of which can match (at most 20) |+| exclude_author_type? | array[string] | [Author types](#search-author-types) to exclude (at most 20) |+| mentions? | array[snowflake] | User IDs that must all be mentioned (at most 100) |+| exclude_mentions? | array[snowflake] | User IDs, any of which excludes a message (at most 100) || mention_everyone? | boolean | Whether a matching message has an everyone mention || pinned? | boolean | Whether a matching message is pinned |-| has?<sup>12</sup> | array[string] | [Content types](#search-content-types), all of which must be present (at most 20) |-| exclude_has? | array[string] | [Content types](#search-content-types), none of which can be present (at most 20) |-| embed_type?<sup>12</sup> | array[string] | [Embed types](#search-embed-types), all of which must be present (at most 20) |-| exclude_embed_type? | array[string] | [Embed types](#search-embed-types), any of which excludes a message (at most 20) |-| embed_provider?<sup>12</sup> <sup>13</sup> | array[string] | The embed provider names, all of which must be present (at most 50, 1-256 characters each) |-| exclude_embed_provider?<sup>13</sup> | array[string] | The embed provider names, any of which excludes a message (at most 50, 1-256 characters each) |-| link_hostname?<sup>12</sup> <sup>13</sup> | array[string] | The hostnames, all of which must be present (at most 100, 1-255 characters each) |-| exclude_link_hostname?<sup>13</sup> | array[string] | The hostnames, any of which excludes a message (at most 100, 1-255 characters each) |-| attachment_filename?<sup>12</sup> <sup>13</sup> | array[string] | The filenames, all of which must be present (at most 100, 1-1024 characters each) |-| exclude_attachment_filename?<sup>13</sup> | array[string] | The filenames, any of which excludes a message (at most 100, 1-1024 characters each) |-| attachment_extension?<sup>12</sup> <sup>14</sup> | array[string] | The extensions, all of which must be present (at most 50, 1-32 characters each) |-| exclude_attachment_extension?<sup>14</sup> | array[string] | The extensions, any of which excludes a message (at most 50, 1-32 characters each) |+| has? | array[string] | [Content types](#search-content-types) that must all be present (at most 20) |+| exclude_has? | array[string] | [Content types](#search-content-types) that can't be present (at most 20) |+| embed_type? | array[string] | [Embed types](#search-embed-types) that must all be present (at most 20) |+| exclude_embed_type? | array[string] | [Embed types](#search-embed-types) to exclude (at most 20) |+| embed_provider?<sup>5</sup> | array[string] | Embed provider names that must all be present (at most 50, 1-256 characters each) |+| exclude_embed_provider?<sup>5</sup> | array[string] | Embed provider names to exclude (at most 50, 1-256 characters each) |+| link_hostname?<sup>5</sup> | array[string] | Hostnames that must all be present (at most 100, 1-255 characters each) |+| exclude_link_hostname?<sup>5</sup> | array[string] | Hostnames to exclude (at most 100, 1-255 characters each) |+| attachment_filename?<sup>5</sup> | array[string] | Filenames that must all be present (at most 100, 1-1024 characters each) |+| exclude_attachment_filename?<sup>5</sup> | array[string] | Filenames to exclude (at most 100, 1-1024 characters each) |+| attachment_extension?<sup>6</sup> | array[string] | Extensions that must all be present (at most 50, 1-32 characters each) |+| exclude_attachment_extension?<sup>6</sup> | array[string] | Extensions to exclude (at most 50, 1-32 characters each) || sort_by? | string | [Search sort field](#search-sort-fields) (default `timestamp`) || sort_order? | string | [Search sort order](#search-sort-orders) (default `desc`) |-| include_nsfw?<sup>15</sup> | boolean | Whether age-restricted channels can contribute results (default false) |--<sup>1</sup> A bot that supplies any value other than `current` is rejected with 400 `INVALID_FORM_BODY` on the path `scope`+| include_nsfw?<sup>7</sup> | boolean | Whether age-restricted channels can give results (default false) |-<sup>2</sup> Consulted only by the `current` scope, where a guild context wins over a channel context, and by the private channel scopes, where it adds one closed channel back+<sup>1</sup> A channel context ignores them-<sup>3</sup> Every listed channel must already be in the resolved scope. A `current` channel context ignores it entirely+<sup>2</sup> On Meilisearch, the comparison uses the second the ID was created in-<sup>4</sup> Read only when `channel_ids` is absent, and then it narrows the resolved scope exactly as `channel_ids` does+<sup>3</sup> Matches message text and embed text. On Elasticsearch, `contents` replaces `content` when both are supplied-<sup>5</sup> Only `page` reaches a page beyond the first+<sup>4</sup> Terms must appear adjacent and in order-<sup>6</sup> The route never honours it. Supplying one serves the first page again while the response still echoes the requested `page`+<sup>5</sup> Compared exactly and case-sensitively-<sup>7</sup> Both bounds are exclusive, so `min_id` matches messages strictly newer than it and `max_id` matches messages strictly older than it+<sup>6</sup> Write extensions in lowercase without the dot. Only the part after the last dot of a filename counts, and only when it has 1-10 characters-<sup>8</sup> Matched against the message text and the collected embed text. The value is trimmed and stripped of control and formatting characters before its length is checked+<sup>7</sup> Ignored unless you are 18 or older. Bots always count as 18 or older-<sup>9</sup> Supply the text query in exactly one of `content` and `contents`--<sup>10</sup> Every phrase must match, and a phrase matches only when its terms appear adjacently and in order in the message text or the collected embed text--<sup>11</sup> A message matches when it satisfies any one of the listed values--<sup>12</sup> A message matches only when it satisfies every listed value, so supplying two values requires both--<sup>13</sup> Compared exactly and case-sensitively, so a partial value never matches. A link hostname uses the URL host of a link in the message text or of an embed URL--<sup>14</sup> Indexed in lowercase, without a leading dot, and only for the final dot-separated segment of a filename when that segment is 1 through 10 characters--<sup>15</sup> Honoured only for an account whose recorded date of birth places it at 18 years or older, and otherwise treated as false. A bot always passes--A `current` guild context rejects a requested channel outside that guild with 400 and the field code [ALL_CHANNELS_MUST_BELONG_TO_GUILD](/http-api/errors/). It rejects a channel inside the guild that the caller cannot read with 403 `MISSING_PERMISSIONS`. Every other scope rejects a requested channel its resolved set does not already contain with 403 `MISSING_PERMISSIONS`. Use `exclude_channel_id` to remove a channel.--Fluxer compares `attachment_extension` without lowercasing it, so an uppercase value never matches. `include_nsfw` gates which channels a resolved scope keeps.--:::caution[Elasticsearch has a 10000 document result window]-A plain text query pages past it. A page beyond that window fails with 500 `INTERNAL_SERVER_ERROR` when `contents` or `exact_phrases` is supplied.-:::--The backends read `min_id` and `max_id` differently. An Elasticsearch instance compares the message ID. A Meilisearch instance compares the whole creation second the bound encodes, so a message created in the same second as the bound is excluded there. An Elasticsearch instance requires at least one `contents` entry to match and replaces `content` with that group. A Meilisearch instance joins the group, `content`, and the quoted phrases into one query string, and requires no entry in particular. Supplying `exact_phrases` without `contents` narrows `content` to the message text alone on Elasticsearch.--The `current` scope requires one of `context_guild_id` and `context_channel_id`. Supplying neither returns 400 with the field code [CONTEXT_CHANNEL_OR_GUILD_ID_REQUIRED](/http-api/errors/) on the path `context`.--Fluxer resolves a supplied `context_guild_id` before anything else. A guild that cannot be resolved returns 404 `UNKNOWN_GUILD`, and a guild the caller is not a member of returns 403 `MISSING_PERMISSIONS`. A guild context searches that guild, restricted to `channel_ids` when supplied and to every channel of the guild otherwise, and every channel in the resulting set must belong to that guild. A channel the caller cannot both view and read history in is dropped when the set came from the guild, and rejected with 403 `MISSING_PERMISSIONS` when the caller named it in `channel_ids`. An age-gated channel that `include_nsfw` does not admit is removed from the set before the permission check runs, so it never causes that refusal. A named thread whose parent was removed that way returns 403 `MISSING_PERMISSIONS` when another named channel remains and the search returns no [search indexing](#search-indexing-object) object. With no other channel left, the search returns an empty page.--For a bot or a user session that declares the [`channel_threads` client capability](/http-api/threads/#client-capability), a guild scope that `channel_ids` does not narrow also includes the threads of each text, announcement, forum, and media channel it includes. A public or announcement thread is included for every such caller. A private thread is included for its members and for [thread moderators](/http-api/threads/#thread-moderators). Fluxer includes at most 5,000 threads, highest ID first. Any other caller searches no thread.--`channel_ids` can name a thread. In a guild context, naming a forum or media channel searches its posts, and naming a text or announcement channel searches that channel without its threads. In a guild context, a caller other than a bot or a user session that declares `channel_threads` who names a thread, a forum channel, or a media channel receives 400 with the field code `ALL_CHANNELS_MUST_BELONG_TO_GUILD`. A forum or media channel never returns the search indexing object in a guild scope. A named thread returns it when its parent text or announcement channel has never been indexed or its index is stale.--A guild whose NSFW level is age restricted refuses a caller who is not old enough with 403 `NSFW_CONTENT_AGE_RESTRICTED`. An old-enough caller searches every channel of such a guild, including its age-gated channels, whether or not `include_nsfw` is set.--A channel context searches only that channel and ignores `channel_ids`, `cursor`, and `include_nsfw`. When the caller cannot read the channel's history and the guild defines no message history cutoff, the search returns an empty result.--The `all_guilds`, `all`, and `open_dms_and_all_guilds` scopes include only guild channels the caller can view and read history in. The `open_dms` and `open_dms_and_all_guilds` scopes include the caller's open private channels. The `all_dms` and `all` scopes include every private channel available to the caller unless `channel_ids` narrows the set. A scope that resolves to no channel returns an empty result with a `total` of `0`.--Searchable text is the message content plus the collected embed text, which covers embed titles, descriptions, URLs, author names, provider names, footer text, and field names and values, including nested embeds.--Content moderation scans every string in the body whose field name does not end in `_id` or `_ids`. A scanned value of at least three characters that matches the instance phrase blocklist or has a blocked URL returns 403 `CONTENT_BLOCKED`.+Every channel in `channel_ids` must be in the scope. A channel from another guild returns 400 with the field code [ALL_CHANNELS_MUST_BELONG_TO_GUILD](/http-api/errors/), and any other channel outside the scope returns 403 `MISSING_PERMISSIONS`.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [message search result](#message-search-result-object) object \| [search indexing](#search-indexing-object) object | Search completed, or an index it needed is not queryable yet |-| 400 | [error response](/http-api/#error-response) | A bot supplied a scope other than `current`, the `current` scope has no context, or a requested channel does not belong to the context guild, each returning `INVALID_FORM_BODY` |-| 403 | [error response](/http-api/#error-response) | Caller presents an OAuth2 bearer credential, or the guild of the context channel cannot be resolved while a stored guild record still exists, each returning `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | A body string is blocked by content moderation and the request returns `CONTENT_BLOCKED` |-| 403 | [error response](/http-api/#error-response) | No search backend is configured for the instance and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 403 | [error response](/http-api/#error-response) | A requested channel is outside the resolved scope, the caller is not a member of the context guild, or the caller cannot view the context channel, each returning `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The context guild or the context channel is age restricted and the caller is not old enough and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Context guild cannot be resolved, or the guild of the context channel cannot be resolved and no stored guild record exists, each returning `UNKNOWN_GUILD` |-| 404 | [error response](/http-api/#error-response) | The context channel does not exist or is a private channel the caller is not a recipient of and the request returns `UNKNOWN_CHANNEL` |-| 404 | [error response](/http-api/#error-response) | The caller's own account record is missing and the request returns `UNKNOWN_USER` |--### Side effects--When a channel in the resolved scope has never been indexed or its index is stale, the operation queues an indexing job for it and returns the [search indexing](#search-indexing-object) object.--### Rate limit+| 200 | [message search result](#message-search-result-object) object \| [search indexing](#search-indexing-object) object | The search completed, or an index isn't ready |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` for a bad scope, a channel from another guild or no context |+| 403 | [error response](/http-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED` when the instance has no search backend |+| 403 | [error response](/http-api/#error-response) | `NSFW_CONTENT_AGE_RESTRICTED` when the context is age restricted and you are not old enough |+| 403 | [error response](/http-api/#error-response) | `CONTENT_BLOCKED` when a search string matches the instance blocklist |-20 requests per 10 seconds for each authenticated user, on the `search:messages` bucket.+The rate limit is 20 requests per 10 seconds, on the `search:messages` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/streams.mdx b/fluxer_docs/src/content/docs/http-api/streams.mdxindex 1159088de..e4a4c52ca 100644--- a/fluxer_docs/src/content/docs/http-api/streams.mdx+++ b/fluxer_docs/src/content/docs/http-api/streams.mdx@@ -1,87 +1,48 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Streams-description: Go Live stream keys, stream region selection, and the stream preview image lifecycle.+description: Stream keys, stream regions and stream preview images.---import RouteHeader from '@/components/RouteHeader.astro';-A Go Live stream is a screen share on a member's existing voice connection. A stream key names one stream. The operations here record a region preference and manage the stream's JPEG preview image.--Every route on this page is user-only. Fluxer rejects a bot token and an OAuth2 bearer credential with 403 `ACCESS_DENIED`.--## Stream lifecycle--Starting and stopping a stream is a main Gateway operation. Going live publishes a screen share track on the LiveKit participant the member already holds, and the publisher advertises it by setting `self_stream` on that connection with [Voice State Update](/gateway/commands/#voice-state-update). Fluxer opens no second connection and issues no new grant. The [Voice overview](/voice/) states the full model.+A stream is a screen share on a member's existing voice connection. These routes record a region preference and manage the stream's JPEG preview image. A bot token or an OAuth2 bearer token gets 403 `ACCESS_DENIED` on every route here.## Stream key-A stream key is one path segment of 1 through 256 characters. It has exactly three colon-separated segments. The form is `{guild_id}:{channel_id}:{connection_id}` for a guild voice stream and `dm:{channel_id}:{connection_id}` for a private call stream.+A stream key identifies one stream and has the form `{guild_id}:{channel_id}:{connection_id}`, or `dm:{channel_id}:{connection_id}` in a DM or group DM. A key that isn't three colon-separated segments of 1-256 characters returns 400 `INVALID_STREAM_KEY_FORMAT`.| Field | Type | Description || --- | --- | --- |-| scope<sup>1</sup> | string | The literal `dm` for a private call, or the decimal guild ID for a guild voice channel |-| channel_id<sup>2</sup> | string | The decimal ID of the voice channel or private channel the stream runs in |-| connection_id<sup>3</sup> | string | The `connection_id` of the publisher's existing voice connection |--<sup>1</sup> Any other value fails the format check, including an empty segment--<sup>2</sup> The segment is canonical decimal digits, `[0-9]+` with no leading zero. A non-canonical form never matches--<sup>3</sup> The publisher's ordinary voice connection, which is also the one in its voice state and in its media participant identity--A key with a different segment count, a non-numeric channel segment, an empty connection segment, or a scope segment that is neither `dm` nor a decimal ID returns 400 `INVALID_STREAM_KEY_FORMAT`.--[Modify stream region](#modify-stream-region), [Get stream preview](#get-stream-preview), and [Delete stream preview](#delete-stream-preview) resolve the channel from the channel segment of the key. [Upload stream preview](#upload-stream-preview) and [Create stream preview upload URL](#create-stream-preview-upload-url) instead resolve it from the `channel_id` in their request body and compare that value against the key afterwards.--Fluxer checks the scope segment against the resolved channel. A guild-scoped key whose resolved channel is private returns 400 `STREAM_KEY_SCOPE_MISMATCH`, and so does a `dm` key whose resolved channel belongs to a guild. A guild-scoped key whose guild segment is not the resolved channel's guild returns the same code.+| scope | string | `dm` for a private call, or the guild ID for a guild voice channel |+| channel_id | string | The ID of the voice channel or private channel the stream runs in |+| connection_id | string | The `connection_id` of the publisher's voice connection |-The route then compares the channel segment against the resolved channel ID, and a mismatch returns 400 `STREAM_KEY_CHANNEL_MISMATCH`. On the routes that have a body `channel_id`, a caller MUST send the same value in the body and in the key.--Fluxer runs that comparison after every other [read access](#access-rules) check. Channel lookup, the scope check, the channel type check, and the `CONNECT` check all run first, so a body `channel_id` naming a channel the caller cannot see returns 404 `UNKNOWN_CHANNEL` or one of the 403 codes listed under [Access rules](#access-rules).+A scope that isn't the channel's guild ID, or `dm` for a DM or group DM, returns 400 `STREAM_KEY_SCOPE_MISMATCH`. Any other channel type returns 400 `INVALID_CHANNEL_TYPE`. Upload stream preview and Create stream preview upload URL also take a `channel_id` in the body, and one that doesn't equal the key's channel segment returns 400 `STREAM_KEY_CHANNEL_MISMATCH`.## Access rules-[Get stream preview](#get-stream-preview) requires read access. Every other route on this page requires mutation access.--Read access matches [Get channel](/http-api/channels/#get-channel) for the [resolved channel](#stream-key). A guild channel also requires the [CONNECT](/http-api/permissions/) permission. The caller does not have to own the stream, so any member who can join the channel can read its preview.--Mutation access requires everything read access does. A guild channel also requires the [STREAM](/http-api/permissions/) permission. The caller must hold a voice state whose channel is the resolved channel and whose `connection_id` is the connection segment of the key. Fluxer rejects a caller that holds no such voice state with 403 `ACCESS_DENIED`, even when it owns the channel.--:::caution[A preview can exist with no live stream]-A caller can record a region and upload a preview for any voice connection it holds, whether or not it is streaming.-:::--Fluxer resolves a guild channel before its guild. A channel row that outlives its guild returns 404 `UNKNOWN_GUILD`. Where the guild record exists and Fluxer cannot resolve the membership state, the route returns 403 `ACCESS_DENIED`, and a caller that is not a member or that lacks [VIEW_CHANNEL](/http-api/permissions/) returns 403 `MISSING_PERMISSIONS`. A caller who lacks `VIEW_CHANNEL` in the parent of a thread, or cannot view a private thread, receives 403 `MISSING_ACCESS`. A thread, a forum channel, or a media channel returns 404 `UNKNOWN_CHANNEL` to a user session that does not declare the [`channel_threads` client capability](/http-api/threads/#client-capability). An unsatisfied age restriction on a resolved guild channel other than a category returns 403 `NSFW_CONTENT_AGE_RESTRICTED`.+| Access | Requirements |+| --- | --- |+| Read | Access to the channel as in [Get channel](/http-api/channels/#get-channel), plus [CONNECT](/http-api/permissions/) in a guild |+| Mutation | Read access, plus [STREAM](/http-api/permissions/) in a guild and your own voice state in the channel with the key's `connection_id` |-A private channel whose recipient set does not contain the caller returns 404 `UNKNOWN_CHANNEL`. An absent channel returns the same code, so recipient membership is never distinguishable from private channel existence.--Every route checks the channel type after the scope check. A guild key names a guild voice channel and a `dm` key names a direct message or a group direct message. Any other resolved channel returns 400 `INVALID_CHANNEL_TYPE`.+A caller without `CONNECT` or `STREAM` gets 403 `MISSING_PERMISSIONS`. A caller without that voice state gets 403 `ACCESS_DENIED`.## Stream preview upload object-A short-lived URL that accepts one stream's preview image. [Create stream preview upload URL](#create-stream-preview-upload-url) returns it, and the client uploads the image with a single `PUT` against `upload_url`.+A signed URL you can `PUT` stream preview JPEGs to until it expires.### Structure| Field | Type | Description || --- | --- | --- |-| upload_url<sup>1</sup> | string | The capability URL that accepts the preview bytes with one `PUT` request |+| upload_url | string | The URL to `PUT` the preview JPEG to, sent exactly as returned || method | string | Always `PUT` |-| content_type<sup>2</sup> | string | The media type of the upload request |-| expires_at<sup>3</sup> | ISO8601 timestamp | The time the capability expires |-| expires_in<sup>3</sup> | integer | The lifetime of the capability in seconds |-| max_bytes | integer | The maximum accepted byte count, always `1000000` |--<sup>1</sup> Either a presigned object storage URL or an [upload relay](/media-proxy/upload-relay/) URL with the signed capability in its `t` query parameter--<sup>2</sup> The request's `content_type` is returned verbatim, original casing included, and an absent field yields `image/jpeg`--<sup>3</sup> A presigned object storage URL lasts one day. A relay URL lasts the relay token lifetime the instance is configured with--A client MUST send the URL exactly as returned and MUST NOT rebuild or reorder it. Rebuilding drops the signed capability in `t`, and a relay URL that arrives without `t` returns 401.--The URL accepts repeated `PUT` requests until it expires. Each replaces the previous preview.+| content_type | string | The media type to send with the upload |+| expires_at | ISO8601 timestamp | The time the URL expires |+| expires_in | integer | The lifetime of the URL in seconds |+| max_bytes | integer | The maximum accepted size, always `1000000` |### Example@@ -100,228 +61,96 @@ The URL accepts repeated `PUT` requests until it expires. Each replaces the prev<RouteHeader method="PATCH" path="/v1/streams/{stream_key}/stream" />-Records the preferred media region for a stream and returns 204 with an empty body. The caller must satisfy the [mutation access](#access-rules) boundary.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| stream_key | string | [Stream key](#stream-key) whose region is set, of 1 through 256 characters |+Records the preferred media region for a stream. You need mutation access.### JSON body| Field | Type | Description || --- | --- | --- |-| region?<sup>1</sup> | string | The RTC region ID of 1 through 64 characters |--<sup>1</sup> An omitted field removes any region already stored for this stream--A region identifier is the `id` of an [RTC region object](/http-api/channels/#rtc-region-object), as returned by [List RTC regions](/http-api/channels/#list-rtc-regions).+| region? | string | The `id` of an [RTC region](/http-api/channels/#rtc-region-object) (1-64 characters), or omit it to clear the preference |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Preference was recorded |-| 400 | [error response](/http-api/#error-response) | Stream key is malformed and the request returns `INVALID_STREAM_KEY_FORMAT` |-| 400 | [error response](/http-api/#error-response) | Its scope disagrees with the resolved channel and the request returns `STREAM_KEY_SCOPE_MISMATCH` |-| 400 | [error response](/http-api/#error-response) | Its channel segment is not the canonical form of the resolved channel ID and the request returns `STREAM_KEY_CHANNEL_MISMATCH` |-| 400 | [error response](/http-api/#error-response) | The resolved channel is not a guild voice channel or a private channel and the request returns `INVALID_CHANNEL_TYPE` |-| 403 | [error response](/http-api/#error-response) | Caller holds no matching voice state or has an unresolvable guild membership state, each returning `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The caller lacks `VIEW_CHANNEL`, `CONNECT`, or `STREAM` and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` in the parent of a thread, or cannot view a private thread, each returning `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The resolved age restriction of a guild channel is not satisfied and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel named by the stream key does not exist, or the caller is not a recipient of the private channel, each returning `UNKNOWN_CHANNEL`, or the guild that owns the channel does not exist and the request returns `UNKNOWN_GUILD` |--### Side effects+| 204 | empty | The preference was recorded |-The call has no effect on where the stream is placed. Fluxer does not validate the region against the caller's accessible region list. The operation emits no Gateway Dispatch.--### Rate limit--20 requests per 10 seconds for each authenticated user and stream key, on the `channel:stream:update::stream_key` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:stream:update::stream_key` bucket.## Get stream preview<RouteHeader method="GET" path="/v1/streams/{stream_key}/preview" />-Returns the stored preview bytes for a stream. The caller must satisfy the [read access](#access-rules) boundary.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| stream_key | string | [Stream key](#stream-key) whose preview is returned, of 1 through 256 characters |+Returns the stored preview image with `Cache-Control: no-store, private`. You need read access.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | preview bytes | A stored preview exists |-| 400 | [error response](/http-api/#error-response) | Stream key is malformed and the request returns `INVALID_STREAM_KEY_FORMAT`, its scope disagrees with the resolved channel and the request returns `STREAM_KEY_SCOPE_MISMATCH`, the resolved channel is not a guild voice channel or a private channel and the request returns `INVALID_CHANNEL_TYPE`, or its channel segment is not the canonical form of the resolved channel ID and the request returns `STREAM_KEY_CHANNEL_MISMATCH` |-| 403 | [error response](/http-api/#error-response) | Caller has an unresolvable guild membership state and the request returns `ACCESS_DENIED`, the caller lacks `VIEW_CHANNEL` or `CONNECT` and the request returns `MISSING_PERMISSIONS`, or the resolved age restriction of a guild channel is not satisfied and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` in the parent of a thread, or cannot view a private thread, each returning `MISSING_ACCESS` |-| 404 | empty | No preview is stored for this stream key |-| 404 | [error response](/http-api/#error-response) | Channel named by the stream key does not exist, or the caller is not a recipient of the private channel, each returning `UNKNOWN_CHANNEL`, or the guild that owns the channel does not exist and the request returns `UNKNOWN_GUILD` |--The 200 also has `Cache-Control: no-store, private` and `Pragma: no-cache`.--A stored preview expires one day after it was written, and a read after that point answers an empty 404. A stored object that is missing, temporarily unreadable, or larger than 1000000 bytes answers an empty 404 too.+| 200 | preview bytes | A preview is stored |+| 404 | empty | No preview is stored, or it expired after one day |-:::note[A missing preview answers 404 with no body]-Every other 404 on this route has an [error response](/http-api/#error-response) body, so a client MUST read an empty 404 as "no preview yet".-:::--The response `Content-Type` is the media type recorded when the preview was written, and it defaults to `image/jpeg` when none was recorded. [Upload stream preview](#upload-stream-preview) accepts a declared media type naming JPEG without inspecting the bytes, and the capability path of [Create stream preview upload URL](#create-stream-preview-upload-url) inspects nothing. A client therefore MUST NOT treat this header as proof of the payload format and MUST decode defensively.--### Rate limit--60 requests per 10 seconds for each authenticated user and stream key, on the `channel:stream:preview:get::stream_key` bucket.+The rate limit is 60 requests per 10 seconds, on the `channel:stream:preview:get::stream_key` bucket.## Upload stream preview<RouteHeader method="POST" path="/v1/streams/{stream_key}/preview" />-Replaces the stream's preview with a JPEG sent inline as base64 and returns 204 with an empty body. The caller must satisfy the [mutation access](#access-rules) boundary.--To upload the image bytes with a separate `PUT` request, use [Create stream preview upload URL](#create-stream-preview-upload-url).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| stream_key | string | [Stream key](#stream-key) that receives the preview, of 1 through 256 characters |+Replaces the preview with a JPEG sent as base64. You need mutation access. To send the bytes with a separate request, use [Create stream preview upload URL](#create-stream-preview-upload-url).### JSON body| Field | Type | Description || --- | --- | --- |-| channel_id<sup>1</sup> | snowflake | The ID of the channel the stream is active in |-| thumbnail<sup>2</sup> | base64 string | The base64-encoded JPEG of 1 through 2000000 characters |-| content_type?<sup>3</sup> | string | The declared media type of 1 through 64 characters |--<sup>1</sup> The channel the route resolves and permission-checks. A value that is not the channel segment of the [stream key](#stream-key) returns 400 `STREAM_KEY_CHANNEL_MISMATCH`+| channel_id | snowflake | The ID of the channel the stream is active in |+| thumbnail | base64 string | The [canonical base64](/topics/uploads/#stream-previews) JPEG (1-2000000 characters) |+| content_type? | string | The declared media type (1-64 characters) |-<sup>2</sup> Decoded bytes are at most 1000000. Fluxer trims the value before checking its length--<sup>3</sup> A value containing `jpeg` or `jpg` in any case is accepted without inspecting the bytes. Any other value, and an absent field, is accepted only when the decoded bytes begin with `FF D8` and end with `FF D9`--Fluxer stores the accepted `content_type` verbatim and returns it from [Get stream preview](#get-stream-preview). When the field is absent, the stored media type is `image/jpeg`.--A `thumbnail` that is not [canonical base64](/topics/uploads/#stream-previews) returns 400 `INVALID_STREAM_THUMBNAIL_PAYLOAD`. Fluxer re-encodes the decoded bytes and rejects the value when the result is not what the client sent. The 2000000 character ceiling admits 1500000 decoded bytes, so an oversized JPEG reaches the byte check and returns `FILE_SIZE_TOO_LARGE`. The format check runs before the size check. An oversized payload that is not a JPEG returns `PREVIEW_MUST_BE_JPEG`.+The API treats the image as a JPEG when `content_type` contains `jpeg` or `jpg`, or when the bytes are a JPEG.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Preview was accepted |-| 400 | [error response](/http-api/#error-response) | Stream key is malformed and the request returns `INVALID_STREAM_KEY_FORMAT` |-| 400 | [error response](/http-api/#error-response) | The key scope disagrees with the resolved channel and the request returns `STREAM_KEY_SCOPE_MISMATCH` |-| 400 | [error response](/http-api/#error-response) | The body channel disagrees with the key and the request returns `STREAM_KEY_CHANNEL_MISMATCH` |-| 400 | [error response](/http-api/#error-response) | The resolved channel is not a guild voice channel or a private channel and the request returns `INVALID_CHANNEL_TYPE` |-| 400 | [error response](/http-api/#error-response) | The payload is not canonical base64 and the request returns `INVALID_STREAM_THUMBNAIL_PAYLOAD` |-| 400 | [error response](/http-api/#error-response) | The payload is not a JPEG and the request returns `PREVIEW_MUST_BE_JPEG` |-| 400 | [error response](/http-api/#error-response) | It exceeds 1000000 bytes and the request returns `FILE_SIZE_TOO_LARGE` |-| 403 | [error response](/http-api/#error-response) | Caller holds no matching voice state or has an unresolvable guild membership state, each returning `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The caller lacks `VIEW_CHANNEL`, `CONNECT`, or `STREAM` and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` in the parent of a thread, or cannot view a private thread, each returning `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The resolved age restriction of a guild channel is not satisfied and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel named by the body `channel_id` does not exist, or the caller is not a recipient of that private channel, each returning `UNKNOWN_CHANNEL`, or the guild that owns the channel does not exist and the request returns `UNKNOWN_GUILD` |--### Side effects+| 204 | empty | The preview was accepted |+| 400 | [error response](/http-api/#error-response) | `INVALID_STREAM_THUMBNAIL_PAYLOAD` when the payload isn't canonical base64 |+| 400 | [error response](/http-api/#error-response) | `PREVIEW_MUST_BE_JPEG` when the payload isn't a JPEG |+| 400 | [error response](/http-api/#error-response) | `FILE_SIZE_TOO_LARGE` when the JPEG exceeds 1000000 bytes |-The decoded bytes replace whatever preview the stream key already had, and the preview metadata expires one day after the write. Fluxer emits no Gateway Dispatch, so a viewer observes the new image on its next [Get stream preview](#get-stream-preview) read.--A 204 does not guarantee that the new preview is readable. A temporary failure can leave the previous image, content type, or expiry in place, or leave no readable preview. Publishers should continue uploading on their normal interval.--### Rate limit--20 requests per 10 seconds for each authenticated user and stream key, on the `channel:stream:preview:post::stream_key` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:stream:preview:post::stream_key` bucket.## Create stream preview upload URL<RouteHeader method="POST" path="/v1/streams/{stream_key}/preview/upload-url" />-Returns a [stream preview upload object](#stream-preview-upload-object) granting a bounded `PUT` upload of the JPEG preview. The caller must satisfy the [mutation access](#access-rules) boundary.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| stream_key | string | [Stream key](#stream-key) that receives the preview, of 1 through 256 characters |+Returns a [stream preview upload object](#stream-preview-upload-object). You need mutation access. `PUT` the JPEG to `upload_url` with the returned `content_type`, and each `PUT` replaces the preview until the URL expires.### JSON body| Field | Type | Description || --- | --- | --- |-| channel_id<sup>1</sup> | snowflake | The ID of the channel the stream is active in |-| content_type?<sup>2</sup> | string | The declared media type of 1 through 64 characters |--<sup>1</sup> The channel the route resolves and permission-checks. A value that is not the channel segment of the [stream key](#stream-key) returns 400 `STREAM_KEY_CHANNEL_MISMATCH`--<sup>2</sup> Only a value containing `jpeg` or `jpg` in any case is accepted, an absent field means `image/jpeg`, and any other value returns 400 `PREVIEW_MUST_BE_JPEG`+| channel_id | snowflake | The ID of the channel the stream is active in |+| content_type? | string | The declared media type, which must contain `jpeg` or `jpg` (1-64 characters, default `image/jpeg`) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [stream preview upload](#stream-preview-upload-object) object | Upload capability was issued |-| 400 | [error response](/http-api/#error-response) | Stream key is malformed and the request returns `INVALID_STREAM_KEY_FORMAT` |-| 400 | [error response](/http-api/#error-response) | The key scope disagrees with the resolved channel and the request returns `STREAM_KEY_SCOPE_MISMATCH` |-| 400 | [error response](/http-api/#error-response) | The body channel disagrees with the key and the request returns `STREAM_KEY_CHANNEL_MISMATCH` |-| 400 | [error response](/http-api/#error-response) | The resolved channel is not a guild voice channel or a private channel and the request returns `INVALID_CHANNEL_TYPE` |-| 400 | [error response](/http-api/#error-response) | The declared media type is not JPEG and the request returns `PREVIEW_MUST_BE_JPEG` |-| 403 | [error response](/http-api/#error-response) | Caller holds no matching voice state or has an unresolvable guild membership state, each returning `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The caller lacks `VIEW_CHANNEL`, `CONNECT`, or `STREAM` and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` in the parent of a thread, or cannot view a private thread, each returning `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The resolved age restriction of a guild channel is not satisfied and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel named by the body `channel_id` does not exist, or the caller is not a recipient of that private channel, each returning `UNKNOWN_CHANNEL`, or the guild that owns the channel does not exist and the request returns `UNKNOWN_GUILD` |--### Side effects--There is no separate completion call. After the `PUT` succeeds, [Get stream preview](#get-stream-preview) returns the uploaded image. Until then it returns an empty 404 or the previous image.--A client MUST send the returned `content_type` with the `PUT` and MUST NOT exceed `max_bytes`. The preview metadata expires one day after this call, so a capability used later than that writes an object no read can find. Fluxer emits no Gateway Dispatch.--:::note[Neither URL shape inspects the bytes]-A relay URL refuses a declared length above `max_bytes` with 413, and a presigned object storage URL enforces nothing beyond the signed media type. An object above `max_bytes` still stores, and [Get stream preview](#get-stream-preview) then answers an empty 404.-:::+| 200 | [stream preview upload](#stream-preview-upload-object) object | The upload URL was issued |+| 400 | [error response](/http-api/#error-response) | `PREVIEW_MUST_BE_JPEG` when the media type isn't JPEG |-### Rate limit--20 requests per 10 seconds for each authenticated user and stream key, on the `channel:stream:preview:upload_url::stream_key` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:stream:preview:upload_url::stream_key` bucket.## Delete stream preview<RouteHeader method="DELETE" path="/v1/streams/{stream_key}/preview" />-Deletes the stored preview for a stream and returns 204 with an empty body. Deleting an absent preview also returns 204. The caller must satisfy the [mutation access](#access-rules) boundary.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| stream_key | string | [Stream key](#stream-key) whose preview is deleted, of 1 through 256 characters |+Deletes the stored preview. You need mutation access.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Preview was deleted, or none was stored |-| 400 | [error response](/http-api/#error-response) | Stream key is malformed and the request returns `INVALID_STREAM_KEY_FORMAT` |-| 400 | [error response](/http-api/#error-response) | Its scope disagrees with the resolved channel and the request returns `STREAM_KEY_SCOPE_MISMATCH` |-| 400 | [error response](/http-api/#error-response) | Its channel segment is not the canonical form of the resolved channel ID and the request returns `STREAM_KEY_CHANNEL_MISMATCH` |-| 400 | [error response](/http-api/#error-response) | The resolved channel is not a guild voice channel or a private channel and the request returns `INVALID_CHANNEL_TYPE` |-| 403 | [error response](/http-api/#error-response) | Caller holds no matching voice state or has an unresolvable guild membership state, each returning `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The caller lacks `VIEW_CHANNEL`, `CONNECT`, or `STREAM` and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` in the parent of a thread, or cannot view a private thread, each returning `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | The resolved age restriction of a guild channel is not satisfied and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel named by the stream key does not exist, or the caller is not a recipient of the private channel, each returning `UNKNOWN_CHANNEL`, or the guild that owns the channel does not exist and the request returns `UNKNOWN_GUILD` |--### Side effects--The preview stops being readable. No Gateway Dispatch is emitted, so viewers observe the removal on their next [Get stream preview](#get-stream-preview) request.--### Rate limit+| 204 | empty | The preview was deleted or none was stored |-20 requests per 10 seconds for each authenticated user and stream key, on the `channel:stream:preview:delete::stream_key` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:stream:preview:delete::stream_key` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/themes.mdx b/fluxer_docs/src/content/docs/http-api/themes.mdxindex e46fafea2..7a14cf8c9 100644--- a/fluxer_docs/src/content/docs/http-api/themes.mdx+++ b/fluxer_docs/src/content/docs/http-api/themes.mdx@@ -1,103 +1,38 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Themes-description: Theme identifiers, custom CSS storage, document bounds, and content screening.+description: Store a custom CSS theme and share it by its ID.---import RouteHeader from '@/components/RouteHeader.astro';-A theme is a custom CSS stylesheet stored under a short code, and anyone holding the code can fetch it. The HTTP API exposes one operation, which stores a theme. The [Media Proxy](/media-proxy/overview/) serves the stored stylesheet back through [Get theme CSS](/media-proxy/routes/#get-theme-css).--The route is user-only. A bot token and an OAuth2 bearer credential are both rejected with 403 `ACCESS_DENIED`.--## Theme identifier--A theme identifier is 16 lowercase hexadecimal characters matching `^[a-f0-9]{16}$`. Submitting identical CSS twice creates two independent themes.--### Example--```json-{- "id": "3f0a91c7d2b84e65"-}-```--## Document bounds--The UTF-8 encoding of a submitted document cannot exceed 8388608 bytes, and the document is at least one character long. Both bounds are fixed constants of the instance.--| Bound | Value |-| --- | --- |-| Encoded CSS<sup>1</sup> <sup>2</sup> | 8388608 bytes |-| Submitted CSS<sup>3</sup> | at least 1 character |--<sup>1</sup> The 8 MiB ceiling is inclusive, so a document whose UTF-8 encoding is exactly 8388608 bytes is stored and one byte more is rejected with 400 `FILE_SIZE_TOO_LARGE`--<sup>2</sup> Measured over the UTF-8 encoding, so a document of multi-byte characters can be shorter than 8388608 characters and still be rejected--<sup>3</sup> Measured in characters of the submitted string--An account holds no theme quota. The `theme:share:create` rate limit bucket is the only bound on how many themes an account creates, and no route here checks an [instance limit key](/http-api/instance/#limit-keys).--## Content screening--The instance-wide content filter screens the submitted document before the route runs. It checks a `css` value of at least 3 characters against the instance phrase blocklist and the instance URL blocklist. A match on either returns 403 `CONTENT_BLOCKED`. A shorter value is never screened.--Fluxer scans a body under every content type except `multipart/form-data` and `application/x-www-form-urlencoded`. The filter also skips a body that does not parse as JSON. The route parses the body from the raw request text and reads no content type, so a JSON document sent under either [form content type](/http-api/#request-body-formats) is stored without passing the blocklists.--The screen precedes the rate limit bucket, the credential check, and the request schema, so a blocked document returns `CONTENT_BLOCKED` even when the request has no credential.--Nothing else inspects the document. Fluxer stores the CSS verbatim and never parses, validates, minifies, or rewrites it.+A theme is a CSS file stored under a random ID. Anyone with the ID can load it from the [Media Proxy](/media-proxy/routes/#get-theme-css) without signing in. There is no route to change or delete a theme.## Create theme<RouteHeader method="POST" path="/v1/users/@me/themes" />-Stores a custom CSS document and returns 201 with the created [theme identifier](#theme-identifier). User-only, and no permission is required.+Stores a CSS file and returns its ID. Bots and OAuth2 tokens can't use this route.### JSON body| Field | Type | Description || --- | --- | --- |-| css<sup>1</sup> <sup>2</sup> | string | The CSS text to store and share (at least 1 character) |--<sup>1</sup> Stored verbatim, bounded by the 8388608-byte UTF-8 ceiling described in [Document bounds](#document-bounds)--<sup>2</sup> An empty string is rejected with the validation code `INVALID_FORMAT`--:::note[Malformed and unusable bodies fail at different paths]-An absent body, a whitespace-only body, and a present but empty, null, or non-string `css` all return 400 `INVALID_FORM_BODY` with `INVALID_FORMAT` at the `css` path. A body that does not parse as JSON returns the same status and code at the `body` path.-:::--A body that parses as JSON but is not an object, such as a string, a number, an array, or `null`, returns the same code at the path `root`.+| css | string | The CSS text (1 character to 8 MiB as UTF-8) |### Response body| Field | Type | Description || --- | --- | --- |-| id | string | The [theme identifier](#theme-identifier) |--The object has the identifier and nothing else.+| id | string | The theme ID (16 lowercase hexadecimal characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 201 | response body | Document was stored |-| 400 | [error response](/http-api/#error-response) | The encoded document exceeds the size ceiling and the request returns `FILE_SIZE_TOO_LARGE` |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | The document is blocked by content moderation and the request returns `CONTENT_BLOCKED` |--### Side effects--Fluxer stores the UTF-8 encoding of the submitted document with the content type `text/css; charset=utf-8`. Fluxer finishes storing the document before it returns the identifier.--The [Media Proxy](/media-proxy/overview/) serves the document from `/themes/{id}.css`.--:::danger[Theme CSS is public and permanent]-The identifier is the only thing guarding a stored document, and the read route is unauthenticated. The HTTP API replaces or deletes no stored theme. A caller MUST NOT put a credential, a token, or any other secret in a submitted document.-:::--### Rate limit+| 201 | response body | The theme was stored |+| 400 | [error response](/http-api/#error-response) | `FILE_SIZE_TOO_LARGE` when the CSS is over 8 MiB |+| 403 | [error response](/http-api/#error-response) | `ACCESS_DENIED` when the caller is a bot or uses an OAuth2 bearer token |+| 403 | [error response](/http-api/#error-response) | `CONTENT_BLOCKED` when the CSS has a blocked phrase or URL |-20 requests per minute for each authenticated user, on the `theme:share:create` bucket.+The rate limit is 20 requests per minute, on the `theme:share:create` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/thread-members.mdx b/fluxer_docs/src/content/docs/http-api/thread-members.mdxindex 44af2915d..927b83b70 100644--- a/fluxer_docs/src/content/docs/http-api/thread-members.mdx+++ b/fluxer_docs/src/content/docs/http-api/thread-members.mdx@@ -6,13 +6,7 @@ description: Thread member objects, joining and leaving threads, member lists, aimport RouteHeader from '@/components/RouteHeader.astro';-A thread member records that a user joined a [thread](/http-api/threads/). A thread holds at most 1,000 members, and adding one more returns 400 `MAX_THREAD_MEMBERS`.--:::note[User requests need the `channel_threads` client capability]-A request from a user without the [`channel_threads` client capability](/http-api/threads/#client-capability) returns 404 `NOT_FOUND`. [Get thread member](#get-thread-member) and [List thread members](#list-thread-members) return 404 `NOT_FOUND` to every user. A `channel_id` that does not exist or names a channel outside a guild returns the same 404.-:::--A route on this page returns 403 `MISSING_PERMISSIONS` when the caller is not a member of the guild, unless its own entry states an earlier result. A guild channel that is not a thread and that the caller cannot view also returns 403 `MISSING_PERMISSIONS`. A thread whose parent channel no longer exists returns 404 `UNKNOWN_CHANNEL`.+A thread member records that a user joined a [thread](/http-api/threads/). A thread has at most 1,000 members. Requests from users need the [`channel_threads` client capability](/http-api/threads/#client-capability) and otherwise return 404 `NOT_FOUND`. Every endpoint returns 400 `INVALID_CHANNEL_TYPE` when the channel is not a thread and 403 `MISSING_ACCESS` when you cannot view it.## Thread member object@@ -25,14 +19,14 @@ A route on this page returns 403 `MISSING_PERMISSIONS` when the caller is not a| join_timestamp | ISO8601 timestamp | The time the user last joined the thread || flags | integer | The [thread member flags](#thread-member-flags) || muted?<sup>2</sup> | boolean | Whether the user muted the thread |-| mute_config?<sup>2</sup> | ?[guild mute configuration](/http-api/users/settings/#guild-mute-configuration-object) object | The mute expiry of the thread, or null when none is stored |+| mute_config?<sup>2</sup> | ?[guild mute configuration](/http-api/users/settings/#guild-mute-configuration-object) object | The mute expiry of the thread || member?<sup>3</sup> | [guild member](/http-api/guild-members/#guild-member-object) object | The guild member of the user |-<sup>1</sup> Omitted on the `member` of a thread in [Ready](/gateway/events/#ready), [Guild Create](/gateway/events/#guild-create), and [Guild Sync](/gateway/events/#guild-sync)+<sup>1</sup> Omitted on the `member` of a thread in [Ready](/gateway/events/#ready), [Guild Create](/gateway/events/#guild-create) and [Guild Sync](/gateway/events/#guild-sync)<sup>2</sup> Present only on the caller's own membership-<sup>3</sup> In an HTTP response, present only when the request sets `with_member` and the user is still a guild member. [Thread Members Update](/gateway/threads/#thread-members-update) defines it on each `added_members` entry+<sup>3</sup> Present when the request sets `with_member` and the user is still in the guild. Each `added_members` entry of [Thread Members Update](/gateway/threads/#thread-members-update) also has it### Example@@ -49,6 +43,8 @@ A route on this page returns 403 `MISSING_PERMISSIONS` when the caller is not a## Thread member flags+At most one of `ALL_MESSAGES`, `ONLY_MENTIONS` and `NO_MESSAGES` is set. With none set, the thread follows the notification level of its parent.+| Value | Name | Description || --- | --- | --- || 1 << 0 | HAS_INTERACTED<sup>1</sup> | The user sent a message in the thread or created it |@@ -56,184 +52,86 @@ A route on this page returns 403 `MISSING_PERMISSIONS` when the caller is not a| 1 << 2 | ONLY_MENTIONS | Notify the user only of mentions in the thread || 1 << 3 | NO_MESSAGES | Notify the user of nothing in the thread |-<sup>1</sup> Set only by Fluxer. A bot that creates a thread starts without it--At most one of the three notification flags is set. With none set, the thread follows the notification level of its parent.--A member keeps the membership after losing access to the parent. Removal from the guild removes every membership in its threads. Fluxer emits a [Thread Members Update](/gateway/threads/#thread-members-update) for each of them.+<sup>1</sup> A bot that creates a thread doesn't get this flag until it sends a message there## Join thread<RouteHeader method="PUT" path="/v1/channels/{channel_id}/thread-members/@me" bot />-Adds the caller to a thread. Returns 204 with no body. Emits a [Thread Members Update](/gateway/threads/#thread-members-update) Gateway event.--### Limitations--- The caller must be able to view the thread.-- The thread must not be archived.-- A locked thread requires a thread moderator.--Joining a thread the caller already belongs to runs the checks above, then returns 204 and changes nothing. Each session of a newly added user receives [Thread Create](/gateway/threads/#thread-create) when it has [thread access](/gateway/threads/#session-flag) and can view the thread. A session still connecting to the guild receives none.--Joining a locked thread needs an enrolled authenticator while the guild [MFA level](/http-api/guilds/#mfa-levels) is elevated, unless the caller owns the guild.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the thread |+Adds you to a thread and sends a [Thread Members Update](/gateway/threads/#thread-members-update) event. You need to be able to view the thread, and to be a thread moderator if it is locked. Joining a locked thread also needs an enrolled authenticator when the guild [MFA level](/http-api/guilds/#mfa-levels) is elevated, unless you own the guild.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Caller is a member |-| 400 | [error response](/http-api/#error-response) | Channel is not a thread and the request returns `INVALID_CHANNEL_TYPE` |-| 400 | [error response](/http-api/#error-response) | Thread is archived and the request returns `THREAD_ARCHIVED` |-| 400 | [error response](/http-api/#error-response) | Thread is locked and the caller is not a thread moderator, returning `THREAD_LOCKED` |-| 400 | [error response](/http-api/#error-response) | Thread has 1,000 members and the request returns `MAX_THREAD_MEMBERS` |-| 400 | [error response](/http-api/#error-response) | Caller needs an authenticator and the request returns `TWO_FACTOR_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Caller cannot view the thread and the request returns `MISSING_ACCESS` |--### Rate limit+| 204 | empty | The caller is a member |+| 400 | [error response](/http-api/#error-response) | `THREAD_ARCHIVED` when the thread is archived |+| 400 | [error response](/http-api/#error-response) | `THREAD_LOCKED` when the thread is locked and the caller is not a thread moderator |+| 400 | [error response](/http-api/#error-response) | `MAX_THREAD_MEMBERS` when the thread has 1,000 members |+| 400 | [error response](/http-api/#error-response) | `TWO_FACTOR_REQUIRED` when the caller needs an authenticator |+| 403 | [error response](/http-api/#error-response) | `MISSING_ACCESS` when the caller cannot view the thread |-10 requests per 10 seconds for each authenticated user and channel ID, on the `channel:thread:member:put::channel_id` bucket.+The rate limit is 10 requests per 10 seconds, on the `channel:thread:member:put::channel_id` bucket.## Add thread member<RouteHeader method="PUT" path="/v1/channels/{channel_id}/thread-members/{user_id}" bot />-Adds another guild member to a thread. Requires `SEND_MESSAGES_IN_THREADS`. Returns 204 with no body. Emits a [Thread Members Update](/gateway/threads/#thread-members-update) Gateway event.--### Limitations--- The caller must be able to view the thread.-- The thread must not be archived.-- A locked thread requires a thread moderator.-- A private thread with `invitable` false requires the caller or the target to be a thread moderator.-- The target must be a guild member who can view the parent.--`user_id` of `@me` behaves as [Join thread](#join-thread). A request that names the caller's own ID runs the checks above, and Fluxer posts no message for it. Adding a user who is already a member runs the checks above, then returns 204 and changes nothing. Each session of a newly added user receives [Thread Create](/gateway/threads/#thread-create) when it has [thread access](/gateway/threads/#session-flag) and can view the thread. A session still connecting to the guild receives none.--Adding to a locked thread needs an enrolled authenticator while the guild [MFA level](/http-api/guilds/#mfa-levels) is elevated, unless the caller owns the guild. Adding a target who is not a thread moderator to a private thread with `invitable` false needs one too.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the thread |-| user_id | snowflake | The ID of the user to add |+Adds a guild member to a thread and sends a [Thread Members Update](/gateway/threads/#thread-members-update) event. You need `SEND_MESSAGES_IN_THREADS`. In a private thread that is not `invitable`, you or the target must be a thread moderator. When the guild [MFA level](/http-api/guilds/#mfa-levels) is elevated and you don't own the guild, you need an enrolled authenticator to add someone to a locked thread. The same applies to adding someone who is not a thread moderator to that kind of private thread. A `user_id` of `@me` works like [Join thread](#join-thread).### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Target is a member |-| 400 | [error response](/http-api/#error-response) | Channel is not a thread and the request returns `INVALID_CHANNEL_TYPE` |-| 400 | [error response](/http-api/#error-response) | Thread is archived and the request returns `THREAD_ARCHIVED` |-| 400 | [error response](/http-api/#error-response) | Thread is locked and the caller is not a thread moderator, returning `THREAD_LOCKED` |-| 400 | [error response](/http-api/#error-response) | Thread has 1,000 members and the request returns `MAX_THREAD_MEMBERS` |-| 400 | [error response](/http-api/#error-response) | Caller needs an authenticator and the request returns `TWO_FACTOR_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Caller cannot view the thread and the request returns `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `SEND_MESSAGES_IN_THREADS` and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | Neither user is a thread moderator in a private thread that is not `invitable`, returning `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | Target cannot view the parent and the request returns `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | Caller is timed out and the request returns `COMMUNICATION_DISABLED` |-| 404 | [error response](/http-api/#error-response) | Target is not a guild member and the request returns `UNKNOWN_MEMBER` |--### Side effects+| 204 | empty | The target is a member |+| 400 | [error response](/http-api/#error-response) | `THREAD_ARCHIVED`, `THREAD_LOCKED`, `MAX_THREAD_MEMBERS` or `TWO_FACTOR_REQUIRED`, as for [Join thread](#join-thread) |+| 403 | [error response](/http-api/#error-response) | `MISSING_ACCESS` when the caller cannot view the thread or the target cannot view the parent |+| 403 | [error response](/http-api/#error-response) | `MISSING_PERMISSIONS` when the caller lacks `SEND_MESSAGES_IN_THREADS` |+| 403 | [error response](/http-api/#error-response) | `MISSING_PERMISSIONS` in a private thread that is not `invitable` when neither user is a thread moderator |+| 403 | [error response](/http-api/#error-response) | `COMMUNICATION_DISABLED` when the caller is timed out |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_MEMBER` when the target is not a guild member |-Adding another user posts a `RECIPIENT_ADD` message in the thread that mentions the target. Fluxer emits [Message Create](/gateway/events/#message-create) for it.--### Rate limit--10 requests per 10 seconds for each authenticated user and channel ID, on the `channel:thread:member:put::channel_id` bucket.+Adding another user posts a `RECIPIENT_ADD` message that mentions the target and sends [Message Create](/gateway/events/#message-create) for it. The rate limit is 10 requests per 10 seconds, on the `channel:thread:member:put::channel_id` bucket.## Leave thread<RouteHeader method="DELETE" path="/v1/channels/{channel_id}/thread-members/@me" bot />-Removes the caller from a thread. Returns 204 with no body. Emits a [Thread Members Update](/gateway/threads/#thread-members-update) Gateway event.--A timed-out member can leave a thread. A member who can no longer view the thread receives 403 `MISSING_ACCESS`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the thread |+Removes you from a thread and sends a [Thread Members Update](/gateway/threads/#thread-members-update) event.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Caller left the thread |-| 400 | [error response](/http-api/#error-response) | Channel is not a thread and the request returns `INVALID_CHANNEL_TYPE` |-| 400 | [error response](/http-api/#error-response) | Thread is archived and the request returns `THREAD_ARCHIVED` |-| 403 | [error response](/http-api/#error-response) | Caller cannot view the thread and the request returns `MISSING_ACCESS` |-| 404 | [error response](/http-api/#error-response) | Caller is not a member and the request returns `UNKNOWN_THREAD_MEMBER` |+| 204 | empty | The caller left the thread |+| 400 | [error response](/http-api/#error-response) | `THREAD_ARCHIVED` when the thread is archived |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_THREAD_MEMBER` when the caller is not a member |-### Rate limit--10 requests per 10 seconds for each authenticated user and channel ID, on the `channel:thread:member:delete::channel_id` bucket.+The rate limit is 10 requests per 10 seconds, on the `channel:thread:member:delete::channel_id` bucket.## Remove thread member<RouteHeader method="DELETE" path="/v1/channels/{channel_id}/thread-members/{user_id}" bot />-Removes a member from a thread. Requires `MANAGE_THREADS`, or ownership of a private thread. Returns 204 with no body. Emits a [Thread Members Update](/gateway/threads/#thread-members-update) Gateway event.--### Limitations--- The caller must be able to view the thread.-- The thread must not be archived.-- The caller must be a [thread moderator](/http-api/threads/#thread-moderators) or the owner of the private thread.--`user_id` of `@me` or of the caller behaves as [Leave thread](#leave-thread).--Removing a member needs an enrolled authenticator while the guild [MFA level](/http-api/guilds/#mfa-levels) is elevated, unless the caller owns the guild or the private thread.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the thread |-| user_id | snowflake | The ID of the user to remove |+Removes a member from a thread and sends a [Thread Members Update](/gateway/threads/#thread-members-update) event. You need to be a [thread moderator](/http-api/threads/#thread-moderators) or the owner of the private thread. When the guild [MFA level](/http-api/guilds/#mfa-levels) is elevated, you also need an enrolled authenticator unless you own the guild or the private thread. A `user_id` of `@me` or of the caller works like [Leave thread](#leave-thread).### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Member was removed |-| 400 | [error response](/http-api/#error-response) | Channel is not a thread and the request returns `INVALID_CHANNEL_TYPE` |-| 400 | [error response](/http-api/#error-response) | Thread is archived and the request returns `THREAD_ARCHIVED` |-| 400 | [error response](/http-api/#error-response) | Caller needs an authenticator and the request returns `TWO_FACTOR_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Caller cannot view the thread and the request returns `MISSING_ACCESS` |-| 403 | [error response](/http-api/#error-response) | Caller is neither a thread moderator nor the owner of the private thread and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | Caller is timed out and the request returns `COMMUNICATION_DISABLED` |-| 404 | [error response](/http-api/#error-response) | Target is not a member and the request returns `UNKNOWN_THREAD_MEMBER` |--### Side effects--Removing another user posts a `RECIPIENT_REMOVE` message in the thread that mentions the target. Fluxer emits [Message Create](/gateway/events/#message-create) for it.--### Rate limit+| 204 | empty | The member was removed |+| 400 | [error response](/http-api/#error-response) | `THREAD_ARCHIVED` or `TWO_FACTOR_REQUIRED`, as for [Join thread](#join-thread) |+| 403 | [error response](/http-api/#error-response) | `MISSING_PERMISSIONS` when the caller is neither a thread moderator nor the owner of the private thread |+| 403 | [error response](/http-api/#error-response) | `COMMUNICATION_DISABLED` when the caller is timed out |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_THREAD_MEMBER` when the target is not a member |-10 requests per 10 seconds for each authenticated user and channel ID, on the `channel:thread:member:delete::channel_id` bucket.+Fluxer posts a `RECIPIENT_REMOVE` message that mentions the target and sends [Message Create](/gateway/events/#message-create) for it. The rate limit is 10 requests per 10 seconds, on the `channel:thread:member:delete::channel_id` bucket.## Get thread member<RouteHeader method="GET" path="/v1/channels/{channel_id}/thread-members/{user_id}" bot />-Returns the [thread member object](#thread-member-object) of a user. Requires a bot token.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the thread |-| user_id | snowflake | The ID of the user |+Returns the [thread member object](#thread-member-object) of a user. Only bots can call it, and users get 404 `NOT_FOUND`.### Query parameters@@ -245,29 +143,16 @@ Returns the [thread member object](#thread-member-object) of a user. Requires a| Status | Body | Condition || --- | --- | --- |-| 200 | [thread member](#thread-member-object) object | Member was returned |-| 400 | [error response](/http-api/#error-response) | Channel is not a thread and the request returns `INVALID_CHANNEL_TYPE` |-| 403 | [error response](/http-api/#error-response) | Caller cannot view the thread and the request returns `MISSING_ACCESS` |-| 404 | [error response](/http-api/#error-response) | User is not a member and the request returns `UNKNOWN_THREAD_MEMBER` |-| 404 | [error response](/http-api/#error-response) | Caller is a user and the request returns `NOT_FOUND` |--### Rate limit+| 200 | [thread member](#thread-member-object) object | The member was returned |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_THREAD_MEMBER` when the user is not a member |-40 requests per 10 seconds for each authenticated user and channel ID, on the `channel:thread:member:get::channel_id` bucket.+The rate limit is 40 requests per 10 seconds, on the `channel:thread:member:get::channel_id` bucket.## List thread members<RouteHeader method="GET" path="/v1/channels/{channel_id}/thread-members" bot />-Returns the [thread member objects](#thread-member-object) of a thread in ascending user ID order. Requires a bot token.--A user client reads member lists through the `thread_member_lists` option of [Lazy Request](/gateway/commands/#lazy-request).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the thread |+Returns the [thread member objects](#thread-member-object) of a thread in ascending user ID order. Only bots can call it, and users get 404 `NOT_FOUND`. User clients use the `thread_member_lists` option of [Lazy Request](/gateway/commands/#lazy-request).### Query parameters@@ -281,26 +166,15 @@ A user client reads member lists through the `thread_member_lists` option of [La| Status | Body | Condition || --- | --- | --- |-| 200 | array[[thread member](#thread-member-object) object] | Members were returned |-| 400 | [error response](/http-api/#error-response) | Channel is not a thread and the request returns `INVALID_CHANNEL_TYPE` |-| 403 | [error response](/http-api/#error-response) | Caller cannot view the thread and the request returns `MISSING_ACCESS` |-| 404 | [error response](/http-api/#error-response) | Caller is a user and the request returns `NOT_FOUND` |+| 200 | array[[thread member](#thread-member-object) object] | The members were returned |-### Rate limit--20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:thread:members:list::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:thread:members:list::channel_id` bucket.## Modify thread member settings<RouteHeader method="PATCH" path="/v1/channels/{channel_id}/thread-members/@me/settings" />-Changes the caller's notification settings for a thread they joined. User-only. Returns the updated [thread member object](#thread-member-object), or 204 when nothing changed. Emits a [Thread Member Update](/gateway/threads/#thread-member-update) Gateway event.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the thread |+Changes your notification settings for a thread you joined and sends a [Thread Member Update](/gateway/threads/#thread-member-update) event. While `muted` is true, you get no push notifications from the thread, including for mentions.### JSON body@@ -312,20 +186,14 @@ Changes the caller's notification settings for a thread they joined. User-only.<sup>1</sup> Replaces the three notification flags and keeps `HAS_INTERACTED`. A value of 0 clears them-While `muted` is true, the member receives no push notification from the thread, including for a mention. A mute with an `end_time` stops when that time passes.-### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [thread member](#thread-member-object) object | Settings changed |+| 200 | [thread member](#thread-member-object) object | The settings changed || 204 | empty | The body matched the stored settings |-| 400 | [error response](/http-api/#error-response) | `flags` sets more than one notification flag or any other bit and the request returns `INVALID_THREAD_NOTIFICATION_SETTINGS` |-| 400 | [error response](/http-api/#error-response) | Channel is not a thread and the request returns `INVALID_CHANNEL_TYPE` |-| 403 | [error response](/http-api/#error-response) | Caller is a bot and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | Caller cannot view the thread and the request returns `MISSING_ACCESS` |-| 404 | [error response](/http-api/#error-response) | Caller is not a member and the request returns `UNKNOWN_THREAD_MEMBER` |--### Rate limit+| 400 | [error response](/http-api/#error-response) | `INVALID_THREAD_NOTIFICATION_SETTINGS` when `flags` sets more than one notification flag or any other bit |+| 403 | [error response](/http-api/#error-response) | `ACCESS_DENIED` when the caller is a bot |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_THREAD_MEMBER` when the caller is not a member |-10 requests per 10 seconds for each authenticated user and channel ID, on the `channel:thread:member:settings::channel_id` bucket.+The rate limit is 10 requests per 10 seconds, on the `channel:thread:member:settings::channel_id` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/threads.mdx b/fluxer_docs/src/content/docs/http-api/threads.mdxindex 80843414f..16db1150e 100644--- a/fluxer_docs/src/content/docs/http-api/threads.mdx+++ b/fluxer_docs/src/content/docs/http-api/threads.mdx@@ -1,24 +1,20 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Threads-description: Thread objects, starting and archiving threads, archived thread lists, thread search, and thread permissions.+description: Thread objects, starting and archiving threads, archived thread lists, thread search and thread permissions.---import RouteHeader from '@/components/RouteHeader.astro';-A thread is a channel inside a guild text, announcement, forum, or media channel that holds its own messages. A public thread or an announcement thread is visible to everyone who can view its parent. A private thread is visible to its members and to thread moderators.--[Thread members](/http-api/thread-members/) defines joining, leaving, and member lists. [Forums](/http-api/forums/) defines forum and media channels, where every thread is a post.+A thread is a channel inside a guild text, announcement, forum or media channel with its own messages. Public and announcement threads are visible to everyone who can view the parent, and a private thread is visible to its [members](/http-api/thread-members/) and to thread moderators.:::note[User requests need the `channel_threads` client capability]-A user request without the `channel_threads` client capability gets 404 `NOT_FOUND` from every route with a route header on this page. A bot needs no declaration. [Client capability](#client-capability) has the details.+A user request needs the `channel_threads` [client capability](#client-capability), and a bot needs none.:::-[List active guild threads](#list-active-guild-threads) returns 404 `NOT_FOUND` to every user. [Modify thread](#modify-thread) and [Delete thread](#delete-thread) return 404 `UNKNOWN_CHANNEL` to a user without the capability.-## Thread object-A thread is a [channel object](/http-api/channels/#channel-object) with the thread fields below.+A thread is a [channel object](/http-api/channels/#channel-object) with the fields below.### Structure@@ -27,34 +23,24 @@ A thread is a [channel object](/http-api/channels/#channel-object) with the thre| id<sup>1</sup> | snowflake | The ID of the thread || type | integer | The [thread type](#thread-types) || guild_id | snowflake | The ID of the guild |-| parent_id | snowflake | The ID of the text, announcement, forum, or media channel the thread belongs to |+| parent_id | snowflake | The ID of the parent channel || owner_id | snowflake | The ID of the user or webhook that created the thread || name | string | The name of the thread (1-100 characters) |-| last_message_id | ?snowflake | The ID of the most recent message, or null when the thread has none |-| last_pin_timestamp | ?ISO8601 timestamp | The time a message was most recently pinned, or null when nothing has ever been pinned |+| last_message_id | ?snowflake | The ID of the most recent message |+| last_pin_timestamp | ?ISO8601 timestamp | The time a message was most recently pinned || rate_limit_per_user | integer | The slowmode interval in seconds (0-21,600) |-| flags<sup>2</sup> | integer | The [channel flags](/http-api/forums/#channel-flags) of the thread |+| flags | integer | The [channel flags](/http-api/forums/#channel-flags) of the thread (only `PINNED`, on a forum post) || thread_metadata | [thread metadata](#thread-metadata-object) object | The archive and lock state of the thread |-| message_count<sup>3</sup> | integer | The number of messages in the thread |-| total_message_sent<sup>4</sup> | integer | The number of messages ever sent in the thread |+| message_count | integer | The number of messages, not counting deleted messages or the first message of a forum post |+| total_message_sent | integer | The number of messages ever sent, not counting the first message of a forum post || member_count | integer | The number of thread members, capped at 50 |-| applied_tags?<sup>5</sup> | array[snowflake] | The IDs of the [forum tags](/http-api/forums/#forum-tag-object) applied to a post (max 5) |-| member_ids_preview?<sup>5</sup> | array[snowflake] | The IDs of the most recently joined members of a post, newest first (max 8) |-| member?<sup>6</sup> | [thread member](/http-api/thread-members/#thread-member-object) object | The thread member object of the caller |--<sup>1</sup> A thread started from a message has the ID of that message. The first message of a forum post has the ID of the post--<sup>2</sup> Only `PINNED` is ever set, and only on a forum or media post--<sup>3</sup> Excludes the first message of a forum post and every deleted message--<sup>4</sup> Excludes the first message of a forum post. Deleting a message does not lower it+| applied_tags? | array[snowflake] | The IDs of the [forum tags](/http-api/forums/#forum-tag-object) on a forum post (max 5) |+| member_ids_preview? | array[snowflake] | The IDs of the newest members of a forum post (max 8) |+| member? | [thread member](/http-api/thread-members/#thread-member-object) object | The thread member object of the caller, when the caller is a member |-<sup>5</sup> Present only on a thread whose parent is a forum or media channel. A Gateway payload has no `member_ids_preview`+<sup>1</sup> A thread started from a message has the ID of that message-<sup>6</sup> Present only when the caller is a member, on [Get channel](/http-api/channels/#get-channel), on [Modify channel](/http-api/channels/#modify-channel), on `thread` of a message, on [Thread Create](/gateway/threads/#thread-create), and on the `threads` list of a guild in [Ready](/gateway/events/#ready), [Guild Create](/gateway/events/#guild-create), and [Guild Sync](/gateway/events/#guild-sync)--The schema also declares `topic`, `url`, `icon`, `position`, `bitrate`, `user_limit`, `voice_connection_limit`, `rtc_region`, `rtc_p2p`, `permission_overwrites`, `recipients`, `nsfw`, `nsfw_override`, `content_warning_level`, `content_warning_text`, `nicks`, `default_auto_archive_duration`, `default_thread_rate_limit_per_user`, `available_tags`, `default_reaction_emoji`, `default_sort_order`, `default_forum_layout`, and `default_tag_setting`. Fluxer never sends them on a thread. A thread uses the permissions of its parent as [Thread permissions](#thread-permissions) describes. An age restriction and a content warning resolve through the parent, then the parent category, and finally the guild.+The schema also declares `topic`, `url`, `icon`, `position`, `bitrate`, `user_limit`, `voice_connection_limit`, `rtc_region`, `rtc_p2p`, `permission_overwrites`, `recipients`, `nsfw`, `nsfw_override`, `content_warning_level`, `content_warning_text`, `nicks`, `default_auto_archive_duration`, `default_thread_rate_limit_per_user`, `available_tags`, `default_reaction_emoji`, `default_sort_order`, `default_forum_layout` and `default_tag_setting`. Fluxer never sends them on a thread.### Example@@ -93,29 +79,19 @@ The archive and lock state of a thread.| --- | --- | --- || archived | boolean | Whether the thread is archived || auto_archive_duration | integer | The [auto archive duration](#auto-archive-durations) in minutes |-| archive_timestamp<sup>1</sup> | ISO8601 timestamp | The time the thread was last archived, unarchived, or given a new auto archive duration |+| archive_timestamp | ISO8601 timestamp | The time the archive state or auto archive duration last changed, or the creation time || locked | boolean | Whether only thread moderators can act in the thread |-| invitable?<sup>2</sup> | boolean | Whether a member who is not a thread moderator can add members who are not thread moderators |+| invitable? | boolean | Whether members who are not thread moderators can add members, on a private thread || create_timestamp | ISO8601 timestamp | The time the thread was created |-<sup>1</sup> Equal to `create_timestamp` until the first of those changes--<sup>2</sup> Present only on a private thread-## Thread types| Value | Name | Description || --- | --- | --- |-| 10 | ANNOUNCEMENT_THREAD | A thread in an announcement channel, visible to everyone who can view the parent |-| 11 | PUBLIC_THREAD | A thread visible to everyone who can view the parent |+| 10 | ANNOUNCEMENT_THREAD | A thread in an announcement channel |+| 11 | PUBLIC_THREAD | A thread in a guild text channel, or a forum post || 12 | PRIVATE_THREAD | A thread in a guild text channel visible to its members and to thread moderators |-A forum or media post is always `PUBLIC_THREAD`. Every thread in an announcement channel is `ANNOUNCEMENT_THREAD`, and an announcement channel holds no private threads.--Converting a guild text channel into an announcement channel turns each of its public threads into an announcement thread. Converting it back turns them into public threads again. Fluxer emits [Thread Update](/gateway/threads/#thread-update) with the new `type` for each active thread. A guild text channel with a private thread cannot become an announcement channel, and the request returns 400 `CHANNEL_HAS_THREADS`.--A message in an announcement thread cannot be published to following channels. Publishing returns 400 `ANNOUNCEMENT_CHANNEL_REQUIRED`. Publishing the message a thread started from works as for any other announcement. A copy delivered to a following channel starts with neither `HAS_THREAD` nor `thread`.-## Auto archive durations| Value | Description |@@ -125,57 +101,33 @@ A message in an announcement thread cannot be published to following channels. P| 4320 | Three days, the default || 10080 | One week |-A create request that omits `auto_archive_duration` gets 4320. Fluxer does not apply the `default_auto_archive_duration` of the parent.+A new thread ignores the parent's `default_auto_archive_duration`.## Thread lifecycle-Fluxer archives an active thread once `auto_archive_duration` minutes pass after the later of its last message and its `archive_timestamp`. It then emits [Thread Update](/gateway/threads/#thread-update). A pinned forum post is never archived automatically. Archiving a pinned post clears its `PINNED` flag.+Fluxer archives a thread `auto_archive_duration` minutes after its last message or its `archive_timestamp`, whichever is later, and sends [Thread Update](/gateway/threads/#thread-update). A pinned forum post is never archived automatically. A guild can have at most 1,000 active threads, and starting or unarchiving one past that returns 400 `MAX_ACTIVE_THREADS`.-A guild holds at most 1,000 active threads. Creating or unarchiving a thread past that count returns 400 `MAX_ACTIVE_THREADS`.--Sending a message to an archived thread unarchives it. Fluxer emits [Thread Update](/gateway/threads/#thread-update) before the message. A locked thread returns 400 `THREAD_LOCKED` to a caller who is not a thread moderator for a message, a reaction, a pin, an edit, a join, or an added member.--An archived thread accepts no reaction, pin, edit, join, leave, or member change, and each returns 400 `THREAD_ARCHIVED`. Deleting a message in an archived thread is allowed.--### Thread moderators--A thread moderator is the guild owner, a member with `ADMINISTRATOR`, or a member holding `MANAGE_THREADS` in the parent who is not timed out.+Sending a message to an archived thread unarchives it. In an archived thread, reacting, pinning, editing, joining, leaving and changing members return 400 `THREAD_ARCHIVED`, and deleting a message still works. In a locked thread, sending, reacting, pinning, editing, joining and adding members return 400 `THREAD_LOCKED` to anyone who is not a thread moderator.## Thread permissions-A thread has no permission overwrites of its own. Fluxer computes permissions in the parent channel and then replaces `SEND_MESSAGES` with `SEND_MESSAGES_IN_THREADS`. Posting in a forum or media channel itself uses the unreplaced `SEND_MESSAGES` of that channel.+A thread has no permission overwrites. Fluxer uses the permissions of the parent with `SEND_MESSAGES_IN_THREADS` in place of `SEND_MESSAGES`. The thread bits are in [Permissions](/http-api/permissions/#permissions).-[Permissions](/http-api/permissions/#permissions) lists the four thread bits, `MANAGE_THREADS`, `CREATE_PUBLIC_THREADS`, `CREATE_PRIVATE_THREADS`, and `SEND_MESSAGES_IN_THREADS`. `MANAGE_THREADS` is an [elevated permission](/http-api/permissions/#elevated-permissions). `ADMINISTRATOR` grants all four bits. The four bits are [feature-gated](/http-api/permissions/#feature-gated-permission-bits).+### Thread moderators-These actions need an enrolled authenticator while the guild [MFA level](/http-api/guilds/#mfa-levels) is elevated, unless the caller owns the guild. Without one, each returns 400 `TWO_FACTOR_REQUIRED`.+A thread moderator is the guild owner, a member with `ADMINISTRATOR`, or a member with `MANAGE_THREADS` in the parent who is not timed out.-- [Delete thread](#delete-thread).-- [Modify thread](#modify-thread) with a change to `locked`, `rate_limit_per_user`, or `flags` that needs a thread moderator, or with unarchiving a locked thread.-- [Modify thread](#modify-thread) with a change to `name`, `auto_archive_duration`, or `invitable`, or with archiving, by a caller who is not the thread owner.-- [Join thread](/http-api/thread-members/#join-thread), [Add thread member](/http-api/thread-members/#add-thread-member), and [Remove thread member](/http-api/thread-members/#remove-thread-member) in the cases those entries state.+### Access rules-A timed-out member can read a thread and can join or leave one. A timed-out member who is neither the guild owner nor an administrator receives 403 `COMMUNICATION_DISABLED` for starting, modifying, or deleting a thread. The same applies to adding or removing a thread member, sending a message, adding a reaction, pinning, and editing their own message in a thread.+A timed-out member who is not the guild owner or an administrator can read, join and leave threads and delete messages, but gets 403 `COMMUNICATION_DISABLED` for anything else.-A caller who can view the parent but is neither a member nor a thread moderator receives 403 `MISSING_ACCESS` for a private thread. Losing access to the parent keeps the membership, and the member receives no event from the thread until access returns.+A caller who is not a member or thread moderator gets 403 `MISSING_ACCESS` for a private thread.## Start thread from message<RouteHeader method="POST" path="/v1/channels/{channel_id}/messages/{message_id}/threads" bot auditReason />-Starts a public thread from a message in a guild text channel, or an announcement thread from a message in an announcement channel. Requires `CREATE_PUBLIC_THREADS` and `READ_MESSAGE_HISTORY`. Returns a [thread object](#thread-object) on success. Emits a [Thread Create](/gateway/threads/#thread-create) Gateway event.--### Limitations--- The channel must be a guild text or announcement channel.-- The message must be a default message or a reply.-- A message starts at most one thread.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the guild text or announcement channel |-| message_id | snowflake | The ID of the message to start the thread from |+Starts a thread from a regular message or a reply in a guild text or announcement channel and returns a [thread object](#thread-object). You need `CREATE_PUBLIC_THREADS` and `READ_MESSAGE_HISTORY`.### JSON body@@ -183,64 +135,30 @@ Starts a public thread from a message in a guild text channel, or an announcemen| --- | --- | --- || name | string | The name of the thread (1-100 characters) || auto_archive_duration? | integer | The [auto archive duration](#auto-archive-durations) in minutes (default 4320) |-| rate_limit_per_user? | integer | The slowmode interval in seconds (0-21,600) |--`rate_limit_per_user` defaults to the `default_thread_rate_limit_per_user` of the parent, or `0` when the parent has none.+| rate_limit_per_user? | integer | The slowmode interval in seconds (0-21,600, default from the parent) |### Response| Status | Body | Condition || --- | --- | --- |-| 201 | [thread](#thread-object) object | Thread was started |-| 400 | [error response](/http-api/#error-response) | Channel is not a guild text or announcement channel and the request returns `INVALID_CHANNEL_TYPE` |-| 400 | [error response](/http-api/#error-response) | Message is a system message and the request returns `CANNOT_MODIFY_SYSTEM_WEBHOOK` |-| 400 | [error response](/http-api/#error-response) | Message already started a thread and the request returns `THREAD_ALREADY_CREATED_FOR_MESSAGE` |-| 400 | [error response](/http-api/#error-response) | Guild has 1,000 active threads and the request returns `MAX_ACTIVE_THREADS` |-| 400 | [error response](/http-api/#error-response) | Parent slowmode denies the thread and the request returns `SLOWMODE_RATE_LIMITED` |-| 403 | [error response](/http-api/#error-response) | Caller lacks a required permission and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | Caller is timed out and the request returns `COMMUNICATION_DISABLED` |-| 403 | [error response](/http-api/#error-response) | Caller account is limited and the request returns `ACCOUNT_LIMITED` |-| 403 | [error response](/http-api/#error-response) | The resolved age restriction is not satisfied and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or is outside a guild, and the request returns `NOT_FOUND` |-| 404 | [error response](/http-api/#error-response) | Message does not exist and the request returns `UNKNOWN_MESSAGE` |--### Side effects+| 201 | [thread](#thread-object) object | The thread was started |+| 400 | [error response](/http-api/#error-response) | `CANNOT_MODIFY_SYSTEM_WEBHOOK` when the message is a system message |+| 400 | [error response](/http-api/#error-response) | `THREAD_ALREADY_CREATED_FOR_MESSAGE` when the message already started a thread |+| 400 | [error response](/http-api/#error-response) | `SLOWMODE_RATE_LIMITED` when the parent slowmode applies |-- Fluxer sets `HAS_THREAD` on the message and emits [Message Update](/gateway/events/#message-update) with `thread`.-- Fluxer emits [Message Create](/gateway/events/#message-create) for the `THREAD_STARTER_MESSAGE` of the thread.-- A source message outside the five most recent messages of the parent also produces a `THREAD_CREATED` message in the parent.-- The caller becomes the first thread member.+Fluxer sends [Thread Create](/gateway/threads/#thread-create), and [Message Update](/gateway/events/#message-update) for the source message.-Starting a thread uses the parent slowmode on its own counter. A bot and a member holding `BYPASS_SLOWMODE` are exempt.--### Rate limit--10 requests per 10 seconds for each authenticated user and channel ID, on the `channel:thread:create::channel_id` bucket.+The rate limit is 10 requests per 10 seconds, on the `channel:thread:create::channel_id` bucket.## Start thread<RouteHeader method="POST" path="/v1/channels/{channel_id}/threads" bot auditReason />-Starts a thread with no source message, or creates a post in a forum or media channel. Returns a [thread object](#thread-object), or a [forum post object](/http-api/forums/#forum-post-object) for a post, on success. Emits a [Thread Create](/gateway/threads/#thread-create) Gateway event.--### Limitations--- In a guild text channel, a public thread requires `CREATE_PUBLIC_THREADS` and a private thread requires `CREATE_PRIVATE_THREADS`.-- In an announcement channel, a thread requires `CREATE_PUBLIC_THREADS`. Both `ANNOUNCEMENT_THREAD` and `PUBLIC_THREAD` start an announcement thread, and `PRIVATE_THREAD` returns 400 `INVALID_CHANNEL_TYPE`.-- In a guild text channel, `ANNOUNCEMENT_THREAD` returns 400 `INVALID_CHANNEL_TYPE`.-- In a forum or media channel, a post requires `SEND_MESSAGES` in that channel.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the guild text, announcement, forum, or media channel |+Starts a thread with no source message, or creates a post in a forum or media channel. A public or announcement thread needs `CREATE_PUBLIC_THREADS`, a private thread needs `CREATE_PRIVATE_THREADS` and a forum post needs `SEND_MESSAGES`.### JSON body-The parent type selects the body. Either body can be sent as multipart form data with the JSON in a `payload_json` part. A forum or media post can also attach files in `files[n]` parts, as [Create message](/http-api/messages/#create-message) describes.--`rate_limit_per_user` defaults to the `default_thread_rate_limit_per_user` of the parent, or `0` when the parent has none.+The body depends on the parent channel type, and you can send it as multipart form data with the JSON in `payload_json`. A forum post can attach `files[n]` parts as in [Create message](/http-api/messages/#create-message).#### Text and announcement channel body@@ -249,148 +167,70 @@ The parent type selects the body. Either body can be sent as multipart form data| name | string | The name of the thread (1-100 characters) || type | integer | The [thread type](#thread-types) to start || auto_archive_duration? | integer | The [auto archive duration](#auto-archive-durations) in minutes (default 4320) |-| rate_limit_per_user? | integer | The slowmode interval in seconds (0-21,600) |-| invitable?<sup>1</sup> | boolean | Whether a member who is not a thread moderator can add members who are not thread moderators (default true) |--<sup>1</sup> Applies only to a private thread+| rate_limit_per_user? | integer | The slowmode interval in seconds (0-21,600, default from the parent) |+| invitable? | boolean | Whether members who are not thread moderators can add members, on a private thread (default true) |#### Forum post body| Field | Type | Description || --- | --- | --- || name | string | The name of the post (1-100 characters) |-| message | object | The first message, with the fields of [Create message](/http-api/messages/#create-message) other than `message_reference`, `nonce`, `tts`, and `favorite_meme_id` |-| applied_tags?<sup>1</sup> | array[snowflake] | The IDs of the forum tags to apply (max 5) |+| message | object | The first message, with the fields of [Create message](/http-api/messages/#create-message) other than `message_reference`, `nonce`, `tts` and `favorite_meme_id` |+| applied_tags? | array[snowflake] | The IDs of the forum tags to apply (max 5, required under `REQUIRE_TAG`) || auto_archive_duration? | integer | The [auto archive duration](#auto-archive-durations) in minutes (default 4320) |-| rate_limit_per_user? | integer | The slowmode interval in seconds (0-21,600) |-| type?<sup>2</sup> | integer | The thread type (`11` only) |--<sup>1</sup> Required when the channel has `REQUIRE_TAG`. A tag marked `moderated` needs a thread moderator--<sup>2</sup> Any other value returns 400 `INVALID_CHANNEL_TYPE`+| rate_limit_per_user? | integer | The slowmode interval in seconds (0-21,600, default from the parent) |+| type? | integer | The thread type (`11` only) |### Response| Status | Body | Condition || --- | --- | --- |-| 201 | [forum post](/http-api/forums/#forum-post-object) object | Post was created in a forum or media channel |-| 201 | [thread](#thread-object) object | Thread was started in a guild text or announcement channel |-| 400 | [error response](/http-api/#error-response) | Channel cannot hold threads, or the thread type does not fit it, returning `INVALID_CHANNEL_TYPE` |-| 400 | [error response](/http-api/#error-response) | Guild has 1,000 active threads and the request returns `MAX_ACTIVE_THREADS` |-| 400 | [error response](/http-api/#error-response) | Parent slowmode denies the thread and the request returns `SLOWMODE_RATE_LIMITED` |-| 400 | [error response](/http-api/#error-response) | A forum post names no tag under `REQUIRE_TAG` and the request returns `FORUM_TAG_REQUIRED` |-| 400 | [error response](/http-api/#error-response) | A forum post names no tag, with `REQUIRE_TAG` and no unmoderated tag, returning `NO_TAGS_AVAILABLE_TO_NON_MODERATORS` |-| 403 | [error response](/http-api/#error-response) | Caller lacks a required permission or applies a moderated tag, returning `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | Caller is timed out and the request returns `COMMUNICATION_DISABLED` |-| 403 | [error response](/http-api/#error-response) | Caller account is limited and the request returns `ACCOUNT_LIMITED` |-| 403 | [error response](/http-api/#error-response) | The resolved age restriction is not satisfied and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or is outside a guild, and the request returns `NOT_FOUND` |-| 404 | [error response](/http-api/#error-response) | A tag does not exist and the request returns `UNKNOWN_FORUM_TAG` |--In a channel with `REQUIRE_TAG` and no unmoderated tag, a caller who is not a thread moderator receives `NO_TAGS_AVAILABLE_TO_NON_MODERATORS`, and a thread moderator receives `FORUM_TAG_REQUIRED`. [Creating and modifying a forum](/http-api/forums/#creating-and-modifying-a-forum) states how a channel reaches that state.--### Side effects--- A public thread in a guild text channel and an announcement thread post a `THREAD_CREATED` message in the parent. A private thread and a forum post have none.-- The first message of a forum post has the ID of the post, and a failed first message deletes the post again.-- Creating a forum post marks the forum as read for a user caller.-- The caller becomes the first thread member.+| 201 | [forum post](/http-api/forums/#forum-post-object) object | The post was created in a forum or media channel |+| 201 | [thread](#thread-object) object | The thread was started in a guild text or announcement channel |+| 400 | [error response](/http-api/#error-response) | `INVALID_CHANNEL_TYPE` when the thread type does not fit the channel |+| 400 | [error response](/http-api/#error-response) | `FORUM_TAG_REQUIRED` when a post under `REQUIRE_TAG` has no tag |+| 400 | [error response](/http-api/#error-response) | `NO_TAGS_AVAILABLE_TO_NON_MODERATORS` when a non-moderator's post under `REQUIRE_TAG` has no tag and every tag is moderated |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_FORUM_TAG` when a tag does not exist |-### Rate limit+Fluxer sends [Thread Create](/gateway/threads/#thread-create).-10 requests per 10 seconds for each authenticated user and channel ID, on the `channel:thread:create::channel_id` bucket.+The rate limit is 10 requests per 10 seconds, on the `channel:thread:create::channel_id` bucket.## Modify thread-[Modify channel](/http-api/channels/#modify-channel) on a thread takes the thread body below and returns the updated [thread object](#thread-object). It emits a [Thread Update](/gateway/threads/#thread-update) Gateway event when a field changes.--### Limitations--- `name`, `auto_archive_duration`, and archiving need the thread owner or a thread moderator.-- `locked` needs a thread moderator, and the thread owner can set it to true.-- `rate_limit_per_user` and `flags` need a thread moderator.-- `invitable` needs the thread owner or a thread moderator.-- Unarchiving needs a thread member, the thread owner, or a thread moderator, and needs a thread moderator when the thread is locked.-- An archived thread accepts no other change unless the same body sets `archived` to false.+[Modify channel](/http-api/channels/#modify-channel) on a thread takes the body below and returns the [thread object](#thread-object). The thread owner or a thread moderator can change `name`, `auto_archive_duration`, `invitable` and `applied_tags`, and can archive or lock the thread. Any thread member can unarchive it. Only a thread moderator can change `rate_limit_per_user` or `flags`, unlock the thread, or change anything in a locked thread.### Thread body| Field | Type | Description || --- | --- | --- || name? | string | The name of the thread (1-100 characters) |-| archived?<sup>1</sup> | ?boolean | Whether the thread is archived |+| archived? | ?boolean | Whether the thread is archived (null leaves it unchanged) || auto_archive_duration? | integer | The [auto archive duration](#auto-archive-durations) in minutes |-| locked?<sup>1</sup> | ?boolean | Whether only thread moderators can act in the thread |-| rate_limit_per_user?<sup>2</sup> | ?integer | The slowmode interval in seconds (0-21,600) |-| flags?<sup>3</sup> | integer | The [channel flags](/http-api/forums/#channel-flags) of the thread |-| applied_tags?<sup>4</sup> | array[snowflake] | The complete set of forum tag IDs (max 5) |-| invitable?<sup>5</sup> | ?boolean | Whether a member who is not a thread moderator can add members who are not thread moderators |--<sup>1</sup> Null leaves the value unchanged--<sup>2</sup> Null sets `0`--<sup>3</sup> Only `PINNED` on a forum or media post. Any other bit returns 400 `INVALID_FORM_BODY`--<sup>4</sup> Only on a forum or media post, and only by the thread owner or a thread moderator--<sup>5</sup> Applies only to a private thread. Null leaves the value unchanged--On a public thread in a guild text channel `applied_tags` returns 400 `INVALID_CHANNEL_TYPE`. A private or announcement thread ignores it.--Pinning a second post in one forum returns 400 `MAX_PINNED_THREADS_IN_FORUM`. Changing `auto_archive_duration` resets `archive_timestamp`. Renaming a thread posts a `CHANNEL_NAME_CHANGE` message in it.+| locked? | ?boolean | Whether only thread moderators can act in the thread (null leaves it unchanged) |+| rate_limit_per_user? | ?integer | The slowmode interval in seconds (0-21,600, null sets 0) |+| flags? | integer | The [channel flags](/http-api/forums/#channel-flags) (only `PINNED`, on a forum post) |+| applied_tags? | array[snowflake] | The complete set of forum tag IDs on a forum post (max 5) |+| invitable? | ?boolean | Whether members who are not thread moderators can add members, on a private thread |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [thread](#thread-object) object | Thread was modified |-| 400 | [error response](/http-api/#error-response) | Thread is archived and the body changes another field, returning `THREAD_ARCHIVED` |-| 400 | [error response](/http-api/#error-response) | Thread is locked and the caller is not a thread moderator, returning `THREAD_LOCKED` |-| 400 | [error response](/http-api/#error-response) | Unarchiving would exceed 1,000 active threads and the request returns `MAX_ACTIVE_THREADS` |-| 400 | [error response](/http-api/#error-response) | Forum already has a pinned post and the request returns `MAX_PINNED_THREADS_IN_FORUM` |-| 400 | [error response](/http-api/#error-response) | `flags` sets a bit the thread cannot hold and the request returns `INVALID_FORM_BODY` |-| 400 | [error response](/http-api/#error-response) | `applied_tags` is set on a public thread in a guild text channel, returning `INVALID_CHANNEL_TYPE` |-| 400 | [error response](/http-api/#error-response) | `applied_tags` is empty under `REQUIRE_TAG` and the request returns `FORUM_TAG_REQUIRED` |-| 400 | [error response](/http-api/#error-response) | `applied_tags` is empty, with `REQUIRE_TAG` and no unmoderated tag, returning `NO_TAGS_AVAILABLE_TO_NON_MODERATORS` |-| 400 | [error response](/http-api/#error-response) | Caller needs an authenticator and the request returns `TWO_FACTOR_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Caller lacks the owner or moderator role the field needs and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | Caller is timed out and the request returns `COMMUNICATION_DISABLED` |-| 404 | [error response](/http-api/#error-response) | A tag does not exist and the request returns `UNKNOWN_FORUM_TAG` |--In a channel with `REQUIRE_TAG` and no unmoderated tag, a caller who is not a thread moderator receives `NO_TAGS_AVAILABLE_TO_NON_MODERATORS`, and a thread moderator receives `FORUM_TAG_REQUIRED`. [Creating and modifying a forum](/http-api/forums/#creating-and-modifying-a-forum) states how a channel reaches that state.--### Rate limit--Shared with [Modify channel](/http-api/channels/#modify-channel).--## Delete thread+| 200 | [thread](#thread-object) object | The thread was modified |+| 400 | [error response](/http-api/#error-response) | `MAX_PINNED_THREADS_IN_FORUM` when the forum already has a pinned post |-[Delete or leave channel](/http-api/channels/#delete-or-leave-channel) on a thread deletes it with its messages, attachments, and memberships. It requires a [thread moderator](#thread-moderators) and emits a [Thread Delete](/gateway/threads/#thread-delete) Gateway event.+Fluxer sends [Thread Update](/gateway/threads/#thread-update) when a field changes. The rate limit is the one for [Modify channel](/http-api/channels/#modify-channel).-### Side effects--- The source message of a thread started from a message loses `HAS_THREAD`, and Fluxer emits [Message Update](/gateway/events/#message-update) for it.-- Fluxer removes the thread and its messages from search.-- The guild audit log records action type 112.--### Rate limit+## Delete thread-Shared with [Delete or leave channel](/http-api/channels/#delete-or-leave-channel).+[Delete or leave channel](/http-api/channels/#delete-or-leave-channel) on a thread deletes it with its messages. You need to be a [thread moderator](#thread-moderators). Fluxer sends [Thread Delete](/gateway/threads/#thread-delete).## List active guild threads<RouteHeader method="GET" path="/v1/guilds/{guild_id}/threads/active" bot />-Returns every active thread in the guild that the bot can view, newest first. Requires a bot token.--A private thread is included when the bot is a member or a thread moderator in its parent.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild |+Returns every active thread in the guild that the bot can view, newest first.### Response body@@ -403,26 +243,16 @@ A private thread is included when the bot is a member or a thread moderator in i| Status | Body | Condition || --- | --- | --- |-| 200 | active threads object | Threads were returned |-| 403 | [error response](/http-api/#error-response) | Bot is not a member of the guild and the request returns `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Caller is a user, and the request returns `NOT_FOUND` |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |+| 200 | active threads object | The threads were returned |+| 404 | [error response](/http-api/#error-response) | `NOT_FOUND` when the caller is a user |-### Rate limit--5 requests per 10 seconds for each authenticated user and guild ID, on the `guild:threads:active::guild_id` bucket.+The rate limit is 5 requests per 10 seconds, on the `guild:threads:active::guild_id` bucket.## List public archived threads<RouteHeader method="GET" path="/v1/channels/{channel_id}/threads/archived/public" bot />-Returns the archived public threads of a guild text, announcement, forum, or media channel, most recently archived first. An announcement channel returns announcement threads. Requires `READ_MESSAGE_HISTORY`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the parent channel |+Returns the archived public and announcement threads of a channel, most recently archived first. You need `READ_MESSAGE_HISTORY`.### Query parameters@@ -437,34 +267,15 @@ Returns the archived public threads of a guild text, announcement, forum, or med| --- | --- | --- || threads | array[[thread](#thread-object) object] | The archived threads || members | array[[thread member](/http-api/thread-members/#thread-member-object) object] | A thread member object for each returned thread the caller joined |-| has_more | boolean | Whether a later request can return more threads |--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | archived threads object | Threads were returned |-| 400 | [error response](/http-api/#error-response) | Channel is not a thread parent and the request returns `INVALID_CHANNEL_TYPE` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `READ_MESSAGE_HISTORY` and the request returns `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or is outside a guild, and the request returns `NOT_FOUND` |--### Rate limit+| has_more | boolean | Whether more threads are available |-20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:threads:archived:list::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:threads:archived:list::channel_id` bucket.## List private archived threads<RouteHeader method="GET" path="/v1/channels/{channel_id}/threads/archived/private" bot />-Returns the archived private threads of a guild text channel, most recently archived first. Requires `READ_MESSAGE_HISTORY` and a [thread moderator](#thread-moderators).--An announcement, forum, or media channel returns 400 `INVALID_CHANNEL_TYPE`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the guild text channel |+Returns the archived private threads of a guild text channel, most recently archived first. You need `READ_MESSAGE_HISTORY`, and you have to be a [thread moderator](#thread-moderators).### Query parameters@@ -479,17 +290,15 @@ An announcement, forum, or media channel returns 400 `INVALID_CHANNEL_TYPE`.| --- | --- | --- || threads | array[[thread](#thread-object) object] | The archived threads || members | array[[thread member](/http-api/thread-members/#thread-member-object) object] | A thread member object for each returned thread the caller joined |-| has_more | boolean | Whether a later request can return more threads |--### Rate limit+| has_more | boolean | Whether more threads are available |-20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:threads:archived:list::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:threads:archived:list::channel_id` bucket.## List joined private archived threads<RouteHeader method="GET" path="/v1/channels/{channel_id}/users/@me/threads/archived/private" bot />-Returns the archived private threads of a guild text channel that the caller joined, newest first. Requires `READ_MESSAGE_HISTORY`.+Returns the archived private threads of a guild text channel that you joined, newest thread first. You need `READ_MESSAGE_HISTORY`.### Query parameters@@ -498,45 +307,37 @@ Returns the archived private threads of a guild text channel that the caller joi| before? | snowflake | Return threads with an ID below this thread ID || limit? | integer | The maximum number of threads to return (2-100, default 50) |-An announcement, forum, or media channel returns 400 `INVALID_CHANNEL_TYPE`.-### Response body| Field | Type | Description || --- | --- | --- || threads | array[[thread](#thread-object) object] | The archived threads || members | array[[thread member](/http-api/thread-members/#thread-member-object) object] | A thread member object for each returned thread the caller joined |-| has_more | boolean | Whether a later request can return more threads |--### Rate limit+| has_more | boolean | Whether more threads are available |-20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:threads:archived:list::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:threads:archived:list::channel_id` bucket.## Search threads<RouteHeader method="GET" path="/v1/channels/{channel_id}/threads/search" bot />-Searches the threads of a guild text, announcement, forum, or media channel by name and tag. Requires `READ_MESSAGE_HISTORY`.--A caller who is not a thread moderator finds public threads and the private threads they joined.+Searches the threads of a channel by name and tag. You need `READ_MESSAGE_HISTORY`, and a caller who is not a thread moderator only finds public threads and private threads they joined.### Query parameters| Field | Type | Description || --- | --- | --- || name? | string | The text to match in thread names (max 100 characters) |-| tag?<sup>1</sup> | array[snowflake] | The forum tag IDs to filter by, repeated once per tag (max 20) |-| tag_setting? | string | `match_some` or `match_all`, defaulting to the `default_tag_setting` of the channel |+| tag? | array[snowflake] | The forum tag IDs to filter by, repeated once per tag (max 20) |+| tag_setting? | string | `match_some` or `match_all` (default from the channel) || archived? | boolean | Whether to return only archived or only active threads (default both) |-| sort_by? | string | `last_message_time`, `archive_time`, `relevance`, or `creation_time` (default `last_message_time`) |+| sort_by? | string | `last_message_time`, `archive_time`, `relevance` or `creation_time` (default `last_message_time`) || sort_order? | string | `asc` or `desc` (default `desc`) || limit? | integer | The maximum number of threads to return (1-25, default 25) || offset? | integer | The number of threads to skip (0-9,975, default 0) || max_id? | snowflake | Return threads with an ID below this ID || min_id? | snowflake | Return threads with an ID above this ID |-| slop? | integer | A value Fluxer accepts and ignores (0-100, default 2) |--<sup>1</sup> Fluxer drops a tag the channel does not have. Under `match_all` a dropped tag empties the result, and under `match_some` the result is empty when every tag is dropped+| slop? | integer | Accepted and ignored (0-100, default 2) |### Response body@@ -544,13 +345,11 @@ A caller who is not a thread moderator finds public threads and the private thre| --- | --- | --- || threads | array[[thread](#thread-object) object] | The matching threads || members | array[[thread member](/http-api/thread-members/#thread-member-object) object] | A thread member object for each returned thread the caller joined |-| has_more | boolean | Whether a later request can return more threads |+| has_more | boolean | Whether more threads are available || total_results | integer | The number of matching threads |-| first_messages?<sup>1</sup> | array[[message](/http-api/messages/#message-object) object] | The first message of each returned post |--<sup>1</sup> Present only for a forum or media channel+| first_messages? | array[[message](/http-api/messages/#message-object) object] | The first message of each returned forum post |-A 202 response has the body below. A search in a guild whose index is not built yet queues the build.+While the thread index for the guild is being built, the API returns 202 with the body below, and you retry after `retry_after` seconds.| Field | Type | Description || --- | --- | --- |@@ -563,52 +362,25 @@ A 202 response has the body below. A search in a guild whose index is not built| Status | Body | Condition || --- | --- | --- |-| 200 | thread search object | Search completed |-| 202 | index not ready object | The guild thread index is being built |-| 400 | [error response](/http-api/#error-response) | Channel is not a thread parent and the request returns `INVALID_CHANNEL_TYPE` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `READ_MESSAGE_HISTORY` and the request returns `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | Thread search is unavailable on the instance and the request returns `FEATURE_TEMPORARILY_DISABLED` |-| 403 | [error response](/http-api/#error-response) | The resolved age restriction is not satisfied and the request returns `NSFW_CONTENT_AGE_RESTRICTED` |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or is outside a guild, and the request returns `NOT_FOUND` |--### Rate limit+| 200 | The response body above | The search finished |+| 202 | The body after the response body | The thread index is being built |+| 403 | [error response](/http-api/#error-response) | `FEATURE_TEMPORARILY_DISABLED` when thread search is off on the instance |-20 requests per 10 seconds for each authenticated user and channel ID, on the `channel:threads:search::channel_id` bucket.+The rate limit is 20 requests per 10 seconds, on the `channel:threads:search::channel_id` bucket.## Thread messages| Value | Name | Description || --- | --- | --- |-| 18 | THREAD_CREATED | System message in the parent that announces a new public or announcement thread |-| 21 | THREAD_STARTER_MESSAGE | First message of a thread started from a message, built on read and never stored |--`message_reference.channel_id` of a `THREAD_CREATED` message is the thread, and the reference names no message.--Fluxer builds a `THREAD_STARTER_MESSAGE` when it reads the thread and stores none. It has the ID of its thread and references the source message. Deleting it returns 403 `MISSING_PERMISSIONS`. When the source message is deleted, the thread stays and its `referenced_message` becomes null.--A message that started a thread has `thread`, the [thread object](#thread-object), and the message flag `HAS_THREAD` (1 << 5). A role mention in a public or announcement thread adds the members of the role, up to 250 per message. A message gets `FAILED_TO_MENTION_SOME_ROLES_IN_THREAD` (1 << 8) when that limit or the [thread member limit](/http-api/thread-members/) stops a role member from being added. Only Fluxer sets either flag.+| 18 | THREAD_CREATED | A system message in the parent for a new public or announcement thread |+| 21 | THREAD_STARTER_MESSAGE | The first message of a thread started from a message, which references the source message |-Sending a message in a thread adds a user sender who has not joined it. A mentioned user who can view the parent is added too. A private thread that is not `invitable` adds mentioned users only when the sender is a thread moderator.+A thread started from a message gets `THREAD_CREATED` only when that message is not among the 5 newest in the parent.-## Thread fields on other objects--| Object | Field | Description |-| --- | --- | --- |-| [Text or announcement channel](/http-api/channels/#channel-object) | default_auto_archive_duration | The stored default [auto archive duration](/http-api/threads/#auto-archive-durations), which Fluxer does not apply to a new thread |-| [Text or announcement channel](/http-api/channels/#channel-object) | default_thread_rate_limit_per_user | The slowmode interval in seconds new threads inherit |-| [Read state](/http-api/read-states/#read-state-object) | flags | The [read state flags](/http-api/read-states/#read-state-flags) |-| [Message search result](/http-api/search/#message-search-result-object) | threads | The threads that contain a returned message |-| [Message search result](/http-api/search/#message-search-result-object) | members | A thread member object for each of those threads the caller joined |-| [Guild audit log response](/http-api/guild-audit-logs/#guild-audit-log-response-object) | threads | The threads a returned thread action targets |--The guild audit log records thread creation, update, and deletion as action types 110, 111, and 112.+A message that started a thread has a `thread` field with the [thread object](#thread-object) and the `HAS_THREAD` flag (1 << 5). Sending a message in a thread adds you and every mentioned user who can view the parent as thread members.## Client capability-A user request reaches a route with a route header on this page only with a session token and `channel_threads` in the `X-Fluxer-Features` header. Without both, Fluxer returns 404 `NOT_FOUND` before the rate limit and before the login check. An OAuth2 bearer token never has the capability. A request with no token gets the same 404. A bot token needs no declaration.--A `channel_id` that does not exist or names a channel outside a guild returns the same 404.--On other routes, a user request without the capability sees no threads. A route that resolves a thread, forum, or media channel by ID returns 404 `UNKNOWN_CHANNEL` unless its own entry states another result. Message lists drop `THREAD_CREATED` messages, and each message loses `thread` and both thread message flags.+A user request needs a session token and `channel_threads` in the `X-Fluxer-Features` header, or every route with a route header on this page returns 404 `NOT_FOUND`. An OAuth2 token can't declare the capability.-A Gateway session reads the separate `CHANNEL_THREADS` [session flag](/gateway/threads/#session-flag).+On other routes, a user without the capability sees no threads, and a route that looks up a thread by ID returns 404 `UNKNOWN_CHANNEL`. A Gateway session uses the `CHANNEL_THREADS` [session flag](/gateway/threads/#session-flag).diff --git a/fluxer_docs/src/content/docs/http-api/unfurl.mdx b/fluxer_docs/src/content/docs/http-api/unfurl.mdxindex 8655766dd..6ef4367d1 100644--- a/fluxer_docs/src/content/docs/http-api/unfurl.mdx+++ b/fluxer_docs/src/content/docs/http-api/unfurl.mdx@@ -6,106 +6,47 @@ description: Resolve a public URL into embed previews.import RouteHeader from '@/components/RouteHeader.astro';-Unfurl resolves one URL into the preview a message would show for it. That preview is an array of [embed](/http-api/messages/#embed-object) objects, the same objects the ordinary message path attaches.+Unfurl turns one URL into the preview a message would show for it, as an array of [embed](/http-api/messages/#embed-object) objects. It fetches the URL again on every call.-The route is user-only. Fluxer rejects a bot token and an OAuth2 bearer credential with 403 `ACCESS_DENIED`.+The route is user-only, so a bot token or OAuth2 bearer credential gets 403 `ACCESS_DENIED`.-## Site resolvers+## Supported sites-The table below lists every site resolver. Whether a site produces a preview depends on the site, and the Klipy and YouTube resolvers also require an API key configured on the instance. Other public URLs can produce previews from their page metadata or media content.+The sites below get a dedicated preview. Any other URL gets a preview from its page metadata, or a media embed when it points to an image, video or audio file.| Site | Matched URL || --- | --- |-| Hacker News<sup>1</sup> | `news.ycombinator.com` with a path beginning `/item` |-| Klipy<sup>2</sup><sup>3</sup> | `klipy.com` and `www.klipy.com` |+| Hacker News | `news.ycombinator.com/item` with an `id` query parameter |+| Klipy<sup>1</sup> | `klipy.com` and `www.klipy.com` || Tenor | `tenor.com` || xkcd | `xkcd.com` |-| YouTube<sup>2</sup><sup>4</sup> | `youtube.com`, `www.youtube.com`, `m.youtube.com`, `music.youtube.com`, `youtube-nocookie.com`, `www.youtube-nocookie.com`, and `youtu.be` |-| Wikipedia<sup>5</sup> | `wikipedia.org`, `www.wikipedia.org`, and the language hosts `en`, `de`, `fr`, `es`, `it`, `ja`, `ru`, and `zh`, with a path beginning `/wiki/` |-| Bluesky<sup>6</sup> | `bsky.app` |-| FxTwitter<sup>7</sup> | `fxtwitter.com`, `fixupx.com`, `twittpr.com`, `xfixup.com`, and any subdomain of those |-| Generic<sup>8</sup> | Every URL |+| YouTube<sup>1</sup> | `youtube.com` and its `www`, `m` and `music` hosts, `youtube-nocookie.com` and `www.youtube-nocookie.com`, and `youtu.be` |+| Wikipedia | `wikipedia.org` and its `www`, `en`, `de`, `fr`, `es`, `it`, `ja`, `ru` and `zh` hosts, under `/wiki/` |+| Bluesky | Post and profile URLs on `bsky.app` |+| FxTwitter | `fxtwitter.com`, `fixupx.com`, `twittpr.com`, `xfixup.com` and their subdomains |-<sup>1</sup> The item identifier is read from the `id` query parameter, and a URL that has none produces no embed--<sup>2</sup> Klipy and YouTube preview URLs use their canonical provider form--<sup>3</sup> Requires the instance to have a Klipy API key configured, and produces nothing without one--<sup>4</sup> The URL has a video identifier of 6 through 15 characters drawn from `A-Za-z0-9_-`, and the instance needs a YouTube Data API key configured--<sup>5</sup> A host whose language subdomain is outside the supported set does not match, and the article title is taken from the path after `/wiki/`--<sup>6</sup> Resolves a post URL and a profile URL. Any other path on the host produces no embed--<sup>7</sup> The mirror domains only. `twitter.com` and `x.com` do not match this resolver and fall through to the generic one--<sup>8</sup> Builds a direct media embed when the response is an image, video, or audio asset. A final response whose status is not 200 produces no embed--A resolved embed has at most one nested embed in `children`, and a nested embed has no `children` of its own.--## Network policy--Fluxer applies its network policy before every fetch and again to every redirect target. It refuses a URL on any of these grounds:--- The URL is empty, exceeds 8192 characters, or contains a control character.-- The scheme is neither HTTP nor HTTPS.-- The URL has user information.-- The port is `0`.-- The host is not a valid public hostname.-- The host resolves to a loopback, private, link-local, or otherwise reserved address.-- The host resolves to no address at all.--Resolution has a 12-second deadline. A fetch fails on a redirect loop, more than five redirects, or a document larger than 8 MiB.--A refused or failed fetch does not by itself fail the operation. When Fluxer produces no embed, the response is 200 with an empty array.--## Cache behaviour--This endpoint reads no cached result and resolves the URL again. A message can show a cached preview for the same URL, or receive its preview later in a message update.+<sup>1</sup> Needs an API key for this site on the instance. Without one, the URL gets the generic preview.## Resolve URL embeds<RouteHeader method="POST" path="/v1/unfurl" />-Resolves the supplied URL. Returns an array of [embed](/http-api/messages/#embed-object) objects, empty when no resolver produces one. User-only.--No permission applies.+Returns the embeds for `url`. Fluxer only fetches public HTTP and HTTPS addresses, and a fetch fails after five redirects or on a document larger than 8 MiB.### JSON body| Field | Type | Description || --- | --- | --- |-| url<sup>1</sup><sup>2</sup><sup>3</sup> | string | Absolute HTTP or HTTPS URL (1-2048 characters) |--<sup>1</sup> Trimmed before its length is measured--<sup>2</sup> A normalised value outside 1 through 2048 characters has the validation code `URL_LENGTH_INVALID`, and every other rejection at this boundary has `INVALID_URL_FORMAT`--<sup>3</sup> The value begins with `http://` or `https://`. Fluxer rejects a value that has embedded credentials, omits a host, uses a protocol-relative form, or ends its host with a trailing dot--Outside a development instance, Fluxer also rejects a URL that omits a top-level domain.--Explicit media can have `CONTAINS_EXPLICIT_MEDIA` in its [flags](/http-api/messages/#attachment-flags). Klipy media is not classified. Message previews in channels that permit explicit media can have different flags.--:::note[This route applies none of the message-path filtering]-It resolves precisely the URL in the request body and returns the complete resolver output, with no URL extraction, no embed cap, and no banned-content scan.-:::+| url | string | The HTTP or HTTPS URL to preview (1-2048 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | array[[embed](/http-api/messages/#embed-object) object] | Resolution completed, possibly with no embed |-| 403 | [error response](/http-api/#error-response) | Caller is a bot or presents a bearer credential and the request returns `ACCESS_DENIED` |-| 502 | [error response](/http-api/#error-response) | The resolution service reports a failure, or answers with a payload the API cannot read, and the request returns `BAD_GATEWAY` |-| 503 | [error response](/http-api/#error-response) | No resolution service is answering, or the service rejects the request at its concurrency limit, and the request returns `SERVICE_UNAVAILABLE` |-| 504 | [error response](/http-api/#error-response) | The resolution service does not answer within its 12-second deadline and the request returns `GATEWAY_TIMEOUT` |--### Side effects--Resolution can fetch the URL and its linked media. It creates no message.--### Rate limit+| 200 | array[[embed](/http-api/messages/#embed-object) object] | Resolution finished, possibly with no embed |+| 403 | [error response](/http-api/#error-response) | `ACCESS_DENIED` for a bot token or OAuth2 bearer credential |+| 502 | [error response](/http-api/#error-response) | `BAD_GATEWAY` when the unfurl service returns an error |+| 503 | [error response](/http-api/#error-response) | `SERVICE_UNAVAILABLE` when no unfurl service is answering |+| 504 | [error response](/http-api/#error-response) | `GATEWAY_TIMEOUT` when the unfurl service doesn't answer within 12 seconds |-10 requests per minute for each authenticated user, on the `unfurl:debug` bucket. Fluxer charges the bucket before it checks the credential, and keys it on the caller's address when no valid credential is present. An unauthenticated caller therefore consumes it and receives 429 `RATE_LIMITED` once it is exhausted, not 401.+The rate limit is 10 requests per minute, on the `unfurl:debug` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/users.mdx b/fluxer_docs/src/content/docs/http-api/users.mdxindex 1f1e388bb..7a835b929 100644--- a/fluxer_docs/src/content/docs/http-api/users.mdx+++ b/fluxer_docs/src/content/docs/http-api/users.mdx@@ -1,44 +1,35 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Users-description: User objects, public profiles, account tags, and the settings record.+description: User objects, profiles, the user settings object and the routes that look up other users.---import RouteHeader from '@/components/RouteHeader.astro';-A user is a Fluxer account. Another account sees the [partial user object](#partial-user-object), and the owner sees the [user object](#user-object). Account mutation is on [Current user](/http-api/users/current-user/).+A user is a Fluxer account, which other accounts see as a [partial user object](#partial-user-object) and its owner sees as a [user object](#user-object). You change your own account through [Current user](/http-api/users/current-user/).-Every route on this page takes a user session token or a bot token. An OAuth2 bearer credential is rejected with 403 `ACCESS_DENIED`.--| Object | Purpose |-| --- | --- |-| [Partial user](#partial-user-object) | Public account representation embedded everywhere |-| [User](#user-object) | Private owner representation |-| [User settings](#user-settings-object) | Account-wide settings record |-| [Full user profile](#full-user-profile-object) | Profile read for one target account |+The routes on this page accept a user session token or a bot token, and an OAuth2 bearer token gets 403 `ACCESS_DENIED`.## Partial user object-The public account representation embedded by messages, relationships, guild members, and applications.+The public account shape inside messages, relationships, guild members and applications.### Structure| Field | Type | Description || --- | --- | --- |-| id | snowflake | The [snowflake](/snowflakes/) that identifies the account |-| username | string | The account username (1-32 ASCII letters, digits, or underscores) |-| discriminator | string | The account discriminator, four decimal digits with leading zeroes |-| global_name | ?string | The display name of the account, or null when none is set |-| avatar<sup>1</sup> | ?string | The image hash of the account avatar, or null when none is set |-| avatar_color | ?integer | The packed 24-bit RGB colour derived from the stored avatar, or null |+| id | snowflake | The ID of the account |+| username | string | The username (1-32 ASCII letters, digits or underscores) |+| discriminator | string | The discriminator, four digits with leading zeroes |+| global_name | ?string | The display name, or null |+| avatar<sup>1</sup> | ?string | The avatar hash, or null |+| avatar_color | ?integer | The 24-bit RGB color taken from the avatar, or null || bot? | boolean | Whether the account is a bot, omitted when false || system? | boolean | Whether the account is a Fluxer system account, omitted when false || flags | integer | [Public user flags](#public-user-flags) |-| mention_flags? | integer | [Reply mention preference](#reply-mention-preferences), omitted when the account has no preference |--<sup>1</sup> An animated avatar hash has the `a_` prefix, and the prefix is removed while the account has no animated avatar entitlement+| mention_flags? | integer | [Reply mention preference](#reply-mention-preferences), omitted when there is none |-On an instance that applies the [account tiers](#account-tiers), an account that cannot yet reach other people shows them only its username and discriminator. `global_name` and `avatar` are null in every partial user that other accounts read, and the account's own reads are unchanged.+<sup>1</sup> An animated avatar hash starts with `a_`### Example@@ -54,170 +45,117 @@ On an instance that applies the [account tiers](#account-tiers), an account that}```-:::note[A deleted account keeps a renderable shape]-A completed deletion returns the username `DeletedUser`, the discriminator `0000`, the global name `Deleted User`, null `avatar` and `avatar_color`, `flags` of `0`, and no `mention_flags`. The `bot` field keeps its account value.-:::+While an account's `profile_restricted` is true, other accounts get null `global_name` and `avatar` for it. A deleted account has the username `DeletedUser`, the discriminator `0000`, the global name `Deleted User`, `flags` of `0` and a null `avatar` and `avatar_color`.-:::note[Substituted values appear only when deletion completes]-A system account never receives the deleted representation. An account only scheduled for deletion keeps its ordinary representation throughout the grace period.-:::--:::note[An instance without tags]-On an instance whose `tag_style` [feature](/http-api/instance/#instance-features-object) is `none`, the username is unique on its own, whatever the [account identity mode](/http-api/instance/#account-identity-modes). Every account that is not a bot has the discriminator `0000` there, and apps show the bare username without `#0000`. Bot accounts keep their random discriminators and show them. Elsewhere `0000` keeps its usual meaning.-:::+On an instance whose `tag_style` [feature](/http-api/instance/#instance-features-object) is `none`, usernames are unique on their own and every account that isn't a bot has the discriminator `0000`.## Public user flags-`flags` holds the publicly visible subset of the account's stored flags. `STAFF` is also removed from `flags` while the account has the stored `STAFF_HIDDEN` flag.+These are the values in the `flags` field, and `STAFF` is left out while the account hides its staff flag.| Value | Name | Description || --- | --- | --- || 1 << 0 | STAFF | Account is a staff member || 1 << 2 | PARTNER | Account is a partner || 1 << 3 | BUG_HUNTER | Account is a bug hunter |-| 1 << 4 | FRIENDLY_BOT | Bot accepts friend requests from users |-| 1 << 5 | FRIENDLY_BOT_MANUAL_APPROVAL | Bot requires manual approval for friend requests |+| 1 << 4 | FRIENDLY_BOT | Bot accepts friend requests |+| 1 << 5 | FRIENDLY_BOT_MANUAL_APPROVAL | Bot approves friend requests by hand || 1 << 6 | SPAMMER | Account is flagged as a spammer || 1 << 7 | PROFILE_HIDDEN | Profile details are hidden from other users |## Reply mention preferences-The account-wide preference applied when another account replies to one of this account's messages. `mention_flags` is exactly one of the values below. It is omitted from a serialised user while the stored value is `NO_PREFERENCE`.+The `mention_flags` value says whether replies to the account's messages mention it by default. A guild member has the same values in its own `mention_flags`, where `NO_PREFERENCE` falls back to the account value.| Value | Name | Description || --- | --- | --- |-| 0 | NO_PREFERENCE | The sender chooses whether each reply mentions this account, with no warning when the mention is toggled |-| 1 | PREFER_MENTION | Replies mention this account by default, and the sender is warned when they disable the mention |-| 2 | PREFER_NO_MENTION | Replies omit the mention by default, and the sender is warned when they enable it |--A guild member has the same enumeration in its own `mention_flags`, where `NO_PREFERENCE` inherits the account-wide value.+| 0 | NO_PREFERENCE | The sender chooses, with no warning |+| 1 | PREFER_MENTION | Replies mention the account, and the sender is warned when they turn the mention off |+| 2 | PREFER_NO_MENTION | Replies don't mention the account, and the sender is warned when they turn the mention on |## User object-The private representation of the current account, returned by [Get current user](/http-api/users/current-user/#get-current-user) and by every operation that changes the account. It extends the [partial user object](#partial-user-object).+The current account as its owner sees it, returned by [Get current user](/http-api/users/current-user/#get-current-user) and by every route that changes the account. It extends the [partial user object](#partial-user-object).### Structure| Field | Type | Description || --- | --- | --- |-| id | snowflake | The [snowflake](/snowflakes/) that identifies the account |-| username | string | The account username (1-32 ASCII letters, digits, or underscores) |-| discriminator | string | The account discriminator, four decimal digits with leading zeroes |-| global_name | ?string | The display name of the account, or null when none is set |-| avatar<sup>1</sup> | ?string | The image hash of the account avatar, or null when none is set |-| avatar_color | ?integer | The packed 24-bit RGB colour derived from the stored avatar, or null |-| bot? | boolean | Whether the account is a bot, omitted when false |-| system? | boolean | Whether the account is a Fluxer system account, omitted when false |-| flags | integer | [Public user flags](#public-user-flags) |-| mention_flags? | integer | [Reply mention preference](#reply-mention-preferences), omitted when the account has no preference |-| is_staff | boolean | Whether the account has the staff flag, including when that flag is hidden from `flags` |-| acls<sup>2</sup> <sup>3</sup> | array[string] | The Admin access control entries held by the account |-| traits<sup>3</sup> <sup>4</sup> | array[string] | The account traits, in sorted order |-| email<sup>5</sup> | ?string | The account email address, or null when none exists |-| email_bounced?<sup>3</sup> | boolean | Whether the mail provider marked the current email as bounced |+| is_staff | boolean | Whether the account has the staff flag, even when it is hidden from `flags` |+| acls<sup>1</sup> | array[string] | The [Admin API](/admin-api/users/#set-user-acls) access entries, empty for most accounts |+| traits<sup>1</sup> | array[string] | The account traits, sorted |+| email<sup>2</sup> | ?string | The email address, or null |+| email_bounced?<sup>1</sup> | boolean | Whether mail to the email address bounced || has_verified_phone | boolean | Deprecated. Always false |-| bio | ?string | The profile biography, or null when none is set |-| pronouns | ?string | The profile pronouns, or null when none are set |-| accent_color | ?integer | The profile accent colour as packed 24-bit RGB, or null when none is set |-| timezone?<sup>6</sup> | ?string | The IANA timezone identifier stored for the account, or null when none is set |-| timezone_privacy_flags?<sup>6</sup> | integer | [Profile field privacy flags](#profile-field-privacy-flags) applied to the profile timezone |-| banner<sup>7</sup> | ?string | The image hash of the profile banner, or null when none is set or the entitlement is missing |-| banner_color | ?integer | The packed 24-bit RGB colour derived from the stored banner, or null |-| mfa_enabled<sup>3</sup> <sup>8</sup> | boolean | Whether any authenticator is configured |-| authenticator_types?<sup>3</sup> <sup>8</sup> | array[integer] | [Authenticator types](#authenticator-types) configured for the account |-| verified<sup>5</sup> | boolean | Whether the account email is verified |+| bio | ?string | The profile biography, or null |+| pronouns | ?string | The profile pronouns, or null |+| accent_color | ?integer | The profile accent color as 24-bit RGB, or null |+| timezone? | ?string | The IANA timezone, or null |+| timezone_privacy_flags? | integer | [Profile field privacy flags](#profile-field-privacy-flags) for the timezone |+| banner | ?string | The profile banner hash, or null |+| banner_color | ?integer | The 24-bit RGB color taken from the banner, or null |+| mfa_enabled<sup>1</sup> | boolean | Whether any authenticator is set up |+| authenticator_types?<sup>1</sup> | array[integer] | [Authenticator types](#authenticator-types) set up for the account |+| verified<sup>2</sup> | boolean | Whether the email address is confirmed || account_limited? | boolean | Whether the account is [limited](#account-limitation) |-| premium_type<sup>9</sup> | ?integer | [Premium type](#premium-types) |-| premium_since<sup>3</sup> <sup>9</sup> | ?ISO8601 timestamp | The time premium was first activated, or null |-| premium_until<sup>3</sup> <sup>10</sup> | ?ISO8601 timestamp | The end of current premium access, or null when no premium period is stored |-| premium_will_cancel<sup>3</sup> | boolean | Whether subscription premium will cancel at the billing boundary |-| premium_billing_cycle<sup>3</sup> | ?string | The premium billing cycle, or null |-| premium_lifetime_sequence<sup>3</sup> | ?integer | The lifetime premium sequence, or null |-| premium_grace_ends_at<sup>11</sup> | ?ISO8601 timestamp | The end of grace access after premium_until passes, or null when no grace is recorded |-| premium_discriminator<sup>12</sup> | boolean | Whether the current discriminator was selected under a premium entitlement |-| premium_badge_hidden<sup>3</sup> | boolean | Whether the premium badge is hidden from the public profile |-| premium_badge_masked<sup>3</sup> | boolean | Whether a lifetime badge is presented as an ordinary subscription badge |-| premium_badge_timestamp_hidden<sup>3</sup> | boolean | Whether the premium activation time is hidden from the public profile |-| premium_badge_sequence_hidden<sup>3</sup> | boolean | Whether the lifetime sequence is hidden from the public profile |-| premium_purchase_disabled<sup>3</sup> | boolean | Whether premium purchasing is disabled for the account |-| premium_enabled_override<sup>3</sup> | boolean | Whether an administrative override grants premium entitlements |-| premium_perks_disabled<sup>3</sup> | boolean | Whether premium entitlements are suspended for the account |-| password_last_changed_at<sup>3</sup> | ?ISO8601 timestamp | The time of the most recent password change, or null |-| last_voice_activity_sharing_change_at<sup>13</sup> | ?ISO8601 timestamp | The time of the most recent bulk voice activity sharing change, or null |-| required_actions<sup>3</sup> | array[string] | Deprecated. Always empty |-| nsfw_allowed<sup>3</sup> <sup>14</sup> | boolean | Whether the account can access age-restricted content |-| has_dismissed_premium_onboarding<sup>3</sup> <sup>15</sup> | boolean | Whether premium onboarding was dismissed |-| has_ever_purchased<sup>3</sup> | boolean | Whether the account has completed a purchase |-| has_unread_gift_inventory<sup>3</sup> <sup>16</sup> | boolean | Whether the gift inventory has unread items |-| unread_gift_inventory_count<sup>3</sup> <sup>16</sup> | integer | The number of unread gift inventory items |-| pending_bulk_message_deletion<sup>3</sup> | ?[pending bulk message deletion](#pending-bulk-message-deletion-object) object | The message deletion the account scheduled for itself, or null when none is pending |-| age_verified_adult? | boolean | Whether adult age verification is complete, omitted when false |-| terms_agreed_at | ?ISO8601 timestamp | The time of the most recent terms acceptance, or null |-| privacy_agreed_at | ?ISO8601 timestamp | The time the account was last shown the current privacy policy, or null |-| claimed? | boolean | Whether the account can be signed in to from another device, through a confirmed email, a password or a passkey |-| account_tier? | string | The [account tier](#account-tiers), one of `unclaimed`, `unverified` or `verified` |-| verification_need?<sup>18</sup> | ?string | What the account still has to do to become verified, or null once it is |+| premium_type | ?integer | [Premium type](#premium-types), `0` while premium is not active |+| premium_since<sup>1</sup> | ?ISO8601 timestamp | When premium started, or null while premium is not active |+| premium_until<sup>1</sup> | ?ISO8601 timestamp | When the current premium period ends, or null |+| premium_will_cancel<sup>1</sup> | boolean | Whether the premium subscription cancels at the end of the period |+| premium_billing_cycle<sup>1</sup> | ?string | The premium billing cycle, or null |+| premium_lifetime_sequence<sup>1</sup> | ?integer | The lifetime premium sequence number, or null |+| premium_grace_ends_at | ?ISO8601 timestamp | When premium access ends after `premium_until` passes, or null |+| premium_discriminator<sup>4</sup> | boolean | Whether the discriminator was picked with premium |+| premium_badge_hidden<sup>1</sup> | boolean | Whether the premium badge is hidden from the profile |+| premium_badge_masked<sup>1</sup> | boolean | Whether a lifetime badge shows as a subscription badge |+| premium_badge_timestamp_hidden<sup>1</sup> | boolean | Whether the premium start date is hidden from the profile |+| premium_badge_sequence_hidden<sup>1</sup> | boolean | Whether the lifetime sequence number is hidden from the profile |+| premium_purchase_disabled<sup>1</sup> | boolean | Whether buying premium is turned off for the account |+| premium_enabled_override<sup>1</sup> | boolean | Whether an admin override grants premium |+| premium_perks_disabled<sup>1</sup> | boolean | Whether premium is suspended for the account |+| password_last_changed_at<sup>1</sup> | ?ISO8601 timestamp | When the password last changed, or null |+| last_voice_activity_sharing_change_at | ?ISO8601 timestamp | When voice activity sharing last changed for all friends (24-hour cooldown), or null |+| required_actions<sup>1</sup> | array[string] | Deprecated. Always empty |+| nsfw_allowed<sup>1</sup> | boolean | Whether the account can see age-restricted content |+| has_dismissed_premium_onboarding<sup>1</sup> | boolean | Whether premium onboarding was dismissed, false while premium is not active |+| has_ever_purchased<sup>1</sup> | boolean | Whether the account has bought anything |+| has_unread_gift_inventory<sup>1</sup> | boolean | Whether the gift inventory has unread items |+| unread_gift_inventory_count<sup>1</sup> | integer | The number of unread gift inventory items |+| pending_bulk_message_deletion<sup>1</sup> | ?[pending bulk message deletion](#pending-bulk-message-deletion-object) object | The scheduled deletion of all the account's messages, or null |+| age_verified_adult? | boolean | Whether adult age verification is done, omitted when false |+| terms_agreed_at | ?ISO8601 timestamp | When the account last accepted the terms, or null |+| privacy_agreed_at | ?ISO8601 timestamp | When the account was last shown the current privacy policy, or null |+| claimed? | boolean | Whether the account can sign in on another device with an email, a password or a passkey |+| account_tier? | string | The [account tier](#account-tiers), `unclaimed`, `unverified` or `verified` |+| verification_need? | ?string | `add_email`, `confirm_email` or `password` until the account is verified, then null || has_password? | boolean | Whether the account has a password |-| date_of_birth_required?<sup>17</sup> | boolean | Whether the account still has to [set its date of birth](/http-api/users/current-user/#set-date-of-birth). Clients ask for it before anything else |-| profile_restricted? | boolean | Whether other accounts see only the username and discriminator, as described under [account tiers](#account-tiers) |--<sup>1</sup> An animated avatar hash has the `a_` prefix, and the prefix is removed while the account has no animated avatar entitlement--<sup>2</sup> The array is empty for an account with no Admin access, and it is replaced in full by [Set user ACLs](/admin-api/users/#set-user-acls). It is independent of `is_staff`--<sup>3</sup> The field is neutralised for an OAuth2 bearer credential as described below--<sup>4</sup> The value `premium` is present exactly when premium entitlements are active, regardless of the stored trait set, and every other stored trait is returned sorted--<sup>5</sup> For an OAuth2 bearer credential without the `email` [scope](/http-api/oauth2/#oauth2-scopes), `email` is `null`--<sup>6</sup> This server version writes the pair for every account--<sup>7</sup> The banner hash is not returned at all while the account lacks the animated banner entitlement, which every profile banner requires--<sup>8</sup> `mfa_enabled` is true exactly when at least one authenticator is configured. An account with no authenticator reports `authenticator_types` as an empty array, and only a bearer read drops the field--<sup>9</sup> The value is forced to `0` and `premium_since` is forced to `null` while premium entitlements are not active--<sup>10</sup> `premium_until` is the later of the subscription end and any stacked gift extension. Fluxer reports it even when premium entitlements are no longer active--<sup>11</sup> After `premium_until` passes, premium entitlements stay active until this time. While the value is null, they stay active for 3 days after `premium_until`--<sup>12</sup> The flag is set when the account changes its username or discriminator while holding non-lifetime premium, and after that premium access ends, Fluxer replaces the discriminator with a newly generated one the next time the account starts a Gateway session. An instance with the `none` tag style skips the replacement and keeps `0000`+| date_of_birth_required?<sup>3</sup> | boolean | Whether the account has to [set its date of birth](/http-api/users/current-user/#set-date-of-birth) first |+| profile_restricted? | boolean | Whether other accounts see only the username and discriminator |-<sup>13</sup> The value drives the 24-hour cooldown on changing the default voice activity sharing state+<sup>1</sup> With an OAuth2 bearer token on [Get current user](/http-api/users/current-user/#get-current-user), arrays are empty, `email_bounced` and `authenticator_types` are left out, booleans are false, nullable fields are null and `unread_gift_inventory_count` is `0`-<sup>14</sup> A bot account is always permitted, and a user account is permitted only when its recorded date of birth places it at 18 years or older+<sup>2</sup> With an OAuth2 bearer token that lacks the `email` [scope](/http-api/oauth2/#oauth2-scopes), `email` is null-<sup>15</sup> The value is false while premium entitlements are not active, even when a dismissal was recorded earlier+<sup>3</sup> When the [accounts configuration](/admin-api/instance/#accounts-configuration-object) enforces it, most routes return 403 `DATE_OF_BIRTH_REQUIRED` until the date is set-<sup>16</sup> Reports whether unread gifts exist and how many. An account with no gifts reports `false` and `0`--<sup>17</sup> True for every account without a date of birth on an instance that collects dates of birth. When the [accounts configuration](/admin-api/instance/#accounts-configuration-object) enforces the date for the account, every route except a short list returns 403 `DATE_OF_BIRTH_REQUIRED`, and the Gateway reports no guilds for the account. The list is get current user, set date of birth, get current user settings, the account disable and delete routes, accept current policies, the data harvest routes, the experiment assignments and get Gateway, plus every authentication and sudo route--<sup>18</sup> One of `add_email`, `confirm_email` or `password`. The same value is the `need` in an `ACCOUNT_VERIFICATION_REQUIRED` [error response](/http-api/#error-response)---:::note[A bearer read returns zero values]-`acls`, `traits`, and `required_actions` become empty arrays. `email_bounced` and `authenticator_types` are dropped. Every field marked <sup>3</sup> above that is a boolean becomes `false`, every timestamp or nullable field becomes `null`, and `unread_gift_inventory_count` becomes `0`.-:::+<sup>4</sup> After premium ends, a `random` tag-style instance gives the account a new discriminator at its next Gateway session## Pending bulk message deletion object-A scheduled deletion of every message the account has sent. The field is this object only while the deletion requested through [Request bulk message deletion](/http-api/users/content/#request-bulk-message-deletion) is still waiting to run.+A deletion you scheduled through [Request bulk message deletion](/http-api/users/content/#request-bulk-message-deletion) that hasn't run yet.### Structure| Field | Type | Description || --- | --- | --- |-| scheduled_at | ISO8601 timestamp | The time at which the deletion runs |-| channel_count<sup>1</sup> | integer | The number of channels holding a message that will be deleted |-| message_count<sup>1</sup> | integer | The number of messages that will be deleted |--<sup>1</sup> Both counts are computed when the deletion is scheduled and are not recomputed while it waits+| scheduled_at | ISO8601 timestamp | When the deletion runs |+| channel_count | integer | The number of channels with messages to delete, counted when it was scheduled |+| message_count | integer | The number of messages to delete, counted when it was scheduled |## Authenticator types+These are the values in `authenticator_types`. `WEBAUTHN` appears only after [Set WebAuthn two-factor authentication](/http-api/users/mfa/#set-webauthn-two-factor-authentication) turns on passkeys as a second factor, and registering a passkey alone doesn't add it.+| Value | Name | Description || --- | --- | --- || 0 | TOTP | Time-based one-time password authenticator |@@ -227,90 +165,95 @@ A scheduled deletion of every message the account has sent. The field is this ob| Value | Name | Description || --- | --- | --- |-| 0 | NONE | No premium subscription |-| 1 | SUBSCRIPTION | Active premium subscription |-| 2 | LIFETIME | Lifetime premium subscription |+| 0 | NONE | No premium |+| 1 | SUBSCRIPTION | Premium subscription |+| 2 | LIFETIME | Lifetime premium |## Account limitation-An account is limited while its [user object](#user-object) reports `account_limited` as true. A limited account can still read, join voice, change its own settings, and manage its sessions. The operations below return 403 [`ACCOUNT_LIMITED`](/http-api/errors/), and the error message tells the user to check their email.+An account is limited while `account_limited` is true. It can still read, join voice, change its own settings and manage its sessions, but these routes return 403 `ACCOUNT_LIMITED`.-- [Create message](/http-api/messages/#create-message) and [Modify message](/http-api/messages/#modify-message) in any channel except the account's personal notes+- [Create message](/http-api/messages/#create-message) and [Modify message](/http-api/messages/#modify-message), except in personal notes- [Start thread from message](/http-api/threads/#start-thread-from-message) and [Start thread](/http-api/threads/#start-thread)- [Crosspost message](/http-api/messages/#crosspost-message)- [Add own reaction](/http-api/messages/#add-own-reaction)- [Create webhook](/http-api/webhooks/#create-webhook)- [Accept invite](/http-api/invites/#accept-invite) and [Join discovery guild](/http-api/discovery/#join-discovery-guild), unless the account is already a member- [Create guild](/http-api/guilds/#create-guild)-- Creating a group direct message through [Create private channel](/http-api/users/private-channels/#create-private-channel), and [Add group direct message recipient](/http-api/channels/#add-group-direct-message-recipient)-- Changing a profile field through [Modify current user](/http-api/users/current-user/#modify-current-user) or [Modify current guild member](/http-api/guild-members/#modify-current-guild-member)-- Setting a custom status through [Modify current user settings](/http-api/users/settings/#modify-current-user-settings) or a [presence update](/gateway/commands/#presence-update)-- [Initiate connection](/http-api/connections/#initiate-connection), [Verify and create connection](/http-api/connections/#verify-and-create-connection), and [Start Bluesky authorisation](/http-api/connections/#start-bluesky-authorisation)+- Creating a group DM with [Create private channel](/http-api/users/private-channels/#create-private-channel), and [Add group direct message recipient](/http-api/channels/#add-group-direct-message-recipient)+- Changing a profile field with [Modify current user](/http-api/users/current-user/#modify-current-user) or [Modify current guild member](/http-api/guild-members/#modify-current-guild-member)+- Setting a custom status with [Modify current user settings](/http-api/users/settings/#modify-current-user-settings) or a [presence update](/gateway/commands/#presence-update)+- [Initiate connection](/http-api/connections/#initiate-connection), [Verify and create connection](/http-api/connections/#verify-and-create-connection) and [Start Bluesky authorization](/http-api/connections/#start-bluesky-authorization)- [Upload entrance sound](/http-api/entrance-sounds/#upload-entrance-sound) and [Set entrance sound selection](/http-api/entrance-sounds/#set-entrance-sound-selection)## Account tiers-Every account is in one of three tiers. It is unclaimed while it has no email address on an instance that signs in with email. It is unverified while its email address is not confirmed. Every other account is verified. On a `username` instance, and on an instance that sends no email, an account with a password or a passkey counts as verified and one without counts as unclaimed.+An account is unclaimed while it has no email address, unverified while its email address isn't confirmed and verified otherwise. When the `account_identity` [feature](/http-api/instance/#instance-features-object) is `username`, an account with a password or a passkey is verified and one without is unclaimed. On an instance that sends no email, or whose `verification_basis` is `local_credential`, an account with an email address follows the same rule. Bots, system accounts and single sign-on accounts are always verified.++`interaction_tier` in the [accounts configuration](/admin-api/instance/#accounts-configuration-object) sets how strict the tiers are. When it is `enforced`, an account that isn't verified can read, edit its own profile and settings, write personal notes and join communities, but can't do most things that involve other people.-An instance chooses with `interaction_tier` in its [accounts configuration](/admin-api/instance/#accounts-configuration-object) how the tiers apply. In `legacy` mode the earlier email verification rules stay as they were. In `enforced` mode an account that is not verified can read, edit its own profile and settings, write personal notes, and join communities, but cannot do anything that reaches another person. Those operations fail with an error that names what is missing. An action that had its own error code before keeps it, such as `UNCLAIMED_ACCOUNT_CANNOT_SEND_MESSAGES` or `EMAIL_VERIFICATION_REQUIRED`, so older clients still understand it. Every other action returns 403 `ACCOUNT_VERIFICATION_REQUIRED`, with `action` and `tier` in the [error response](/http-api/#error-response).+A denial that has its own code returns it, such as `UNCLAIMED_ACCOUNT_CANNOT_SEND_MESSAGES` or `EMAIL_VERIFICATION_REQUIRED`. Every other denial returns 403 `ACCOUNT_VERIFICATION_REQUIRED`, and so does every denial for an account whose `verification_need` is `password`. That [error response](/http-api/#error-response) has `action`, `tier` and `need`, and `action` is one of the values below.| Action | Operations || --- | --- |-| `message` | Create, modify and crosspost a message, start a thread |-| `typing` | Trigger typing indicator |-| `reaction` | Add own reaction |-| `direct_message` | Open a direct message |-| `group_dm` | Create or join a group direct message |+| `message` | Create, modify or crosspost a message, or start a thread |+| `typing` | Trigger the typing indicator |+| `reaction` | Add a reaction |+| `direct_message` | Send a DM |+| `direct_message_open` | Open a DM |+| `group_dm` | Create or join a group DM || `friend_request` | Send a friend request || `friend_accept` | Accept a friend request || `invite_create` | Create an invite |+| `guild_join` | Accept an invite or join a discovery guild || `guild_create` | Create a guild || `voice` | Join a voice channel |-| `call` | Start or ring a call |+| `call` | Start or ring a call in a DM |+| `group_call` | Start or join a call in a group DM || `thread_join` | Join a thread || `channel_follow` | Follow an announcement channel || `ownership_transfer` | Receive guild ownership || `application_create` | Create an application || `gift_redeem` | Redeem a gift, for unclaimed accounts only |+| `profile_customize` | Change a profile field |+| `report` | Submit a report |+| `mfa` | Turn on two-factor authentication or regenerate backup codes |+| `guild_verification` | Talk in a guild that requires a verified email |-Reports from accounts that are not verified are accepted on an `enforced` instance, up to 5 a day for each account and 10 a day for each IP address. A second report on the same target from the same network within a day is accepted and then dropped.--The join gate applies to people assigned [guild visits](/admin-api/instance/#guild-visits-configuration-object) on every client. An instance that sets `guild_join_gate` to `visits_capable` applies it only when the client sends the `X-Fluxer-Capabilities: guild_visits` request header.+`guild_join` applies only to accounts assigned [guild visits](/admin-api/instance/#guild-visits-configuration-object), and never while the instance sets `guild_join_gate` to `off`. With `visits_capable`, it applies only to clients that send the `X-Fluxer-Capabilities: guild_visits` header.## Profile field privacy flags-A field whose flags value is `0` is visible to nobody, including on the owner's own profile read.+These are the values in `timezone_privacy_flags`, and a field with flags `0` is hidden from everyone, including the owner.| Value | Name | Description || --- | --- | --- |-| 1 << 0 | EVERYONE | Anyone permitted to view the full profile can see the field |+| 1 << 0 | EVERYONE | Anyone who can see the full profile can see the field || 1 << 1 | FRIENDS | Friends can see the field || 1 << 2 | MUTUAL_GUILDS | Members of a mutual guild can see the field |## User settings object-The complete account-wide settings record, with one field per setting. `synced_preferences` holds a base64-encoded Protobuf snapshot defined by the [user settings Protobuf reference](/http-api/users/settings-protobuf/). Fluxer stores that snapshot for clients and never interprets it.--The [user settings update object](/http-api/users/settings/#user-settings-update-object) lists the fields an update accepts and what each supplied or omitted field does to the stored value. Both settings operations return this object, and so do [Ready](/gateway/events/#ready-object) and [User Settings Update](/gateway/events/#user-settings-update). Every field below is always present.+The account-wide settings, returned by [Get current user settings](/http-api/users/settings/) and [Modify current user settings](/http-api/users/settings/#modify-current-user-settings) and sent in the [Ready](/gateway/events/#ready-object) and [User Settings Update](/gateway/events/#user-settings-update) events. Every field is always present.### Structure| Field | Type | Description || --- | --- | --- || status | string | [Presence status](/http-api/users/settings/#presence-status-values) |-| status_resets_at | ?ISO8601 timestamp | The time at which the scheduled status reset applies, or null |-| status_resets_to | ?string | [Presence status](/http-api/users/settings/#presence-status-values) applied by the scheduled reset, or null |+| status_resets_at | ?ISO8601 timestamp | When the status resets, or null |+| status_resets_to | ?string | The [presence status](/http-api/users/settings/#presence-status-values) to reset to, or null || theme | string | [Theme value](/http-api/users/settings/#theme-values) || locale | string | The interface [locale](/topics/locales/#supported-locales) |-| restricted_guilds<sup>1</sup> | array[snowflake] | The guilds where member direct messages are restricted |-| bot_restricted_guilds<sup>1</sup> | array[snowflake] | The guilds where bot direct messages are restricted |-| default_guilds_restricted | boolean | Whether newly joined guilds restrict member direct messages |-| bot_default_guilds_restricted | boolean | Whether newly joined guilds restrict bot direct messages |-| inline_attachment_media | boolean | Whether attachment media is rendered inline |-| inline_embed_media | boolean | Whether embed media is rendered inline |-| gif_auto_play | boolean | Whether GIF media plays automatically |-| render_embeds | boolean | Whether message embeds are rendered |-| render_reactions | boolean | Whether message reactions are rendered |+| restricted_guilds | array[snowflake] | The guilds where DMs from members are restricted |+| bot_restricted_guilds | array[snowflake] | The guilds where DMs from bots are restricted |+| default_guilds_restricted | boolean | Whether newly joined guilds restrict DMs from members |+| bot_default_guilds_restricted | boolean | Whether newly joined guilds restrict DMs from bots |+| inline_attachment_media | boolean | Whether attachment media shows inline |+| inline_embed_media | boolean | Whether embed media shows inline |+| gif_auto_play | boolean | Whether GIFs play automatically |+| render_embeds | boolean | Whether embeds show |+| render_reactions | boolean | Whether reactions show || animate_emoji | boolean | Whether custom emoji animate || animate_stickers | integer | [Sticker animation setting](#sticker-animation-settings) || render_spoilers | integer | [Spoiler rendering setting](#spoiler-rendering-settings) |@@ -318,58 +261,40 @@ The [user settings update object](/http-api/users/settings/#user-settings-update| friend_source_flags | integer | [Friend source flags](#friend-source-flags) || incoming_call_flags | integer | [Incoming call flags](#incoming-call-flags) || group_dm_add_permission_flags | integer | [Group DM add permission flags](#group-dm-add-permission-flags) |-| guild_folders<sup>2</sup> | array[[guild folder](#guild-folder-object) object] | The user-owned guild sidebar layout |-| custom_status | ?[custom status](#custom-status-object) object | The current custom status, or null when none is set |-| afk_timeout | integer | The idle time in seconds before the account is presented as away |+| guild_folders | array[[guild folder](#guild-folder-object) object] | The guild sidebar layout |+| custom_status | ?[custom status](#custom-status-object) object | The custom status, or null |+| afk_timeout | integer | Idle seconds before the account shows as away || time_format | integer | [Time format setting](#time-format-settings) |-| developer_mode | boolean | Whether developer mode is enabled |-| trusted_domains<sup>3</sup> | array[string] | The external link domains the account trusts |+| developer_mode | boolean | Whether developer mode is on |+| trusted_domains | array[string] | The trusted link domains, or `*` alone to trust all || default_hide_muted_channels | boolean | Whether newly joined guilds hide muted channels |-| sensitive_content_friend_dm_filter | integer | [Sensitive media filter](#sensitive-media-filters) for friend direct messages |-| sensitive_content_non_friend_dm_filter | integer | [Sensitive media filter](#sensitive-media-filters) for non-friend direct messages |+| sensitive_content_friend_dm_filter | integer | [Sensitive media filter](#sensitive-media-filters) for DMs from friends |+| sensitive_content_non_friend_dm_filter | integer | [Sensitive media filter](#sensitive-media-filters) for DMs from others || sensitive_content_guild_filter | integer | [Guild sensitive media filter](#guild-sensitive-media-filters) |-| suppress_unprivileged_self_mentions<sup>4</sup> | boolean | Whether direct and reply mentions from unprivileged users are suppressed |-| suppress_unprivileged_self_mentions_bypass_user_ids<sup>4</sup> <sup>5</sup> | array[snowflake] | The users exempt from mention suppression |-| staff_dm_access_user_ids<sup>4</sup> <sup>5</sup> | array[snowflake] | The users granted staff direct message access |-| synced_preferences<sup>6</sup> | string | The base64-encoded [synced preferences](/http-api/users/settings-protobuf/) message |+| suppress_unprivileged_self_mentions<sup>1</sup> | boolean | Whether direct and reply mentions from unprivileged users are suppressed |+| suppress_unprivileged_self_mentions_bypass_user_ids<sup>1</sup> | array[snowflake] | The users exempt from mention suppression |+| staff_dm_access_user_ids<sup>1</sup> | array[snowflake] | The users granted staff DM access |+| synced_preferences | string | Base64 [synced preferences](/http-api/users/settings-protobuf/) for clients (512 KiB decoded), empty if never synced || profile_privacy | integer | [Profile privacy level](#profile-privacy-levels) |-| default_share_voice_activity<sup>7</sup> | boolean | Whether a newly accepted friend relationship starts with voice activity sharing on |-| privacy_setup_version<sup>8</sup> | integer | The latest privacy setup version the account has reviewed, 0 if it never has |-| privacy_setup_completed_at | ?ISO8601 timestamp | When the account last completed the privacy setup, or null if it never has |--<sup>1</sup> Duplicate identifiers are removed when the array is written+| default_share_voice_activity | boolean | Whether new friends start with voice activity sharing on, set through [Modify voice activity sharing](/http-api/users/settings/#modify-voice-activity-sharing) |+| privacy_setup_version | integer | The latest privacy setup version the account reviewed, or 0 |+| privacy_setup_completed_at | ?ISO8601 timestamp | When the account last finished the privacy setup, or null |-<sup>2</sup> An account with an empty stored layout that still holds a legacy guild ordering receives one uncategorised folder holding that ordering. An account with neither receives an empty array--<sup>3</sup> The single entry `*` trusts every domain, and it cannot be combined with a concrete domain--<sup>4</sup> The field is writable only by a staff account and is reset to its zero value on every settings update from an ordinary account--<sup>5</sup> Duplicate identifiers are removed and the array is returned in ascending identifier order--<sup>6</sup> The message is `fluxer.user.preferences.v1.SyncedPreferences`. The empty string means nothing has been synced yet. The decoded message cannot exceed 524288 bytes, the 512 KiB ceiling--<sup>7</sup> The field is read-only here and is changed by [Modify voice activity sharing](/http-api/users/settings/#modify-voice-activity-sharing)--<sup>8</sup> Fluxer only stores this number. The first-party client compares it with the privacy setup version it ships and asks the user to review their direct message settings while the stored number is lower+<sup>1</sup> Only staff accounts can set it. A settings update from any other account sets it to false or empty## Custom status object-A custom status is the text and emoji stored on the account's [user settings](#user-settings-object).+The text and emoji set as the account's status.### Structure| Field | Type | Description || --- | --- | --- |-| text | ?string | The status text (1-128 characters), or null when none is set |-| expires_at?<sup>1</sup> | ISO8601 timestamp | The time at which the status expires |-| emoji_id?<sup>1</sup> | snowflake | The ID of the custom emoji shown beside the text |-| emoji_name<sup>2</sup> | ?string | The custom emoji name resolved from `emoji_id`, the single Unicode emoji supplied directly, or null |-| emoji_animated | boolean | Whether the selected custom emoji is animated |--<sup>1</sup> The field is omitted when the status has no expiry or no custom emoji--<sup>2</sup> A payload with `emoji_id` has its `emoji_name` replaced by the name of that emoji+| text | ?string | The status text (1-128 characters), or null |+| expires_at? | ISO8601 timestamp | When the status expires, omitted when it doesn't |+| emoji_id? | snowflake | The ID of the custom emoji, omitted for none |+| emoji_name | ?string | The custom emoji name, a Unicode emoji, or null |+| emoji_animated | boolean | Whether the custom emoji is animated |### Example@@ -385,26 +310,18 @@ A custom status is the text and emoji stored on the account's [user settings](#u## Guild folder object-One entry of the saved, user-owned guild sidebar layout. Joining a guild prepends its ID to the uncategorised folder. Leaving or losing a guild removes its ID from every folder and drops any non-uncategorised folder the removal leaves empty, whether or not it has a name.+A folder in the guild sidebar. When you join a guild, Fluxer adds it to the start of the uncategorized folder, and when you leave one, Fluxer removes it and deletes any other folder it leaves empty.### Structure| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | ?integer | The identifier of the folder |-| name | ?string | The name of the folder, or null when none is set |-| color<sup>2</sup> | ?integer | The folder colour as packed 24-bit RGB |+| id | ?integer | The ID of the folder, `-1` for the uncategorized folder |+| name | ?string | The folder name, or null |+| color | ?integer | The folder color as 24-bit RGB, or null || flags | integer | [Guild folder flags](#guild-folder-flags) |-| icon<sup>3</sup> | string | [Guild folder icon](#guild-folder-icons) |-| guild_ids<sup>4</sup> | array[snowflake] | The IDs of the guilds in the folder, in sidebar order |--<sup>1</sup> The value `-1` identifies the uncategorised folder, which holds guilds not placed in a named folder. A stored layout that omits it has it prepended when the layout is written--<sup>2</sup> A folder written without a colour is stored with `0`. The value is null on an uncategorised folder built from a legacy guild ordering or created by a guild join--<sup>3</sup> A folder written without an icon is stored with `folder`--<sup>4</sup> Writing the layout keeps one occurrence of a guild ID that appears in more than one folder, preferring a named folder over the uncategorised one+| icon | string | [Guild folder icon](#guild-folder-icons) |+| guild_ids | array[snowflake] | The guild IDs in sidebar order. A guild can appear in only one folder |### Example@@ -423,13 +340,13 @@ One entry of the saved, user-owned guild sidebar layout. Joining a guild prepend| Value | Name | Description || --- | --- | --- |-| 1 << 0 | SHOW_ICON_WHEN_COLLAPSED | Show the selected icon instead of guild previews while collapsed |+| 1 << 0 | SHOW_ICON_WHEN_COLLAPSED | Show the icon instead of guild previews while collapsed |## Guild folder icons| Value | Description || --- | --- |-| folder | Folder icon, applied when no icon is supplied |+| folder | Folder icon, the default || star | Star icon || heart | Heart icon || bookmark | Bookmark icon |@@ -442,22 +359,22 @@ One entry of the saved, user-owned guild sidebar layout. Joining a guild prepend| Value | Name | Description || --- | --- | --- || 0 | ALWAYS_ANIMATE | Always animate stickers |-| 1 | ANIMATE_ON_INTERACTION | Animate stickers during interaction |+| 1 | ANIMATE_ON_INTERACTION | Animate stickers on interaction || 2 | NEVER_ANIMATE | Never animate stickers |## Spoiler rendering settings| Value | Name | Description || --- | --- | --- |-| 0 | ALWAYS | Always show spoiler content |-| 1 | ON_CLICK | Show spoiler content after interaction |-| 2 | IF_MODERATOR | Show spoiler content for moderators |+| 0 | ALWAYS | Always show spoilers |+| 1 | ON_CLICK | Show spoilers on click |+| 2 | IF_MODERATOR | Show spoilers to moderators |## Time format settings| Value | Name | Description || --- | --- | --- |-| 0 | AUTO | Select the time format from the locale |+| 0 | AUTO | Use the locale's time format || 1 | TWELVE_HOUR | Use a 12-hour clock || 2 | TWENTY_FOUR_HOUR | Use a 24-hour clock |@@ -478,13 +395,13 @@ One entry of the saved, user-owned guild sidebar layout. Joining a guild prepend## Profile privacy levels-A bot account is never subject to profile privacy, and a caller reading its own profile is never restricted.+Profile privacy never applies to bots or to your own profile.| Value | Name | Description || --- | --- | --- |-| 0 | ALL_GUILDS | Friends and members of any mutual guild can view the full profile |-| 1 | SMALL_GUILDS_ONLY | Friends and members of a mutual guild with at most 200 members can view the full profile |-| 2 | FRIENDS_ONLY | Only friends can view the full profile |+| 0 | ALL_GUILDS | Friends and members of any mutual guild can see the full profile |+| 1 | SMALL_GUILDS_ONLY | Friends and members of a mutual guild with at most 200 members can see the full profile |+| 2 | FRIENDS_ONLY | Only friends can see the full profile |## Friend source flags@@ -492,279 +409,206 @@ A bot account is never subject to profile privacy, and a caller reading its own| --- | --- | --- || 1 << 0 | MUTUAL_FRIENDS | Accept requests from users with mutual friends || 1 << 1 | MUTUAL_GUILDS | Accept requests from users in mutual guilds |-| 1 << 2 | NO_RELATION | Accept requests without an existing relation |+| 1 << 2 | NO_RELATION | Accept requests from anyone |## Incoming call flags-`SILENT_EVERYONE` applies to calls the other flags already permit. When conflicting policy flags are supplied, `FRIENDS_ONLY` takes precedence over `NOBODY`.+When both `FRIENDS_ONLY` and `NOBODY` are set, `FRIENDS_ONLY` applies.| Value | Name | Description || --- | --- | --- |-| 1 << 0 | FRIENDS_OF_FRIENDS | Permit calls from friends of friends |-| 1 << 1 | GUILD_MEMBERS | Permit calls from guild members |-| 1 << 2 | EVERYONE | Permit calls from everyone |-| 1 << 3 | FRIENDS_ONLY | Permit calls only from friends |+| 1 << 0 | FRIENDS_OF_FRIENDS | Allow calls from friends of friends |+| 1 << 1 | GUILD_MEMBERS | Allow calls from guild members |+| 1 << 2 | EVERYONE | Allow calls from everyone |+| 1 << 3 | FRIENDS_ONLY | Allow calls only from friends || 1 << 4 | NOBODY | Reject all incoming calls |-| 1 << 5 | SILENT_EVERYONE | Receive permitted calls silently |+| 1 << 5 | SILENT_EVERYONE | Receive allowed calls silently |## Group DM add permission flags-When conflicting policy flags are supplied, `FRIENDS_ONLY` takes precedence over `NOBODY`, which takes precedence over `EVERYONE`.+When `FRIENDS_ONLY` is set it applies over `NOBODY`, and `NOBODY` applies over `EVERYONE`.| Value | Name | Description || --- | --- | --- |-| 1 << 0 | FRIENDS_OF_FRIENDS | Permit friends of friends to add the user |-| 1 << 1 | GUILD_MEMBERS | Permit guild members to add the user |-| 1 << 2 | EVERYONE | Permit everyone to add the user |-| 1 << 3 | FRIENDS_ONLY | Permit only friends to add the user |-| 1 << 4 | NOBODY | Prevent every user from adding the user |+| 1 << 0 | FRIENDS_OF_FRIENDS | Friends of friends can add the user |+| 1 << 1 | GUILD_MEMBERS | Guild members can add the user |+| 1 << 2 | EVERYONE | Everyone can add the user |+| 1 << 3 | FRIENDS_ONLY | Only friends can add the user |+| 1 << 4 | NOBODY | Nobody can add the user |## User profile object-The account-wide profile customisation inside a [full user profile object](#full-user-profile-object).+The account-wide profile inside a [full user profile object](#full-user-profile-object). Every field is null when the target's profile is hidden, or when its `profile_restricted` is true and you aren't the target.### Structure| Field | Type | Description || --- | --- | --- |-| bio<sup>1</sup> | ?string | The account-wide biography, or null when none is set |-| pronouns<sup>1</sup> | ?string | The account-wide pronouns, or null when none are set |-| banner<sup>2</sup> | ?string | The image hash of the profile banner, or null when none is set |-| banner_color | ?integer | The packed 24-bit RGB colour derived from the stored banner, or null |-| accent_color | ?integer | The profile accent colour as packed 24-bit RGB, or null when none is set |--<sup>1</sup> The value is forced to `null` when profile privacy restricts the viewer, which is reported by `profile_limited`--<sup>2</sup> The banner hash is not returned while the account lacks the animated banner entitlement, which every profile banner requires. The hash is not returned regardless of profile privacy+| bio | ?string | The biography, or null |+| pronouns | ?string | The pronouns, or null |+| banner | ?string | The profile banner hash, or null |+| banner_color | ?integer | The 24-bit RGB color taken from the banner, or null |+| accent_color | ?integer | The accent color as 24-bit RGB, or null |## Guild member profile object-A guild member profile is the per-guild profile customisation of the target account, in the guild named by the `guild_id` query parameter.+The target's profile in the guild from the `guild_id` query parameter.### Structure| Field | Type | Description || --- | --- | --- |-| bio<sup>1</sup> | ?string | The guild-specific biography, or null when none is set |-| pronouns<sup>1</sup> | ?string | The guild-specific pronouns, or null when none are set |-| banner<sup>2</sup> | ?string | The image hash of the guild-specific banner, or null when none is set |-| accent_color | ?integer | The guild profile accent colour as packed 24-bit RGB, or null when none is set |--<sup>1</sup> The value is forced to `null` when profile privacy restricts the viewer--<sup>2</sup> Fluxer sets the value to `null` when the account no longer has premium and the membership has a guild avatar, banner, biography, or accent colour. It stays `null` until the account joins the guild again. An animated banner hash has the `a_` prefix+| bio | ?string | The guild biography, or null |+| pronouns | ?string | The guild pronouns, or null |+| banner | ?string | The guild banner hash, or null |+| accent_color | ?integer | The guild accent color as 24-bit RGB, or null |## Mutual guild object-One guild that both the caller and the target account belong to.+A guild that both you and the target are in.### Structure| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the guild |-| nick | ?string | The nickname the target account uses in the guild, or null when none is set |+| nick | ?string | The target's nickname in the guild, or null |## Full user profile object-The profile read returned by [Get user profile](#get-user-profile) for one target account.+Returned by [Get user profile](#get-user-profile). When profile privacy restricts you, `profile_limited` is true and `bio` and `pronouns` are null in both profile objects.### Structure| Field | Type | Description || --- | --- | --- |-| user | [partial user](#partial-user-object) object | The public representation of the target account |-| user_profile | [user profile](#user-profile-object) object | The account-wide profile customisation |-| guild_member?<sup>1</sup> | [guild member](/http-api/guild-members/#guild-member-object) object | The membership the target account holds in the named guild |-| guild_member_profile?<sup>1</sup> | [guild member profile](#guild-member-profile-object) object | The per-guild profile customisation of the target account |-| premium_type?<sup>2</sup> <sup>7</sup> | integer | The [premium type](#premium-types) visible to the caller |-| premium_since?<sup>2</sup> <sup>7</sup> | ISO8601 timestamp | The premium activation time visible to the caller |-| premium_lifetime_sequence?<sup>2</sup> <sup>7</sup> | integer | The lifetime premium sequence visible to the caller |-| profile_badges | array[[profile badge](#profile-badge-object) object] | The badges to show on the profile, in display order |-| mutual_friends?<sup>3</sup> | array[[partial user](#partial-user-object) object] | The mutual friends in descending account identifier order |-| mutual_guilds?<sup>3</sup> | array[[mutual guild](#mutual-guild-object) object] | The guilds the caller and the target are both members of |-| connected_accounts<sup>4</sup> | array[[connection](/http-api/connections/#connection-object) object] | The verified connections the caller is permitted to see |-| timezone_offset<sup>5</sup> | ?integer | The offset of the target profile timezone in minutes from UTC, or null |-| profile_limited?<sup>6</sup> | boolean | Whether profile privacy removed restricted fields |--<sup>1</sup> The pair requires the `guild_id` query parameter and requires both the caller and the target to be members of that guild--<sup>2</sup> All three are omitted while the profile is restricted or the target hides the premium badge. `premium_since` is also omitted while the target hides the activation time. `premium_lifetime_sequence` is also omitted while the target hides the sequence--<sup>3</sup> Each array is omitted unless its query parameter, `with_mutual_friends` or `with_mutual_guilds`, is true. Both are always omitted when the target is the caller--<sup>4</sup> The array is empty when the profile is restricted. It otherwise holds only verified connections whose [profile field privacy flags](#profile-field-privacy-flags) admit the caller+| user | [partial user](#partial-user-object) object | The target account |+| user_profile | [user profile](#user-profile-object) object | The account-wide profile |+| guild_member?<sup>1</sup> | [guild member](/http-api/guild-members/#guild-member-object) object | The target's membership in the requested guild |+| guild_member_profile?<sup>1</sup> | [guild member profile](#guild-member-profile-object) object | The target's profile in the requested guild |+| premium_type?<sup>2</sup> | integer | The target's [premium type](#premium-types) |+| premium_since?<sup>2</sup> | ISO8601 timestamp | When the target's premium started |+| premium_lifetime_sequence?<sup>2</sup> | integer | The target's lifetime premium sequence number |+| profile_badges | array[[profile badge](#profile-badge-object) object] | The badges to show, in order |+| mutual_friends?<sup>3</sup> | array[[partial user](#partial-user-object) object] | Your mutual friends with the target |+| mutual_guilds?<sup>3</sup> | array[[mutual guild](#mutual-guild-object) object] | The guilds you and the target share |+| connected_accounts<sup>4</sup> | array[[connection](/http-api/connections/#connection-object) object] | The target's verified connections you can see |+| timezone_offset<sup>4</sup> | ?integer | The target's timezone offset from UTC in minutes, or null |+| profile_limited? | boolean | Present and true when profile privacy restricts you |-<sup>5</sup> The value is null unless the profile is unrestricted, the target has stored a timezone, and its [profile field privacy flags](#profile-field-privacy-flags) admit the caller+<sup>1</sup> Only with `guild_id` when both you and the target are members of that guild-<sup>6</sup> The field is present only on a restricted read+<sup>2</sup> Left out when the profile is restricted or the target hides the badge, date or sequence. Use `profile_badges` to show badges-<sup>7</sup> Deprecated for badge display. Render `profile_badges` instead, which applies the same privacy rules and adds localised labels+<sup>3</sup> Only when the matching `with_` query parameter is true, and never for your own profile-A lifetime target that masks its badge reports `premium_type` of `1`, not `2`.+<sup>4</sup> Empty or null when the profile is restricted or the target's [profile field privacy flags](#profile-field-privacy-flags) don't include you## Profile badge object-One badge on a [full user profile](#full-user-profile-object). The server decides which badges apply, their order, and their text, so a client renders the list as it comes.+One badge on a [full user profile](#full-user-profile-object). The API picks the badges, their order and their text, and clients show the list as it comes.### Structure| Field | Type | Description || --- | --- | --- || kind<sup>1</sup> | string | A stable key for the badge |-| label | string | The full badge description in the caller's locale, for the tooltip, and the alt text when there is no caption |+| label | string | The badge description in your locale, for the tooltip and alt text || asset<sup>2</sup> | ?string | The 16-character hex hash of the badge image, or null for a text badge |-| aspect_ratio<sup>3</sup> | ?number | The image width divided by its height, or null for a square badge |-| caption<sup>4</sup> | ?string | The short text the badge stands for, or null |-| href | ?string | The absolute URL a click opens, or null |-| small_asset? | string | The image hash for 20 pixels and smaller, served like `asset`. Use it instead of `asset` at those sizes |-| count? | ?integer | Never present on a self-hosted instance |+| aspect_ratio | ?number | Image width divided by height, or null for a square badge |+| caption | ?string | Short text the badge stands for, shown in place of the image when `asset` is null |+| href | ?string | The URL a click opens, or null |+| small_asset? | string | The image hash to use at 20 pixels and smaller |+| count? | ?integer | A number shown with the badge, or null || accessible_label? | ?string | The label for screen readers, used in place of `label` |-| details?<sup>5</sup> | ?[badge details](#badge-details-object) object | The content of the richer vertical tooltip |+| details? | ?[badge details](#badge-details-object) object | A richer tooltip with the badge art, `title` and `lines`. Without it, `label` is the tooltip |-<sup>1</sup> The known values are `staff` and `premium`, which appears only while premium tiers are active on the instance. New values can appear at any time, so a client renders an unknown kind from the other fields+<sup>1</sup> Known values are `staff` and `premium`. Render any other kind from its other fields-<sup>2</sup> The image is served at `{static_cdn}/badges/{asset}.webp`, where `static_cdn` is the `endpoints.static_cdn` value from [instance discovery](/http-api/instance/). Square badges are 128 by 128 pixels and also have a PNG at `{static_cdn}/badges/{asset}.png`. A hashed file never changes, so it can be cached forever--<sup>3</sup> Render the image at the badge height and `aspect_ratio` times that height wide--<sup>4</sup> A badge with a null `asset` shows its caption as text instead--<sup>5</sup> When present, show a vertical tooltip with the badge art larger at the top, then `title`, then each line. Otherwise `label` is the whole tooltip+<sup>2</sup> The image is at `{static_cdn}/badges/{asset}.webp`, with `static_cdn` from [instance discovery](/http-api/instance/), and square badges also have a `.png`. Hashed files never change### Badge details object| Field | Type | Description || --- | --- | --- || title | string | The first line under the badge art |-| lines | array[string] | The further lines, in order |+| lines | array[string] | The other lines, in order |### Visibility+Your own profile follows the same rules and shows what other people see. `label` uses your stored locale, then `Accept-Language`, then `en-US`.+| Condition | Effect || --- | --- || The target is hidden or under enforcement | The list is empty |-| The profile is restricted for the caller | Only `staff` remains |+| The profile is restricted for you | Only `staff` remains || The target hides the premium badge | `premium` is dropped |-| The target hides the premium activation time | The premium label has no date |+| The target hides the premium start date | The premium label has no date || The target hides its staff flag | `staff` is dropped |## Get user<RouteHeader method="GET" path="/v1/users/{user_id}" bot />-Returns a [partial user](#partial-user-object) object for any account. Requires no permission and no relationship with the target.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |--:::note[A deleted target still resolves]-A target whose deletion has completed returns 200 with the substituted [deleted account representation](#partial-user-object), so historical references stay renderable. Only an identifier that was never allocated returns 404 `UNKNOWN_USER`.-:::+Returns a [partial user](#partial-user-object) object for any account, with no relationship needed. A deleted account comes back in its [deleted form](#partial-user-object).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [partial user](#partial-user-object) object | User was returned |-| 404 | [error response](/http-api/#error-response) | Identifier was never allocated and the request returns `UNKNOWN_USER` |--### Rate limit+| 200 | [partial user](#partial-user-object) object | The user was returned |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_USER` when the ID was never used |-100 requests per 10 seconds for each authenticated user and target user ID, on the `user:read::user_id` bucket.+The rate limit is 100 requests per 10 seconds, on the `user:read::user_id` bucket.## Get user profile<RouteHeader method="GET" path="/v1/users/{target_id}/profile" bot />-Returns a [full user profile](#full-user-profile-object) object for one target account.--### Limitations--- A caller reading another account needs one of these relationships with the target: friendship, a pending friend request in either direction, a shared guild, or a shared group direct message channel.-- Reading a bot target is always permitted.-- Reading the caller's own profile bypasses both the access check and profile privacy.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| target_id | snowflake | The ID of the target account |+Returns a [full user profile](#full-user-profile-object) object. To get the profile of another account that isn't a bot, you need a friendship, a pending friend request, a shared guild or a shared group DM with it. Profile privacy can still [restrict the fields](#full-user-profile-object) you get.### Query parameters| Field | Type | Description || --- | --- | --- |-| guild_id?<sup>1</sup> | snowflake | The guild whose member and guild profile objects are included |-| with_mutual_friends?<sup>2</sup> | boolean | Whether to include mutual friends (default false) |-| with_mutual_guilds?<sup>2</sup> | boolean | Whether to include mutual guilds (default false) |--<sup>1</sup> A guild that either the caller or the target is not a member of omits `guild_member` and `guild_member_profile`. The read still returns 200--<sup>2</sup> The value is trimmed and read as true only for the exact strings `true`, `True`, and `1`. Every other value, including absence, is false--:::note[Profile privacy is a field filter]-A read that passes the access check can still be restricted. A restricted read nulls `bio` and `pronouns` in both profile objects, empties `connected_accounts`, nulls `timezone_offset`, and sets `profile_limited` to true. It also removes the premium fields from the body and keeps only the staff, partner, and bug hunter entries in `profile_badges`.-:::+| guild_id? | snowflake | The guild to include member and guild profile objects for |+| with_mutual_friends? | boolean | Whether to include mutual friends (default false) |+| with_mutual_guilds? | boolean | Whether to include mutual guilds (default false) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [full user profile](#full-user-profile-object) object | Profile was returned |-| 403 | [error response](/http-api/#error-response) | Caller has no relationship permitting profile access |-| 404 | [error response](/http-api/#error-response) | Target user does not exist |--### Side effects+| 200 | [full user profile](#full-user-profile-object) object | The profile was returned |+| 403 | [error response](/http-api/#error-response) | `MISSING_ACCESS` when you share no relationship with the target |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_USER` when the target doesn't exist |-When the target's premium access and its grace period have both ended, reading the profile clears the target's stored premium subscription fields. That change emits no Gateway Dispatch and does not prevent the profile from being returned.--### Rate limit--100 requests per 10 seconds for each authenticated user and target user ID, on the `user:profile::target_id` bucket.+The rate limit is 100 requests per 10 seconds, on the `user:profile::target_id` bucket.## Check user tag<RouteHeader method="GET" path="/v1/users/check-tag" bot />-Reports whether a username and discriminator pair is unavailable.+Returns whether another account already uses a username and discriminator. Usernames compare without case and discriminators compare as numbers, with `7` matching `0007`, and your own tag returns `false`. When the `tag_style` [feature](/http-api/instance/#instance-features-object) is `none`, the discriminator is ignored unless you are a bot.### Query parameters| Field | Type | Description || --- | --- | --- |-| username<sup>1</sup> | string | The username after trimming (1-32 ASCII letters, digits, or underscores) |-| discriminator<sup>2</sup> | string | The discriminator (1-4 decimal digits) |--<sup>1</sup> The value cannot be `everyone` or `here` and cannot contain `fluxer` or `system message`, all compared case-insensitively--<sup>2</sup> The value is parsed as a decimal integer before the lookup, so `7`, `07`, and `0007` describe the same tag--The caller's current tag returns `false`. The username comparison is case-insensitive and the discriminator is compared as an integer.--When the caller is not a bot on an instance with the `none` tag style, the discriminator is ignored. There `taken` reports whether another account that is not a bot holds the username in any letter case. An account waiting to be deleted still holds its username.--A reserved username fails validation with `USERNAME_RESERVED_VALUE` or `USERNAME_CANNOT_CONTAIN_RESERVED_TERMS`, and no `taken` value comes back for it.+| username | string | The username (1-32 ASCII letters, digits or underscores) |+| discriminator | string | The discriminator (1-4 digits) |### Response body| Field | Type | Description || --- | --- | --- |-| taken | boolean | Whether the normalised tag is unavailable |--:::caution[`true` also comes from transient conditions]-A tag claimed by a registration still in progress reads as taken for up to 30 seconds. A lookup that waits more than 10 seconds on a busy username also reads as taken.-:::+| taken | boolean | Whether the tag is taken |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Tag availability was returned |--### Rate limit+| 200 | response body | The result was returned |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` when `username` is reserved (`USERNAME_RESERVED_VALUE` or `USERNAME_CANNOT_CONTAIN_RESERVED_TERMS`) |-60 requests per 10 seconds for each authenticated user, on the `user:check_tag` bucket.+The rate limit is 60 requests per 10 seconds, on the `user:check_tag` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/users/content.mdx b/fluxer_docs/src/content/docs/http-api/users/content.mdxindex c7ec66de7..e62cec87e 100644--- a/fluxer_docs/src/content/docs/http-api/users/content.mdx+++ b/fluxer_docs/src/content/docs/http-api/users/content.mdx@@ -1,317 +1,199 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: User content collections-description: Recent mentions, saved messages, and deletion of the caller's own messages.+description: Recent mentions, saved messages and deletion of your own messages.---import RouteHeader from '@/components/RouteHeader.astro';-Recent mentions and saved messages are private lists that only the account owning them can read. Further routes delete the messages the caller authored, one filtered and immediate, the other unfiltered and delayed by a day. Data harvests are on [Data harvests](/http-api/users/data-harvest/).+Recent mentions and saved messages are private lists that only the account that owns them can read. Two more routes delete the messages you wrote. For data archives see [Data harvests](/http-api/users/data-harvest/).-These routes are user-only. Fluxer rejects a bot or OAuth2 bearer credential with 403 `ACCESS_DENIED`.--Every route except [Delete current user's messages](#delete-current-users-messages) reaches the main Gateway, and a Gateway failure returns 502 `BAD_GATEWAY`, 503 `SERVICE_UNAVAILABLE`, or 504 `GATEWAY_TIMEOUT`. [Save message](#save-message) resolves the channel before it writes, so a failure there stores nothing. The request still returns 204 when a [Saved Message Create](/gateway/events/#saved-message-create), [Saved Message Delete](/gateway/events/#saved-message-delete), or [Recent Mention Delete](/gateway/events/#recent-mention-delete) Dispatch fails to publish after the write.--:::caution[A failed response can still change the schedule]-[Request bulk message deletion](#request-bulk-message-deletion) and [Cancel bulk message deletion](#cancel-bulk-message-deletion) can return 502, 503, or 504 after changing the schedule. Read the account again before deciding whether to retry.-:::+Only user tokens can call these routes, and Fluxer rejects a bot or OAuth2 bearer token with 403 `ACCESS_DENIED`.## Saved message object-A saved entry is a private bookmark pairing one message with the channel it was saved from. Saving a message notifies nobody, including its author.--The entry stores no copy of the message. Fluxer resolves the message against current permissions on every read, so one entry can have a message on one read and none on the next.+A saved message is a private bookmark that pairs a message with the channel it was saved from. It stores no copy of the message, and Fluxer checks your permissions each time you list saved messages.### Structure| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | snowflake | The ID of the saved entry |-| channel_id<sup>2</sup> | snowflake | The channel the message was saved from |+| id | snowflake | The ID of the saved entry, always equal to `message_id` |+| channel_id | snowflake | The channel the message was saved from || message_id | snowflake | The ID of the saved message || status | string | The [saved message status](#saved-message-statuses) of the entry |-| message<sup>3</sup> | ?[message](/http-api/messages/#message-object) object | The message as the caller can currently see it, or null |--<sup>1</sup> Always equal to `message_id`, because one message can be saved at most once per account--<sup>2</sup> The channel supplied when the message was saved, and it is not re-derived on read--<sup>3</sup> Null exactly when `status` is `missing_permissions`, and otherwise the message resolved for the caller at read time. A message that still exists and needs `READ_MESSAGE_HISTORY` the caller no longer holds is also null.+| message | ?[message](/http-api/messages/#message-object) object | The message as you can see it, null when `status` is `missing_permissions` |## Saved message statuses| Value | Description || --- | --- |-| available | The message resolved and is included in the entry |-| missing_permissions<sup>1</sup> | The caller can no longer reach the channel or read the message, so `message` is null |--<sup>1</sup> Reported when resolving the channel fails with `MISSING_PERMISSIONS`, `UNKNOWN_CHANNEL`, `UNKNOWN_GUILD`, `ACCESS_DENIED`, or `NSFW_CONTENT_AGE_RESTRICTED`. Also reported when the channel resolves and a stored message needs `READ_MESSAGE_HISTORY` the caller does not hold.--An entry saved from a thread, a forum channel, or a media channel is omitted for a user session that does not declare the [`channel_threads` client capability](/http-api/threads/#client-capability). Fluxer reads up to three further batches of entries to replace it.+| available | The message is included in the entry |+| missing_permissions | You can't view the channel or read the message |## Bulk message deletion scopes+The `scope` field of [Delete current user's messages](#delete-current-users-messages).+| Value | Description || --- | --- |-| selected | The supplied context toggles and guild filter choose what is deleted |-| inaccessible_only<sup>1</sup> | The deletion covers only guilds the caller has left and group DMs the caller is no longer a member of |--<sup>1</sup> One-to-one direct messages are never eligible under this scope+| selected | The `include_*` fields and the guild filter decide which messages are deleted |+| inaccessible_only | Only guilds you have left and group DMs you are no longer in |## Guild filter modes+The `guild_filter_mode` field of the same endpoint.+| Value | Description || --- | --- |-| exclude | The deletion covers every eligible guild except `excluded_guild_ids` |-| include_only | The deletion covers only `included_guild_ids` |+| exclude | Every eligible guild except `excluded_guild_ids` |+| include_only | Only `included_guild_ids` |## List recent mentions<RouteHeader method="GET" path="/v1/users/@me/mentions" />-Lists the caller's recent mention history. Returns an array of [message](/http-api/messages/#message-object) objects the caller can still read, in descending message ID order.--Fluxer resolves each retained entry against current permissions. A message that has been deleted, or whose channel the caller can no longer reach, other than a thread the caller cannot view, is omitted without being removed from history. The filters and `limit` apply before that resolution, so a full page can return fewer messages than `limit`.+Returns [messages](/http-api/messages/#message-object) from your recent mention history that you can still read, newest first. Fluxer records only mentions in guild channels. A deleted message or a channel you can no longer view is left out, and a page can have fewer messages than `limit`.-An entry in a thread, a forum channel, or a media channel is omitted for a user session that does not declare `channel_threads`. Fluxer reads up to three further batches of history to replace it.+An entry in a thread, forum channel or media channel is left out unless the session declares the [`channel_threads` client capability](/http-api/threads/#client-capability).### Query parameters| Field | Type | Description || --- | --- | --- |-| limit?<sup>1</sup> | integer | The maximum number of mentions read from history (1-100, default 25) |-| roles?<sup>2</sup> <sup>3</sup> | boolean | Whether entries recorded as role mentions are included (default true) |-| everyone?<sup>2</sup> <sup>3</sup> <sup>4</sup> | boolean | Whether entries recorded as everyone mentions are included (default true) |-| guilds?<sup>2</sup> <sup>5</sup> | boolean | Whether entries in a guild channel are included (default true) |-| before? | snowflake | The upper bound on entry message ID, exclusive |--<sup>1</sup> A value outside the range fails with `VALUE_MUST_BE_INTEGER_IN_RANGE` at the `limit` path. The value is read with a leading-integer parse, so `25abc` is accepted as `25`--<sup>2</sup> Only the exact strings `true`, `True`, and `1` are read as true. Every other value, `TRUE` and `yes` included, is read as false--<sup>3</sup> The filter excludes every entry with the named mention kind, so a message that arrived through both a direct and a role mention is excluded while `roles` is false--<sup>4</sup> An `@here` mention is recorded as an everyone mention. It is recorded only for an account holding a live Gateway session on the guild when the mention was fanned out+| limit? | integer | The maximum number of mentions to look up (1-100, default 25) |+| roles? | boolean | Whether role mentions are included (default true) |+| everyone? | boolean | Whether `@everyone` and `@here` mentions are included (default true) |+| guilds? | boolean | Whether mentions in guild channels are included (default true) |+| before? | snowflake | Only return mentions with a message ID below this |-<sup>5</sup> Every recorded entry has a guild, so setting this to false always returns an empty array--:::note[Only guild channel mentions are recorded]-A direct message never produces an entry. Fluxer records nothing for the message author, for a bot account, or for a member who cannot view the channel. In a thread, an `@everyone` or `@here` mention counts only for a [thread member](/http-api/thread-members/).-:::--The response has no cursor metadata, so `before` and `limit` are the only pagination controls.--Fluxer drops a direct mention at message creation when the mentioned account has blocked the author, so it never reaches the history. An `@everyone` or `@here` mention is not recorded while `suppress_everyone` is enabled for the guild, and a role mention is not recorded while `suppress_roles` is enabled. A message that also has a direct mention is still recorded. Changing those [guild notification settings](/http-api/users/settings/#user-guild-settings-object) later does not retroactively add or remove history.--:::caution[One bad entry can fail the whole listing]-Fluxer omits an entry whose channel the caller cannot reach. An entry in a thread the caller can no longer view returns 403 `MISSING_ACCESS` for the whole request. Narrow the window with `before` to page around it.-:::--Fluxer also omits an entry that needs age verification and one whose membership state does not resolve. [Thread permissions](/http-api/threads/#thread-permissions) states when a thread stops being viewable.+Only `true`, `True` and `1` count as true for the boolean fields. Setting `guilds` to false always returns an empty array.### Response| Status | Body | Condition || --- | --- | --- || 200 | array[[message](/http-api/messages/#message-object) object] | Readable mentions were returned |-| 403 | [error response](/http-api/#error-response) | A retained entry is in a thread the caller cannot view and the request returns `MISSING_ACCESS` |--### Rate limit+| 403 | [error response](/http-api/#error-response) | `MISSING_ACCESS` fails the whole list when an entry is in a thread you can no longer view |-40 requests per 10 seconds for each authenticated user, on the `user:mentions:read` bucket.+The rate limit is 40 requests per 10 seconds, on the `user:mentions:read` bucket.## Mark recent mentions read<RouteHeader method="POST" path="/v1/users/@me/mentions/read" />-Removes entries from the caller's recent mention history. Returns 204 with an empty body. Emits one [Recent Mention Delete](/gateway/events/#recent-mention-delete) Gateway event for each entry it removes.+Removes entries from your recent mention history and returns 204. Sends a [Recent Mention Delete](/gateway/events/#recent-mention-delete) event for each entry removed. It doesn't change the channel's unread mention count, which is part of its [read state](/http-api/read-states/).### JSON body| Field | Type | Description || --- | --- | --- |-| message_ids<sup>1</sup> | array[snowflake] | The recent mention message IDs to remove (1-100 entries) |--<sup>1</sup> An ID absent from the history is an idempotent no-op that emits no Dispatch. A duplicate ID is not deduplicated, so an ID naming a real entry twice emits the Dispatch twice+| message_ids | array[snowflake] | The message IDs of the entries to remove (1-100 entries) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Every supplied ID was processed |--:::note[Removing an entry leaves the message unread]-The mention count on the entry's channel does not change. [Read states](/http-api/read-states/) defines acknowledgement.-:::+| 204 | empty | The entries were removed, and unknown IDs are ignored |-### Side effects--Fluxer looks up every supplied ID first and deletes only the entries that exist. [Recent Mention Delete](/gateway/events/#recent-mention-delete) reaches the caller's own sessions once for every entry found, so a request naming only unknown IDs writes nothing.--### Rate limit--60 requests per 10 seconds for each authenticated user, on the `user:mentions:delete` bucket, which is shared with [Delete recent mention](#delete-recent-mention).+The rate limit is 60 requests per 10 seconds, on the `user:mentions:delete` bucket.## Delete recent mention<RouteHeader method="DELETE" path="/v1/users/@me/mentions/{message_id}" />-Removes one entry from the caller's recent mention history. Returns 204 with an empty body. Emits a [Recent Mention Delete](/gateway/events/#recent-mention-delete) Gateway event when an entry is removed.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| message_id | snowflake | The message ID of the recent mention entry |--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 204 | empty | The entry was removed, or no entry named that message |--### Side effects--A matching entry is deleted and [Recent Mention Delete](/gateway/events/#recent-mention-delete) reaches the caller's own sessions. When no entry existed the request writes nothing. The message stays in its channel, and the caller's channel mention count and unread badge are unchanged.--### Rate limit+Removes one entry from your recent mention history and returns 204, whether or not the entry existed. Sends a [Recent Mention Delete](/gateway/events/#recent-mention-delete) event when an entry is removed.-60 requests per 10 seconds for each authenticated user, on the `user:mentions:delete` bucket, which is shared with [Mark recent mentions read](#mark-recent-mentions-read).+The rate limit is 60 requests per 10 seconds, on the `user:mentions:delete` bucket.## List saved messages<RouteHeader method="GET" path="/v1/users/@me/saved-messages" />-Lists the caller's saved message collection. Returns an array of [saved message](#saved-message-object) objects in descending message ID order.+Returns an array of [saved messages](#saved-message-object), newest first. An entry whose message you can no longer read comes back with status `missing_permissions`. An entry whose message was deleted is removed from your saved messages and left out, and a page can have fewer entries than `limit`.-The response is a bare array with no cursor metadata, so `before` and `limit` are the only pagination controls. An entry whose channel the caller can no longer reach, or whose message the caller can no longer read, comes back with status `missing_permissions` and a null message. An entry in a thread the caller can no longer view returns 403 `MISSING_ACCESS` for the whole request. An entry whose message no longer exists is deleted and omitted. The array can hold fewer entries than `limit`.+An entry saved from a thread, forum channel or media channel is left out unless the session declares the [`channel_threads` client capability](/http-api/threads/#client-capability).### Query parameters| Field | Type | Description || --- | --- | --- |-| limit?<sup>1</sup> <sup>2</sup> | integer | The maximum number of entries read from the collection (1-100, default 25) |-| before?<sup>2</sup> | snowflake | The upper bound on entry message ID, exclusive |--<sup>1</sup> A value outside the range fails with `VALUE_MUST_BE_INTEGER_IN_RANGE` at the `limit` path--<sup>2</sup> Applied to the stored entries before each one is resolved--:::caution[Reading the collection deletes entries]-Fluxer permanently deletes an entry whenever its message no longer exists. An entry whose message the caller cannot read is kept and reported as `missing_permissions`.-:::--A guild configuring [message_history_cutoff](/http-api/guilds/#guild-object) still serves a message posted at or after the cutoff to a member without `READ_MESSAGE_HISTORY`, so the entry stays `available`. A message posted before the cutoff is reported as `missing_permissions`.+| limit? | integer | The maximum number of entries to look up (1-100, default 25) |+| before? | snowflake | Only return entries with a message ID below this |### Response| Status | Body | Condition || --- | --- | --- || 200 | array[[saved message](#saved-message-object) object] | Saved entries were returned |-| 403 | [error response](/http-api/#error-response) | A stored entry is in a thread the caller cannot view and the request returns `MISSING_ACCESS` |--### Side effects+| 403 | [error response](/http-api/#error-response) | `MISSING_ACCESS` fails the whole list when an entry is in a thread you can no longer view |-When this read deletes an entry whose message no longer exists, Fluxer emits no [Saved Message Delete](/gateway/events/#saved-message-delete).--### Rate limit--40 requests per 10 seconds for each authenticated user, on the `user:saved_messages:read` bucket.+The rate limit is 40 requests per 10 seconds, on the `user:saved_messages:read` bucket.## Save message<RouteHeader method="POST" path="/v1/users/@me/saved-messages" />-Adds a message to the caller's private saved message collection. Returns 204 with an empty body. Emits a [Saved Message Create](/gateway/events/#saved-message-create) Gateway event.+Saves a message and returns 204 when you can view its channel and the message itself, and sends a [Saved Message Create](/gateway/events/#saved-message-create) event to your sessions.-The caller needs access to the channel and to the message.+An account can save at most the `max_bookmarks` [instance limit](/http-api/instance/#limit-keys), 50 by default.### JSON body| Field | Type | Description || --- | --- | --- |-| channel_id<sup>1</sup> | snowflake | The channel containing the message |+| channel_id | snowflake | The channel containing the message || message_id | snowflake | The ID of the message to save |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Message is present in the saved collection |-| 400 | [error response](/http-api/#error-response) | The collection is at its ceiling and the request returns `MAX_BOOKMARKS` |-| 403 | [error response](/http-api/#error-response) | The caller lacks `VIEW_CHANNEL` or guild membership, returning `MISSING_PERMISSIONS`, the membership state cannot be resolved, returning `ACCESS_DENIED`, or the channel needs age verification, returning `NSFW_CONTENT_AGE_RESTRICTED` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` in the parent of a thread, or cannot view a private thread, each returning `MISSING_ACCESS` |-| 404 | [error response](/http-api/#error-response) | The channel returns `UNKNOWN_CHANNEL`, its guild returns `UNKNOWN_GUILD`, the message returns `UNKNOWN_MESSAGE`, or the account returns `UNKNOWN_USER` |--### Side effects--Saving an already stored message rewrites the entry. [Saved Message Create](/gateway/events/#saved-message-create) reaches the caller's own sessions on every accepted save, a repeat save included, with the message object as the caller can currently see it. A save of a message in a thread reaches only the sessions with [thread access](/gateway/threads/#session-flag).--### Rate limit+| 204 | empty | The message is in your saved messages |+| 400 | [error response](/http-api/#error-response) | `MAX_BOOKMARKS` when you are at the limit, even for a message already saved |+| 403 | [error response](/http-api/#error-response) | `NSFW_CONTENT_AGE_RESTRICTED` when the channel needs age verification |-30 requests per 10 seconds for each authenticated user, on the `user:saved_messages:write` bucket, which is shared with [Unsave message](#unsave-message).+The rate limit is 30 requests per 10 seconds, on the `user:saved_messages:write` bucket.## Unsave message<RouteHeader method="DELETE" path="/v1/users/@me/saved-messages/{message_id}" />-Removes a message from the caller's private saved message collection. Returns 204 with an empty body. Emits a [Saved Message Delete](/gateway/events/#saved-message-delete) Gateway event.--No current access to the channel is required.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| message_id | snowflake | The message ID of the saved entry |--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 204 | empty | Message is absent from the saved collection |--### Side effects+Removes a message from your saved messages and returns 204, whether or not it was saved. You don't need access to the channel. Sends a [Saved Message Delete](/gateway/events/#saved-message-delete) event to your sessions.-Fluxer always issues the delete, and [Saved Message Delete](/gateway/events/#saved-message-delete) reaches the caller's own sessions on every accepted request, including one naming a message the account never saved. The saved entry is removed and the message stays in its channel.--### Rate limit--30 requests per 10 seconds for each authenticated user, on the `user:saved_messages:write` bucket, which is shared with [Save message](#save-message).+The rate limit is 30 requests per 10 seconds, on the `user:saved_messages:write` bucket.## Delete current user's messages<RouteHeader method="POST" path="/v1/users/@me/messages/bulk-delete-mine" mfa />-Deletes the messages the caller authored that the supplied filter selects. Requires [sudo mode](/http-api/users/mfa/#sudo-mode). Returns 202 with an empty body before deletion begins.--Deletion emits batched [Message Delete Bulk](/gateway/events/#message-delete-bulk) Dispatches as it progresses, and finally a [Message Create](/gateway/events/#message-create) for the completion direct message.+Deletes the messages you wrote that the filter selects, and needs [sudo mode](/http-api/users/mfa/#sudo-mode). Returns 202 before deletion starts. Fluxer sends [Message Delete Bulk](/gateway/events/#message-delete-bulk) events as it works and then a direct message from the system account with the totals. Personal notes are never deleted.:::danger[Deletion is permanent]-Every message the filter selects is deleted from its channel for every recipient, and its attachments are permanently removed. No operation restores them. Obtain explicit user confirmation before submitting, and never present the 202 as confirmation that deletion has finished.+Fluxer deletes every selected message for every recipient and removes its attachments. Nothing restores them.:::### JSON body-The caller proves sudo mode either with the sudo fields below or with an existing proof in the `X-Fluxer-Sudo-Mode-JWT` request header.+The sudo fields are the [sudo verification object](/http-api/users/mfa/#sudo-verification-object), and you can send an existing proof in the `X-Fluxer-Sudo-Mode-JWT` header instead. The `selected` scope needs at least one of `include_dms`, `include_dms_closed`, `include_group_dms` and `include_guilds` to be true. The `inaccessible_only` scope ignores them and the guild filter.| Field | Type | Description || --- | --- | --- || scope? | string | The [deletion scope](#bulk-message-deletion-scopes), default `selected` |-| include_dms? | boolean | Whether one-to-one DMs the caller still has open are included (default true) |-| include_dms_closed?<sup>1</sup> | boolean | Whether one-to-one DMs the caller has closed are included (default true) |-| include_group_dms?<sup>2</sup> | boolean | Whether group DMs the caller is still a member of are included (default true) |-| include_guilds?<sup>2</sup> | boolean | Whether channels and threads in guilds the caller is still a member of are included (default true) |-| guild_filter_mode?<sup>3</sup> | string | The [guild filter mode](#guild-filter-modes), default `exclude` |-| excluded_guild_ids? | array[snowflake] | The guilds left untouched in `exclude` mode (max 500 IDs, default empty) |-| included_guild_ids? | array[snowflake] | The only guilds targeted in `include_only` mode (max 500 IDs, default empty) |-| start_date?<sup>4</sup> | ?ISO8601 timestamp | The inclusive lower bound on message time, or null for no lower bound |-| end_date?<sup>4</sup> | ?ISO8601 timestamp | The exclusive upper bound on message time, or null for no upper bound |-| password?<sup>5</sup> | string | The account password (8-256 characters) |-| mfa_method?<sup>5</sup> | string | The sudo MFA method, one of `totp`, `webauthn` or `email_code` |-| mfa_code?<sup>5</sup> | string | The sudo authenticator code, or an unconsumed backup code (1-32 characters) |-| webauthn_response?<sup>5</sup> | [WebAuthn assertion](/http-api/users/mfa/#webauthn-assertion-object) object | The sudo WebAuthn assertion |-| webauthn_challenge?<sup>5</sup> | string | The sudo WebAuthn challenge (1-256 characters) |+| include_dms? | boolean | Whether open one-to-one DMs are included (default true) |+| include_dms_closed? | boolean | Whether closed one-to-one DMs are included (default true) |+| include_group_dms? | boolean | Whether group DMs you are still in are included (default true) |+| include_guilds? | boolean | Whether guilds you are still in are included (default true) |+| guild_filter_mode? | string | The [guild filter mode](#guild-filter-modes), default `exclude` |+| excluded_guild_ids? | array[snowflake] | The guilds to skip in `exclude` mode (max 500 IDs) |+| included_guild_ids? | array[snowflake] | The only guilds to delete from in `include_only` mode (max 500 IDs) |+| start_date? | ?ISO8601 timestamp | Only messages at or after this time |+| end_date? | ?ISO8601 timestamp | Only messages before this time, and it must be later than `start_date` |+| password? | string | The account password (8-256 characters) |+| mfa_method? | string | The sudo MFA method, one of `totp`, `webauthn` or `email_code` |+| mfa_code? | string | The sudo authenticator code or an unused backup code (1-32 characters) |+| webauthn_response? | [WebAuthn assertion](/http-api/users/mfa/#webauthn-assertion-object) object | The sudo WebAuthn assertion |+| webauthn_challenge? | string | The sudo WebAuthn challenge (1-256 characters) || email_code_ticket? | string | The ticket from [send a sudo email code](/http-api/users/mfa/#send-a-sudo-email-code) (1-128 characters) || email_code? | string | The 6-digit code from that email |@@ -319,79 +201,47 @@ The caller proves sudo mode either with the sudo fields below or with an existin| Status | Body | Condition || --- | --- | --- |-| 202 | empty | Deletion was accepted for asynchronous processing |-| 400 | [error response](/http-api/#error-response) | The date range or context selection is invalid, or a supplied sudo proof is wrong and the request returns `INVALID_PASSWORD`, `PASSWORD_NOT_SET`, or `INVALID_MFA_CODE` |-| 403 | [error response](/http-api/#error-response) | No accepted sudo proof is present and the request returns `SUDO_MODE_REQUIRED` |-| 500 | [error response](/http-api/#error-response) | Deletion could not be queued |--### Side effects--An account holding a TOTP secret or a registered WebAuthn credential that proved sudo mode with MFA receives a fresh proof in the response header. A request that already had a valid proof gets that same token echoed back without an extended lifetime.--As deletion progresses, each affected channel emits [Message Delete Bulk](/gateway/events/#message-delete-bulk) in batches of at most 100 message IDs. The deleted messages' attachments are permanently removed. A message deleted in a thread lowers the `message_count` of that [thread](/http-api/threads/#thread-object), except for the first message of a forum or media post.+| 202 | empty | Deletion was accepted |+| 400 | [error response](/http-api/#error-response) | An `end_date` not after `start_date`, no `include_*` field true, or a wrong sudo proof |+| 403 | [error response](/http-api/#error-response) | `SUDO_MODE_REQUIRED` when no accepted proof is present |-On completion the system account sends the caller a direct message in the account locale reporting the total deleted message count and the number of channels touched. That message arrives through the ordinary [Message Create](/gateway/events/#message-create) Dispatch.--### Rate limit--5 requests per 30 minutes for each authenticated user, on the `user:messages:bulk_delete_mine_filtered` bucket.+The rate limit is 5 requests per 30 minutes, on the `user:messages:bulk_delete_mine_filtered` bucket.## Request bulk message deletion<RouteHeader method="POST" path="/v1/users/@me/messages/delete" mfa />-Schedules deletion of every message the caller has ever sent. Returns 204 with an empty body. Emits a [User Update](/gateway/events/#user-update) Gateway event.--The request requires [sudo mode](/http-api/users/mfa/#sudo-mode). [Delete current user's messages](#delete-current-users-messages) is the immediate counterpart and takes a filter. This form takes none and waits a day.--Calling the operation again replaces the pending schedule. The account holds at most one pending deletion, reported by the [pending bulk message deletion object](/http-api/users/#pending-bulk-message-deletion-object) on the [user object](/http-api/users/#user-object).+Schedules deletion of every message you have sent, to run one day later, and needs [sudo mode](/http-api/users/mfa/#sudo-mode). Returns 204 and sends a [User Update](/gateway/events/#user-update) event. The [user object](/http-api/users/#user-object) shows the schedule in [`pending_bulk_message_deletion`](/http-api/users/#pending-bulk-message-deletion-object), and a new request replaces it.:::danger[Deletion is permanent once it runs]-The schedule targets every message the caller authored before the scheduled moment and removes their attachments. Unlike the filtered form it applies no channel eligibility rule, so it also deletes the caller's personal notes. [Cancel bulk message deletion](#cancel-bulk-message-deletion) is the only way to stop it.+This deletes everything you wrote, including personal notes, and removes the attachments. [Cancel bulk message deletion](#cancel-bulk-message-deletion) is the only way to stop it.:::### JSON body-The body is the [sudo verification object](/http-api/users/mfa/#sudo-verification-object) and has no other field. An existing proof is in the `X-Fluxer-Sudo-Mode-JWT` request header.+The body is the [sudo verification object](/http-api/users/mfa/#sudo-verification-object). You can send an existing proof in the `X-Fluxer-Sudo-Mode-JWT` header instead.### Response| Status | Body | Condition || --- | --- | --- || 204 | empty | The deletion was scheduled |-| 400 | [error response](/http-api/#error-response) | A supplied sudo proof is wrong and the request returns `INVALID_PASSWORD`, `PASSWORD_NOT_SET`, or `INVALID_MFA_CODE` |-| 403 | [error response](/http-api/#error-response) | No accepted sudo proof is present and the request returns `SUDO_MODE_REQUIRED` |-| 500 | [error response](/http-api/#error-response) | The deletion could not be scheduled |--The 204 has `X-Fluxer-Sudo-Mode-JWT` when sudo verification issued or reused a token.+| 400 | [error response](/http-api/#error-response) | A wrong sudo proof (`INVALID_PASSWORD`, `PASSWORD_NOT_SET`, `INVALID_MFA_CODE`) |+| 403 | [error response](/http-api/#error-response) | `SUDO_MODE_REQUIRED` when no accepted proof is present |-### Side effects--The new schedule replaces any pending deletion and starts exactly one day later. Its message and channel counts reflect the account at scheduling time and do not update while it waits.--The updated counts and schedule are published to the caller through [User Update](/gateway/events/#user-update). No message is deleted by this request, so no channel receives a Dispatch until the scheduled work runs.--:::caution[Nothing announces that the deletion finished]-When deletion runs, the pending schedule becomes null without a [User Update](/gateway/events/#user-update).-:::--### Rate limit--6 requests per minute for each authenticated user, on the `user:messages:bulk_delete` bucket, which is shared with [Cancel bulk message deletion](#cancel-bulk-message-deletion).+The rate limit is 6 requests per minute, on the `user:messages:bulk_delete` bucket.## Cancel bulk message deletion<RouteHeader method="DELETE" path="/v1/users/@me/messages/delete" />-Cancels a pending bulk message deletion. Returns 200 on success. Emits a [User Update](/gateway/events/#user-update) Gateway event.--No sudo verification applies. An account with no pending deletion still returns 200 and still emits the Dispatch. Once the scheduled work has started there is nothing left to cancel, and the deleted messages are not restored.+Cancels a pending bulk message deletion and sends a [User Update](/gateway/events/#user-update) event with `pending_bulk_message_deletion` set to null. It returns 200 even when nothing is pending. Once the deletion has started, the deleted messages are not restored.### Response body| Field | Type | Description || --- | --- | --- |-| success | boolean | Whether the cancellation was applied, always true |+| success | boolean | Always true |### Response@@ -399,10 +249,4 @@ No sudo verification applies. An account with no pending deletion still returns| --- | --- | --- || 200 | response body | The pending deletion, if any, was cancelled |-### Side effects--The scheduled moment and both stored counts are cleared from the account, the queued work is removed, and [User Update](/gateway/events/#user-update) reaches the caller with `pending_bulk_message_deletion` set to null.--### Rate limit--6 requests per minute for each authenticated user, on the `user:messages:bulk_delete` bucket, which is shared with [Request bulk message deletion](#request-bulk-message-deletion).+The rate limit is 6 requests per minute, on the `user:messages:bulk_delete` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/users/current-user.mdx b/fluxer_docs/src/content/docs/http-api/users/current-user.mdxindex ba1a48d59..3c02a66c3 100644--- a/fluxer_docs/src/content/docs/http-api/users/current-user.mdx+++ b/fluxer_docs/src/content/docs/http-api/users/current-user.mdx@@ -1,38 +1,23 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Current user-description: Reading and mutating the authenticated account, plus its lifecycle operations.+description: Routes that read and change the account making the request.---import RouteHeader from '@/components/RouteHeader.astro';-The current user is the account that presented the credential, represented as a [user object](/http-api/users/#user-object). The routes here read that account, change it, and run its lifecycle operations.--Every route except [Get current user](#get-current-user) is user-only. Those routes reject a bot or OAuth2 bearer credential with 403 `ACCESS_DENIED`.--## Sudo verification--Security-sensitive fields and destructive lifecycle operations on this page require [sudo mode](/http-api/users/mfa/#sudo-mode), which states the token form, the header round trip, and the code each failure returns. The accepted proof depends on the account state.--| Account state | Accepted proof |-| --- | --- |-| No TOTP secret and no registered WebAuthn credential | The current `password`, or an emailed code when the account has a confirmed email address |-| A TOTP secret or a registered WebAuthn credential | `mfa_method` of `totp` with `mfa_code`, or `mfa_method` of `webauthn` with `webauthn_response` and `webauthn_challenge` |-| A registered WebAuthn credential and no TOTP secret | `mfa_method` of `webauthn` as above, or `mfa_method` of `totp` with `mfa_code` holding an unconsumed backup code |-| No password, no confirmed email address and neither of those | None, the requirement is already satisfied |--Once an account holds a TOTP secret or a registered WebAuthn credential, its `password` stops working here. A passkey counts whether or not the account enabled passkeys as a second factor. The `methods` object on a 403 `SUDO_MODE_REQUIRED` reports `backup_codes` so a client knows whether the code input is worth offering.+These routes read and change the account that made the request, a [user object](/http-api/users/#user-object). Every route except [Get current user](#get-current-user) needs a user session and doesn't accept bot or OAuth2 tokens. Changing credentials and the account lifecycle routes need [sudo mode](/http-api/users/mfa/#sudo-mode).## Guild entry object-The community an account entered after signing up with an invite.+The guild an account joined or is visiting after signing up with an invite.### Structure| Field | Type | Description || --- | --- | --- || guild_id | snowflake | The guild the account entered |-| mode | string | `member` when the account joined, `visit` when it looks around without joining |+| mode | string | `member` when the account joined, `visit` when it is visiting without joining |## Date of birth result object@@ -41,7 +26,7 @@ The community an account entered after signing up with an invite.| Field | Type | Description || --- | --- | --- || user | [user](/http-api/users/#user-object) object | The updated account |-| entry | ?[guild entry](#guild-entry-object) object | The community to open next, or null |+| entry | ?[guild entry](#guild-entry-object) object | The guild to open next, or null |## Email code delivery object@@ -58,7 +43,7 @@ The community an account entered after signing up with an invite.| Field | Type | Description || --- | --- | --- |-| next_step | string | `confirm_email` when the emailed code still has to be entered, `none` when the account is already set up |+| next_step | string | `confirm_email` when the emailed code still has to be entered, otherwise `none` || user | [user](/http-api/users/#user-object) object | The updated account || code_expires_at?<sup>1</sup> | ISO8601 timestamp | When the emailed code stops working || resend_available_at?<sup>1</sup> | ISO8601 timestamp | When another code can be requested |@@ -69,178 +54,137 @@ The community an account entered after signing up with an invite.<RouteHeader method="GET" path="/v1/users/@me" bot oauth2="identify" />-Returns the current [user](/http-api/users/#user-object) object.--### Limitations--- An OAuth2 bearer credential must hold the `identify` [scope](/http-api/oauth2/#oauth2-scopes), and one without it is rejected with 403 [`MISSING_OAUTH_SCOPE`](/http-api/errors/), whose body has `required_scope`.-- A bearer receives the [user object](/http-api/users/#user-object) with the zero values that page lists for a bearer read, and `email` only when it also holds the `email` scope.+Returns the current [user](/http-api/users/#user-object) object. An OAuth2 bearer needs the `identify` [scope](/http-api/oauth2/#oauth2-scopes) and gets `email` only with the `email` scope.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [user](/http-api/users/#user-object) object | Current account was returned |-| 403 | [error response](/http-api/#error-response) | Bearer credential lacks the `identify` scope and the request returns `MISSING_OAUTH_SCOPE` |+| 200 | [user](/http-api/users/#user-object) object | The account was returned |+| 403 | [error response](/http-api/#error-response) | `MISSING_OAUTH_SCOPE` when a bearer lacks the `identify` scope |-### Rate limit--40 requests per 10 seconds for each authenticated user, on the `user:settings:get` bucket, which is shared with [Get current user settings](/http-api/users/settings/#get-current-user-settings).+The rate limit is 40 requests per 10 seconds, on the `user:settings:get` bucket, shared with [Get current user settings](/http-api/users/settings/#get-current-user-settings).## Modify current user<RouteHeader method="PATCH" path="/v1/users/@me" />-Modifies the current account and returns the resulting [user](/http-api/users/#user-object) object.--### Limitations--- Changing the username or discriminator to a different value, supplying `new_password`, or supplying `email_token` requires [sudo verification](/http-api/users/mfa/#sudo-mode).-- A field supplied with the value the account already holds is not a change and does not raise that requirement.-- An unclaimed account never raises it either.+Changes the account and returns the updated [user](/http-api/users/#user-object) object. A different username or discriminator, `new_password` and `email_token` need [sudo verification](/http-api/users/mfa/#sudo-mode) for a claimed account.### JSON body| Field | Type | Description || --- | --- | --- |-| username?<sup>1</sup> | string | Username after trimming (1-32 ASCII letters, digits, or underscores) |-| discriminator?<sup>2</sup> | string \| integer | Discriminator parsed as an integer (1-4 decimal digits) |-| global_name?<sup>3</sup> | ?string | Display name after sanitisation (1-32 characters), or null to clear |-| email?<sup>4</sup> | string | Always rejected, because an address is applied through `email_token` |-| new_password?<sup>5</sup> | string | New password (8-256 characters) |-| password? | string | Current password (8-256 characters), used as [sudo verification](/http-api/users/mfa/#sudo-mode) proof |-| avatar?<sup>6</sup> | ?string | Base64-encoded avatar image, or null to clear |-| banner?<sup>6</sup> <sup>7</sup> | ?string | Base64-encoded banner image, or null to clear |-| bio?<sup>8</sup> | ?string | Biography (1-320 characters), or null to clear |-| pronouns?<sup>9</sup> | ?string | Pronouns (1-40 characters), or null to clear |-| accent_color? | ?integer | Packed 24-bit RGB colour (0-16777215), or null to clear |-| timezone?<sup>10</sup> | ?string | Supported IANA timezone identifier (1-128 characters), or null to clear |-| timezone_privacy_flags? | integer | [Profile field privacy flags](/http-api/users/#profile-field-privacy-flags) applied to the profile timezone |+| username?<sup>1</sup> | string | Username (1-32 ASCII letters, digits or underscores) |+| discriminator?<sup>2</sup> | string \| integer | Discriminator (1-4 decimal digits) |+| global_name? | ?string | Display name (1-32 characters), or null to clear |+| email?<sup>3</sup> | string | Always rejected, use `email_token` |+| new_password?<sup>4</sup> | string | New password (8-256 characters) |+| password? | string | Current password (8-256 characters) |+| avatar?<sup>5</sup> | ?string | Base64-encoded avatar image, or null to clear |+| banner?<sup>5</sup> <sup>6</sup> | ?string | Base64-encoded banner image, or null to clear |+| bio?<sup>7</sup> | ?string | Biography (1-320 characters), or null to clear |+| pronouns? | ?string | Pronouns (1-40 characters), or null to clear |+| accent_color? | ?integer | Packed 24-bit RGB color (0-16777215), or null to clear |+| timezone?<sup>8</sup> | ?string | IANA timezone identifier (1-128 characters), or null to clear |+| timezone_privacy_flags? | integer | [Profile field privacy flags](/http-api/users/#profile-field-privacy-flags) for the timezone || premium_badge_hidden? | boolean | Whether to hide the premium badge from the public profile |-| premium_badge_masked? | boolean | Whether to present a lifetime badge as an ordinary subscription badge |+| premium_badge_masked? | boolean | Whether to show a lifetime badge as an ordinary subscription badge || premium_badge_timestamp_hidden? | boolean | Whether to hide the premium activation time || premium_badge_sequence_hidden? | boolean | Whether to hide the lifetime premium sequence |-| premium_enabled_override?<sup>11</sup> | boolean | Whether a staff override grants premium entitlements |-| has_dismissed_premium_onboarding?<sup>12</sup> | boolean | Whether the premium onboarding flow has been dismissed |-| has_unread_gift_inventory?<sup>13</sup> | boolean | Whether the gift inventory still holds unread items |-| mention_flags? | integer | [Reply mention preference](/http-api/users/#reply-mention-preferences), one of `0`, `1`, or `2` |-| email_token?<sup>14</sup> | string | Email token (1-256 characters) issued by [verify new email](/http-api/users/email-and-password/#verify-new-email) |-| mfa_method? | string | [Sudo verification](/http-api/users/mfa/#sudo-mode) method, one of `totp`, `webauthn` or `email_code` |-| mfa_code? | string | [Sudo verification](/http-api/users/mfa/#sudo-mode) authenticator or backup code (1-32 characters) |-| webauthn_response? | [WebAuthn assertion](/http-api/users/mfa/#webauthn-assertion-object) object | [Sudo verification](/http-api/users/mfa/#sudo-mode) WebAuthn assertion |-| webauthn_challenge? | string | [Sudo verification](/http-api/users/mfa/#sudo-mode) WebAuthn challenge (1-256 characters) |+| premium_enabled_override?<sup>9</sup> | boolean | Whether a staff override grants premium entitlements |+| has_dismissed_premium_onboarding?<sup>10</sup> | boolean | Whether the premium onboarding flow was dismissed |+| has_unread_gift_inventory?<sup>11</sup> | boolean | Whether the gift inventory has unread items |+| mention_flags? | integer | [Reply mention preference](/http-api/users/#reply-mention-preferences), one of `0`, `1` or `2` |+| email_token? | string | Email token (1-256 characters) from [verify new email](/http-api/users/email-and-password/#verify-new-email) |+| mfa_method? | string | Sudo mode method, one of `totp`, `webauthn` or `email_code` |+| mfa_code? | string | Authenticator or backup code (1-32 characters) |+| webauthn_response? | [WebAuthn assertion](/http-api/users/mfa/#webauthn-assertion-object) object | WebAuthn assertion |+| webauthn_challenge? | string | WebAuthn challenge (1-256 characters) || email_code_ticket? | string | The ticket from [send a sudo email code](/http-api/users/mfa/#send-a-sudo-email-code) (1-128 characters) || email_code? | string | The 6-digit code from that email |-<sup>1</sup> The value cannot be `everyone` or `here` and cannot contain `fluxer` or `system message`, on every instance including a self-hosted one. On an instance with the `none` tag style, a username another account holds in any letter case returns `USERNAME_ALREADY_TAKEN`--<sup>2</sup> Supplying the field without a username requires the custom discriminator entitlement and is otherwise rejected with `CHANGING_DISCRIMINATOR_REQUIRES_PREMIUM`. A pair already assigned to another account is rejected with `TAG_ALREADY_TAKEN`. On an instance with the `none` tag style an account that is not a bot always has the discriminator `0000`. Any other value returns the field code `DISCRIMINATOR_NOT_SUPPORTED_ON_INSTANCE`, and a username change keeps `0000`--<sup>3</sup> Sanitisation strips standalone surrogates, invisible characters, and variation selectors and collapses whitespace before the length is measured--<sup>4</sup> Any string value returns [`EMAIL_MUST_BE_CHANGED_VIA_TOKEN`](/http-api/errors/) on the `email` path, joined by `INVALID_EMAIL_FORMAT` when the string is not an address--<sup>5</sup> A claimed account also supplies `password`, and a body that omits it is rejected with `PASSWORD_NOT_SET`. When the instance checks for breached passwords, a breached one is rejected with [`PASSWORD_IS_TOO_COMMON`](/http-api/errors/)+<sup>1</sup> Can't be `everyone` or `here` and can't contain `fluxer` or `system message`. On an instance with the `none` tag style, a name another account has in any letter case returns `USERNAME_ALREADY_TAKEN`-<sup>6</sup> The value may have a `data:...;base64,` prefix. The remaining payload runs 1 to 139810136 characters+<sup>2</sup> Without a username, needs the custom discriminator entitlement or returns `CHANGING_DISCRIMINATOR_REQUIRES_PREMIUM`. A taken pair returns `TAG_ALREADY_TAKEN`. On an instance with the `none` tag style the discriminator is always `0000` and any other value returns `DISCRIMINATOR_NOT_SUPPORTED_ON_INSTANCE`-<sup>7</sup> Every non-null value requires the animated banner entitlement, which gates every profile banner, and is otherwise rejected with [`BANNERS_REQUIRE_PREMIUM`](/http-api/errors/)+<sup>3</sup> Returns [`EMAIL_MUST_BE_CHANGED_VIA_TOKEN`](/http-api/errors/), and `INVALID_EMAIL_FORMAT` when the value is not an address-<sup>8</sup> The resolved `max_bio_length` instance limit applies on top of the schema bound, and a longer value is rejected with `CONTENT_EXCEEDS_MAX_LENGTH`+<sup>4</sup> A claimed account that already has a password also sends the current `password` or gets `PASSWORD_NOT_SET`. A breached password returns [`PASSWORD_IS_TOO_COMMON`](/http-api/errors/) when the instance checks for them-<sup>9</sup> The value is matched against the instance profile substring blocklist like `username`, `global_name`, and `bio`+<sup>5</sup> Can start with a `data:...;base64,` prefix-<sup>10</sup> An unrecognised identifier is rejected with `INVALID_TIMEZONE_IDENTIFIER`. Setting a first timezone without `timezone_privacy_flags` sets those flags to `EVERYONE`+<sup>6</sup> Any non-null value needs the animated banner entitlement or returns [`BANNERS_REQUIRE_PREMIUM`](/http-api/errors/)-<sup>11</sup> The field requires the [`STAFF`](/http-api/users/#public-user-flags) flag, and a caller without it is rejected with 403 [`MISSING_ACCESS`](/http-api/errors/)+<sup>7</sup> The `max_bio_length` instance limit also applies and returns `CONTENT_EXCEEDS_MAX_LENGTH`-<sup>12</sup> Only `true` has an effect, recording the current time as the dismissal moment. `false` is accepted and does nothing+<sup>8</sup> An unknown identifier returns `INVALID_TIMEZONE_IDENTIFIER`. A first timezone without `timezone_privacy_flags` is visible to `EVERYONE`-<sup>13</sup> Only `false` has an effect, advancing the gift inventory read cursor to the current sequence. `true` is accepted and does nothing+<sup>9</sup> Needs the [`STAFF`](/http-api/users/#public-user-flags) flag or returns 403 [`MISSING_ACCESS`](/http-api/errors/)-<sup>14</sup> Supplying the field applies the verified address the token stands for, and the token is deleted once the update lands+<sup>10</sup> Only `true` has an effect-An omitted field leaves its stored value untouched, and an explicit `null` clears a nullable field. `has_dismissed_premium_onboarding` acts only on `true` and `has_unread_gift_inventory` only on `false`, so neither can be reversed through this route.+<sup>11</sup> Only `false` has an effect-To skip the body proof fields, send the sudo token in the `X-Fluxer-Sudo-Mode-JWT` request header.+While `interaction_tier` is `legacy` ([account tiers](/http-api/users/#account-tiers)), an unverified account gets 403 [`PROFILE_EMAIL_VERIFICATION_REQUIRED`](/http-api/errors/) when it changes the username, discriminator, display name, avatar, banner, biography, pronouns, accent color, timezone, timezone privacy or a premium badge field. In that mode an [unclaimed](/http-api/users/#account-tiers) account can only send `new_password`, `has_dismissed_premium_onboarding`, `has_unread_gift_inventory`, `email_token` and the sudo fields, and any other field returns [`UNCLAIMED_ACCOUNTS_CAN_ONLY_SET_EMAIL_VIA_TOKEN`](/http-api/errors/). On an instance where people sign in with a username, `new_password` can come with `username` to claim the account in one request.-A body that has no `email_token` and nothing beyond `mfa_method`, `mfa_code`, `webauthn_response`, and `webauthn_challenge` returns the current account unchanged. Supplying `password` alone is an update with nothing to change, and it still emits [User Update](/gateway/events/#user-update).+In `enforced` mode an unclaimed account on an `email` instance that sends `new_password` without `email_token` gets 400 `USE_CLAIM_ROUTE`.-A claimed account needs a verified email before changing the username, discriminator, display name, avatar, banner, biography, pronouns, accent colour, timezone, timezone privacy, or any premium badge field. A request without one returns 403 [`PROFILE_EMAIL_VERIFICATION_REQUIRED`](/http-api/errors/).+A [limited account](/http-api/users/#account-limitation) can't change profile fields and gets 403 [`ACCOUNT_LIMITED`](/http-api/errors/).-While the instance [enforces single sign-on](/authentication/#single-sign-on-enforcement), an account linked to the provider that sets `new_password` or `email_token` gets 403 [`SSO_REQUIRED`](/http-api/errors/) and nothing changes.+While the instance [enforces single sign-on](/authentication/#single-sign-on-enforcement), an account linked to the provider that sends `new_password` or `email_token` gets 403 [`SSO_REQUIRED`](/http-api/errors/).-A [limited account](/http-api/users/#account-limitation) cannot change any of those fields. A request that sets one returns 403 [`ACCOUNT_LIMITED`](/http-api/errors/).+### Images and blocklists-An account is unclaimed while it holds no password credential, is not a bot, and does not have the SSO trait. Such an account may set only `new_password`, `has_dismissed_premium_onboarding`, and `has_unread_gift_inventory`. Any other field is rejected with [`UNCLAIMED_ACCOUNTS_CAN_ONLY_SET_EMAIL_VIA_TOKEN`](/http-api/errors/) on the path of the first offending field. The allow-list covers the profile payload only, so `email_token` and the sudo fields stay available as the way such an account claims itself. On an instance where members sign in with a username, a body with `new_password` may also set `username`, which claims the account in one request.+Avatars and banners can be PNG, JPEG, WebP, GIF, APNG, AVIF, HEIC, HEIF, JPEG XL or SVG, up to the `avatar_max_size` limit (10485760 bytes by default). Other formats return `INVALID_IMAGE_FORMAT` and larger images return `IMAGE_SIZE_EXCEEDS_LIMIT`. An animated avatar needs the animated avatar entitlement or returns `ANIMATED_AVATARS_REQUIRE_PREMIUM`.-### Image validation+A username, display name, biography or pronouns that matches the instance blocklist returns 403 [`CONTENT_BLOCKED`](/http-api/errors/). `STAFF` accounts skip the profile blocklist but not the phrase and URL blocklists.-Decoded avatar and banner content stays within the resolved `avatar_max_size` limit, which defaults to 10485760 bytes, and a larger payload is rejected with `IMAGE_SIZE_EXCEEDS_LIMIT`. Accepted formats are PNG, JPEG, WebP, GIF, APNG, AVIF, HEIC, HEIF, JPEG XL, and SVG. Anything else, animated AVIF included, is rejected with `INVALID_IMAGE_FORMAT`, and so is content the Media Proxy cannot identify.+### Change limits-An animated avatar requires the animated avatar entitlement and is otherwise rejected with `ANIMATED_AVATARS_REQUIRE_PREMIUM`. A successfully decoded avatar or non-null banner derives its dominant colour and returns it later as `avatar_color` or `banner_color`.--### Content blocklists--The username, display name, biography, and pronouns are matched against the instance profile substring blocklist, and a match returns 403 [`CONTENT_BLOCKED`](/http-api/errors/). An account with the `STAFF` flag is exempt. The biography and pronouns are also scanned against the phrase and URL blocklists.--The global content filter applied to every POST, PUT, and PATCH JSON body runs the phrase and URL blocklists over the whole body before the handler. It reads `username`, `global_name`, `email`, `timezone`, and `discriminator` when supplied as a string, alongside the biography and pronouns. It skips `avatar`, `banner`, `password`, `new_password`, `email_token`, `mfa_code`, `webauthn_response`, `webauthn_challenge`, and every field whose name ends in `_flags`, and it ignores any value shorter than 3 characters. A match returns the same 403 `CONTENT_BLOCKED`, and no flag exempts an account from it.--### Secondary controls--Each control is separate from the route bucket. A denial returns 400 `INVALID_FORM_BODY` with the matching validation code rather than 429.+A denied change returns 400 `INVALID_FORM_BODY` with the validation code.| Change | Allowance | Validation code || --- | --- | --- |-| Resulting username or discriminator | 5 per 3 hours | `USERNAME_CHANGED_TOO_MANY_TIMES` |-| Biography to a different value | 25 per 30 minutes | `BIO_CHANGED_TOO_MANY_TIMES` |-| Pronouns to a different value | 25 per 30 minutes | `PRONOUNS_CHANGED_TOO_MANY_TIMES` |-| Accent colour to a different value | 25 per 30 minutes | `ACCENT_COLOR_CHANGED_TOO_MANY_TIMES` |-| Any non-null avatar | 25 per 30 minutes | `AVATAR_CHANGED_TOO_MANY_TIMES` |-| Any banner value past the entitlement check | 25 per 30 minutes | `BANNER_CHANGED_TOO_MANY_TIMES` |--Fluxer consumes the avatar control before it detects identical content, and clearing the avatar consumes nothing. A clearing request consumes the banner control, and so does a request whose value is unchanged.--:::caution[A password change rotates the session]-Supplying `new_password` on a claimed account deletes every other authentication session and every outstanding password reset token, then replaces the session that issued the request. The user object in the response then also has the fields of the [password change completion object](/http-api/users/email-and-password/#password-change-completion-object), and the client sends every later request with that token. [Auth Session Change](/gateway/events/#auth-session-change) never includes it.+| Username or discriminator | 5 per 3 hours | `USERNAME_CHANGED_TOO_MANY_TIMES` |+| Biography | 25 per 30 minutes | `BIO_CHANGED_TOO_MANY_TIMES` |+| Pronouns | 25 per 30 minutes | `PRONOUNS_CHANGED_TOO_MANY_TIMES` |+| Accent color | 25 per 30 minutes | `ACCENT_COLOR_CHANGED_TOO_MANY_TIMES` |+| Avatar | 25 per 30 minutes | `AVATAR_CHANGED_TOO_MANY_TIMES` |+| Banner | 25 per 30 minutes | `BANNER_CHANGED_TOO_MANY_TIMES` |++:::caution[A password change replaces the session]+Sending `new_password` on a claimed account deletes every other session and issues a new token for the request. The response then has the fields of the [password change completion object](/http-api/users/email-and-password/#password-change-completion-object).:::### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [user](/http-api/users/#user-object) object | Account was returned after applying every permitted field |-| 200 | [user](/http-api/users/#user-object) object with the [password change completion](/http-api/users/email-and-password/#password-change-completion-object) fields | Account was returned after a password change rotated the session |-| 400 | [error response](/http-api/#error-response) | Body, image, tag, password, entitlement, secondary control, or sudo proof is invalid |-| 403 | [error response](/http-api/#error-response) | Email verification, sudo verification, or a staff-only field is required, or content is blocked |-| 403 | [error response](/http-api/#error-response) | The account is limited and the body changes a profile field, and the request returns `ACCOUNT_LIMITED` |-| 403 | [error response](/http-api/#error-response) | Single sign-on is enforced and an account linked to it sets a password or email, returning `SSO_REQUIRED` |+| 200 | [user](/http-api/users/#user-object) object | The account was updated |+| 200 | [user](/http-api/users/#user-object) object with the [password change completion](/http-api/users/email-and-password/#password-change-completion-object) fields | A password change replaced the session |+| 400 | [error response](/http-api/#error-response) | The body, image, tag, password, entitlement, change limit or sudo proof is invalid |+| 403 | [error response](/http-api/#error-response) | Email verification, sudo verification or `STAFF` is needed, or content is blocked |-### Side effects+Fluxer sends [User Update](/gateway/events/#user-update) to the account.-A successful change emits [User Update](/gateway/events/#user-update) to the account. When a [partial user object](/http-api/users/#partial-user-object) field changes, other accounts observe the new value. Changing the username, discriminator, or display name also updates the account in guild member search for every guild whose members are indexed. A body with no `email_token` and no field beyond the sudo verification fields changes nothing and emits no Dispatch. Any other accepted body emits the Dispatch even when no stored value changed.--### Rate limit--20 requests per minute for each authenticated user, on the `user:update` bucket, which is shared with [Accept current policies](#accept-current-policies) and [Reset current premium state](#reset-current-premium-state).+The rate limit is 20 requests per minute, on the `user:update` bucket.## Set date of birth<RouteHeader method="PUT" path="/v1/users/@me/date-of-birth" />-Sets the date of birth of an account that has none. Returns a [date of birth result](#date-of-birth-result-object) object.--An instance that does not [collect date of birth](/http-api/instance/#public-registration-fields-object) returns 404 `NOT_FOUND`. An account that already has one returns 409 `DATE_OF_BIRTH_ALREADY_SET`, because a date of birth cannot be changed once set.+Sets the date of birth of an account that has none and returns a [date of birth result](#date-of-birth-result-object) object. A date of birth can't be changed once set.### JSON body| Field | Type | Description || --- | --- | --- |-| date_of_birth<sup>1</sup> | string | The date of birth in exact `YYYY-MM-DD` form |+| date_of_birth<sup>1</sup> | string | The date of birth as `YYYY-MM-DD` |-<sup>1</sup> A date that does not exist, is today or later, or lies more than 120 years before today (UTC) returns the field code `INVALID_DATE_OF_BIRTH_FORMAT`+<sup>1</sup> A date that doesn't exist, is today or later, or is more than 120 years ago returns `INVALID_DATE_OF_BIRTH_FORMAT`-Fluxer resolves the region from the client IP address, with the same minimum age as [register an account](/http-api/authentication/#register-an-account). An age below it returns 403 `ACCOUNT_BELOW_MINIMUM_AGE`. The account is then closed at once, its sessions end, its username is released, and it is deleted after 72 hours. Signing in does not cancel that deletion.+The minimum age follows the region of the client IP address, as in [register an account](/http-api/authentication/#register-an-account). A person below it gets 403 `ACCOUNT_BELOW_MINIMUM_AGE`, and the account is closed and deleted after 72 hours.### Response@@ -249,24 +193,18 @@ Fluxer resolves the region from the client IP address, with the same minimum age| 200 | [date of birth result](#date-of-birth-result-object) object | The date of birth was set || 400 | [error response](/http-api/#error-response) | The date is invalid || 403 | [error response](/http-api/#error-response) | The person is below the minimum age |-| 404 | [error response](/http-api/#error-response) | The instance does not collect dates of birth |+| 404 | [error response](/http-api/#error-response) | The instance doesn't [collect date of birth](/http-api/instance/#public-registration-fields-object) || 409 | [error response](/http-api/#error-response) | The account already has a date of birth |-### Side effects--The account leaves the [date of birth step](/http-api/users/#user-object). Settings still on their defaults change to the adult defaults when the person is an adult, with [User Settings Update](/gateway/events/#user-settings-update). Fluxer emits [User Update](/gateway/events/#user-update), adds the account's guilds to its Gateway sessions, and accepts the invite held from sign-up.+Fluxer sends [User Update](/gateway/events/#user-update), and [User Settings Update](/gateway/events/#user-settings-update) when settings still on their defaults change to match the age.-### Rate limit--5 requests per hour for each authenticated user, on the `user:date_of_birth` bucket.+The rate limit is 5 requests per hour, on the `user:date_of_birth` bucket.## Claim an account<RouteHeader method="POST" path="/v1/users/@me/claim" />-Adds an email address, and optionally a password, to an unclaimed account, so it can be signed in to from another device. Returns a [claim result](#claim-result-object) object.--An account that is not unclaimed returns 400 `ACCOUNT_ALREADY_CLAIMED`.+Adds an email address, and optionally a password, to an unclaimed account so it can sign in from another device. Returns a [claim result](#claim-result-object) object.### JSON body@@ -275,55 +213,45 @@ An account that is not unclaimed returns 400 `ACCOUNT_ALREADY_CLAIMED`.| email?<sup>1</sup> | string | The email address to add || password?<sup>2</sup> | string | The password to set (8-256 characters) |-<sup>1</sup> Required on an `email` instance, where a missing value returns the field code `EMAIL_IS_REQUIRED`. Ignored on a `username` instance. The address gets the checks of [register an account](/http-api/authentication/#register-an-account)--<sup>2</sup> Required on a `username` instance, on an instance that sends no email and on an instance whose `verification_basis` is `local_credential`, unless the account has a passkey. A missing value there returns 400 `PASSWORD_REQUIRED_TO_CLAIM`. A breached password returns the field code `PASSWORD_IS_TOO_COMMON`+<sup>1</sup> Needed on an `email` instance or the field code `EMAIL_IS_REQUIRED` is returned. Ignored on a `username` instance. An address on another account returns `EMAIL_ALREADY_IN_USE`-An address stored on another account, confirmed or not, returns the field code `EMAIL_ALREADY_IN_USE`. On an instance that sends email, the address is stored on the account at once and waits for [confirm the email address](#confirm-the-email-address).+<sup>2</sup> Needed when the instance uses usernames to sign in, sends no email or has `verification_basis` set to `local_credential`, unless the account has a passkey. Without it the route returns 400 `PASSWORD_REQUIRED_TO_CLAIM`. A breached password returns `PASSWORD_IS_TOO_COMMON`-On an instance that sends no email, the address is confirmed at once. The claim result then has `next_step` set to `none` and no timestamps. On a `username` instance `next_step` is always `none`.+On an instance that sends email, the address waits for [confirm the email address](#confirm-the-email-address). Otherwise it is confirmed at once and `next_step` is `none`.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [claim result](#claim-result-object) object | The account was claimed, or the address waits for its code |-| 400 | [error response](/http-api/#error-response) | The body, address or password is invalid, the address is in use, or the account is already claimed |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | A route, global, address or IP bucket denies the request, or codes to the address are waiting longer |+| 200 | [claim result](#claim-result-object) object | The account was claimed or the address waits for its code |+| 400 | [error response](/http-api/#error-response) | The input is invalid, or `ACCOUNT_ALREADY_CLAIMED` |-### Side effects+Fluxer sends [User Update](/gateway/events/#user-update), and emails the code when `next_step` is `confirm_email`.-Fluxer emits [User Update](/gateway/events/#user-update) to the account and emails the code.--### Rate limit--5 requests per hour for each authenticated user, on the `user:claim` bucket.+The rate limit is 5 requests per hour, on the `user:claim` bucket.## Send an email confirmation code<RouteHeader method="POST" path="/v1/users/@me/email-verification/send" />-Emails a 6-digit code to the unconfirmed address of the account. Returns an [email code delivery](#email-code-delivery-object) object.--An unclaimed account returns 400 `USE_CLAIM_ROUTE`, and an account whose address is already confirmed returns 400 `ACCOUNT_ALREADY_CLAIMED`.+Emails a 6-digit code to the unconfirmed address of the account and returns an [email code delivery](#email-code-delivery-object) object.### Response| Status | Body | Condition || --- | --- | --- || 200 | [email code delivery](#email-code-delivery-object) object | The code was sent |-| 400 | [error response](/http-api/#error-response) | The account has no unconfirmed address |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | A route, global, address or IP bucket denies the request, or codes to the address are waiting longer |--### Rate limit+| 400 | [error response](/http-api/#error-response) | `USE_CLAIM_ROUTE` for an unclaimed account or one without an address |+| 400 | [error response](/http-api/#error-response) | `ACCOUNT_ALREADY_CLAIMED` for a confirmed address |+| 400 | [error response](/http-api/#error-response) | `EMAIL_CODES_UNAVAILABLE` when no code can be sent |-3 requests per 15 minutes for each authenticated user, on the `user:email_verification` bucket.+The rate limit is 3 requests per 15 minutes, on the `user:email_verification` bucket.## Confirm the email address<RouteHeader method="POST" path="/v1/users/@me/email-verification/confirm" />-Confirms the address of the account with the emailed code. Returns the updated [user](/http-api/users/#user-object) object.+Confirms the address with the emailed code and returns the updated [user](/http-api/users/#user-object) object.### JSON body@@ -336,140 +264,106 @@ Confirms the address of the account with the emailed code. Returns the updated [| Status | Body | Condition || --- | --- | --- || 200 | [user](/http-api/users/#user-object) object | The address was confirmed |-| 400 | [error response](/http-api/#error-response) | The code is wrong or expired |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Route or global bucket denies the request |+| 400 | [error response](/http-api/#error-response) | `INVALID_SIGN_IN_CODE` for a wrong code, `SIGN_IN_CODE_EXPIRED` after 5 wrong tries, 10 minutes or an address change |-### Side effects+Fluxer sends [User Update](/gateway/events/#user-update).-Fluxer emits [User Update](/gateway/events/#user-update) to the account.+The rate limit is 10 requests per minute, on the `user:email_verification:confirm` bucket.-### Rate limit--10 requests per minute for each authenticated user, on the `user:email_verification:confirm` bucket.--## Forget authorised IPs+## Forget authorized IPs<RouteHeader method="DELETE" path="/v1/users/@me/authorized-ips" mfa />-Deletes every authorised IP record for the current account. Requires [sudo verification](/http-api/users/mfa/#sudo-mode). Returns 204 with an empty body and emits no Gateway Dispatch.--A later sign-in from any address then needs fresh IP authorisation.+Deletes every authorized IP record, and the next sign-in from any address needs fresh authorization. Needs [sudo verification](/http-api/users/mfa/#sudo-mode).### JSON body-The body is the [sudo verification object](/http-api/users/mfa/#sudo-verification-object). It may be an empty object when the request presents an accepted sudo token.+The [sudo verification object](/http-api/users/mfa/#sudo-verification-object), which can be empty when you send a sudo token.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Authorised IP records were cleared |-| 403 | [error response](/http-api/#error-response) | Sudo verification is required and the request returns `SUDO_MODE_REQUIRED` |+| 204 | empty | The records were deleted |+| 403 | [error response](/http-api/#error-response) | `SUDO_MODE_REQUIRED` |-### Rate limit--10 requests per minute for each authenticated user, on the `user:authorized_ips:forget` bucket.+The rate limit is 10 requests per minute, on the `user:authorized_ips:forget` bucket.## Disable current account<RouteHeader method="POST" path="/v1/users/@me/disable" mfa />-Disables the current account while preserving its data. Requires [sudo verification](/http-api/users/mfa/#sudo-mode).--The route issues no sudo token and returns no `X-Fluxer-Sudo-Mode-JWT` response header.+Disables the account and keeps its data. Needs [sudo verification](/http-api/users/mfa/#sudo-mode), and the response has no `X-Fluxer-Sudo-Mode-JWT` header.### JSON body-The body is the [sudo verification object](/http-api/users/mfa/#sudo-verification-object). It may be an empty object when the request presents an accepted sudo token.+The [sudo verification object](/http-api/users/mfa/#sudo-verification-object), which can be empty when you send a sudo token.-:::caution[A later request with the same credential returns 401]-Disabling deletes every authentication session the account owns, including the one that issued the request. Signing in again clears the disabled flag, unless the flag came from a temporary suspension.+:::caution[Every session ends]+Disabling deletes every session of the account, including the one that made the request. Signing in again enables the account unless a temporary suspension disabled it.:::### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Account was disabled |-| 403 | [error response](/http-api/#error-response) | Sudo verification is required and the request returns `SUDO_MODE_REQUIRED` |-| 500 | [error response](/http-api/#error-response) | The account could not be disabled or its sessions could not be deleted |--### Side effects--Fluxer marks the account disabled and deletes every authentication session it owns. [User Update](/gateway/events/#user-update) is published only after that deletion, so no client of the account is left to receive it. The disabled flag is not part of the public flag bitfield, so other accounts observe no change.+| 204 | empty | The account was disabled |+| 403 | [error response](/http-api/#error-response) | `SUDO_MODE_REQUIRED` |-### Rate limit--5 requests per hour for each authenticated user, on the `user:account:disable` bucket.+The rate limit is 5 requests per hour, on the `user:account:disable` bucket.## Schedule current account deletion<RouteHeader method="POST" path="/v1/users/@me/delete" mfa />-Schedules deletion of the current account and deletes every authentication session it holds. Requires [sudo verification](/http-api/users/mfa/#sudo-mode).--### Limitations--- An account that owns at least one guild is rejected with 400 [`USER_OWNS_GUILDS`](/http-api/errors/).+Schedules deletion of the account and deletes every session. Needs [sudo verification](/http-api/users/mfa/#sudo-mode).### JSON body-The body is the [sudo verification object](/http-api/users/mfa/#sudo-verification-object). It may be an empty object when the request presents an accepted sudo token.+The [sudo verification object](/http-api/users/mfa/#sudo-verification-object), which can be empty when you send a sudo token.-:::caution[Signing in before the deadline cancels the deletion]-The deletion deadline is 14 days ahead by default. Once erasure starts, signing in cannot cancel it.-:::--:::note[Transfer guild ownership first]-Fluxer checks guild ownership before it accepts the deletion, so an owner of any guild transfers or deletes each guild first.+:::caution[Signing in cancels the deletion]+The deletion happens 14 days later by default. Signing in before then cancels it, and once erasure starts it can't be cancelled.:::### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Account deletion was scheduled |-| 400 | [error response](/http-api/#error-response) | The caller owns at least one guild and the request returns `USER_OWNS_GUILDS` |-| 409 | [error response](/http-api/#error-response) | `CONFLICT`, because erasure has started or the deletion state changed during the request |--### Side effects--Fluxer marks the account for deletion at the configured deadline and queues it for erasure at that time. When the account has an email address, Fluxer sends a scheduled deletion email in the account locale. Every authentication session is deleted, and [User Update](/gateway/events/#user-update) is published only after that deletion. The self-deleted flag is not part of the public flag bitfield, so other accounts observe no change until erasure runs.+| 204 | empty | The deletion was scheduled |+| 400 | [error response](/http-api/#error-response) | The account owns a guild, `USER_OWNS_GUILDS` |+| 409 | [error response](/http-api/#error-response) | `CONFLICT` when erasure has started |-### Rate limit+Fluxer emails the account when it has an address.-5 requests per hour for each authenticated user, on the `user:account:delete` bucket.+The rate limit is 5 requests per hour, on the `user:account:delete` bucket.## Accept current policies<RouteHeader method="POST" path="/v1/users/@me/terms-acceptance" />-Records acceptance of the current terms of service, and that the current privacy policy was shown. Returns the updated [user](/http-api/users/#user-object) object.+Records acceptance of the current terms of service and that the privacy policy was shown, and returns the updated [user](/http-api/users/#user-object) object.### JSON body-The body is an empty object, and an absent or empty body is read as one. Any supplied property is discarded. Invalid JSON returns 400 `INVALID_FORM_BODY` with `INVALID_FORMAT` at the `body` path. Valid JSON that is not an object is rejected with 400.+The body is an empty object.### Response| Status | Body | Condition || --- | --- | --- || 200 | [user](/http-api/users/#user-object) object | The acceptance was recorded |-| 400 | [error response](/http-api/#error-response) | The body is not valid JSON, or it parses as JSON that is not an object |+| 400 | [error response](/http-api/#error-response) | The body is not a JSON object |-### Side effects+Fluxer sends [User Update](/gateway/events/#user-update).-Fluxer sets both `terms_agreed_at` and `privacy_agreed_at` to the request time and emits [User Update](/gateway/events/#user-update) to the account. Neither timestamp belongs to the [partial user object](/http-api/users/#partial-user-object), so no other account observes the change. Repeating the operation replaces both timestamps.--### Rate limit--20 requests per minute for each authenticated user, on the `user:update` bucket, which is shared with [Modify current user](#modify-current-user) and [Reset current premium state](#reset-current-premium-state).+The rate limit is 20 requests per minute, on the `user:update` bucket.## Preview profile badges<RouteHeader method="POST" path="/v1/users/@me/profile-badges/preview" />-Returns the current account's [profile badges](/http-api/users/#profile-badge-object) as other people would see them with the given badge settings applied. Nothing is saved.+Returns the account's [profile badges](/http-api/users/#profile-badge-object) as others would see them with the given settings. Nothing is saved.### JSON body@@ -480,49 +374,35 @@ Returns the current account's [profile badges](/http-api/users/#profile-badge-ob| premium_badge_timestamp_hidden? | boolean | Preview with the premium badge date hidden || premium_badge_sequence_hidden? | boolean | Preview with the lifetime sequence hidden |-Each field has the meaning it has on [Modify current user](#modify-current-user). A field that is left out keeps the value the account has saved.+A field you leave out keeps the saved value.### Response body| Field | Type | Description || --- | --- | --- |-| profile_badges | array[[profile badge](/http-api/users/#profile-badge-object) object] | The badges in display order, localised for the current account |+| profile_badges | array[[profile badge](/http-api/users/#profile-badge-object) object] | The badges in display order |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | response body | Badges were returned |--### Rate limit+| 200 | response body | The badges were returned |-100 requests per 10 seconds for each authenticated user, on the `user:profile::target_id` bucket.+The rate limit is 100 requests per 10 seconds, on the `user:profile::target_id` bucket.## Reset current premium state<RouteHeader method="POST" path="/v1/users/@me/premium/reset" />-Clears every premium field on the current account and returns 204 with an empty body. Requires the [`STAFF`](/http-api/users/#public-user-flags) flag.--A caller without that flag is rejected with 403 [`MISSING_ACCESS`](/http-api/errors/).--:::note[The payment provider is untouched]-Nothing is cancelled or refunded in the payment provider, which stays authoritative for its own objects.-:::+Clears every premium field on the account. You need the [`STAFF`](/http-api/users/#public-user-flags) flag.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Premium state was cleared |-| 403 | [error response](/http-api/#error-response) | Caller does not have the `STAFF` flag and the request returns `MISSING_ACCESS` |--### Side effects--The operation clears `premium_type`, `premium_since`, `premium_until`, `premium_gift_extension_ends_at`, `premium_will_cancel`, `premium_billing_cycle`, `premium_grace_ends_at`, and `premium_lifetime_sequence`, plus the stored provider customer and subscription identifiers, the purchase and first refund markers, both gift inventory sequences, and the staff premium override flag. It emits [User Update](/gateway/events/#user-update) to the account.--Other accounts observe a change only when the account held an animated avatar, whose served avatar hash loses its animation prefix with the entitlement.+| 204 | empty | The premium state was cleared |+| 403 | [error response](/http-api/#error-response) | `MISSING_ACCESS` without the `STAFF` flag |-### Rate limit+Fluxer sends [User Update](/gateway/events/#user-update).-20 requests per minute for each authenticated user, on the `user:update` bucket, which is shared with [Modify current user](#modify-current-user) and [Accept current policies](#accept-current-policies).+The rate limit is 20 requests per minute, on the `user:update` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/users/data-harvest.mdx b/fluxer_docs/src/content/docs/http-api/users/data-harvest.mdxindex 90107e3ee..e5277eb66 100644--- a/fluxer_docs/src/content/docs/http-api/users/data-harvest.mdx+++ b/fluxer_docs/src/content/docs/http-api/users/data-harvest.mdx@@ -1,254 +1,163 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Data harvests-description: Compiling the account's data into a downloadable ZIP archive.+description: Requesting a ZIP archive of the account's data and downloading it.---import RouteHeader from '@/components/RouteHeader.astro';-A data harvest is a ZIP archive of the current account's data. Fluxer compiles it in the background, reports progress while it runs, and issues a temporary download URL once the archive is written.+A data harvest is a ZIP archive of the current account's data. Fluxer builds it in the background while you poll its status, then you download it.-Every route except [Download data harvest archive](#download-data-harvest-archive) is user-only. Fluxer rejects a bot or OAuth2 bearer credential with 403 `ACCESS_DENIED`. No route here requires [sudo mode](/http-api/users/mfa/#sudo-mode). [Delete current user's messages](/http-api/users/content/#delete-current-users-messages) takes the same filter shape, destroys the messages, and requires it.+Every route except [Download data harvest archive](#download-data-harvest-archive) needs a user token. Bot and OAuth2 tokens get 403.-:::caution[A completed archive has a seven day download deadline]-A completed harvest records a deadline exactly seven days after the archive was written. After it, [Get data harvest download URL](#get-data-harvest-download-url) returns 400 `HARVEST_EXPIRED` and [Download data harvest archive](#download-data-harvest-archive) returns 404, while the record keeps reporting `completed`. Nothing extends or restores it.-:::+You can download a completed archive until `download_url_expires_at`, seven days after it is written. After that, [Get data harvest download URL](#get-data-harvest-download-url) returns 400 `HARVEST_EXPIRED` and the status stays `completed`.-## Harvest status values+## Archive contents++The archive has these files.++- `user.json` with the account, its connections without credentials and its thread memberships+- `channels/{channel_id}/messages.json` for each channel with a collected message, oldest first+- `payments/payment_history.json`+- `integrations/oauth.json` with the applications the account owns+- `account/security.json`+- the avatar and banner under `assets/user/`-Use `status` to track preparation of the archive.+Each message lists its attachments with a [data package URL](/http-api/messages/#data-package-attachment-urls), and the archive doesn't include the files. When the harvest completes, Fluxer emails a download link if the account has an email address and the instance sends email.++## Harvest status values| Value | Description || --- | --- |-| pending | No processing attempt has started |-| processing | An attempt has started and has neither completed nor failed |-| completed | The archive was written and is ready for download |-| failed | The latest attempt recorded a failure |+| pending | Processing has not started |+| processing | An attempt is running |+| completed | The archive is ready for download |+| failed | The latest attempt failed |-Fluxer retries the underlying job. A retry clears `failed_at` and `error_message`, sets `started_at` again, resets the reported progress to 0, and reports `processing` while it runs. On success it records `completed_at`, `file_size`, and a download deadline, and reports `completed`.+When an attempt fails, Fluxer retries it a limited number of times. The retry clears `failed_at` and `error_message`, resets progress to 0 and reports `processing`. After the last attempt fails, `progress_step` becomes `Failed` and the status stays `failed`.## Harvest creation object-The acknowledgement returned by both creation operations.-### Structure| Field | Type | Description || --- | --- | --- || harvest_id | snowflake | The ID of the created harvest |-| status<sup>1</sup> | string | The [harvest status](#harvest-status-values) at creation |-| created_at<sup>2</sup> | ISO8601 timestamp | When the harvest was requested |--<sup>1</sup> Always `pending`--<sup>2</sup> Recorded at the same moment the [snowflake](/snowflakes/) is generated, so ordering harvests by ID is the same as ordering them by `created_at`+| status | string | The [harvest status](#harvest-status-values), always `pending` |+| created_at | ISO8601 timestamp | When the harvest was requested |## Harvest status object-The full state of one harvest. It extends the [harvest creation](#harvest-creation-object) object with progress and completion fields.-### Structure| Field | Type | Description || --- | --- | --- || harvest_id | snowflake | The ID of the harvest |-| status | string | The derived [harvest status](#harvest-status-values) |+| status | string | The [harvest status](#harvest-status-values) || created_at | ISO8601 timestamp | When the harvest was requested |-| started_at<sup>1</sup> | ?ISO8601 timestamp | When the current processing attempt began, or null while the harvest is pending |-| completed_at | ?ISO8601 timestamp | When the archive was written, or null when it has not been |-| failed_at<sup>2</sup> | ?ISO8601 timestamp | When the latest attempt recorded a failure, or null when it has not |-| file_size<sup>3</sup> | ?string | The archive size in bytes as a decimal string, or null before the archive was written |-| progress_percent<sup>4</sup> | number | Progress from 0 through 100 |-| progress_step<sup>5</sup> | ?string | The [harvest progress step](#harvest-progress-steps) for the current stage |-| error_message<sup>6</sup> | ?string | The latest attempt's failure description, or null when it has not failed |-| download_url_expires_at<sup>7</sup> | ?ISO8601 timestamp | When the archive's download deadline elapses, or null before completion |-| expires_at<sup>8</sup> | ?ISO8601 timestamp | When the archive's download deadline elapses, or null before completion |--<sup>1</sup> A new processing attempt replaces this timestamp, resets `progress_percent` to 0, and sets `progress_step` to `Starting harvest`--<sup>2</sup> Cleared when a new attempt starts, so it is non-null only when the latest attempt failed--<sup>3</sup> A decimal string because the value is 64-bit--<sup>4</sup> Every recorded value is a whole number. It never decreases inside a single attempt, and completion sets it to exactly 100--<sup>5</sup> Every record is created with the step `Queued`, so this member is never null--<sup>6</sup> The string form of the underlying failure. It is diagnostic and is not stable for programmatic matching--<sup>7</sup> Recorded when the archive is written, exactly seven days after that moment. Past it Fluxer issues no new download URL--<sup>8</sup> A second name for `download_url_expires_at`. The stored value is the same+| started_at | ?ISO8601 timestamp | When the current attempt began |+| completed_at | ?ISO8601 timestamp | When the archive was written |+| failed_at | ?ISO8601 timestamp | When the latest attempt failed |+| file_size | ?string | The archive size in bytes as a decimal string |+| progress_percent | number | Progress from 0 through 100 |+| progress_step | ?string | The [harvest progress step](#harvest-progress-steps) |+| error_message | ?string | The latest failure description, for logs only |+| download_url_expires_at | ?ISO8601 timestamp | When the archive stops being downloadable |+| expires_at | ?ISO8601 timestamp | Same as `download_url_expires_at` |## Harvest progress steps-A short English label describing the current stage. Every value is fixed except the harvested-message label, which includes the message count.-| Value | Description || --- | --- |-| Queued | Recorded when the harvest record is created, with progress 0 |-| Starting harvest | Recorded when a processing attempt begins, with progress reset to 0 |-| Harvesting messages | Message collection has started, with progress 5 |-| Harvested N messages<sup>1</sup> | Message collection has finished, where N is the exact decimal count collected |+| Queued | The harvest was created |+| Starting harvest | An attempt began, with progress 0 |+| Harvesting messages | Message collection started, with progress 5 |+| Harvested N messages | N messages were collected. This step is skipped when there are none || Collecting user metadata | Account data is being collected, with progress 60 || Downloading attachments and creating archive | The ZIP archive is being written, with progress 65 || Completed | The archive is ready, with progress 100 |--<sup>1</sup> Skipped when no messages are collected+| Failed | The last attempt failed and Fluxer stopped retrying |## Harvest download object-One issued download URL and its stated expiry.-### Structure| Field | Type | Description || --- | --- | --- |-| download_url<sup>1</sup> | string | The temporary archive download URL (1-2048 characters) |-| expires_at<sup>2</sup> | ISO8601 timestamp | Seven days after this response was produced |--<sup>1</sup> Resolves to a single ZIP object served as `application/zip`--<sup>2</sup> Exactly seven days after issuance, even when the archive's own deadline falls earlier--A URL pointing at [Download data harvest archive](#download-data-harvest-archive) still stops resolving at the archive's own deadline, so its stated expiry can outlast the point at which it stops working.--:::note[An issued URL has its own seven day validity]-A presigned object storage URL, the default form, is never rechecked against the harvest record, so one issued shortly before the deadline keeps working past it. The signed token form rechecks the deadline.-:::+| download_url | string | The temporary archive download URL (1-2048 characters) |+| expires_at | ISO8601 timestamp | Seven days after the URL was issued |## Harvest message filter object-The filter chooses which messages a harvest collects. Every non-message section of the archive is included whatever the filter says.+The filter chooses which messages a harvest collects, and the rest of the archive is always included.### Structure| Field | Type | Description || --- | --- | --- |-| scope?<sup>1</sup> | string | Which set of contexts the harvest targets, either `selected` or `inaccessible_only` (default `selected`) |-| include_dms? | boolean | Whether to include one-to-one direct messages the caller still has open (default true) |-| include_dms_closed?<sup>2</sup> | boolean | Whether to include one-to-one direct messages the caller has closed (default true) |-| include_group_dms? | boolean | Whether to include group DMs the caller is still a member of (default true) |-| include_guilds? | boolean | Whether to include channels and threads in guilds the caller is a member of (default true) |-| guild_filter_mode?<sup>3</sup> | string | How the guild list is read, either `exclude` or `include_only` (default `exclude`) |-| excluded_guild_ids? | array[snowflake] | The guilds to leave out in `exclude` mode (max 500, default empty) |-| included_guild_ids? | array[snowflake] | The only guilds to include in `include_only` mode (max 500, default empty) |-| start_date?<sup>4</sup> | ?ISO8601 timestamp | Inclusive lower bound on message timestamps, or null for no lower bound |-| end_date?<sup>4</sup> | ?ISO8601 timestamp | Exclusive upper bound on message timestamps, or null for no upper bound |--<sup>1</sup> The `selected` scope requires at least one of the include fields to be true, and a body disabling them all is rejected at path `include_dms`--<sup>2</sup> Independent of `include_dms`, so setting `include_dms` false and `include_dms_closed` true targets closed conversations only--<sup>3</sup> The guild lists are read only when `include_guilds` is true and the scope is `selected`, and the list that does not match the mode is ignored+| scope? | string | Either `selected` or `inaccessible_only` (default `selected`) |+| include_dms? | boolean | Whether to include open one-to-one DMs (default true) |+| include_dms_closed?<sup>1</sup> | boolean | Whether to include closed one-to-one DMs (default true) |+| include_group_dms? | boolean | Whether to include group DMs you are still in (default true) |+| include_guilds? | boolean | Whether to include guilds you are still in (default true) |+| guild_filter_mode? | string | Either `exclude` or `include_only` (default `exclude`) |+| excluded_guild_ids? | array[snowflake] | The guilds to leave out in `exclude` mode (max 500) |+| included_guild_ids? | array[snowflake] | The only guilds to include in `include_only` mode (max 500) |+| start_date?<sup>2</sup> | ?ISO8601 timestamp | Inclusive lower bound on message time |+| end_date?<sup>2</sup> | ?ISO8601 timestamp | Exclusive upper bound on message time |-<sup>4</sup> Compared against the creation time embedded in the message [snowflake](/snowflakes/), so editing an old message does not move it into a later window+<sup>1</sup> Independent of `include_dms`-Under the `selected` scope, each context has its own condition:+<sup>2</sup> Compared with the message ID's [snowflake](/snowflakes/) timestamp. When both are set, `start_date` must be earlier than `end_date`.-- A one-to-one direct message is collected when the conversation is still open and `include_dms` is true, or when it has been closed and `include_dms_closed` is true.-- A group DM is collected only while the caller is still a recipient and `include_group_dms` is true.-- A guild channel is collected only while the caller is still a member, `include_guilds` is true, and the guild is admitted by the configured list mode.--The `inaccessible_only` scope selects messages in guilds the caller has left or been removed from and in group DMs the caller has left. It never selects one-to-one direct messages, and it ignores the toggles, the guild filter mode, and both guild lists.--Both scopes exclude the caller's personal notes channel, and both exclude a message whose channel no longer resolves or is neither a direct message, a group DM, nor a guild channel.--Supplying both date bounds requires `start_date` strictly earlier than `end_date`. An equal or reversed pair is rejected at path `end_date`.--:::caution[A filtered archive still has every non-message section]-The archive still contains the account document, the payment history document, the owned application document, the security document, and the account's avatar and banner. No read response returns the applied filter, so a caller keeps its own record of what it submitted.-:::+The `selected` scope needs at least one `include_*` field set to true. The `inaccessible_only` scope selects messages in guilds you left or were removed from and in group DMs you left. It ignores the `include_*` fields, `guild_filter_mode` and both guild lists, and `start_date` and `end_date` still apply. Both scopes skip your personal notes channel.## Request data harvest<RouteHeader method="POST" path="/v1/users/@me/harvest" />-Creates an unfiltered harvest of the account. Returns a [harvest creation](#harvest-creation-object) object on success.--The operation takes no request body and always returns before the archive exists, so the caller polls [Get data harvest status](#get-data-harvest-status) or [Get latest data harvest](#get-latest-data-harvest) with the returned ID.+Creates an unfiltered harvest and returns a [harvest creation](#harvest-creation-object) object. The request has no body.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [harvest creation](#harvest-creation-object) object | The harvest request was accepted |-| 404 | [error response](/http-api/#error-response) | The authenticated account no longer resolves and the request returns `UNKNOWN_USER` |-| 500 | [error response](/http-api/#error-response) | The harvest record could not be written or the job could not be queued |--### Side effects--A harvest record is created with a new [snowflake](/snowflakes/), the request time as `created_at`, progress 0, the step `Queued`, and every other timestamp null. Creating a harvest removes no earlier record and enforces no ceiling on how many an account holds, so the route bucket is the only bound.--Fluxer prepares the archive in the background. It contains:--- `user.json`, the account document, including connections with their identifiers, visibility settings and verification dates but no credentials. It lists the [thread memberships](/http-api/thread-members/#thread-member-object) of the account in its current guilds, with the thread, guild, and parent IDs, `join_timestamp`, `flags`, and `muted`-- one `channels/{channel_id}/messages.json` file for each channel that contributed a message, with its messages ordered oldest first-- `payments/payment_history.json`-- `integrations/oauth.json`, the [applications](/http-api/applications/) the account owns, with no entry for an application it only authorised-- `account/security.json`-- the account avatar and banner under `assets/user/` when present--Attachment metadata appears with its message and has the attachment ID, filename, size, content type, CDN URL, and pixel dimensions. The CDN URL is a [data package URL](/http-api/messages/#data-package-attachment-urls), so it does not expire and still reads its attachment after the archive's own seven day deadline passes. Removing the secret that signed it is the only thing that ends it. The attachment files themselves are never included.+| 200 | [harvest creation](#harvest-creation-object) object | The harvest was requested |-Every authored message is collected, with no ceiling on the count. Messages that no longer exist are omitted. Other read failures fail the attempt. After completion, Fluxer attempts to email a download URL if the account has an email address and the instance has email delivery enabled. That URL expires seven days after it was issued. Email failure does not prevent downloading a completed archive.--### Rate limit--5 requests per 30 minutes for each authenticated user, on the `user:data:harvest` bucket shared with [Request filtered data harvest](#request-filtered-data-harvest).+The rate limit is 5 requests per 30 minutes, on the `user:data:harvest` bucket, shared with [Request filtered data harvest](#request-filtered-data-harvest).## Request filtered data harvest<RouteHeader method="POST" path="/v1/users/@me/harvest/filtered" />-Creates a harvest whose message collection is constrained by a filter. Returns a [harvest creation](#harvest-creation-object) object on success.+Creates a harvest that collects only the messages the filter selects and returns a [harvest creation](#harvest-creation-object) object. With every field at its default, it collects the same messages as [Request data harvest](#request-data-harvest) except those in guilds and group DMs you have left.### JSON body-The body is a [harvest message filter](#harvest-message-filter-object) object. Every field is optional, so an empty object is accepted and every default admits its context. An empty request body is read as an empty object.--:::note[A filtered archive tests channel eligibility for every message]-Even with every default, a filtered archive drops messages in the caller's personal notes channel, in group DMs and guilds the caller has left, and in a channel that no longer resolves. [Request data harvest](#request-data-harvest) collects those.-:::+A [harvest message filter](#harvest-message-filter-object) object.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [harvest creation](#harvest-creation-object) object | The filtered harvest request was accepted |-| 400 | [error response](/http-api/#error-response) | A filter field failed validation, the `selected` scope enabled no context, a guild list exceeded 500 entries, or the date bounds were not strictly increasing |-| 404 | [error response](/http-api/#error-response) | The authenticated account no longer resolves and the request returns `UNKNOWN_USER` |-| 500 | [error response](/http-api/#error-response) | The harvest record could not be written or the job could not be queued |--### Side effects--The side effects match [Request data harvest](#request-data-harvest), except that only messages selected by the filter are collected.+| 200 | [harvest creation](#harvest-creation-object) object | The harvest was requested |+| 400 | [error response](/http-api/#error-response) | A field is invalid, `selected` has no `include_*` field set to true or `start_date` is not before `end_date` |-### Rate limit--5 requests per 30 minutes for each authenticated user, on the `user:data:harvest` bucket shared with [Request data harvest](#request-data-harvest).+The rate limit is 5 requests per 30 minutes, on the `user:data:harvest` bucket, shared with [Request data harvest](#request-data-harvest).## Get latest data harvest<RouteHeader method="GET" path="/v1/users/@me/harvest/latest" />-Returns the account's most recently created [harvest status](#harvest-status-object) object.--Returns the newest harvest regardless of status, including a failed harvest newer than a completed one.--:::note[An account with no harvest receives 200 and `null`]-The body is the literal JSON value `null`, so decode it before treating the response as an object.-:::+Returns the newest [harvest status](#harvest-status-object) object, or `null` when the account has no harvest.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [harvest status](#harvest-status-object) object \| null | The latest harvest state was returned, or null when none exists |--### Rate limit+| 200 | [harvest status](#harvest-status-object) object \| null | The latest harvest was returned |-40 requests per 10 seconds for each authenticated user, on the `user:harvest:latest` bucket.+The rate limit is 40 requests per 10 seconds, on the `user:harvest:latest` bucket.## Get data harvest status@@ -256,111 +165,60 @@ The body is the literal JSON value `null`, so decode it before treating the respReturns one [harvest status](#harvest-status-object) object owned by the current account.-A harvest belonging to another account returns 404 `UNKNOWN_HARVEST`.--Fluxer removes no harvest record, so an ID that once resolved keeps resolving. A 404 means the ID was never issued to this account, and another account's harvest is never distinguishable from one that never existed.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| harvestId | snowflake | The ID of the harvest |-### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [harvest status](#harvest-status-object) object | The harvest state was returned |-| 404 | [error response](/http-api/#error-response) | The harvest is unknown or belongs to another account, returning `UNKNOWN_HARVEST` |--### Rate limit+| 200 | [harvest status](#harvest-status-object) object | The harvest was returned |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_HARVEST` when the harvest doesn't exist or isn't yours |-40 requests per 10 seconds for each authenticated user, on the `user:harvest:status` bucket.+The rate limit is 40 requests per 10 seconds, on the `user:harvest:status` bucket.## Get data harvest download URL<RouteHeader method="GET" path="/v1/users/@me/harvest/{harvestId}/download" />-Issues a temporary download URL for one completed harvest. Returns a [harvest download](#harvest-download-object) object on success.+Issues a temporary download URL for a completed harvest and returns a [harvest download](#harvest-download-object) object. By default the URL is a presigned object storage URL. When `FLUXER_API_PRESIGNED_HARVEST_DOWNLOADS_ENABLED` is false, it links to [Download data harvest archive](#download-data-harvest-archive).-Fluxer evaluates the rejection cases in a fixed order, each with its own code. An unknown or foreign harvest is 404 `UNKNOWN_HARVEST`. A harvest whose latest attempt failed is 400 `HARVEST_FAILED`. A harvest with no recorded completion or no stored archive is 400 `HARVEST_NOT_READY`. A harvest past its download deadline is 400 `HARVEST_EXPIRED`.--:::danger[Each request issues a new bearer URL]-A URL is created for each call, its stated expiry is seven days later, and a later call revokes nothing. Treat every issued URL as a secret.+:::caution[Anyone with a download URL can get the archive]+Issuing a new URL doesn't revoke earlier ones, and each one works until it expires.:::-The URL takes one of the forms below. When the instance has presigned harvest downloads enabled, which is the default, it is an object storage presigned URL. Otherwise it points at [Download data harvest archive](#download-data-harvest-archive) on this API with a signed `token` query parameter.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| harvestId | snowflake | The ID of the harvest |-### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [harvest download](#harvest-download-object) object | A download URL was issued |-| 400 | [error response](/http-api/#error-response) | The harvest returns `HARVEST_NOT_READY`, `HARVEST_FAILED`, or `HARVEST_EXPIRED` |-| 404 | [error response](/http-api/#error-response) | The harvest is unknown or belongs to another account, returning `UNKNOWN_HARVEST` |-| 500 | [error response](/http-api/#error-response) | A download URL could not be issued |+| 200 | [harvest download](#harvest-download-object) object | A URL was issued |+| 400 | [error response](/http-api/#error-response) | `HARVEST_NOT_READY`, `HARVEST_FAILED` or `HARVEST_EXPIRED` |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_HARVEST` when the harvest doesn't exist or isn't yours |-### Rate limit--10 requests per minute for each authenticated user, on the `user:harvest:download` bucket.+The rate limit is 10 requests per minute, on the `user:harvest:download` bucket.## Download data harvest archive<RouteHeader method="GET" path="/v1/harvest-downloads/{harvestId}" unauthenticated />-Streams the archive of one completed harvest.--The `token` query parameter issued by [Get data harvest download URL](#get-data-harvest-download-url) authorises the download without a session. Use the complete issued URL and keep it secret.--The operation is active only while the instance has presigned harvest downloads disabled. That setting is enabled by default, so a default deployment answers every request here as 404 without inspecting the token.--:::note[Every rejection looks identical]-A missing, malformed, forged, or expired token and a token for another harvest all return 404 with the plain text body `Not Found`. So do a harvest that never completed, one that recorded a failure, one past its deadline, and a stale object key.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| harvestId | snowflake | The ID of the harvest |+Streams the archive of a completed harvest. Use the full URL from [Get data harvest download URL](#get-data-harvest-download-url), whose `token` authorizes the request. When presigned downloads are on, this route returns 404.### Query parameters| Field | Type | Description || --- | --- | --- |-| token | string | Signed download token issued with the download URL (1-2,048 characters) |+| token | string | The signed download token (1-2048 characters) |### Request headers| Field | Type | Description || --- | --- | --- |-| Range? | string | Standard byte range, answered with 206 and a `Content-Range` header |+| Range? | string | A byte range, answered with 206 and `Content-Range` |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | archive bytes | The complete archive was streamed |+| 200 | archive bytes | The archive was streamed as `application/zip` called `fluxer-data-{harvestId}.zip` || 206 | archive bytes | The requested byte range was streamed |-| 404 | `Not Found` | The token is missing, invalid, or expired, the harvest is not downloadable, or the instance issues presigned URLs instead |-| 500 | [error response](/http-api/#error-response) | Object storage could not be read |--### Response headers--The 200 has `Content-Type: application/zip`, `Content-Disposition`<sup>1</sup>, `Content-Length`, `Accept-Ranges: bytes`, and `Cache-Control: private, no-store`. The 206 has the 200 headers plus `Content-Range`. The 404 has `Content-Type: text/plain`.--<sup>1</sup> `Content-Disposition` is always `attachment` and names the file `fluxer-data-{harvestId}.zip`--### Side effects--The archive is read and streamed. The harvest is unchanged and the token is not consumed, so it stays usable until its own expiry.--### Rate limit+| 404 | `Not Found` | The token is invalid or expired, or the harvest is not downloadable |+| 416 | `Range Not Satisfiable` | The requested byte range is outside the archive |-60 requests per minute for each client IP address, or for the authenticated account when the request has a resolvable credential, on the `user:harvest:download_file` bucket.+The rate limit is 60 requests per minute, on the `user:harvest:download_file` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/users/email-and-password.mdx b/fluxer_docs/src/content/docs/http-api/users/email-and-password.mdxindex 89b06a84e..d120f1cad 100644--- a/fluxer_docs/src/content/docs/http-api/users/email-and-password.mdx+++ b/fluxer_docs/src/content/docs/http-api/users/email-and-password.mdx@@ -1,107 +1,59 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Email and password changes-description: Ticketed replacement of the account email address and password, the sudo password change, and recovery kits.+description: Changing the account email address and password, bounced email recovery and recovery kits.---import RouteHeader from '@/components/RouteHeader.astro';-Changing the email address or the password on an account takes several steps. Fluxer opens a ticket, emails a code, and every later step sends that ticket with the codes and proofs collected so far. An account whose address the mail provider rejected uses [bounced email recovery](#bounced-email-recovery) instead.+Changing the email address or password takes several calls. Fluxer emails a code, you send it back with the ticket from the first call, and each step returns what the next one needs. Every route needs a user session, and bots can't use them.-Every operation needs a non-bot user session.+On an instance where people sign in with a username (`account_identity` is `username` in the [instance features](/http-api/instance/#instance-features-object)), accounts have no email address. There the email change and password change routes return 400 `EMAIL_UNAVAILABLE_ON_INSTANCE`. Use [Set a new password](#set-a-new-password), [Get recovery kit status](#get-recovery-kit-status) and [Create a recovery kit](#create-a-recovery-kit) instead, which return 400 `USERNAME_SIGN_IN_ONLY` on an email instance.-An instance where members sign in with a username, which reports `account_identity` as `username` in its [instance features](/http-api/instance/#instance-features-object), keeps no email address on any account. There every email change and password change route on this page returns 400 `EMAIL_UNAVAILABLE_ON_INSTANCE`. [Set a new password](#set-a-new-password) changes the password under sudo mode, and the [recovery kit](#recovery-kit-object) routes give the account a way back after a forgotten password. Those three routes exist only on such an instance, and an `email` instance returns 400 `USERNAME_SIGN_IN_ONLY` from each.+An account linked to an instance that [enforces single sign-on](/authentication/#single-sign-on-enforcement) gets 403 `SSO_REQUIRED` from every email change and password change route, because the provider manages its email and sign-in.-While an `email` instance [enforces single sign-on](/authentication/#single-sign-on-enforcement), the provider manages the email address and sign-in of every account linked to it. Every email change and password change route on this page returns 403 `SSO_REQUIRED` for such an account, before any ticket is read, and the account takes the provider's verified email the next time it signs in.+## Tickets and codes-## Ticket and code contract+Keep these values out of logs and URLs, because anyone who has one can continue the change.-A ticket identifier is a version 4 UUID. Fluxer issues it when the flow starts, and every later step sends it as a plain string of 1 to 256 characters. Each ticket belongs to one account, and a step sent by another account fails with `INVALID_OR_EXPIRED_TICKET`. A completed ticket rejects every further step with `TICKET_ALREADY_COMPLETED`. Starting a flow again issues a fresh ticket and leaves an outstanding one usable.+| Value | Description |+| --- | --- |+| ticket | A UUID from the first call of a flow. It belongs to one account and stops working once the flow completes |+| code | An emailed code like `ABCD-1234`, valid for 10 minutes. Send it exactly as written, in uppercase with the hyphen |+| original_proof | A UUID that proves the original address step, needed to request and verify the new address |+| verification_proof | A UUID that proves the password change code, needed to complete the change |+| email_token | A UUID for one verified new address, valid for 30 minutes and usable once |-A verification code is eight characters from the uppercase Latin alphabet and the decimal digits, written as two four-character groups separated by a hyphen. A code lives for 10 minutes from the moment it is sent. Fluxer trims a submitted value and the comparison is otherwise exact, so a value with any other stray character fails with `INVALID_VERIFICATION_CODE`.+You can resend a code 30 seconds after the previous send, and every email also counts against a per-account limit (see [Rate limits](/topics/rate-limits/)). A bad ticket, code, proof or token returns 400 `INVALID_FORM_BODY`. The [validation error](/http-api/#validation-error-object) entry has the specific code, such as `INVALID_VERIFICATION_CODE` or `VERIFICATION_CODE_EXPIRED`, and its `path` is the field.-:::caution[A lowercase code never matches]-A client that accepts free-form input uppercases the value and preserves the separator before submitting it.-:::+## Email change steps-Fluxer returns a proof, a version 4 UUID, from every step that establishes a fact about the ticket. The email change flow issues `original_proof` for the original address and requires it on [Request new email](#request-new-email) and [Verify new email](#verify-new-email). The password change flow issues `verification_proof` for the emailed code and requires it to complete the change.+An email change goes through these steps in order. When `require_original` is false, the ticket skips the first verify step and [Start email change](#start-email-change) returns `original_proof` right away.-An email token is a version 4 UUID standing for one verified new address. It lives 30 minutes, belongs to the account it was issued to, and is deleted once consumed. A token presented by another account fails with `INVALID_EMAIL_TOKEN`, and one past its lifetime is deleted and fails with `EMAIL_TOKEN_EXPIRED`.--Fluxer refuses a resend for 30 seconds after the previous send of the same code. The refusal is HTTP 429 with a `Retry-After` computed from the exact moment the next send becomes available. This cooldown is separate from the route bucket and the email-send controls.--:::danger[Tickets, codes, proofs, and email tokens are credentials]-Each of these values can advance a security-sensitive account change. Keep them out of logs, analytics, URLs, and messages to unintended recipients. They are opaque, so preserve them exactly and derive nothing from their contents.-:::--:::note[Ticket failures are validation entries]-Every ticket, code, address, proof, token, and password failure named on this page arrives as HTTP 400 whose top-level code is `INVALID_FORM_BODY`. The named value is the `code` of one [validation error](/http-api/#validation-error-object) entry, and that entry's `path` is the field it belongs to.-:::--- A ticket failure uses the path `ticket`.-- A code failure uses the path `code`.-- An address failure uses the path `new_email` or `email`.-- A proof failure uses the path `original_proof` or `verification_proof`.-- An email token failure uses the path `email_token`.-- A password failure uses the path `password` or `new_password`.--The account-level codes `ACCESS_DENIED`, `SUDO_MODE_REQUIRED`, and `RATE_LIMITED` arrive as the top-level `code`.--## Email send controls--Each operation that sends an email counts against its own route bucket and against a 15-minute email-send control for the account. Exhausting either produces HTTP 429 even when the other has room.--| Control | Allowance | Operations |+| Step | Call | Result || --- | --- | --- |-| Original address | 3 sends per 15 minutes | [Start email change](#start-email-change) and [Resend original email code](#resend-original-email-code) |-| New address | 5 sends per 15 minutes | [Request new email](#request-new-email), [Resend new email code](#resend-new-email-code), and both bounced recovery sends |-| Password change start | 3 sends per 15 minutes | [Start password change](#start-password-change) |-| Password change resend | 3 sends per 15 minutes | [Resend password change code](#resend-password-change-code) |--## Email change ticket states--The email change ticket is pending-original, pending-new, or completed. A step allowed in one state is rejected in every other with the code named in the paragraphs below.--| Current state | Operation | Next state |-| --- | --- | --- |-| Pending original | [Resend original email code](#resend-original-email-code) | Pending original |-| Pending original | [Verify original email](#verify-original-email) | Pending new |-| Pending new | [Request new email](#request-new-email) | Pending new |-| Pending new | [Resend new email code](#resend-new-email-code) | Pending new |-| Pending new | [Verify new email](#verify-new-email) | Completed |--A ticket created without original email verification starts in the pending-new state and receives its `original_proof` directly from [Start email change](#start-email-change). Requesting or verifying a new address while the ticket is still pending original fails with `ORIGINAL_EMAIL_MUST_BE_VERIFIED_FIRST`.--Verifying the original stage on a ticket that never required it fails with `ORIGINAL_VERIFICATION_NOT_REQUIRED`. Resending the original code fails with `ORIGINAL_EMAIL_ALREADY_VERIFIED` on a ticket that has passed original address verification and on a ticket that never required the stage, so the response does not tell the two apart. On a ticket that has passed original address verification, verifying the original address again returns the same `original_proof`.--Resending the new address code before an address has been requested fails with `NO_NEW_EMAIL_REQUESTED`. A pending-original ticket returns the same code.--[Request new email](#request-new-email) and [Resend new email code](#resend-new-email-code) share one 30-second cooldown. Requesting a different address cannot bypass it.+| 1 | [Start email change](#start-email-change) | A ticket and a code to the current address |+| 2 | [Verify original email](#verify-original-email) | The original address proof |+| 3 | [Request new email](#request-new-email) | A code sent to the new address |+| 4 | [Verify new email](#verify-new-email) | The email token |+| 5 | [Apply email change](#apply-email-change) | The updated user |-Reaching the completed state issues an email token and leaves the account email unchanged. [Apply email change](#apply-email-change) writes the new address.+Calling a step out of order returns `ORIGINAL_EMAIL_MUST_BE_VERIFIED_FIRST`, `ORIGINAL_VERIFICATION_NOT_REQUIRED`, `ORIGINAL_EMAIL_ALREADY_VERIFIED` or `NO_NEW_EMAIL_REQUESTED`.## Email change start object-The state of a newly created email change ticket.+A new email change ticket.### Structure| Field | Type | Description || --- | --- | --- |-| ticket | string | The identifier every later step of this flow sends |-| require_original<sup>1</sup> | boolean | Whether the original address needs verification before a new address can be requested |-| original_email<sup>2</sup> | ?string | The address on the account, or null when the account has none |-| original_proof<sup>3</sup> | ?string | The proof for the original address stage, or null while that stage is unverified |-| original_code_expires_at<sup>4</sup> | ?ISO8601 timestamp | The moment the code sent to the original address expires, 10 minutes after it was sent |-| resend_available_at<sup>4</sup> | ?ISO8601 timestamp | The earliest moment the original address code can be resent, 30 seconds after the last send |--<sup>1</sup> True only when the account holds an email address and that address is verified--<sup>2</sup> Recorded on the ticket at creation, so a later change to the account email does not move it. [Request new email](#request-new-email) compares against this recorded value--<sup>3</sup> Set exactly when `require_original` is false. [Request new email](#request-new-email) and [Verify new email](#verify-new-email) require it--<sup>4</sup> Null whenever `require_original` is false+| ticket | string | The ticket for the later steps |+| require_original | boolean | Whether you must verify a code sent to the current address first. True when that address is verified |+| original_email | ?string | The current address on the account |+| original_proof | ?string | The proof, set only when `require_original` is false |+| original_code_expires_at | ?ISO8601 timestamp | When the code sent to the current address expires |+| resend_available_at | ?ISO8601 timestamp | When you can resend the code to the current address |### Example@@ -118,22 +70,16 @@ The state of a newly created email change ticket.## New email request object-The state of a ticket with a candidate address bound to it and a code sent to that address.+A ticket with a new address and a code sent to it.### Structure| Field | Type | Description || --- | --- | --- |-| ticket<sup>1</sup> | string | The identifier every later step of this flow sends |-| new_email<sup>2</sup> | string | The address now bound to the ticket |-| new_code_expires_at | ISO8601 timestamp | The moment the code sent to the new address expires, 10 minutes after it was sent |-| resend_available_at<sup>3</sup> | ?ISO8601 timestamp | The earliest moment the new address code can be resent, 30 seconds after the last send |--<sup>1</sup> Echoes the ticket the request named, except on [Request replacement email for bounced address](#request-replacement-email-for-bounced-address), where it identifies the ticket that operation created--<sup>2</sup> The trimmed form of the submitted address, which is what a later [Verify new email](#verify-new-email) writes--<sup>3</sup> Always set+| ticket | string | The ticket for the later steps |+| new_email | string | The new address, trimmed |+| new_code_expires_at | ISO8601 timestamp | When the code sent to the new address expires |+| resend_available_at | ?ISO8601 timestamp | When you can resend the code |## Original email verification object@@ -141,9 +87,7 @@ The state of a ticket with a candidate address bound to it and a code sent to th| Field | Type | Description || --- | --- | --- |-| original_proof<sup>1</sup> | string | The proof [Request new email](#request-new-email) and [Verify new email](#verify-new-email) require |--<sup>1</sup> Stable for the lifetime of the ticket. Verifying the original address again returns the same value+| original_proof | string | The proof for the later email change steps |## New email verification object@@ -151,23 +95,19 @@ The state of a ticket with a candidate address bound to it and a code sent to th| Field | Type | Description || --- | --- | --- |-| email_token<sup>1</sup> | string | The token [Apply email change](#apply-email-change) consumes to write the address |--<sup>1</sup> The token lives 30 minutes and stands for the exact address the ticket verified+| email_token | string | The token [Apply email change](#apply-email-change) uses |## Password change start object-The state of a newly created password change ticket.+A new password change ticket.### Structure| Field | Type | Description || --- | --- | --- |-| ticket | string | The identifier every later step of this flow sends |-| code_expires_at | ISO8601 timestamp | The moment the emailed code expires, 10 minutes after it was sent |-| resend_available_at<sup>1</sup> | ?ISO8601 timestamp | The earliest moment the code can be resent, 30 seconds after the last send |--<sup>1</sup> Always set+| ticket | string | The ticket for the later steps |+| code_expires_at | ISO8601 timestamp | When the emailed code expires |+| resend_available_at | ?ISO8601 timestamp | When you can resend the code |## Password verification object@@ -175,24 +115,18 @@ The state of a newly created password change ticket.| Field | Type | Description || --- | --- | --- |-| verification_proof<sup>1</sup> | string | The proof [Complete password change](#complete-password-change) consumes |--<sup>1</sup> Stable for the lifetime of the ticket. Verifying the same code again returns the same value+| verification_proof | string | The proof [Complete password change](#complete-password-change) needs |## Password change completion object-The replacement session [Complete password change](#complete-password-change) returns after the password is written. [Modify current user](/http-api/users/current-user/#modify-current-user) adds the same fields to its user object when it changes the password.+The new session after a password change. Fluxer ends every session on the account, including the one that made the request, and you send later requests with this `token`. [Modify current user](/http-api/users/current-user/#modify-current-user) adds the same fields when it changes the password.### Structure| Field | Type | Description || --- | --- | --- |-| token<sup>1</sup> | string | The authentication token for the replacement session |-| auth_session_id_hash | string | The base64url-encoded hash of the replacement authentication session |--<sup>1</sup> The same operation destroys the token the client authenticated with, so the client sends every later request with this value--[Set a new password](#set-a-new-password) returns the same object.+| token | string | The token for the new session |+| auth_session_id_hash | string | The base64url hash of the new session ID |## Recovery kit status object@@ -201,34 +135,28 @@ The replacement session [Complete password change](#complete-password-change) re| Field | Type | Description || --- | --- | --- || has_recovery_kit | boolean | Whether the account has a recovery kit |-| created_at | ?ISO8601 timestamp | When the current kit was created, or null when there is none |+| created_at | ?ISO8601 timestamp | When the current kit was created |## Recovery kit object-A newly issued recovery kit. [Recover an account](/http-api/authentication/#recover-an-account) redeems the key to set a new password without signing in.+A new recovery kit, whose key [Recover an account](/http-api/authentication/#recover-an-account) uses to set a new password without signing in.### Structure| Field | Type | Description || --- | --- | --- |-| recovery_key<sup>1</sup> | string | The recovery key, 8 groups of 4 characters joined by `-` |+| recovery_key | string | The key, 8 groups of 4 Crockford base32 characters joined by `-` || created_at | ISO8601 timestamp | When the kit was created |## Start email change<RouteHeader method="POST" path="/v1/users/@me/email-change/start" />-Creates an email change ticket. Returns an [email change start](#email-change-start-object) object on success.--Only an account that holds an email address or is unclaimed can start an email change. Every other account fails with `MUST_HAVE_EMAIL_TO_CHANGE_IT`.--Original address verification applies only when the account holds a verified email address. A bounce clears the verified state. An account whose address has not been verified again since the bounce gets a ticket that skips the original stage. [Apply email change](#apply-email-change) marks the address verified again without clearing the bounced marker. An account that has applied a change since the bounce therefore gets a ticket that does require the stage.--Sending an original address code counts against the original address control.+Creates an email change ticket and, when the current address is verified, emails it a code. A claimed account with no email address gets `MUST_HAVE_EMAIL_TO_CHANGE_IT`. An instance that can't send email returns 400 `EMAIL_CODES_UNAVAILABLE` here and from [Resend original email code](#resend-original-email-code).### JSON body-The body can be omitted, and any supplied body is an object with no fields. Fluxer strips unknown keys before it handles the request.+The body is empty or an empty object.### Response@@ -236,169 +164,105 @@ The body can be omitted, and any supplied body is an object with no fields. Flux| --- | --- | --- || 200 | [email change start](#email-change-start-object) object | The ticket was created |-### Side effects--When original address verification applies, Fluxer creates the ticket in the pending-original state and sends one verification email to the account's current address. A ticket that skips the stage is created pending-new with its `original_proof` already issued. No account field changes.--### Rate limit--10 requests per minute for each authenticated user, on the `user:email_change:start` bucket.+The rate limit is 10 requests per minute, on the `user:email_change:start` bucket.## Resend original email code<RouteHeader method="POST" path="/v1/users/@me/email-change/resend-original" />-Sends a fresh verification code to the account's original address for an active ticket. Returns 204 with an empty body.--A ticket that is no longer pending-original fails with `ORIGINAL_EMAIL_ALREADY_VERIFIED`. A ticket recording no original address fails with `NO_ORIGINAL_EMAIL_ON_RECORD`.--The send counts against the original address control, and the ticket applies its own 30-second cooldown.+Sends a new code to the current address and makes the previous code invalid.### JSON body| Field | Type | Description || --- | --- | --- |-| ticket | string | The identifier returned by [Start email change](#start-email-change) (1-256 characters) |+| ticket | string | The ticket from [Start email change](#start-email-change) (1-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | A replacement original address code was sent |--### Side effects--Fluxer replaces the ticket's original address code, send time, and code expiry, which invalidates the previous code. One verification email goes to the original address.--### Rate limit+| 204 | empty | The code was sent |-10 requests per minute for each authenticated user, on the `user:email_change:resend_original` bucket.+The rate limit is 10 requests per minute, on the `user:email_change:resend_original` bucket.## Verify original email<RouteHeader method="POST" path="/v1/users/@me/email-change/verify-original" />-Verifies the original address stage and advances the ticket to pending-new. Returns an [original email verification](#original-email-verification-object) object on success.--Running the operation against a ticket that already cleared the stage returns the same proof and changes nothing. A ticket that never required the stage fails with `ORIGINAL_VERIFICATION_NOT_REQUIRED`. A ticket with no issued code fails with `VERIFICATION_CODE_NOT_ISSUED`, a code past its 10-minute lifetime with `VERIFICATION_CODE_EXPIRED`, and a mismatch with `INVALID_VERIFICATION_CODE`.+Checks the code sent to the current address and returns a proof, and calling it again on the same ticket returns the same proof.### JSON body| Field | Type | Description || --- | --- | --- |-| ticket | string | The identifier returned by [Start email change](#start-email-change) (1-256 characters) |-| code | string | The code sent to the original address (1-256 characters) |+| ticket | string | The ticket from [Start email change](#start-email-change) (1-256 characters) |+| code | string | The code sent to the current address (1-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [original email verification](#original-email-verification-object) object | The original address is verified |--### Rate limit+| 200 | [original email verification](#original-email-verification-object) object | The current address is verified |-20 requests per minute for each authenticated user, on the `user:email_change:verify_original` bucket.+The rate limit is 20 requests per minute, on the `user:email_change:verify_original` bucket.## Request new email<RouteHeader method="POST" path="/v1/users/@me/email-change/request-new" />-Binds a new address to an active ticket and sends it a verification code. Returns a [new email request](#new-email-request-object) object on success.--A ticket that has not cleared original address verification fails with `ORIGINAL_EMAIL_MUST_BE_VERIFIED_FIRST`. An `original_proof` that does not match the ticket fails with `INVALID_PROOF_TOKEN`.--Fluxer trims the address and then checks it in order.--- An empty address fails with `EMAIL_IS_REQUIRED`.-- An address equal to the ticket's recorded original fails with `NEW_EMAIL_MUST_BE_DIFFERENT`.-- An address on a domain missing from the instance's allowed email domains fails with `EMAIL_DOMAIN_NOT_ALLOWED`.-- A domain that publishes no mail exchange or address records fails with `EMAIL_DOMAIN_CANNOT_RECEIVE_MAIL`.-- An address another account already owns fails with `EMAIL_ALREADY_IN_USE`.--Ownership is checked again when the resulting email token is applied, so a successful request here does not reserve the address. Calling the operation again with a different address replaces the pending address on the same ticket.--The send counts against the new address control, and the ticket applies its own 30-second cooldown.+Sets the new address on the ticket and emails it a code. Calling it again with another address replaces the address on the ticket. The new address must differ from the current one, use a domain the instance allows and not belong to another account.### JSON body| Field | Type | Description || --- | --- | --- |-| ticket | string | The identifier returned by [Start email change](#start-email-change) (1-256 characters) |-| new_email<sup>1</sup> | string | The address to bind to the ticket (1-254 characters) |-| original_proof | string | The proof issued by [Start email change](#start-email-change) or [Verify original email](#verify-original-email) (1-256 characters) |-| new_password?<sup>2</sup> | string | The password to check against the breached-password corpus (8-256 characters) |--<sup>1</sup> A syntactically invalid address fails with `INVALID_EMAIL_FORMAT`, one outside the length bound with `EMAIL_LENGTH_INVALID`, and a local part outside the permitted ASCII set with `INVALID_EMAIL_LOCAL_PART`--<sup>2</sup> The value is only checked against the breached-password corpus, which reports a match as `PASSWORD_IS_TOO_COMMON`. Nothing on this page writes it--:::note[`new_password` is checked here and never written]-An unclaimed account learns that its intended password is unusable before a code is sent. The account then sets that password by passing `new_password` alongside `email_token` to [Modify current user](/http-api/users/current-user/#modify-current-user).-:::+| ticket | string | The ticket from [Start email change](#start-email-change) (1-256 characters) |+| new_email | string | The new address (1-254 characters) |+| original_proof | string | The proof from [Start email change](#start-email-change) or [Verify original email](#verify-original-email) (1-256 characters) |+| new_password? | string | A password to check against known breached passwords. Not saved (8-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [new email request](#new-email-request-object) object | The address was bound and a code was sent |--### Side effects--The ticket stores the requested address, a fresh code, its send time, and its expiry, and stays pending-new. One verification email goes to the requested address. The account email is unchanged at this stage.+| 200 | [new email request](#new-email-request-object) object | The code was sent to the new address |-### Rate limit--10 requests per minute for each authenticated user, on the `user:email_change:request_new` bucket.+The rate limit is 10 requests per minute, on the `user:email_change:request_new` bucket.## Resend new email code<RouteHeader method="POST" path="/v1/users/@me/email-change/resend-new" />-Sends a fresh verification code to the address already bound to an active ticket. Returns 204 with an empty body.--A ticket with no requested address fails with `NO_NEW_EMAIL_REQUESTED`.--The send counts against the new address control, and the ticket applies its own 30-second cooldown.+Sends a new code to the new address and makes the previous code invalid.### JSON body| Field | Type | Description || --- | --- | --- |-| ticket | string | The identifier returned by [Start email change](#start-email-change) (1-256 characters) |+| ticket | string | The ticket from [Start email change](#start-email-change) (1-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | A replacement new address code was sent |--### Side effects+| 204 | empty | The code was sent |-Fluxer replaces the ticket's new address code, send time, and code expiry, which invalidates the previous code. One verification email goes to the requested address.--### Rate limit--10 requests per minute for each authenticated user, on the `user:email_change:resend_new` bucket.+The rate limit is 10 requests per minute, on the `user:email_change:resend_new` bucket.## Verify new email<RouteHeader method="POST" path="/v1/users/@me/email-change/verify-new" />-Verifies the requested address and completes the ticket. Returns a [new email verification](#new-email-verification-object) object on success.--An `original_proof` that does not match the ticket fails with `INVALID_PROOF_TOKEN`. A ticket with no requested address or no issued code fails with `VERIFICATION_CODE_NOT_ISSUED`, a code past its 10-minute lifetime with `VERIFICATION_CODE_EXPIRED`, and a mismatch with `INVALID_VERIFICATION_CODE`.--:::caution[The email token cannot be recovered]-This operation moves the ticket to the completed state, so a second call fails with `TICKET_ALREADY_COMPLETED`.-:::+Checks the code sent to the new address, completes the ticket and returns an email token. The account email doesn't change until you call [Apply email change](#apply-email-change).### JSON body| Field | Type | Description || --- | --- | --- |-| ticket | string | The identifier returned by [Start email change](#start-email-change) (1-256 characters) |+| ticket | string | The ticket from [Start email change](#start-email-change) (1-256 characters) || code | string | The code sent to the new address (1-256 characters) |-| original_proof | string | The proof issued by [Start email change](#start-email-change) or [Verify original email](#verify-original-email) (1-256 characters) |+| original_proof | string | The proof from [Start email change](#start-email-change) or [Verify original email](#verify-original-email) (1-256 characters) |### Response@@ -406,402 +270,236 @@ This operation moves the ticket to the completed state, so a second call fails w| --- | --- | --- || 200 | [new email verification](#new-email-verification-object) object | The new address is verified |-### Side effects--The ticket moves to the completed state and a 30-minute email token is issued for the verified address. The account's email address is still unchanged.--### Rate limit--20 requests per minute for each authenticated user, on the `user:email_change:verify_new` bucket.+The rate limit is 20 requests per minute, on the `user:email_change:verify_new` bucket.## Apply email change<RouteHeader method="POST" path="/v1/users/@me/email-change/apply" mfa />-Consumes an email token and writes its address to the account. Returns the updated [user](/http-api/users/#user-object) object on success. Emits a [User Update](/gateway/events/#user-update) Gateway event.--A claimed account proves [sudo mode](/http-api/users/mfa/#sudo-mode) before the route reads the token. An unclaimed account is exempt and applies the change with its session alone.+Sets the verified address on the account and returns the updated [user](/http-api/users/#user-object). A claimed account needs [sudo mode](/http-api/users/mfa/#sudo-mode), and an unclaimed account doesn't.-A token that belongs to another account fails with `INVALID_EMAIL_TOKEN`, and one past its 30-minute lifetime fails with `EMAIL_TOKEN_EXPIRED`. An expired token is deleted when rejected. Fluxer checks the address against existing account ownership again here. An address another account has taken since fails with `EMAIL_ALREADY_IN_USE` without consuming the token.--[Modify current user](/http-api/users/current-user/#modify-current-user) accepts the same token alongside an unrelated profile edit. The token is single use, so a retry after success fails with `INVALID_EMAIL_TOKEN`.+The token fails with `EMAIL_TOKEN_EXPIRED` after 30 minutes and `INVALID_EMAIL_TOKEN` once used.### JSON body-The body extends the [sudo verification object](/http-api/users/mfa/#sudo-verification-object) with `email_token`, and the sudo fields it merges in are repeated below. An existing sudo proof is sent in the `X-Fluxer-Sudo-Mode-JWT` request header.+The body extends the [sudo verification object](/http-api/users/mfa/#sudo-verification-object) with `email_token`.| Field | Type | Description || --- | --- | --- |-| email_token | string | The token returned by [Verify new email](#verify-new-email) (1-256 characters) |-| password?<sup>1</sup> | string | The account password (8-256 characters) |-| mfa_method?<sup>2</sup> | string | The sudo MFA method, one of `totp`, `webauthn` or `email_code` |-| mfa_code?<sup>3</sup> | string | The sudo authenticator code or an unconsumed backup code (1-32 characters) |-| webauthn_response?<sup>4</sup> | [WebAuthn assertion](/http-api/users/mfa/#webauthn-assertion-object) object | The assertion produced for the supplied challenge |-| webauthn_challenge?<sup>4</sup> | string | The challenge returned by [create sudo WebAuthn authentication options](/http-api/users/mfa/#create-sudo-webauthn-authentication-options) (1-256 characters) |-| email_code_ticket? | string | The ticket from [send a sudo email code](/http-api/users/mfa/#send-a-sudo-email-code) (1-128 characters) |-| email_code? | string | The 6-digit code from that email |--<sup>1</sup> Considered only while the account holds no TOTP secret and no registered WebAuthn credential, and ignored once either exists--<sup>2</sup> Required when the account holds a TOTP secret or a registered WebAuthn credential, unless the request already presents an accepted sudo proof--<sup>3</sup> Required when `mfa_method` is `totp`. The value is a current authenticator code or an unconsumed backup code, and Fluxer reads it as a backup code alone while the account holds no TOTP secret--<sup>4</sup> Both fields are required together when `mfa_method` is `webauthn`--The body has no profile field and no `new_password` field, and Fluxer strips unknown keys before it handles the request.--:::caution[An unclaimed account never sends `password` here]-Sudo mode does not apply to an unclaimed account, so Fluxer reads `password` as an ordinary account update field. Such an account can update only `new_password`, `has_dismissed_premium_onboarding`, and `has_unread_gift_inventory`. The request fails with `UNCLAIMED_ACCOUNTS_CAN_ONLY_SET_EMAIL_VIA_TOKEN` on the path `password`.-:::--An unclaimed account that also wants a first password makes a single [Modify current user](/http-api/users/current-user/#modify-current-user) call with `email_token` and `new_password`.+| email_token | string | The token from [Verify new email](#verify-new-email) (1-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [user](/http-api/users/#user-object) object | The verified email change was applied |-| 403 | [error response](/http-api/#error-response) | Sudo mode was not proven and the request returns `SUDO_MODE_REQUIRED` with the [sudo mode methods object](/http-api/users/mfa/#sudo-mode-methods-object) |+| 200 | [user](/http-api/users/#user-object) object | The new address was set |-The 200 has `X-Fluxer-Sudo-Mode-JWT` when sudo verification issued a proof.+Fluxer sends [User Update](/gateway/events/#user-update) and emails the previous address, if there was one, a link to [revert the change](/http-api/authentication/#revert-an-email-change). Sessions and the password don't change.-:::note[The password is untouched]-This operation replaces the email address only. Nothing on the path revokes a credential, so authentication sessions, OAuth2 access tokens, and OAuth2 refresh tokens all stay valid. [Complete password change](#complete-password-change) destroys sessions.-:::--### Side effects--Fluxer replaces the account email and marks it verified. The bounced marker is not cleared, so an account that has it recovers through [bounced email recovery](#bounced-email-recovery).--For an ordinary change from an existing address, Fluxer sends a revert email to the original address so its holder can use [Revert an email change](/http-api/authentication/#revert-an-email-change). Fluxer deletes the email token, records the contact change in the account's contact change log, and emits [User Update](/gateway/events/#user-update). No public member field changes, so no [Guild Member Update](/gateway/events/#guild-member-update) follows.--### Rate limit--20 requests per minute for each authenticated user, on the `user:email_change:apply` bucket.+The rate limit is 20 requests per minute, on the `user:email_change:apply` bucket.## Bounced email recovery-An account whose stored address the mail provider rejected has the bounced marker, reported as `email_bounced` on the [user object](/http-api/users/#user-object). The bounce also clears the verified email state. The operations below bind a replacement address and finish without the sudo-gated apply step.--Every one of them requires the bounced marker. An account without it is rejected with 403 `ACCESS_DENIED`, and an account with no address at all is rejected with `MUST_HAVE_EMAIL_TO_CHANGE_IT`.--The flow also requires the account to hold no verified address, which is the state a bounce leaves. [Apply email change](#apply-email-change) marks an address verified without clearing the bounced marker. An account that took the ordinary flow after its bounce has both states, so it gets `ORIGINAL_EMAIL_MUST_BE_VERIFIED_FIRST` here and changes its address through the ordinary flow.--The codes and the 30-second cooldown in this flow follow [Ticket and code contract](#ticket-and-code-contract). The sends in this flow count against the new address control.+When mail to an account's address bounces, the [user object](/http-api/users/#user-object) has `email_bounced` set to true. The three routes below set a new address without the original address step or sudo mode. Other accounts use the normal email change flow.## Request replacement email for bounced address<RouteHeader method="POST" path="/v1/users/@me/email-change/bounced/request-new" />-Starts the recovery flow. Returns a [new email request](#new-email-request-object) object on success.--This operation creates a ticket and binds the replacement address in the same call. Fluxer checks the address exactly as [Request new email](#request-new-email) does: the address must have a domain that publishes mail exchange or address records, belong to no other account, and differ from the bounced address.--The send counts against the new address control.--:::caution[A failed attempt still sends mail]-When the account does hold a verified address the request fails with `ORIGINAL_EMAIL_MUST_BE_VERIFIED_FIRST`. The failure comes only after Fluxer has created the ticket, sent one code to the address the account holds, and counted one send against the original address control.-:::+Creates a ticket, sets the new address on it and emails it a code. The address is checked the same way as in [Request new email](#request-new-email).### JSON body| Field | Type | Description || --- | --- | --- |-| new_email | string | The address to replace the bounced one (1-254 characters) |+| new_email | string | The new address (1-254 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [new email request](#new-email-request-object) object | The replacement address was bound and a code was sent |-| 403 | [error response](/http-api/#error-response) | The account is not marked bounced and the request returns `ACCESS_DENIED` |--### Side effects+| 200 | [new email request](#new-email-request-object) object | The code was sent to the new address |-A ticket is created pending-new with the replacement address bound to it, and one verification email goes to that address. No account field changes. Keep the returned `ticket`, because the remaining steps take no other identifier.--### Rate limit--10 requests per minute for each authenticated user, on the `user:email_change:bounced:request_new` bucket.+The rate limit is 10 requests per minute, on the `user:email_change:bounced:request_new` bucket.## Resend replacement email code<RouteHeader method="POST" path="/v1/users/@me/email-change/bounced/resend-new" />-Sends a fresh verification code to the replacement address bound to an active recovery ticket. Returns 204 with an empty body.--A ticket with no replacement address fails with `NO_NEW_EMAIL_REQUESTED`.--The send counts against the new address control, and the ticket applies its own 30-second cooldown.+Sends a new code to the new address and makes the previous code invalid.### JSON body| Field | Type | Description || --- | --- | --- |-| ticket | string | The identifier returned by [Request replacement email for bounced address](#request-replacement-email-for-bounced-address) (1-256 characters) |+| ticket | string | The ticket from [Request replacement email for bounced address](#request-replacement-email-for-bounced-address) (1-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | A replacement code was sent |-| 403 | [error response](/http-api/#error-response) | The account is not marked bounced and the request returns `ACCESS_DENIED` |+| 204 | empty | The code was sent |-### Side effects--Fluxer replaces the ticket's code, send time, and code expiry, which invalidates the previous code. One verification email goes to the replacement address.--### Rate limit--10 requests per minute for each authenticated user, on the `user:email_change:bounced:resend_new` bucket.+The rate limit is 10 requests per minute, on the `user:email_change:bounced:resend_new` bucket.## Verify replacement email for bounced address<RouteHeader method="POST" path="/v1/users/@me/email-change/bounced/verify-new" />-Verifies the replacement address and writes it to the account in the same call. Returns the updated [user](/http-api/users/#user-object) object on success. Emits a [User Update](/gateway/events/#user-update) Gateway event.--No sudo verification and no email token step applies.+Checks the code and sets the new address on the account in the same call. Returns the updated [user](/http-api/users/#user-object) with `email_bounced` set to false, and Fluxer sends [User Update](/gateway/events/#user-update).### JSON body| Field | Type | Description || --- | --- | --- |-| ticket | string | The identifier returned by [Request replacement email for bounced address](#request-replacement-email-for-bounced-address) (1-256 characters) |-| code | string | The code sent to the replacement address (1-256 characters) |+| ticket | string | The ticket from [Request replacement email for bounced address](#request-replacement-email-for-bounced-address) (1-256 characters) |+| code | string | The code sent to the new address (1-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [user](/http-api/users/#user-object) object | The replacement address was verified and written |-| 403 | [error response](/http-api/#error-response) | The account is not marked bounced and the request returns `ACCESS_DENIED` |--### Side effects--The account gets the verified replacement address and `email_bounced` becomes false. The ticket is completed and cannot be reused.--No revert email is sent.+| 200 | [user](/http-api/users/#user-object) object | The new address was set |-### Rate limit--20 requests per minute for each authenticated user, on the `user:email_change:bounced:verify_new` bucket.+The rate limit is 20 requests per minute, on the `user:email_change:bounced:verify_new` bucket.## Start password change<RouteHeader method="POST" path="/v1/users/@me/password-change/start" />-Creates a password change ticket and sends a verification code to the account email. Returns a [password change start](#password-change-start-object) object on success.--An account holding no email address fails with `MUST_HAVE_EMAIL_TO_CHANGE_IT`.--The send counts against the password change start control.+Creates a password change ticket and emails a code to the account address. An account with no email address gets `MUST_HAVE_EMAIL_TO_CHANGE_IT`.### JSON body-The body can be omitted, and any supplied body is an object with no fields. Fluxer strips unknown keys before it handles the request.+The body is empty or an empty object.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [password change start](#password-change-start-object) object | The ticket was created and a code was sent |--### Side effects+| 200 | [password change start](#password-change-start-object) object | The code was sent |-A ticket is created in its pending state and one verification email goes to the account address. No account field changes.--### Rate limit--10 requests per minute for each authenticated user, on the `user:password_change:start` bucket.+The rate limit is 10 requests per minute, on the `user:password_change:start` bucket.## Resend password change code<RouteHeader method="POST" path="/v1/users/@me/password-change/resend" />-Sends a fresh verification code for an active password change ticket. Requires the account to still hold an email address. Returns 204 with an empty body.--The send counts against the password change resend control, and the ticket applies its own 30-second cooldown.+Sends a new code and makes the previous code invalid.### JSON body| Field | Type | Description || --- | --- | --- |-| ticket | string | The identifier returned by [Start password change](#start-password-change) (1-256 characters) |+| ticket | string | The ticket from [Start password change](#start-password-change) (1-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | A replacement code was sent |--### Side effects+| 204 | empty | The code was sent |-Fluxer replaces the ticket's code, send time, and code expiry, which invalidates the previous code. One verification email goes to the account address.--### Rate limit--10 requests per minute for each authenticated user, on the `user:password_change:resend` bucket.+The rate limit is 10 requests per minute, on the `user:password_change:resend` bucket.## Verify password change code<RouteHeader method="POST" path="/v1/users/@me/password-change/verify" />-Verifies the emailed code. Returns a [password verification](#password-verification-object) object on success.--Running the operation against an already verified ticket returns the same proof. A ticket with no issued code fails with `VERIFICATION_CODE_NOT_ISSUED`, a code past its 10-minute lifetime with `VERIFICATION_CODE_EXPIRED`, and a mismatch with `INVALID_VERIFICATION_CODE`.+Checks the emailed code and returns a proof, and calling it again on the same ticket returns the same proof.### JSON body| Field | Type | Description || --- | --- | --- |-| ticket | string | The identifier returned by [Start password change](#start-password-change) (1-256 characters) |-| code | string | The code sent to the account address (1-256 characters) |+| ticket | string | The ticket from [Start password change](#start-password-change) (1-256 characters) |+| code | string | The emailed code (1-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [password verification](#password-verification-object) object | The code was accepted |--### Side effects+| 200 | [password verification](#password-verification-object) object | The code is correct |-The ticket moves to its verified state and stores a verification proof. The account password is still unchanged.--### Rate limit--20 requests per minute for each authenticated user, on the `user:password_change:verify` bucket.+The rate limit is 20 requests per minute, on the `user:password_change:verify` bucket.## Complete password change<RouteHeader method="POST" path="/v1/users/@me/password-change/complete" />-Consumes a verified ticket and replaces the account password. Returns a [password change completion](#password-change-completion-object) object on success. Emits an [Auth Session Change](/gateway/events/#auth-session-change) Gateway event with the replacement token.--An account with a second factor, meaning the TOTP or WebAuthn [authenticator type](/http-api/users/#authenticator-types), must also prove [sudo mode](/http-api/users/mfa/#sudo-mode) with that factor, because the emailed code alone would let whoever reads the mailbox take the account. Other accounts need no sudo verification. A ticket outside its verified state fails with `INVALID_OR_EXPIRED_TICKET`. A proof that does not match fails with `INVALID_PROOF_TOKEN`. A replacement password in the public breached-password corpus is rejected with `PASSWORD_IS_TOO_COMMON`. The ticket is marked completed once the password is written, so a retry fails with `TICKET_ALREADY_COMPLETED`.+Sets the new password and returns a [new session](#password-change-completion-object). An account with TOTP or a WebAuthn credential also needs [sudo mode](/http-api/users/mfa/#sudo-mode) with that factor. A password found in known breaches fails with `PASSWORD_IS_TOO_COMMON`.### JSON body+The body extends the [sudo verification object](/http-api/users/mfa/#sudo-verification-object) with these fields.+| Field | Type | Description || --- | --- | --- |-| ticket | string | The identifier returned by [Start password change](#start-password-change) (1-256 characters) |-| verification_proof | string | The proof issued by [Verify password change code](#verify-password-change-code) (1-256 characters) |-| new_password | string | The password to write to the account (8-256 characters) |-| password? | string | Unused here, part of the [sudo verification object](/http-api/users/mfa/#sudo-verification-object) (8-256 characters) |-| mfa_method? | string | The sudo verification method, one of `totp`, `webauthn` or `email_code` |-| mfa_code? | string | Authenticator code or unconsumed backup code (1-32 characters) |-| webauthn_response? | [WebAuthn assertion](/http-api/users/mfa/#webauthn-assertion-object) object | Assertion for the sudo challenge |-| webauthn_challenge? | string | The challenge returned by [create sudo WebAuthn authentication options](/http-api/users/mfa/#create-sudo-webauthn-authentication-options) (1-256 characters) |-| email_code_ticket? | string | Unused here, because an account with a second factor cannot use an email code |-| email_code? | string | Unused here, for the same reason |+| ticket | string | The ticket from [Start password change](#start-password-change) (1-256 characters) |+| verification_proof | string | The proof from [Verify password change code](#verify-password-change-code) (1-256 characters) |+| new_password | string | The new password (8-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [password change completion](#password-change-completion-object) object | The password was replaced |-| 403 | [error response](/http-api/#error-response) | `SUDO_MODE_REQUIRED`, because the account has a second factor and no proof was sent |+| 200 | [password change completion](#password-change-completion-object) object | The password was changed |-:::danger[Every existing session is destroyed]-Completing a password change deletes every authentication session for the account, including the one that authenticated the request, and issues the single replacement this operation returns. Switch to the returned `token` immediately.-:::+Fluxer sends [Auth Session Change](/gateway/events/#auth-session-change) with the old and new session ID hashes.-### Side effects--The password is changed and the ticket is completed. All password reset tokens and existing authentication sessions are revoked. The caller receives [Auth Session Change](/gateway/events/#auth-session-change) with the replacement token before its session ends. The returned token is the account's only session. OAuth2 access tokens and refresh tokens remain valid.--### Rate limit--10 requests per minute for each authenticated user, on the `user:password_change:complete` bucket.+The rate limit is 10 requests per minute, on the `user:password_change:complete` bucket.## Set a new password<RouteHeader method="POST" path="/v1/users/@me/password" mfa />-Replaces the account password after [sudo mode](/http-api/users/mfa/#sudo-mode) is proven. Returns a [password change completion](#password-change-completion-object) object. Emits an [Auth Session Change](/gateway/events/#auth-session-change) Gateway event with the replacement token.--Only a `username` instance serves this operation, and an `email` instance returns 400 `USERNAME_SIGN_IN_ONLY`. A replacement password in the public breached-password corpus is rejected with `PASSWORD_IS_TOO_COMMON` on `new_password`. An account that signs in through SSO and has no password returns the field code `PASSWORD_NOT_SET` on `new_password` before sudo mode is checked, and an instance that enforces SSO returns 403 `SSO_REQUIRED`.+Changes the password on a username instance after [sudo mode](/http-api/users/mfa/#sudo-mode) and returns a [new session](#password-change-completion-object). It also deletes the account's recovery kit. A password found in known breaches fails with `PASSWORD_IS_TOO_COMMON`, and an SSO account with no password gets `PASSWORD_NOT_SET`. An instance that enforces single sign-on returns 403 `SSO_REQUIRED`.### JSON body-The body extends the [sudo verification object](/http-api/users/mfa/#sudo-verification-object) with the field below, and an existing sudo proof is sent in the `X-Fluxer-Sudo-Mode-JWT` request header.+The body extends the [sudo verification object](/http-api/users/mfa/#sudo-verification-object) with `new_password`.| Field | Type | Description || --- | --- | --- |-| new_password | string | The password to write to the account (8-256 characters) |+| new_password | string | The new password (8-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [password change completion](#password-change-completion-object) object | The password was replaced |-| 400 | [error response](/http-api/#error-response) | The body or password is invalid, an SSO account has no password, or the instance signs members in with email |-| 403 | [error response](/http-api/#error-response) | Sudo mode was not proven and the request returns `SUDO_MODE_REQUIRED`, or the instance enforces SSO |+| 200 | [password change completion](#password-change-completion-object) object | The password was changed |-:::danger[Every existing session is destroyed]-Setting a new password deletes every authentication session for the account, including the one that authenticated the request, and issues the single replacement this operation returns. Switch to the returned `token` immediately.-:::+Fluxer sends [Auth Session Change](/gateway/events/#auth-session-change) with the old and new session ID hashes.-### Side effects--The password is changed and the change time recorded. All password reset tokens and existing authentication sessions are revoked, and the account's recovery kit is deleted. The caller receives [Auth Session Change](/gateway/events/#auth-session-change) with the replacement token before its session ends. The returned token is the account's only session.--### Rate limit--10 requests per minute for each authenticated user, on the `user:password:update` bucket.+The rate limit is 10 requests per minute, on the `user:password:update` bucket.## Get recovery kit status<RouteHeader method="GET" path="/v1/users/@me/recovery-kit" />-Reports whether the account has a recovery kit. Returns a [recovery kit status](#recovery-kit-status-object) object.--Only a `username` instance serves this operation, and an `email` instance returns 400 `USERNAME_SIGN_IN_ONLY`.+Returns whether the account has a recovery kit.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [recovery kit status](#recovery-kit-status-object) object | The status was read |-| 400 | [error response](/http-api/#error-response) | The instance signs members in with email |+| 200 | [recovery kit status](#recovery-kit-status-object) object | The status was returned |-### Side effects--None. No Gateway Dispatch is emitted.--### Rate limit--20 requests per minute for each authenticated user, on the `user:recovery_kit:get` bucket.+The rate limit is 20 requests per minute, on the `user:recovery_kit:get` bucket.## Create a recovery kit<RouteHeader method="POST" path="/v1/users/@me/recovery-kit" mfa />-Issues a new recovery kit after [sudo mode](/http-api/users/mfa/#sudo-mode) is proven. Returns a [recovery kit](#recovery-kit-object) object.--Only a `username` instance serves this operation, and an `email` instance returns 400 `USERNAME_SIGN_IN_ONLY`. An account that signs in through SSO and has no password returns the field code `PASSWORD_NOT_SET` on `password` before sudo mode is checked, and an instance that enforces SSO returns 403 `SSO_REQUIRED`.--:::caution[A new kit replaces the previous one immediately]-The previous key stops working as soon as this operation succeeds. A client MUST show the new key to the user before it discards the response.-:::+Creates a recovery kit after [sudo mode](/http-api/users/mfa/#sudo-mode) and makes the previous key stop working. Show the key to the person before you discard the response, because Fluxer never returns it again. An SSO account with no password gets `PASSWORD_NOT_SET`, and an instance that enforces single sign-on returns 403 `SSO_REQUIRED`.### JSON body-The body is the [sudo verification object](/http-api/users/mfa/#sudo-verification-object), and an existing sudo proof is sent in the `X-Fluxer-Sudo-Mode-JWT` request header.+The body is the [sudo verification object](/http-api/users/mfa/#sudo-verification-object).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [recovery kit](#recovery-kit-object) object | The kit was issued |-| 400 | [error response](/http-api/#error-response) | The body is invalid, an SSO account has no password, or the instance signs members in with email |-| 403 | [error response](/http-api/#error-response) | Sudo mode was not proven and the request returns `SUDO_MODE_REQUIRED`, or the instance enforces SSO |--### Side effects--The account's recovery kit is replaced, and only a SHA-256 hash of the new key is stored. No other account field changes. No Gateway Dispatch is emitted.--### Rate limit+| 200 | [recovery kit](#recovery-kit-object) object | The kit was created |-6 requests per minute for each authenticated user, on the `user:recovery_kit:create` bucket.+The rate limit is 6 requests per minute, on the `user:recovery_kit:create` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/users/gifts.mdx b/fluxer_docs/src/content/docs/http-api/users/gifts.mdxindex 710e48927..79c9ab2c1 100644--- a/fluxer_docs/src/content/docs/http-api/users/gifts.mdx+++ b/fluxer_docs/src/content/docs/http-api/users/gifts.mdx@@ -1,98 +1,42 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Gift inventory-description: Premium gift codes the current account created, and their redemption state.+description: Premium gift codes the current account bought, and whether each was redeemed.---import RouteHeader from '@/components/RouteHeader.astro';-The gift inventory lists the premium gift codes the current account created, with the redemption state of each. The [Gifts resource](/http-api/gifts/) has public gift lookup and redemption, and the [Billing resource](/http-api/billing/) has gift purchase.+The gift inventory has the premium gift codes the current account bought.-A self-hosted deployment returns 404 `NOT_FOUND` here unless its [premium mode](/admin-api/instance/#premium-modes) is `mirror`, as [deployment availability](/http-api/deployment-availability/) describes.--A code enters this inventory only through a completed gift checkout with the payment provider. The Admin API records a code it issues against the system account, so that code never appears in any account's inventory.--:::note[A received gift never appears in the inventory]-Only the account that created a code sees it here.-:::--:::note[Listing gifts does not clear the unread marker]-A newly issued code raises `has_unread_gift_inventory` on the [user object](/http-api/users/#user-object). A client clears it by sending `has_unread_gift_inventory` as `false` to [Modify current user](/http-api/users/current-user/#modify-current-user).-:::+A new code sets `has_unread_gift_inventory` on the [user object](/http-api/users/#user-object) and adds one to `unread_gift_inventory_count`. To clear both, send `has_unread_gift_inventory: false` to [Modify current user](/http-api/users/current-user/#modify-current-user). Listing gifts doesn't clear them.## Gift inventory object-One gift code created by the current account, with its redemption state. A completed checkout yields at most one code even when the payment provider retries its notification.+One gift code the current account bought. Any account with an unredeemed code can [redeem it](/http-api/gifts/#redeem-gift).### Structure| Field | Type | Description || --- | --- | --- |-| code<sup>1</sup> | string | The code a recipient presents to [Redeem gift](/http-api/gifts/#redeem-gift) |-| duration_type<sup>2</sup> | string | The [gift duration unit](/http-api/gifts/#gift-duration-units) that `duration_quantity` is measured in |-| duration_quantity<sup>3</sup> | integer | The number of `duration_type` units the code grants |-| created_at<sup>4</sup> | ISO8601 timestamp | The time the code was created |-| created_by<sup>5</sup> | [partial user](/http-api/users/#partial-user-object) object | The account that created the code |-| redeemed_at?<sup>6</sup> | ?ISO8601 timestamp | The time the code was redeemed, or null while it is unredeemed |-| redeemed_by?<sup>6</sup> <sup>7</sup> | ?[partial user](/http-api/users/#partial-user-object) object | The account that redeemed the code, or null while it is unredeemed |--<sup>1</sup> Exactly 32 characters drawn from the uppercase letters, the lowercase letters, and the digits, and unique across every code ever issued--<sup>2</sup> One of `days`, `weeks`, `months`, or `years`. A purchased code has only `months` or `years`, because a term dividing evenly into years is normalised to years--<sup>3</sup> A purchased code always has `1`, because the only gift products are one month and one year. The value `0` means a lifetime grant, and no current operation issues one--<sup>4</sup> The checkout time, which can predate when the code appeared in the inventory--<sup>5</sup> Always the current account--<sup>6</sup> Declared optional by the response schema and always emitted, so an unredeemed code has an explicit null in each--<sup>7</sup> Fluxer substitutes a placeholder partial named `DeletedUser` for a redeemer whose account no longer resolves, so null here always means the code is unredeemed--The object adds the creation time and the redemption identity to what the public [gift object](/http-api/gifts/#gift-object) reports, and has no `redeemed` boolean.--Redeeming a lifetime-quantity code converts the account to lifetime premium and cancels any active recurring subscription.--:::danger[A code is a bearer credential]-Fluxer records no recipient at issue time, so [redemption](/http-api/gifts/#redeem-gift) binds a code to whichever eligible account presents it first. The inventory returns the full code, and no operation unredeems it. Treat every unredeemed code as a secret.-:::--### Example--```json-{- "code": "aB3xQ7kR2mW9tL5vN8pY1cD4fH6jS0zE",- "duration_type": "months",- "duration_quantity": 1,- "created_at": "2026-02-11T12:04:33.000Z",- "created_by": {"id": "1501314428688998182", "username": "aria", "discriminator": "0042"},- "redeemed_at": null,- "redeemed_by": null-}-```+| code | string | The gift code |+| duration_type | string | The [duration unit](/http-api/gifts/#gift-duration-units) of `duration_quantity` |+| duration_quantity | integer | The number of `duration_type` units the code grants |+| created_at | ISO8601 timestamp | When the code was created |+| created_by | [partial user](/http-api/users/#partial-user-object) object | The account that bought the code |+| redeemed_at? | ?ISO8601 timestamp | When the code was redeemed, or null if it is unredeemed |+| redeemed_by? | ?[partial user](/http-api/users/#partial-user-object) object | The account that redeemed the code, or null if it is unredeemed |## List current user gifts<RouteHeader method="GET" path="/v1/users/@me/gifts" />-Lists the gift codes the current account created, newest first. Returns an array of [gift inventory](#gift-inventory-object) objects on success.--The listing is not paginated, so it accepts no query parameter and returns no cursor.--An unredeemed code is listed indefinitely. A redeemed code is listed only while its redemption is less than seven days old, so an account whose codes were all redeemed longer ago receives an empty array.--A revoked code is omitted at every age. Fluxer revokes a code when a refund, or a dispute that closes as `lost`, reaches the purchase while the code is still unredeemed, and no route reports the reversal to the buyer. A code already redeemed when the reversal arrived is not revoked, so it stays listed under the seven-day rule while Fluxer recomputes the redeemer's entitlement from their remaining redeemed gifts.--A redeemed code that has dropped out of the listing still exists, still resolves through the [Gifts resource](/http-api/gifts/), and is still permanently spent. A revoked code stops resolving through that resource with 404 `UNKNOWN_GIFT_CODE`.+Returns the gift codes the current account bought, newest first, with no pagination. The list leaves out revoked codes and codes redeemed more than seven days ago.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | array[[gift inventory](#gift-inventory-object) object] | The inventory was returned |-| 404 | [error response](/http-api/#error-response) | The deployment is self-hosted in the `everyone` premium mode and the request returns `NOT_FOUND` |--### Rate limit+| 200 | array[[gift inventory](#gift-inventory-object) object] | The gift codes were returned |+| 404 | [error response](/http-api/#error-response) | `NOT_FOUND` when the instance [premium mode](/admin-api/instance/#premium-modes) isn't `mirror` |-40 requests per 10 seconds for each authenticated user, on the `gifts:list` bucket.+The rate limit is 40 requests per 10 seconds, on the `gifts:list` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/users/mfa.mdx b/fluxer_docs/src/content/docs/http-api/users/mfa.mdxindex f2f647dfc..6cc7fc59d 100644--- a/fluxer_docs/src/content/docs/http-api/users/mfa.mdx+++ b/fluxer_docs/src/content/docs/http-api/users/mfa.mdx@@ -1,124 +1,63 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Multi-factor authentication-description: TOTP, backup codes, WebAuthn credentials, and sudo mode.+description: TOTP, backup codes, WebAuthn credentials and sudo mode.---import RouteHeader from '@/components/RouteHeader.astro';-Multi-factor authentication asks for a second proof of identity after the account password. Fluxer accepts a TOTP authenticator app and WebAuthn credentials such as a passkey. A one-use backup code works instead of a TOTP code, and [sudo mode](#sudo-mode) reuses these factors to protect every security-sensitive operation in the API.--Registering a WebAuthn credential does not make passkeys a second factor. A registered credential answers a [sudo mode](#sudo-mode) challenge and a passwordless login on its own, and only [Set WebAuthn two-factor authentication](#set-webauthn-two-factor-authentication) adds the WebAuthn [authenticator type](/http-api/users/#authenticator-types) that makes a passkey a required second factor at password login.--Every route here requires a non-bot user session.--:::caution[A challenge is one-use and context-bound]-Fluxer consumes a backup code, a WebAuthn registration challenge, and a WebAuthn sudo challenge on first use. A challenge is bound to the user it was issued to and to the operation it was issued for. The operations are registration, sudo, MFA login, and discoverable login. It expires after five minutes, so a registration challenge cannot be redeemed as a sudo assertion.-:::+An account can use a TOTP authenticator app and WebAuthn credentials such as passkeys as a second factor, with one-use backup codes as a fallback. A registered passkey works for [sudo mode](#sudo-mode) and passwordless login right away, but password login only asks for it after [Set WebAuthn two-factor authentication](#set-webauthn-two-factor-authentication) turns it on.## TOTP parameters-Fluxer validates a TOTP code as a six-digit HMAC-SHA-1 one-time password over a 30-second time step counted from the Unix epoch. It accepts one time step of clock skew on either side. A submitted code is exactly six decimal digits, and Fluxer rejects any other value. The shared secret is Base32, and Fluxer ignores whitespace, hyphens, and trailing padding when it decodes one.--The client generates the secret, presents it to the user, and submits it with a code derived from it when calling [Enable TOTP MFA](#enable-totp-mfa). Fluxer never generates or returns a TOTP secret.--:::caution[A TOTP code can pass twice]-Fluxer rejects an accepted code for 30 seconds if it is sent again. The skew keeps a code valid up to 90 seconds, so it passes again once those 30 seconds lapse. Wait for the next time step.-:::--## Backup code contract--Regenerating backup codes deletes the stored set and then issues exactly 10 replacements, so any code the user had already saved stops working.--Enabling TOTP issues 10 codes without deleting anything first. An account that already generated a set through [List MFA backup codes](#list-mfa-backup-codes) while holding no TOTP secret keeps those codes alongside the 10 the enable response returns. Every one stays redeemable. Disabling TOTP deletes every backup code only when the account is left with no second factor, so an account that keeps passkeys as a second factor keeps its whole set.--[List MFA backup codes](#list-mfa-backup-codes) reads the current set back at any time and reports which codes are already consumed. Consuming a code is irreversible. An account that cannot prove [sudo mode](#sudo-mode) reads the same set through the [backup codes challenge](#backup-codes-challenge).--A backup code has only these entry points: the `mfa_code` field of the [sudo verification object](#sudo-verification-object) with `mfa_method` set to `totp`, the `code` field of [Disable TOTP MFA](#disable-totp-mfa), and the `code` field of [complete login with TOTP](/http-api/authentication/#complete-login-with-totp). Every other code field rejects it. All accept a current authenticator code or an unconsumed backup code. [Enable TOTP MFA](#enable-totp-mfa) validates only against the secret being enrolled.+Fluxer accepts six-digit HMAC-SHA-1 codes with a 30-second time step and one step of clock skew either way. Your client generates the Base32 secret, shows it to the user and sends it with a code to [Enable TOTP MFA](#enable-totp-mfa).-Only the `code` field of [Disable TOTP MFA](#disable-totp-mfa) requires the account to hold a TOTP secret, so an account whose only second factor is passkeys never reaches that one. The other two accept an unconsumed backup code from such an account: the [sudo verification object](#sudo-verification-object) reads `mfa_code` as a backup code whenever the account holds no TOTP secret, and [complete login with TOTP](/http-api/authentication/#complete-login-with-totp) reads `code` the same way. Together they are the recovery path when no passkey is at hand. Any account reads and replaces its set through [List MFA backup codes](#list-mfa-backup-codes) with `regenerate` set to true, whether or not it holds a TOTP secret, because that route needs sudo mode alone.+## Backup codes-[Set WebAuthn two-factor authentication](#set-webauthn-two-factor-authentication) mints 10 codes when it turns the toggle on for an account holding none, so an account whose only second factor is passkeys always has a set to fall back on.+An account gets 10 backup codes when it enables TOTP, and when it turns on passkeys as a second factor while it has no unused codes. Each code works once, and Fluxer ignores case, spaces and hyphens when it compares them. You can send a backup code wherever a TOTP code is accepted, except in [Enable TOTP MFA](#enable-totp-mfa). Fluxer deletes every code when the account is left with no second factor.-:::caution[An uppercase backup code with spaces still matches]-Fluxer lowercases the submitted value and each stored code, then removes every character outside `a-z` and `0-9`. `abcdefgh` and `AbCd EfGh` both match the issued code `abcd-efgh`.-:::+A user who lost their codes and their authenticator can get them back by email without sudo mode.-:::danger[Authenticator secrets are credentials]-Keep the TOTP secret and every backup code out of logs, analytics, URLs, and other surfaces visible to third parties. A regenerated set replaces the previous one immediately, so let the user store the new set before discarding the response.-:::+1. [Start MFA backup codes challenge](#start-mfa-backup-codes-challenge) emails a code and returns a ticket that lasts 30 minutes.+2. [Verify MFA backup codes challenge code](#verify-mfa-backup-codes-challenge-code) trades the code, which lasts 10 minutes, for the current codes and a proof.+3. [Regenerate MFA backup codes](#regenerate-mfa-backup-codes) uses the proof to replace the set.-## Backup codes challenge+The account needs a verified email address and a second factor turned on. On an instance where people sign in with a username these routes return 400 `EMAIL_UNAVAILABLE_ON_INSTANCE`, and on an instance that sends no email they return 400 `EMAIL_CODES_UNAVAILABLE`. Ticket, code and proof errors come back as `INVALID_FORM_BODY` [validation errors](/http-api/#validation-error-object).-An account that lost its saved backup codes reads the set back through an emailed challenge. [Start MFA backup codes challenge](#start-mfa-backup-codes-challenge) opens a ticket and emails a code. [Verify MFA backup codes challenge code](#verify-mfa-backup-codes-challenge-code) exchanges that code for the current set and a proof. [Regenerate MFA backup codes](#regenerate-mfa-backup-codes) then presents the ticket and the proof to replace the set. [Resend MFA backup codes challenge code](#resend-mfa-backup-codes-challenge-code) sends a fresh code any time before verification.--[Sudo mode](#sudo-mode) applies to none of the four, so a user who no longer has the authenticator app still reaches the codes through the email address. The account needs a verified email address and TOTP enabled. Only [Start MFA backup codes challenge](#start-mfa-backup-codes-challenge) checks the address, and [Regenerate MFA backup codes](#regenerate-mfa-backup-codes) checks TOTP a second time.--An instance where members sign in with a username keeps no email address, and all four return 400 `EMAIL_UNAVAILABLE_ON_INSTANCE` there. An account on such an instance reads and replaces its set through [List MFA backup codes](#list-mfa-backup-codes) under sudo mode.--A ticket is a version 4 UUID valid for 30 minutes after the challenge starts, the code is resent, or the code is verified. Regeneration does not extend it. An expired, unknown, or another account's ticket fails with `INVALID_OR_EXPIRED_TICKET`.--A verification code is eight characters drawn from the uppercase Latin alphabet and the decimal digits, written as two four-character groups separated by a hyphen. A code is valid for 10 minutes from the moment it is sent, and each send replaces the code the previous send issued.--:::note[A lowercase code with no hyphen still matches]-Fluxer trims the submitted value, uppercases it, and removes every hyphen before it compares. A wrong value fails with `INVALID_VERIFICATION_CODE` on the path `code`.-:::--Verification consumes the code and issues a proof as a version 4 UUID. An incorrect proof fails with `INVALID_PROOF_TOKEN`. A ticket with no proof fails with `INVALID_OR_EXPIRED_TICKET` on `verification_proof`.--Every ticket, code, and proof failure named here arrives as HTTP 400 whose top-level code is `INVALID_FORM_BODY`. The named value is the `code` of one [validation error](/http-api/#validation-error-object) entry, and that entry's `path` is the field it belongs to.--Each operation passes through its own route bucket and, separately, through one of the controls below. Exhausting either produces HTTP 429 even when the other has room.--| Control | Allowance | Operation |-| --- | --- | --- |-| Challenge start | 3 sends per 15 minutes for each account | [Start MFA backup codes challenge](#start-mfa-backup-codes-challenge) |-| Challenge resend | 3 sends per 15 minutes for each account | [Resend MFA backup codes challenge code](#resend-mfa-backup-codes-challenge-code) |-| Code verification | 5 attempts per 15 minutes for each ticket | [Verify MFA backup codes challenge code](#verify-mfa-backup-codes-challenge-code) |-| Regeneration | 5 attempts per 15 minutes for each ticket | [Regenerate MFA backup codes](#regenerate-mfa-backup-codes) |+Each step also has a limit of its own, on top of its route bucket.-Fluxer refuses a resend for 30 seconds after the previous send on the same ticket. That refusal is HTTP 429 with a `Retry-After` computed from the moment the next send becomes available. It is independent of the route bucket and of the 15-minute send controls.+| Step | Limit |+| --- | --- |+| Start | 3 emails per 15 minutes for each account |+| Resend | 3 emails per 15 minutes for each account, and 30 seconds between emails on a ticket |+| Verify | 5 attempts per 15 minutes for each ticket |+| Regenerate | 5 attempts per 15 minutes for each ticket |## Sudo mode-Sudo mode is a short-lived proof that the human in front of the session is still the account holder. An operation that requires it accepts a valid `X-Fluxer-Sudo-Mode-JWT` request header or the [sudo verification object](#sudo-verification-object) fields inside the JSON body.--A sudo token lasts five minutes and works only for the account that obtained it, across that account's sessions. Treat it as opaque. A new token is issued only after an MFA proof from an account holding a TOTP secret or a registered WebAuthn credential, or after an email code.--:::caution[The echoed header repeats the request value]-When Fluxer issues no fresh token it echoes the request's `X-Fluxer-Sudo-Mode-JWT` value back unchanged and never re-signs it, so the five-minute window never slides. Fluxer echoes the value even when it fails verification.-:::+Sudo mode is a recent proof that the account holder is present, and security-sensitive operations need it. Send the proof as [sudo verification object](#sudo-verification-object) fields in the JSON body, or send an earlier token in the `X-Fluxer-Sudo-Mode-JWT` header. After a TOTP, backup code, passkey or email code proof, Fluxer returns a token in the same response header, and it works for five minutes on any of the account's sessions. A password proof returns no token, and the account sends `password` on each call.-The accepted proof depends on what the account can present, which is a stored TOTP secret or a registered WebAuthn credential. The [authenticator types](/http-api/users/#authenticator-types) the account advertises do not enter into it, so a passkey proves sudo mode whether or not passkeys are enabled as a second factor.+The first row that matches the account says which proofs it can send.-| Account state | Accepted proof |+| Account state | Proof to send || --- | --- |-| Neither a TOTP secret nor a registered WebAuthn credential | `password`, when the account has one |-| A TOTP secret or a registered WebAuthn credential | `mfa_method` with its matching fields, because `password` and `email_code` are no longer accepted |-| A registered WebAuthn credential and no TOTP secret | The same, and `mfa_method` of `totp` then reads `mfa_code` as an unconsumed backup code |-| No password credential and a confirmed email address | `mfa_method` of `email_code` |-| None of those | Nothing, and eligible sudo operations pass |--The `email_code` method needs an instance that sends email. [Send a sudo email code](#send-a-sudo-email-code) returns the `email_code_ticket`, and the person types the emailed code into `email_code`. A wrong code returns 400 `INVALID_SIGN_IN_CODE` and counts toward the account's wrong-code limit in [send an email code](/http-api/authentication/#send-an-email-code), and after 5 wrong tries or 10 minutes the ticket returns 400 `SIGN_IN_CODE_EXPIRED`. A ticket issued to another account returns 400 `UNKNOWN_SIGN_IN_TICKET`.--The `totp` method reads `mfa_code` as a current authenticator code or an unconsumed backup code. An account holding no TOTP secret is left with the backup code alone, which is how an account whose only second factor is passkeys proves sudo mode with no passkey at hand. The `webauthn` method reads `webauthn_response` and `webauthn_challenge` together and requires a registered credential.+| A second factor is turned on | `mfa_method` of `totp` or `webauthn` with its fields |+| Has a password | `password`, or `webauthn` with a passkey |+| Has a confirmed email address on an instance that sends email | `mfa_method` of `email_code` after [Send a sudo email code](#send-a-sudo-email-code), or `webauthn` with a passkey |+| None of these | Nothing, and the operation goes ahead |-A request that has no accepted proof fails with 403 `SUDO_MODE_REQUIRED`. Its body has the [sudo mode methods object](#sudo-mode-methods-object) members, so a client can tell which proof to ask the user for. A proof that is present but wrong fails instead with 400 `INVALID_FORM_BODY` and a [validation error](/http-api/#validation-error-object) entry. A mismatched password produces path `password` with code `INVALID_PASSWORD`. A rejected TOTP code, backup code, or WebAuthn assertion produces path `mfa_code` with code `INVALID_MFA_CODE`, so a client cannot tell which of the three was rejected.--The `totp` method also consumes a per-account allowance of 10 multi-factor attempts in 15 minutes, shared by every sudo-gated operation on every resource. Fluxer charges the allowance before it checks the code, so a wrong code and a correct code both draw on it. A correct code resets the counter to zero. While it is exhausted, a correct code returns the same `INVALID_MFA_CODE` entry as a wrong one. The `webauthn` method draws on no allowance. The login MFA allowances on [HTTP authentication](/http-api/authentication/) are counted separately.--Fluxer returns an issued or echoed token in the `X-Fluxer-Sudo-Mode-JWT` response header. A client keeps it and sends it in the same header on every later sudo-gated operation.+Without a proof, the request returns 403 `SUDO_MODE_REQUIRED` with the [sudo mode methods](#sudo-mode-methods-object) fields. A wrong password returns 400 `INVALID_PASSWORD` on the path `password`, and a wrong TOTP code, backup code or passkey assertion returns 400 `INVALID_MFA_CODE` on the path `mfa_code`. The `totp` method allows 10 attempts per 15 minutes for each account, and a correct code resets the count. A wrong email code returns 400 `INVALID_SIGN_IN_CODE`, a ticket past 10 minutes or 5 wrong tries returns 400 `SIGN_IN_CODE_EXPIRED`, and an unknown ticket returns 400 `UNKNOWN_SIGN_IN_TICKET`.## Sudo mode methods object-In a `SUDO_MODE_REQUIRED` error response, `has_mfa` and `methods` are at the top level of the [error response](/http-api/#error-response) object.+`SUDO_MODE_REQUIRED` responses have these fields at the top level of the [error response](/http-api/#error-response).### Structure| Field | Type | Description || --- | --- | --- |-| has_mfa | boolean | Whether the account can satisfy a sudo mode challenge |-| methods | [sudo mode method availability](#sudo-mode-method-availability-object) object | Authenticators the account can present |+| has_mfa | boolean | Whether the account has TOTP or at least one passkey |+| methods | [sudo mode method availability](#sudo-mode-method-availability-object) object | The proofs the account can give |## Sudo mode method availability object@@ -126,41 +65,42 @@ In a `SUDO_MODE_REQUIRED` error response, `has_mfa` and `methods` are at the top| Field | Type | Description || --- | --- | --- |-| totp<sup>1</sup> | boolean | Whether the account has a TOTP secret and the TOTP authenticator type |-| webauthn | boolean | Whether the account has at least one registered WebAuthn credential |-| backup_codes<sup>2</sup> | boolean | Whether the account holds at least one unconsumed backup code |+| totp | boolean | Whether the account has TOTP enabled |+| webauthn | boolean | Whether the account has at least one passkey |+| backup_codes<sup>1</sup> | boolean | Whether the account has at least one unused backup code || email_code? | boolean | Whether the account can prove sudo mode with an emailed code || password? | boolean | Whether the account can prove sudo mode with its password |-<sup>1</sup> Both conditions are required, so an account holding a stored secret without the [authenticator type](/http-api/users/#authenticator-types) reports `false`--<sup>2</sup> There is no `backup_codes` method. The value tells a client to offer the code input, which a backup code reaches under `mfa_method` of `totp` like any other code, and to label that input as a backup code when `totp` is `false`. It reports the stored codes alone, so a client reads it only while `has_mfa` is true, because an account that cannot answer a sudo challenge proves sudo mode with its `password` however many codes it holds--## Sudo verification object+<sup>1</sup> A backup code goes in `mfa_code` with `mfa_method` set to `totp`, also on an account without TOTP. There is no `backup_codes` method-Operations that require sudo mode merge these fields into their own JSON body. Every field is optional at the boundary, because the accepted combination depends on the account state described in [sudo mode](#sudo-mode).+## Sudo MFA methods object### Structure| Field | Type | Description || --- | --- | --- |-| password?<sup>1</sup> | string | Account password (8-256 characters) |-| mfa_method?<sup>2</sup> | string | MFA method, one of `totp`, `webauthn` or `email_code` |-| mfa_code?<sup>3</sup> | string | Authenticator code or unconsumed backup code (1-32 characters) |-| webauthn_response?<sup>4</sup> | [WebAuthn assertion](#webauthn-assertion-object) object | Assertion produced for the supplied challenge |-| webauthn_challenge?<sup>4</sup> | string | Challenge returned by [create sudo WebAuthn authentication options](#create-sudo-webauthn-authentication-options) (1-256 characters) |-| email_code_ticket?<sup>5</sup> | string | Ticket returned by [send a sudo email code](#send-a-sudo-email-code) (1-128 characters) |-| email_code?<sup>5</sup> | string | The 6-digit code from the email |--<sup>1</sup> Considered only while the account holds no TOTP secret and no registered WebAuthn credential, and ignored once either exists+| totp | boolean | Whether the account has TOTP enabled |+| webauthn | boolean | Whether the account has at least one passkey |+| backup_codes | boolean | Whether the account has at least one unused backup code |+| has_mfa | boolean | Whether the account has TOTP or at least one passkey |+| email_code? | boolean | Whether the account can prove sudo mode with an emailed code |+| password? | boolean | Whether the account can prove sudo mode with its password |-<sup>2</sup> Required when the account holds a TOTP secret or a registered WebAuthn credential, unless a valid sudo token is already present+## Sudo verification object-<sup>3</sup> Required when `mfa_method` is `totp`, with a current authenticator code or an unconsumed backup code. Fluxer reads it as a backup code alone while the account holds no TOTP secret+Operations that need [sudo mode](#sudo-mode) accept these fields in their JSON body.-<sup>4</sup> Both fields are required together when `mfa_method` is `webauthn`+### Structure-<sup>5</sup> Both fields are required together when `mfa_method` is `email_code`+| Field | Type | Description |+| --- | --- | --- |+| password? | string | Account password (8-256 characters) |+| mfa_method? | string | One of `totp`, `webauthn` or `email_code` |+| mfa_code? | string | TOTP code or unused backup code, for `totp` (1-32 characters) |+| webauthn_response? | [WebAuthn assertion](#webauthn-assertion-object) object | Assertion for `webauthn_challenge`, for `webauthn` |+| webauthn_challenge? | string | Challenge from [Create sudo WebAuthn authentication options](#create-sudo-webauthn-authentication-options) (1-256 characters) |+| email_code_ticket? | string | Ticket from [Send a sudo email code](#send-a-sudo-email-code), for `email_code` (1-128 characters) |+| email_code? | string | The 6-digit code from the email, for `email_code` |## MFA backup codes object@@ -187,8 +127,8 @@ Operations that require sudo mode merge these fields into their own JSON body. E| Field | Type | Description || --- | --- | --- |-| code | string | One-use backup code |-| consumed | boolean | Whether the code has already been consumed |+| code | string | The code, two groups of four lowercase letters and digits |+| consumed | boolean | Whether the code has been used |## MFA backup codes challenge object@@ -196,9 +136,9 @@ Operations that require sudo mode merge these fields into their own JSON body. E| Field | Type | Description || --- | --- | --- |-| ticket | string | The identifier every later step of this flow sends |-| code_expires_at | ISO8601 timestamp | The moment the emailed code expires, 10 minutes after it was sent |-| resend_available_at | ISO8601 timestamp | The earliest moment the code can be resent, 30 seconds after the last send |+| ticket | string | The ticket to send in later steps |+| code_expires_at | ISO8601 timestamp | When the emailed code expires |+| resend_available_at | ISO8601 timestamp | When you can ask for another code |## MFA backup codes verification object@@ -207,29 +147,21 @@ Operations that require sudo mode merge these fields into their own JSON body. E| Field | Type | Description || --- | --- | --- || backup_codes | array[[MFA backup code](#mfa-backup-code-object) object] | The account's current backup codes |-| verification_proof<sup>1</sup> | string | The proof [Regenerate MFA backup codes](#regenerate-mfa-backup-codes) consumes |--<sup>1</sup> A resend clears the stored proof and the next verification issues a different value+| verification_proof | string | The proof for [Regenerate MFA backup codes](#regenerate-mfa-backup-codes) |## WebAuthn credential object-An account holds at most 10 WebAuthn credentials. Both [Create WebAuthn registration options](#create-webauthn-registration-options) and [Register WebAuthn credential](#register-webauthn-credential) enforce this limit.--Fluxer verifies every assertion against the instance's `FLUXER_PASSKEY_RP_ID` and against the allowed origins configured for the instance. Fluxer rejects an assertion whose reported signature counter is not greater than the stored counter. The exception is a stored and a reported counter of zero, which is how an authenticator without a counter appears.+An account can have up to 10 WebAuthn credentials.### Structure| Field | Type | Description || --- | --- | --- || id | string | Base64url credential ID |-| name | string | User-assigned credential name (1-100 characters) |-| created_at | ISO8601 timestamp | The time [Register WebAuthn credential](#register-webauthn-credential) stored the credential |-| last_used_at<sup>1</sup> | ?ISO8601 timestamp | Most recent successful authentication |-| rp_id | string | The domain the passkey was created for, the instance's `FLUXER_PASSKEY_RP_ID` |--<sup>1</sup> Null until the credential completes a login, MFA, or sudo assertion for the first time--Fluxer never returns the credential's public key, signature counter, or reported transports.+| name | string | Name the user gave the credential (1-100 characters) |+| created_at | ISO8601 timestamp | When the credential was registered |+| last_used_at | ?ISO8601 timestamp | When the credential was last used, or null if never |+| rp_id | string | The domain the passkey was created for |## WebAuthn credential descriptor object@@ -238,10 +170,8 @@ Fluxer never returns the credential's public key, signature counter, or reported| Field | Type | Description || --- | --- | --- || id | string | Base64url credential ID |-| type | string | Credential type, always `public-key` |-| transports?<sup>1</sup> | array[string] | Authenticator transports from the [WebAuthn authenticator transport values](#webauthn-authenticator-transports) |--<sup>1</sup> Present only when the authenticator reported its transports during registration+| type | string | Always `public-key` |+| transports? | array[string] | [Transports](#webauthn-authenticator-transports) the authenticator reported at registration, or `internal`, `hybrid`, `usb`, `nfc` and `ble` when it reported none |## WebAuthn authenticator transports@@ -257,7 +187,7 @@ Fluxer never returns the credential's public key, signature counter, or reported## WebAuthn assertion object-The browser WebAuthn `PublicKeyCredential` serialisation. Its field names are camelCase, because Fluxer accepts the exact structure the WebAuthn client API produces.+The `PublicKeyCredential` JSON the browser WebAuthn API produces.### Structure@@ -266,11 +196,9 @@ The browser WebAuthn `PublicKeyCredential` serialisation. Its field names are ca| id | string | Base64url credential ID || rawId | string | Base64url raw credential ID || response | [WebAuthn assertion response](#webauthn-assertion-response-object) object | Authenticator assertion response |-| authenticatorAttachment? | string | Authenticator attachment, either `cross-platform` or `platform` |+| authenticatorAttachment? | string | Either `cross-platform` or `platform` || clientExtensionResults | [WebAuthn client extension results](#webauthn-client-extension-results-object) object | Client extension outputs |-| type | string | Credential type, always `public-key` |--Malformed fields return `INVALID_FORM_BODY`. Each operation documents its cryptographic verification errors.+| type | string | Always `public-key` |## WebAuthn assertion response object@@ -281,9 +209,7 @@ Malformed fields return `INVALID_FORM_BODY`. Each operation documents its crypto| clientDataJSON | string | Base64url client data JSON || authenticatorData | string | Base64url authenticator data || signature | string | Base64url assertion signature |-| userHandle?<sup>1</sup> | string | Base64url user handle |--<sup>1</sup> Present only when the assertion came from a discoverable credential+| userHandle? | string | Base64url user handle, for a discoverable credential |## WebAuthn registration response object@@ -294,11 +220,9 @@ Malformed fields return `INVALID_FORM_BODY`. Each operation documents its crypto| id | string | Base64url credential ID || rawId | string | Base64url raw credential ID || response | [WebAuthn attestation response](#webauthn-attestation-response-object) object | Authenticator attestation response |-| authenticatorAttachment? | string | Authenticator attachment, either `cross-platform` or `platform` |+| authenticatorAttachment? | string | Either `cross-platform` or `platform` || clientExtensionResults | [WebAuthn client extension results](#webauthn-client-extension-results-object) object | Client extension outputs |-| type | string | Credential type, always `public-key` |--Malformed fields return `INVALID_FORM_BODY`. An attestation that fails verification returns `INVALID_WEBAUTHN_CREDENTIAL`.+| type | string | Always `public-key` |## WebAuthn attestation response object@@ -309,12 +233,14 @@ Malformed fields return `INVALID_FORM_BODY`. An attestation that fails verificat| clientDataJSON | string | Base64url client data JSON || attestationObject | string | Base64url attestation object || authenticatorData? | string | Base64url authenticator data |-| transports?<sup>1</sup> | array[string] | Authenticator transports from the [WebAuthn authenticator transport values](#webauthn-authenticator-transports) |+| transports? | array[string] | [Transports](#webauthn-authenticator-transports) the authenticator supports || publicKeyAlgorithm? | integer | COSE public key algorithm identifier || publicKey? | string | Base64url credential public key |## WebAuthn client extension results object+Fluxer accepts extension result fields beyond these.+### Structure| Field | Type | Description |@@ -333,58 +259,36 @@ Malformed fields return `INVALID_FORM_BODY`. An attestation that fails verificat## WebAuthn authentication options object-Every operation that issues a WebAuthn authentication challenge returns this object: sudo verification here, and the login option operations on [HTTP authentication](/http-api/authentication/).+The options to pass to `navigator.credentials.get()`, returned for sudo mode here and for login on [HTTP authentication](/http-api/authentication/).### Structure| Field | Type | Description || --- | --- | --- |-| challenge<sup>1</sup> | string | Base64url one-use challenge |-| timeout<sup>2</sup> | integer | Authenticator operation timeout in milliseconds |-| rpId | string | Relying party identifier, the instance's `FLUXER_PASSKEY_RP_ID` |-| allowCredentials?<sup>3</sup> | array[[WebAuthn credential descriptor](#webauthn-credential-descriptor-object) object] | Credentials accepted for this operation |-| userVerification<sup>4</sup> | string | User verification requirement, one of `discouraged`, `preferred`, or `required` |--<sup>1</sup> Expires five minutes after issue and is bound to the operation that issued it, so a sudo challenge cannot be redeemed as a login assertion--<sup>2</sup> Every operation emits the fixed value `60000`, a standard PublicKeyCredential request option--<sup>3</sup> Sudo and MFA login options list the account's passkeys. The field is absent on the discoverable login route--<sup>4</sup> Sudo options and MFA login completion request `discouraged`. Discoverable login requests and verifies `required`--Fluxer emits no other PublicKeyCredential request options member, so `hints` and `extensions` never appear on this object.+| challenge | string | Base64url one-use challenge, valid for five minutes |+| timeout | integer | Authenticator timeout in milliseconds, always `60000` |+| rpId | string | Relying party ID, the instance's `FLUXER_PASSKEY_RP_ID` |+| allowCredentials? | array[[WebAuthn credential descriptor](#webauthn-credential-descriptor-object) object] | The account's passkeys, left out for discoverable login |+| userVerification | string | One of `discouraged`, `preferred` or `required` |## WebAuthn registration options object+The options to pass to `navigator.credentials.create()`.+### Structure| Field | Type | Description || --- | --- | --- || rp | [WebAuthn relying party](#webauthn-relying-party-object) object | Relying party identity |-| user | [WebAuthn registration user](#webauthn-registration-user-object) object | Account identity bound to the credential |-| challenge | string | Base64url one-use challenge |-| pubKeyCredParams<sup>1</sup> | array[[WebAuthn public key parameter](#webauthn-public-key-parameter-object) object] | Accepted public key algorithms |-| timeout<sup>2</sup> | integer | Authenticator operation timeout in milliseconds |-| excludeCredentials<sup>3</sup> | array[[WebAuthn credential descriptor](#webauthn-credential-descriptor-object) object] | Existing credentials that cannot be registered again |-| authenticatorSelection<sup>4</sup> | [WebAuthn authenticator selection](#webauthn-authenticator-selection-object) object | Authenticator selection requirements |-| attestation<sup>5</sup> | string | Attestation conveyance, always `none` |-| extensions<sup>6</sup> | [WebAuthn client extension inputs](#webauthn-client-extension-inputs-object) object | Requested client extensions |-| hints<sup>7</sup> | array[string] | Authenticator hints |--<sup>1</sup> Always the COSE identifiers `-8`, `-7`, and `-257`, in that order, standing for EdDSA, ECDSA with SHA-256, and RSASSA-PKCS1-v1_5 with SHA-256--<sup>2</sup> Every registration emits the fixed value `60000`--<sup>3</sup> Holds every credential already stored for the account, so an authenticator cannot enrol the same credential twice. It is an empty array when the account holds none--<sup>4</sup> Fluxer requests a preferred discoverable credential and preferred user verification, and requires neither, so `requireResidentKey` is `false`--<sup>5</sup> Fluxer requests `none`, so no attestation statement is retained--<sup>6</sup> Always present with `credProps` set to `true`, the only extension Fluxer requests--<sup>7</sup> Always an empty array+| user | [WebAuthn registration user](#webauthn-registration-user-object) object | The account the credential belongs to |+| challenge | string | Base64url one-use challenge, valid for five minutes |+| pubKeyCredParams | array[[WebAuthn public key parameter](#webauthn-public-key-parameter-object) object] | Accepted algorithms, COSE `-8`, `-7` and `-257` |+| timeout | integer | Authenticator timeout in milliseconds, always `60000` |+| excludeCredentials | array[[WebAuthn credential descriptor](#webauthn-credential-descriptor-object) object] | The account's existing credentials |+| authenticatorSelection | [WebAuthn authenticator selection](#webauthn-authenticator-selection-object) object | Authenticator requirements |+| attestation | string | Always `none` |+| extensions | [WebAuthn client extension inputs](#webauthn-client-extension-inputs-object) object | Requested extensions, `credProps` only |+| hints | array[string] | Always empty |## WebAuthn relying party object@@ -392,8 +296,8 @@ Fluxer emits no other PublicKeyCredential request options member, so `hints` and| Field | Type | Description || --- | --- | --- |-| name | string | Relying party display name configured for the instance |-| id | string | Relying party identifier, the instance's `FLUXER_PASSKEY_RP_ID` |+| name | string | Relying party display name |+| id | string | Relying party ID, the instance's `FLUXER_PASSKEY_RP_ID` |## WebAuthn registration user object@@ -401,11 +305,9 @@ Fluxer emits no other PublicKeyCredential request options member, so `hints` and| Field | Type | Description || --- | --- | --- |-| id | string | WebAuthn user handle, the decimal account [snowflake](/snowflakes/) encoded as base64url |+| id | string | User handle, the account [snowflake](/snowflakes/) as a decimal string in base64url || name | string | Account username |-| displayName<sup>1</sup> | string | Account display label |--<sup>1</sup> Fluxer supplies the account username in both `name` and `displayName`+| displayName | string | Account username |## WebAuthn public key parameter object@@ -414,7 +316,7 @@ Fluxer emits no other PublicKeyCredential request options member, so `hints` and| Field | Type | Description || --- | --- | --- || alg | integer | COSE algorithm identifier |-| type | string | Credential type, always `public-key` |+| type | string | Always `public-key` |## WebAuthn authenticator selection object@@ -422,10 +324,10 @@ Fluxer emits no other PublicKeyCredential request options member, so `hints` and| Field | Type | Description || --- | --- | --- |-| authenticatorAttachment? | string | Authenticator attachment, either `cross-platform` or `platform` |+| authenticatorAttachment? | string | Either `cross-platform` or `platform` || requireResidentKey? | boolean | Whether a discoverable credential is required |-| residentKey? | string | Discoverable credential preference, one of `discouraged`, `preferred`, or `required` |-| userVerification? | string | User verification preference, one of `discouraged`, `preferred`, or `required` |+| residentKey? | string | One of `discouraged`, `preferred` or `required` |+| userVerification? | string | One of `discouraged`, `preferred` or `required` |## WebAuthn client extension inputs object@@ -434,7 +336,7 @@ Fluxer emits no other PublicKeyCredential request options member, so `hints` and| Field | Type | Description || --- | --- | --- || appid? | string | AppID extension value |-| credProps?<sup>1</sup> | boolean | Whether credential properties are requested |+| credProps? | boolean | Whether credential properties are requested || hmacCreateSecret? | boolean | Whether HMAC secret creation is requested || minPinLength? | boolean | Whether minimum PIN length is requested |@@ -445,8 +347,8 @@ Fluxer emits no other PublicKeyCredential request options member, so `hints` and| Field | Type | Description || --- | --- | --- || ticket | string | The value to send back as `email_code_ticket` |-| code_expires_at | ISO8601 timestamp | When the emailed code stops working, 10 minutes after sending |-| resend_available_at | ISO8601 timestamp | When another code can be requested, 30 seconds after sending |+| code_expires_at | ISO8601 timestamp | When the emailed code expires, 10 minutes after sending |+| resend_available_at | ISO8601 timestamp | When you can ask for another code, 30 seconds after sending |## WebAuthn two-factor object@@ -454,544 +356,332 @@ Fluxer emits no other PublicKeyCredential request options member, so `hints` and| Field | Type | Description || --- | --- | --- |-| user | [user](/http-api/users/#user-object) object | The updated account, with `authenticator_types` reflecting the change |-| backup_codes<sup>1</sup> | ?array[[MFA backup code](#mfa-backup-code-object) object] | The 10 codes minted by this call, or null when none were minted |--<sup>1</sup> Present with codes only when the call turned the toggle on for an account holding no backup code. A call that turned the toggle off, or that found a set already in place, reports null+| user | [user](/http-api/users/#user-object) object | The updated account |+| backup_codes | ?array[[MFA backup code](#mfa-backup-code-object) object] | The 10 new codes, or null when the call created none |## Enable TOTP MFA<RouteHeader method="POST" path="/v1/users/@me/mfa/totp/enable" mfa />-Enables TOTP for the current account and returns an [MFA backup codes](#mfa-backup-codes-object) object holding 10 new codes. [Sudo mode](#sudo-mode) is required. Emits a [User Update](/gateway/events/#user-update) Gateway event.--Fluxer checks sudo mode first, so an account that already holds a WebAuthn credential proves it with that credential.--### Limitations--- The account needs a verified email address and is otherwise refused with 403 `MFA_EMAIL_VERIFICATION_REQUIRED`.-- An account that already has TOTP enabled is refused with 400 `TWO_FA_NOT_ENABLED`.+Enables TOTP and returns 10 new backup codes. You need [sudo mode](#sudo-mode) and a [verified account](/http-api/users/#account-tiers). Sends a [User Update](/gateway/events/#user-update) Gateway event.### JSON body-The body extends the [sudo verification object](#sudo-verification-object) with the fields below, and an existing sudo proof is sent in the `X-Fluxer-Sudo-Mode-JWT` request header.+The body extends the [sudo verification object](#sudo-verification-object) with these fields.| Field | Type | Description || --- | --- | --- |-| secret<sup>1</sup> | string | Base32 TOTP secret (1-256 characters) |-| code<sup>2</sup> | string | Current TOTP code generated from the submitted secret (1-32 characters) |--<sup>1</sup> Generated by the client and stored verbatim on the account--<sup>2</sup> A backup code is rejected here+| secret | string | Base32 TOTP secret your client generated (1-256 characters) |+| code | string | Current TOTP code for `secret`, not a backup code (1-32 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [MFA backup codes](#mfa-backup-codes-object) object | TOTP was enabled and 10 backup codes were issued |-| 400 | [error response](/http-api/#error-response) | The TOTP code did not match the submitted secret, returning `INVALID_CODE` on the path `code`, or TOTP is already enabled and the request returns `TWO_FA_NOT_ENABLED` |-| 403 | [error response](/http-api/#error-response) | The account email is unverified and the request returns `MFA_EMAIL_VERIFICATION_REQUIRED`, or sudo mode was not proven and the request returns `SUDO_MODE_REQUIRED` |--### Side effects--TOTP is enabled and 10 backup codes are issued. Any backup code the account already held stays in place, so the response has only the 10 new codes. Fluxer also copies the account's authenticator types to every bot account the user owns. [User Update](/gateway/events/#user-update) reaches the user's sessions and each owned bot whose authenticator types changed.+| 200 | [MFA backup codes](#mfa-backup-codes-object) object | TOTP was enabled |+| 400 | [error response](/http-api/#error-response) | `INVALID_CODE` on the path `code`, or `TWO_FA_NOT_ENABLED` when TOTP is already enabled |+| 403 | [error response](/http-api/#error-response) | `MFA_EMAIL_VERIFICATION_REQUIRED` or `ACCOUNT_VERIFICATION_REQUIRED` when the account isn't verified |-### Rate limit--10 requests per minute for each authenticated user, on the `user:mfa:totp:enable` bucket.+The rate limit is 10 requests per minute, on the `user:mfa:totp:enable` bucket.## Disable TOTP MFA<RouteHeader method="POST" path="/v1/users/@me/mfa/totp/disable" mfa />-Disables TOTP for the current account and returns 204 with an empty body. [Sudo mode](#sudo-mode) is required. Emits a [User Update](/gateway/events/#user-update) Gateway event.--Fluxer checks one authenticator code or backup code for each request. With a valid sudo token, it checks `code`. Without one, the sudo verification fields prove sudo mode when `mfa_method` is set, and Fluxer does not check `code`. Otherwise `code` proves sudo mode as if it were `mfa_code` with `mfa_method` set to `totp`, so the attempt draws on the TOTP allowance described under [sudo mode](#sudo-mode).--TOTP must already be enabled, or the request is refused with 400 `TWO_FACTOR_REQUIRED`. A verified email is not required, so an account whose address later became unverified can still remove its authenticator.+Disables TOTP under [sudo mode](#sudo-mode) and returns 204. This deletes every backup code unless passkeys stay on as a second factor. Sends a [User Update](/gateway/events/#user-update) Gateway event.### JSON body-The body extends the [sudo verification object](#sudo-verification-object) with the field below, and an existing sudo proof is sent in the `X-Fluxer-Sudo-Mode-JWT` request header.+The body extends the [sudo verification object](#sudo-verification-object) with this field.| Field | Type | Description || --- | --- | --- |-| code<sup>1</sup> | string | Current TOTP code or an unconsumed backup code (1-32 characters) |--<sup>1</sup> A wrong value returns `INVALID_CODE` on the path `code` with a sudo token, and `INVALID_MFA_CODE` on the path `mfa_code` when `code` proves sudo mode+| code<sup>1</sup> | string | Current TOTP code or unused backup code (1-32 characters) |-:::caution[Backup codes survive only while a second factor remains]-Disabling TOTP invalidates every backup code on the account, including the code that proved this request, unless the account keeps passkeys enabled as a second factor. An account that keeps that toggle on keeps its whole set. An account left with no second factor is left with no codes, and needs [List MFA backup codes](#list-mfa-backup-codes) with `regenerate` set to true to issue a new set. A registered WebAuthn credential alone does not preserve the set.-:::+<sup>1</sup> Without a sudo token or `mfa_method`, `code` also proves sudo mode### Response| Status | Body | Condition || --- | --- | --- || 204 | empty | TOTP was disabled |-| 400 | [error response](/http-api/#error-response) | The code did not match, or TOTP is not enabled and the request returns `TWO_FACTOR_REQUIRED` |-| 403 | [error response](/http-api/#error-response) | Sudo mode was not proven and the request returns `SUDO_MODE_REQUIRED` |--### Side effects--TOTP is disabled. Every backup code stops working unless the account keeps passkeys enabled as a second factor, in which case the whole set survives. Fluxer removes the TOTP authenticator type, along with the unassigned legacy authenticator value `1` when the account still held it. Fluxer also copies the account's authenticator types to every bot account the user owns. [User Update](/gateway/events/#user-update) goes to the user's sessions and each owned bot whose authenticator types changed.--### Rate limit+| 400 | [error response](/http-api/#error-response) | `INVALID_CODE` on the path `code`, or `INVALID_MFA_CODE` on the path `mfa_code` when `code` proves sudo mode |+| 400 | [error response](/http-api/#error-response) | `TWO_FACTOR_REQUIRED` when TOTP isn't enabled |-10 requests per minute for each authenticated user, on the `user:mfa:totp:disable` bucket.+The rate limit is 10 requests per minute, on the `user:mfa:totp:disable` bucket.## List MFA backup codes<RouteHeader method="POST" path="/v1/users/@me/mfa/backup-codes" mfa />-Returns an [MFA backup codes](#mfa-backup-codes-object) object, replacing the set first when `regenerate` is true. [Sudo mode](#sudo-mode) is required.--Neither a verified email nor an authenticator is required, so an account with no MFA at all can prove sudo mode with its password and use this operation. An account whose only second factor is passkeys proves sudo mode with a passkey, or with one of these codes as `mfa_code` under `mfa_method` of `totp`, and reads or replaces its set the same way. [Complete login with TOTP](/http-api/authentication/#complete-login-with-totp) redeems one of those codes later.--A backup code sent as `mfa_code` to satisfy sudo mode is consumed. With `regenerate` false it comes back with `consumed` set to true. With `regenerate` true it is deleted with the rest of the previous set and does not appear.--:::caution[Regeneration replaces the previous set immediately]-Every previous code becomes invalid. If regeneration fails, the old codes may already be unusable.-:::+Returns the account's backup codes, and replaces them with 10 new codes first when `regenerate` is true. You need [sudo mode](#sudo-mode), and replacing the codes also needs a [verified account](/http-api/users/#account-tiers).### JSON body-The body extends the [sudo verification object](#sudo-verification-object) with the field below, and an existing sudo proof is sent in the `X-Fluxer-Sudo-Mode-JWT` request header.+The body extends the [sudo verification object](#sudo-verification-object) with this field.| Field | Type | Description || --- | --- | --- |-| regenerate<sup>1</sup> | boolean | Whether to discard the current set and issue 10 replacements |--<sup>1</sup> The field is required. Passing `false` reads the current set without changing it+| regenerate | boolean | Whether to delete the current codes and create 10 new ones |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [MFA backup codes](#mfa-backup-codes-object) object | The current or replacement codes were returned |-| 403 | [error response](/http-api/#error-response) | Sudo mode was not proven and the request returns `SUDO_MODE_REQUIRED` |--### Rate limit+| 200 | [MFA backup codes](#mfa-backup-codes-object) object | The current or new codes were returned |+| 403 | [error response](/http-api/#error-response) | `MFA_EMAIL_VERIFICATION_REQUIRED` or `ACCOUNT_VERIFICATION_REQUIRED` when `regenerate` is true and the account isn't verified |-6 requests per minute for each authenticated user, on the `user:mfa:backup_codes` bucket.+The rate limit is 6 requests per minute, on the `user:mfa:backup_codes` bucket.## Start MFA backup codes challenge<RouteHeader method="POST" path="/v1/users/@me/mfa/backup-codes/challenge" />-Creates a backup codes challenge ticket and sends a verification code to the account email address. Returns an [MFA backup codes challenge](#mfa-backup-codes-challenge-object) object on success.--Sudo mode is not required, and the route reads no sudo verification field.--The send consumes the challenge start control.--### Limitations--- The account needs a verified email address and is otherwise refused with 403 `MFA_EMAIL_VERIFICATION_REQUIRED`.-- An account holding no email address is refused with 400 `INVALID_FORM_BODY` and the validation code `USER_DOES_NOT_HAVE_AN_EMAIL_ADDRESS` on the path `email`.-- The account needs TOTP enabled and is otherwise refused with 400 `TWO_FACTOR_REQUIRED`.--### JSON body--The body can be omitted, and any supplied body is an object with no fields. Fluxer strips unknown keys before it handles the request.+Emails a verification code to the account and returns a ticket. The body is empty or `{}`.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [MFA backup codes challenge](#mfa-backup-codes-challenge-object) object | The ticket was created and a code was sent |-| 400 | [error response](/http-api/#error-response) | TOTP is not enabled and the request returns `TWO_FACTOR_REQUIRED`, or the account holds no address |-| 403 | [error response](/http-api/#error-response) | The account email is unverified and the request returns `MFA_EMAIL_VERIFICATION_REQUIRED` |--### Side effects--Fluxer stores a ticket holding the code and its expiry, and one verification email goes to the account address. No account field changes and no backup code is issued.--### Rate limit+| 200 | [MFA backup codes challenge](#mfa-backup-codes-challenge-object) object | The code was sent |+| 400 | [error response](/http-api/#error-response) | `TWO_FACTOR_REQUIRED` when the account has no second factor turned on |+| 400 | [error response](/http-api/#error-response) | `EMAIL_CODES_UNAVAILABLE` when the instance doesn't send email |+| 403 | [error response](/http-api/#error-response) | `MFA_EMAIL_VERIFICATION_REQUIRED` when the email address is unverified |-6 requests per minute for each authenticated user, on the `user:mfa:backup_codes_challenge:start` bucket.+The rate limit is 6 requests per minute, on the `user:mfa:backup_codes_challenge:start` bucket.## Resend MFA backup codes challenge code<RouteHeader method="POST" path="/v1/users/@me/mfa/backup-codes/challenge/resend" />-Sends a fresh verification code for an active backup codes challenge ticket. Returns 204 with an empty body.--The route reads the ticket and the account address only. An account holding no email address is refused with 400 `INVALID_FORM_BODY` and the validation code `USER_DOES_NOT_HAVE_AN_EMAIL_ADDRESS` on the path `email`.--The send consumes the challenge resend control, and the ticket enforces its own 30-second cooldown.--:::caution[A resend undoes a completed verification]-Fluxer clears the ticket's stored proof on every resend. A client that already holds a proof needs [Verify MFA backup codes challenge code](#verify-mfa-backup-codes-challenge-code) again before [Regenerate MFA backup codes](#regenerate-mfa-backup-codes) accepts it.-:::+Emails a new code for the ticket and returns 204. The old code and any proof already issued for the ticket stop working.### JSON body| Field | Type | Description || --- | --- | --- |-| ticket | string | The identifier returned by [Start MFA backup codes challenge](#start-mfa-backup-codes-challenge) (1-256 characters) |+| ticket | string | Ticket from [Start MFA backup codes challenge](#start-mfa-backup-codes-challenge) (1-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | A replacement code was sent |-| 400 | [error response](/http-api/#error-response) | The ticket is unknown and the request returns `INVALID_OR_EXPIRED_TICKET` |--### Side effects--Fluxer replaces the ticket's code, send time, and code expiry, which invalidates the previous code. The stored proof is cleared and one verification email goes to the account address.+| 204 | empty | A new code was sent |+| 400 | [error response](/http-api/#error-response) | `INVALID_OR_EXPIRED_TICKET` when the ticket is unknown or expired |-### Rate limit--6 requests per minute for each authenticated user, on the `user:mfa:backup_codes_challenge:resend` bucket.+The rate limit is 6 requests per minute, on the `user:mfa:backup_codes_challenge:resend` bucket.## Verify MFA backup codes challenge code<RouteHeader method="POST" path="/v1/users/@me/mfa/backup-codes/challenge/verify" />-Verifies the emailed code and returns an [MFA backup codes verification](#mfa-backup-codes-verification-object) object holding the current codes and a proof.--Verification consumes the code. A ticket holding no code fails with `VERIFICATION_CODE_NOT_ISSUED`, which is what a second verification of the same ticket returns. A code past its 10-minute lifetime fails with `VERIFICATION_CODE_EXPIRED`. A mismatch fails with `INVALID_VERIFICATION_CODE`.--Fluxer charges the per-ticket verification allowance before it reads the code, so a wrong code and a correct code both draw on it.+Checks the emailed code and returns the account's backup codes and a proof. A code works once.### JSON body| Field | Type | Description || --- | --- | --- |-| ticket | string | The identifier returned by [Start MFA backup codes challenge](#start-mfa-backup-codes-challenge) (1-256 characters) |-| code | string | The code sent to the account address (1-256 characters) |+| ticket | string | Ticket from [Start MFA backup codes challenge](#start-mfa-backup-codes-challenge) (1-256 characters) |+| code | string | The code from the email (1-256 characters) |### Response| Status | Body | Condition || --- | --- | --- || 200 | [MFA backup codes verification](#mfa-backup-codes-verification-object) object | The code was accepted |-| 400 | [error response](/http-api/#error-response) | The ticket returns `INVALID_OR_EXPIRED_TICKET`, or the code was not issued, has expired, or did not match |--### Side effects--The ticket stores a fresh proof and its code is cleared. The response holds every backup code on the account, including the consumed ones. No backup code is issued, consumed, or deleted.+| 400 | [error response](/http-api/#error-response) | `INVALID_VERIFICATION_CODE`, `VERIFICATION_CODE_EXPIRED` or `VERIFICATION_CODE_NOT_ISSUED` |-### Rate limit--20 requests per minute for each authenticated user, on the `user:mfa:backup_codes_challenge:verify` bucket.+The rate limit is 20 requests per minute, on the `user:mfa:backup_codes_challenge:verify` bucket.## Regenerate MFA backup codes<RouteHeader method="POST" path="/v1/users/@me/mfa/backup-codes/challenge/regenerate" />-Replaces the account's backup codes with 10 new ones and returns an [MFA backup codes](#mfa-backup-codes-object) object. Sudo mode is not required.--The ticket and its proof are the only authorisation. Without TOTP enabled the request is refused with 400 `TWO_FACTOR_REQUIRED`.--A ticket holding no proof returns `INVALID_OR_EXPIRED_TICKET` on the path `verification_proof`, and a proof that does not match returns `INVALID_PROOF_TOKEN`.--:::caution[Regeneration leaves the ticket usable]-The same ticket and proof can replace the set again until the ticket expires, 30 minutes after verification.-:::+Replaces the account's backup codes with 10 new ones. The ticket and proof can be used again until the ticket expires.### JSON body| Field | Type | Description || --- | --- | --- |-| ticket | string | The identifier returned by [Start MFA backup codes challenge](#start-mfa-backup-codes-challenge) (1-256 characters) |-| verification_proof | string | The proof issued by [Verify MFA backup codes challenge code](#verify-mfa-backup-codes-challenge-code) (1-256 characters) |+| ticket | string | Ticket from [Start MFA backup codes challenge](#start-mfa-backup-codes-challenge) (1-256 characters) |+| verification_proof | string | Proof from [Verify MFA backup codes challenge code](#verify-mfa-backup-codes-challenge-code) (1-256 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [MFA backup codes](#mfa-backup-codes-object) object | The previous set was deleted and 10 replacements were issued |-| 400 | [error response](/http-api/#error-response) | TOTP is not enabled and the request returns `TWO_FACTOR_REQUIRED`, or the ticket or the proof was rejected |--### Side effects+| 200 | [MFA backup codes](#mfa-backup-codes-object) object | The codes were replaced |+| 400 | [error response](/http-api/#error-response) | `INVALID_PROOF_TOKEN`, `INVALID_OR_EXPIRED_TICKET` or `TWO_FACTOR_REQUIRED` |-The previous set is replaced with 10 new codes. A failure can leave the old codes unusable. Authenticator types are unchanged and no Gateway event is emitted.--### Rate limit--6 requests per minute for each authenticated user, on the `user:mfa:backup_codes_challenge:regenerate` bucket.+The rate limit is 6 requests per minute, on the `user:mfa:backup_codes_challenge:regenerate` bucket.## List WebAuthn credentials<RouteHeader method="GET" path="/v1/users/@me/mfa/webauthn/credentials" />-Returns an array of [WebAuthn credential](#webauthn-credential-object) objects registered to the current account, or an empty array when none exist. Sudo mode is not required.+Returns the account's WebAuthn credentials.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | array[[WebAuthn credential](#webauthn-credential-object) object] | Credentials were returned |--### Rate limit+| 200 | array[[WebAuthn credential](#webauthn-credential-object) object] | The credentials were returned |-40 requests per 10 seconds for each authenticated user, on the `mfa:webauthn:list` bucket.+The rate limit is 40 requests per 10 seconds, on the `mfa:webauthn:list` bucket.## Create WebAuthn registration options<RouteHeader method="POST" path="/v1/users/@me/mfa/webauthn/credentials/registration-options" mfa />-Creates a one-use registration challenge and returns a [WebAuthn registration options](#webauthn-registration-options-object) object. [Sudo mode](#sudo-mode) is required.--This operation sets no `X-Fluxer-Sudo-Mode-JWT` response header.--### Limitations--- The account needs a verified email address.-- An account already holding 10 credentials receives 400 `WEBAUTHN_CREDENTIAL_LIMIT_REACHED` and no challenge.+Returns a registration challenge for [Register WebAuthn credential](#register-webauthn-credential). You need [sudo mode](#sudo-mode) and a [verified account](/http-api/users/#account-tiers) or one that only needs a password, and the response never has a sudo token.### JSON body-The body is a [sudo verification object](#sudo-verification-object). An existing sudo proof is sent in the `X-Fluxer-Sudo-Mode-JWT` request header.+The body is a [sudo verification object](#sudo-verification-object).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [WebAuthn registration options](#webauthn-registration-options-object) object | Challenge and registration options were issued |-| 400 | [error response](/http-api/#error-response) | 10 credentials are already registered and the request returns `WEBAUTHN_CREDENTIAL_LIMIT_REACHED` |-| 403 | [error response](/http-api/#error-response) | The account email is unverified and the request returns `MFA_EMAIL_VERIFICATION_REQUIRED`, or sudo mode was not proven and the request returns `SUDO_MODE_REQUIRED` |--### Side effects--Fluxer issues a registration challenge for the current user. It expires after five minutes and can be redeemed once.+| 200 | [WebAuthn registration options](#webauthn-registration-options-object) object | The challenge was created |+| 400 | [error response](/http-api/#error-response) | `WEBAUTHN_CREDENTIAL_LIMIT_REACHED` when the account has 10 credentials |+| 403 | [error response](/http-api/#error-response) | `MFA_EMAIL_VERIFICATION_REQUIRED` when the account needs to confirm or add an email address to be verified |-### Rate limit--20 requests per 10 seconds for each authenticated user, on the `mfa:webauthn:registration_options` bucket.+The rate limit is 20 requests per 10 seconds, on the `mfa:webauthn:registration_options` bucket.## Register WebAuthn credential<RouteHeader method="POST" path="/v1/users/@me/mfa/webauthn/credentials" />-Consumes a registration challenge, adds one WebAuthn credential to the current account, and returns 204 with an empty body. Emits a [WebAuthn Credentials Update](/gateway/events/#webauthn-credentials-update) Gateway event.--Registration changes no [authenticator type](/http-api/users/#authenticator-types). The credential answers a sudo mode challenge and a passwordless login straight away, and passkeys become a second factor at password login only through [Set WebAuthn two-factor authentication](#set-webauthn-two-factor-authentication).--The account needs a verified email and fewer than 10 registered credentials. This route accepts no sudo verification fields of its own. Fluxer verifies the attestation against the domain the challenge was issued for and the instance's allowed origins, and does not require user verification. The credential keeps that domain.+Adds a WebAuthn credential to the account and returns 204. A challenge works only once, even when registration fails, and you need new options to try again. Sends a [WebAuthn Credentials Update](/gateway/events/#webauthn-credentials-update) Gateway event, and a [User Update](/gateway/events/#user-update) event for the account's first credential.### JSON body| Field | Type | Description || --- | --- | --- |-| response | [WebAuthn registration response](#webauthn-registration-response-object) object | Authenticator response for the registration challenge |-| challenge | string | One-use registration challenge (1-1024 characters) |-| name | string | User-assigned credential name (1-100 characters) |--:::caution[A failed registration cannot reuse its challenge]-Fluxer consumes the registration challenge before it re-checks the credential limit and before it verifies the attestation. Request fresh registration options after any failure.-:::+| response | [WebAuthn registration response](#webauthn-registration-response-object) object | The authenticator's response to the challenge |+| challenge | string | Challenge from [Create WebAuthn registration options](#create-webauthn-registration-options) (1-1024 characters) |+| name | string | Name for the credential (1-100 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Credential was registered |-| 400 | [error response](/http-api/#error-response) | The challenge or attestation failed and the request returns `INVALID_WEBAUTHN_CREDENTIAL`, the public key returns `INVALID_WEBAUTHN_PUBLIC_KEY_FORMAT`, the signature counter returns `INVALID_WEBAUTHN_CREDENTIAL_COUNTER`, or the limit returns `WEBAUTHN_CREDENTIAL_LIMIT_REACHED` |-| 403 | [error response](/http-api/#error-response) | The account email is unverified and the request returns `MFA_EMAIL_VERIFICATION_REQUIRED` |--### Side effects--The credential is added to the account. No authenticator type changes, and no bot account the user owns is touched.--[WebAuthn Credentials Update](/gateway/events/#webauthn-credentials-update) reaches the user's sessions with the complete current credential summaries.+| 204 | empty | The credential was registered |+| 400 | [error response](/http-api/#error-response) | `INVALID_WEBAUTHN_CREDENTIAL`, `INVALID_WEBAUTHN_PUBLIC_KEY_FORMAT` or `INVALID_WEBAUTHN_CREDENTIAL_COUNTER` |+| 400 | [error response](/http-api/#error-response) | `WEBAUTHN_CREDENTIAL_LIMIT_REACHED` when the account has 10 credentials |+| 403 | [error response](/http-api/#error-response) | `MFA_EMAIL_VERIFICATION_REQUIRED` when the account needs to confirm or add an email address to be verified |-### Rate limit--10 requests per minute for each authenticated user, on the `mfa:webauthn:register` bucket.+The rate limit is 10 requests per minute, on the `mfa:webauthn:register` bucket.## Rename WebAuthn credential<RouteHeader method="PATCH" path="/v1/users/@me/mfa/webauthn/credentials/{credential_id}" mfa />-Changes the user-assigned name of one WebAuthn credential owned by the current account and returns 204 with an empty body. [Sudo mode](#sudo-mode) is required. Emits a [WebAuthn Credentials Update](/gateway/events/#webauthn-credentials-update) Gateway event.--A verified email is not required.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| credential_id | string | Base64url credential ID registered to the current account (1-2048 characters) |+Renames a WebAuthn credential under [sudo mode](#sudo-mode) and returns 204. Sends a [WebAuthn Credentials Update](/gateway/events/#webauthn-credentials-update) Gateway event.### JSON body-The body extends the [sudo verification object](#sudo-verification-object) with the field below, and an existing sudo proof is sent in the `X-Fluxer-Sudo-Mode-JWT` request header.+The body extends the [sudo verification object](#sudo-verification-object) with this field.| Field | Type | Description || --- | --- | --- |-| name | string | Replacement credential name (1-100 characters) |+| name | string | New name for the credential (1-100 characters) |### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Credential was renamed |-| 403 | [error response](/http-api/#error-response) | Sudo mode was not proven and the request returns `SUDO_MODE_REQUIRED` |-| 404 | [error response](/http-api/#error-response) | The credential is not registered to the current account, returning `UNKNOWN_WEBAUTHN_CREDENTIAL` |--### Side effects--The credential name is replaced and no authenticator type changes. [WebAuthn Credentials Update](/gateway/events/#webauthn-credentials-update) reaches the current user's sessions with the complete current credential summaries.+| 204 | empty | The credential was renamed |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_WEBAUTHN_CREDENTIAL` |-### Rate limit--20 requests per 10 seconds for each authenticated user, on the `mfa:webauthn:update` bucket.+The rate limit is 20 requests per 10 seconds, on the `mfa:webauthn:update` bucket.## Delete WebAuthn credential<RouteHeader method="DELETE" path="/v1/users/@me/mfa/webauthn/credentials/{credential_id}" mfa />-Deletes one WebAuthn credential owned by the current account and returns 204 with an empty body. [Sudo mode](#sudo-mode) is required. Emits a [WebAuthn Credentials Update](/gateway/events/#webauthn-credentials-update) Gateway event, and a [User Update](/gateway/events/#user-update) event when this was the account's final WebAuthn credential and passkeys were enabled as a second factor.--A verified email is not required.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| credential_id | string | Base64url credential ID registered to the current account (1-2048 characters) |+Deletes a WebAuthn credential under [sudo mode](#sudo-mode) and returns 204. Deleting the last credential also turns off passkeys as a second factor, and without TOTP it deletes every backup code. Sends a [WebAuthn Credentials Update](/gateway/events/#webauthn-credentials-update) Gateway event, and a [User Update](/gateway/events/#user-update) event when it deletes the last credential.### JSON body-The body is a [sudo verification object](#sudo-verification-object). An existing sudo proof is sent in the `X-Fluxer-Sudo-Mode-JWT` request header.--:::caution[Removing the final credential removes an authenticator]-Deleting the account's last WebAuthn credential removes the WebAuthn authenticator type from an account that enabled passkeys as a second factor with [Set WebAuthn two-factor authentication](#set-webauthn-two-factor-authentication). Without TOTP the account then has no second factor. Either way it can no longer answer a WebAuthn sudo challenge, and without a TOTP secret sudo mode falls back to the account password.-:::+The body is a [sudo verification object](#sudo-verification-object).### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Credential was deleted |-| 403 | [error response](/http-api/#error-response) | Sudo mode was not proven and the request returns `SUDO_MODE_REQUIRED` |-| 404 | [error response](/http-api/#error-response) | The credential is not registered to the current account, returning `UNKNOWN_WEBAUTHN_CREDENTIAL` |+| 204 | empty | The credential was deleted |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_WEBAUTHN_CREDENTIAL` |-### Side effects--The credential is deleted. When it was the final one and the account had passkeys enabled as a second factor, the WebAuthn authenticator type is removed from the account and from every bot account owned by the user.--[WebAuthn Credentials Update](/gateway/events/#webauthn-credentials-update) reaches the user's sessions with the remaining credential summaries. When the authenticator types changed, [User Update](/gateway/events/#user-update) also reaches the user and each affected owned bot.--### Rate limit--10 requests per minute for each authenticated user, on the `mfa:webauthn:delete` bucket.+The rate limit is 10 requests per minute, on the `mfa:webauthn:delete` bucket.## Set WebAuthn two-factor authentication<RouteHeader method="PUT" path="/v1/users/@me/mfa/webauthn/two-factor" mfa />-Turns passkeys on or off as a second factor for the current account and returns a [WebAuthn two-factor](#webauthn-two-factor-object) object. [Sudo mode](#sudo-mode) is required. Emits a [User Update](/gateway/events/#user-update) Gateway event.--Enabling adds the WebAuthn [authenticator type](/http-api/users/#authenticator-types), so password login then asks for a passkey. Disabling removes it and leaves every registered credential in place, still usable for sudo mode and for passwordless login.--### Limitations--- Enabling while the account has no registered WebAuthn credential is refused with 400 `NO_PASSKEYS_REGISTERED`.+Turns passkeys on or off as a second factor at password login. You need [sudo mode](#sudo-mode), and turning it on also needs a [verified account](/http-api/users/#account-tiers). Turning it on creates 10 backup codes when the account has no unused codes, and turning it off without TOTP deletes every backup code. Sends a [User Update](/gateway/events/#user-update) Gateway event when the setting changes.### JSON body-The body extends the [sudo verification object](#sudo-verification-object) with `enabled`, and the sudo fields it merges in are repeated below. An existing sudo proof is sent in the `X-Fluxer-Sudo-Mode-JWT` request header.+The body extends the [sudo verification object](#sudo-verification-object) with this field.| Field | Type | Description || --- | --- | --- |-| enabled | boolean | Whether passkeys count as a second factor at password login |-| password?<sup>1</sup> | string | Account password (8-256 characters) |-| mfa_method?<sup>2</sup> | string | MFA method, either `totp` or `webauthn` |-| mfa_code?<sup>3</sup> | string | Authenticator code or unconsumed backup code (1-32 characters) |-| webauthn_response?<sup>4</sup> | [WebAuthn assertion](#webauthn-assertion-object) object | Assertion produced for the supplied challenge |-| webauthn_challenge?<sup>4</sup> | string | Challenge returned by [create sudo WebAuthn authentication options](#create-sudo-webauthn-authentication-options) (1-256 characters) |--<sup>1</sup> Considered only while the account holds no TOTP secret and no registered WebAuthn credential, and ignored once either exists--<sup>2</sup> Required when the account holds a TOTP secret or a registered WebAuthn credential, unless a valid sudo token is already present--<sup>3</sup> Required when `mfa_method` is `totp`, with a current authenticator code or an unconsumed backup code. Fluxer reads it as a backup code alone while the account holds no TOTP secret--<sup>4</sup> Both fields are required together when `mfa_method` is `webauthn`+| enabled | boolean | Whether passkeys are a second factor at password login |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [WebAuthn two-factor](#webauthn-two-factor-object) object | The authenticator type was set to the requested state |-| 400 | [error response](/http-api/#error-response) | Enabling was requested with no registered credential and the request returns `NO_PASSKEYS_REGISTERED` |-| 403 | [error response](/http-api/#error-response) | Sudo mode was not proven and the request returns `SUDO_MODE_REQUIRED` |--### Side effects--The WebAuthn authenticator type is added or removed, and Fluxer copies the account's authenticator types to every bot account the user owns. [User Update](/gateway/events/#user-update) reaches the user's sessions and each owned bot whose authenticator types changed.--Enabling on an account that holds no backup code issues 10, which the response returns. They are the recovery path for an account whose only second factor is passkeys, and [complete login with TOTP](/http-api/authentication/#complete-login-with-totp) redeems one. An account that already holds a set keeps it and the response reports null. A request that asks for the state the account already has changes nothing and issues no code.--### Rate limit+| 200 | [WebAuthn two-factor](#webauthn-two-factor-object) object | The setting was saved |+| 400 | [error response](/http-api/#error-response) | `NO_PASSKEYS_REGISTERED` when turning it on with no credentials |+| 403 | [error response](/http-api/#error-response) | `MFA_EMAIL_VERIFICATION_REQUIRED` or `ACCOUNT_VERIFICATION_REQUIRED` when turning it on and the account isn't verified |-10 requests per minute for each authenticated user, on the `mfa:webauthn:two_factor` bucket.+The rate limit is 10 requests per minute, on the `mfa:webauthn:two_factor` bucket.## Get sudo MFA methods<RouteHeader method="GET" path="/v1/users/@me/sudo/mfa-methods" />-Returns a [sudo MFA methods](#sudo-mfa-methods-object) object describing which sudo challenges the current account can answer. Sudo mode is not required.+Returns the [sudo mode](#sudo-mode) proofs the account can give.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [sudo MFA methods](#sudo-mfa-methods-object) object | Available methods were returned |+| 200 | [sudo MFA methods](#sudo-mfa-methods-object) object | The methods were returned |-### Rate limit--20 requests per minute for each authenticated user, on the `sudo:mfa:methods` bucket.+The rate limit is 20 requests per minute, on the `sudo:mfa:methods` bucket.## Send a sudo email code<RouteHeader method="POST" path="/v1/users/@me/sudo/email-code" />-Emails a 6-digit code to the confirmed address of the current account, for [sudo mode](#sudo-mode). Sudo mode is not required. Returns a [sudo email code](#sudo-email-code-object) object.--An account with a TOTP secret or a registered WebAuthn credential gets 400 `SUDO_SECOND_FACTOR_REQUIRED` and confirms with that factor instead. An account that has a password, an account without a confirmed email address, and any account on an instance that sends no email get 400 `EMAIL_CODES_UNAVAILABLE`.+Emails a 6-digit code for [sudo mode](#sudo-mode) to an account that has no password and no second factor. The code lasts 10 minutes and allows 5 wrong tries.### Response| Status | Body | Condition || --- | --- | --- || 200 | [sudo email code](#sudo-email-code-object) object | The code was sent |-| 400 | [error response](/http-api/#error-response) | Email codes are unavailable for the account |-| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | A route, global, address, IP or wrong-code limit denies the request, or the resend cooldown is running |--### Side effects--The operation stores the code for 10 minutes and emails it. After 5 codes to one address in an hour each further code waits longer, and the account's wrong-code limit stops codes, as in [send an email code](/http-api/authentication/#send-an-email-code).--### Rate limit+| 400 | [error response](/http-api/#error-response) | `SUDO_SECOND_FACTOR_REQUIRED` when the account has a second factor turned on |+| 400 | [error response](/http-api/#error-response) | `EMAIL_CODES_UNAVAILABLE` when the account has a password or no verified email address, or the instance doesn't send email |+| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | Too many codes were sent or too many wrong codes were tried |-5 requests per 15 minutes for each authenticated user, on the `sudo:email_code` bucket.+The rate limit is 5 requests per 15 minutes, on the `sudo:email_code` bucket.## Create sudo WebAuthn authentication options<RouteHeader method="POST" path="/v1/users/@me/sudo/webauthn/authentication-options" />-Creates a one-use sudo challenge and returns a [WebAuthn authentication options](#webauthn-authentication-options-object) object listing the account's passkeys.--The account needs at least one credential in the chosen group. Sudo mode is not required to obtain the challenge.+Returns a sudo challenge that lists the account's passkeys. Send the signed result as `webauthn_response` and `webauthn_challenge` in a [sudo verification object](#sudo-verification-object).### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [WebAuthn authentication options](#webauthn-authentication-options-object) object | Challenge and options were issued |-| 400 | [error response](/http-api/#error-response) | No WebAuthn credential is registered and the request returns `NO_PASSKEYS_REGISTERED` |--### Side effects--Fluxer issues a sudo challenge for the current user. It expires after five minutes and can be redeemed once by submitting it as `webauthn_challenge` alongside `webauthn_response` in a [sudo verification object](#sudo-verification-object).--### Rate limit+| 200 | [WebAuthn authentication options](#webauthn-authentication-options-object) object | The challenge was created |+| 400 | [error response](/http-api/#error-response) | `NO_PASSKEYS_REGISTERED` |-10 requests per minute for each authenticated user, on the `sudo:webauthn:options` bucket.+The rate limit is 10 requests per minute, on the `sudo:webauthn:options` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/users/notes.mdx b/fluxer_docs/src/content/docs/http-api/users/notes.mdxindex e0bdef4ab..fac8944ce 100644--- a/fluxer_docs/src/content/docs/http-api/users/notes.mdx+++ b/fluxer_docs/src/content/docs/http-api/users/notes.mdx@@ -1,44 +1,30 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: User notes-description: Private note text the caller stores against another account.+description: Private notes you keep about other accounts.---import RouteHeader from '@/components/RouteHeader.astro';-A note is short private text the caller stores about another account.--Every route here requires a user session. A bot or OAuth2 bearer credential is refused with 403 `ACCESS_DENIED`.--:::note[A note is private to its author]-The target account never receives the note in an HTTP response or [Gateway Dispatch](/gateway/events/). A note has no relationship requirement, so the caller can hold one for an account that is neither a friend nor blocked.-:::+A note is short private text you keep about another account, and only you can see it. Bots and OAuth2 tokens get 403 `ACCESS_DENIED` on these routes.## User note object-A single note the caller holds for one target account.-### Structure| Field | Type | Description || --- | --- | --- |-| note<sup>1</sup> | string | The note text the caller stored for the target account |--<sup>1</sup> Never null and never the empty string. A stored note is always 1 to 256 characters after normalisation, and an omitted, null, or empty `note` deletes the stored note+| note | string | The note text for the target account (1-256 characters) |## User notes record-Every note the caller has stored. The record is a `map[snowflake, string]`. Each property name is the [snowflake](/snowflakes/) of one target account, and its value is that target's note text.--The Gateway delivers the same map as the `notes` field of the [READY](/gateway/events/#ready-object) payload, so a connected client already holds the record before it calls the list operation.+A map from target account [snowflake](/snowflakes/) to note text. The Gateway sends the same map in the `notes` field of the [READY](/gateway/events/#ready-object) payload.### Structure| Field | Type | Description || --- | --- | --- |-| {target_id}<sup>1</sup> | string | The stored note text for the account named by the property |--<sup>1</sup> A target with no note has no property, so an account with no notes receives an empty object+| {target_id} | string | The note text for the account with this ID |### Example@@ -53,91 +39,49 @@ The Gateway delivers the same map as the `notes` field of the [READY](/gateway/e<RouteHeader method="GET" path="/v1/users/@me/notes" />-Returns the caller's complete [user notes record](#user-notes-record). The operation is not paged, so every stored note comes back in one response.--A note has no creation or modification timestamp.+Returns all your notes as a [user notes record](#user-notes-record), or an empty object when you have none.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [user notes record](#user-notes-record) | Notes were returned, possibly as an empty object |+| 200 | [user notes record](#user-notes-record) | Notes were returned |-### Rate limit--60 requests per 10 seconds for each authenticated user, on the `user:notes:read` bucket, shared with [Get user note](#get-user-note).+The rate limit is 60 requests per 10 seconds, on the `user:notes:read` bucket.## Get user note<RouteHeader method="GET" path="/v1/users/@me/notes/{target_id}" />-Returns the caller's [user note](#user-note-object) object for one target account.--A target with no stored note returns 404 `UNKNOWN_USER`. The same status covers an account that exists without a note and an ID that names no account at all.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| target_id<sup>1</sup> | snowflake | The ID of the account the note describes |--<sup>1</sup> Fluxer removes leading and trailing whitespace before it reads the value. A leading zero, a sign, a decimal point, or any other non-digit returns 400 `INVALID_FORM_BODY` with the validation code `INVALID_SNOWFLAKE_FORMAT`, and a value above 9223372036854775807 returns `SNOWFLAKE_OUT_OF_RANGE`+Returns your [user note](#user-note-object) for one account.### Response| Status | Body | Condition || --- | --- | --- || 200 | [user note](#user-note-object) object | The note was returned |-| 404 | [error response](/http-api/#error-response) | No note is stored for the target ID and the request returns `UNKNOWN_USER` |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_USER` when no note is stored for the ID |-### Rate limit--60 requests per 10 seconds for each authenticated user, on the `user:notes:read` bucket, shared with [List user notes](#list-user-notes).+The rate limit is 60 requests per 10 seconds, on the `user:notes:read` bucket.## Set user note<RouteHeader method="PUT" path="/v1/users/@me/notes/{target_id}" />-Creates, replaces, or deletes the caller's note for one target account. Returns 204 with an empty body. Emits a [User Note Update](/gateway/events/#user-note-update) Gateway event.--The supplied text becomes the complete stored note. A target ID that names no account returns 404 `UNKNOWN_USER`, even when the request would only delete a note. The caller can store a note for any account that exists, including a bot account, its own account, and an account it holds no relationship with.--:::caution[An omitted, null, or empty note deletes it]-An empty string is [read as `null`](/http-api/#input-normalisation), so the forms are indistinguishable. Any value that normalises to the empty string, such as one made only of whitespace, fails validation with `STRING_LENGTH_INVALID`. There is no separate delete route.-:::--A `note` of at least 3 characters matching the instance phrase blocklist, or with a URL matching the URL blocklist, is rejected with 403 `CONTENT_BLOCKED`. The blocklist check runs before the route's own credential and body checks, so a blocked value is refused with `CONTENT_BLOCKED` even when the request would also fail one of those checks.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| target_id<sup>1</sup> | snowflake | The ID of the account the note describes |--<sup>1</sup> Fluxer removes leading and trailing whitespace before it reads the value. A leading zero, a sign, a decimal point, or any other non-digit returns `INVALID_SNOWFLAKE_FORMAT`, and a value above 9223372036854775807 returns `SNOWFLAKE_OUT_OF_RANGE`+Creates, replaces or deletes your note on an account and sends a [User Note Update](/gateway/events/#user-note-update) event to your sessions.### JSON body-Fluxer reads an omitted body as an empty object and deletes the stored note.-| Field | Type | Description || --- | --- | --- |-| note?<sup>1</sup> | ?string | The complete replacement note text, or null to delete the stored note (1-256 characters) |--<sup>1</sup> Fluxer trims the value and the bound applies to the result, so a value that trims to empty returns `STRING_LENGTH_INVALID` at the `note` path+| note? | ?string | The note text (1-256 characters), or null or an empty string to delete the note |### Response| Status | Body | Condition || --- | --- | --- || 204 | empty | The note was set or deleted |-| 403 | [error response](/http-api/#error-response) | The note is blocked by content moderation and the request returns `CONTENT_BLOCKED` |-| 404 | [error response](/http-api/#error-response) | The target account does not exist and the request returns `UNKNOWN_USER` |--### Side effects--Supplying text creates or replaces the note, and a request that supplies none deletes it. [User Note Update](/gateway/events/#user-note-update) reaches the caller's own sessions for every accepted request, including one that supplies the current value and one that deletes an absent note. Its payload has the target ID in `id` and the note text in `note`. On a deletion the note text is the empty string.--### Rate limit+| 403 | [error response](/http-api/#error-response) | `CONTENT_BLOCKED` when the text matches the instance blocklist |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_USER` when the account does not exist |-40 requests per 10 seconds for each authenticated user, on the `user:notes:write` bucket.+The rate limit is 40 requests per 10 seconds, on the `user:notes:write` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/users/private-channels.mdx b/fluxer_docs/src/content/docs/http-api/users/private-channels.mdxindex 8b6d4b09b..93ff10928 100644--- a/fluxer_docs/src/content/docs/http-api/users/private-channels.mdx+++ b/fluxer_docs/src/content/docs/http-api/users/private-channels.mdx@@ -1,66 +1,50 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Private channels-description: Direct message and group DM discovery, creation, preload, and pin order.+description: List, create, preload and pin direct messages and group DMs.---import RouteHeader from '@/components/RouteHeader.astro';-A private channel is a conversation outside any guild. It is either a direct message between two accounts or a group DM with its own participant set. Its fields come from the [channel object](/http-api/channels/#channel-object).--The routes here take a user session or a bot token. An OAuth2 bearer credential receives 403 `ACCESS_DENIED`.--:::note[Open state is per participant]-A direct message channel exists once, and each participant holds its own open state. Closing one side leaves the channel and its messages in place, so a later [Create private channel](#create-private-channel) request for the same pair returns that stored channel.-:::+A private channel is a direct message between two accounts or a group DM. Its fields are in the [channel object](/http-api/channels/#channel-object). These routes take a user session or a bot token, not an OAuth2 token.## Preloaded messages object-The response of both preload operations. It has no fixed field set, and each property name is the [snowflake](/snowflakes/) of one requested channel.+Each property name is the [snowflake](/snowflakes/) of one requested channel.### Structure| Field | Type | Description || --- | --- | --- |-| {channel_id}<sup>1</sup><sup>2</sup> | ?[message](/http-api/messages/#message-object) object | The latest message the caller can read in the channel, or null |+| {channel_id}<sup>1</sup> | ?[message](/http-api/messages/#message-object) object | The latest message you can read, or null when there is none |-<sup>1</sup> A requested channel that is neither a direct message nor a group DM has no property at all. A channel that cannot be resolved, or whose latest message is missing, is present with the value null--<sup>2</sup> A repeated channel ID collapses into one property, so the object holds at most one entry for each distinct ID+<sup>1</sup> Channels that aren't direct messages or group DMs are left out## Group DM unaddable recipient object-One recipient that could not be added to a group DM, and the reason. [Create private channel](#create-private-channel) returns an array of these as `unaddable_recipients` at the top level of a `GROUP_DM_RECIPIENTS_NOT_ADDABLE` [error response](/http-api/#error-response).+[Create private channel](#create-private-channel) returns an array of these as `unaddable_recipients` in a `GROUP_DM_RECIPIENTS_NOT_ADDABLE` [error response](/http-api/#error-response).### Structure| Field | Type | Description || --- | --- | --- || user_id | snowflake | The recipient that could not be added |-| reason | string | The [unaddable reason](#group-dm-unaddable-reasons) the recipient was rejected under |+| reason | string | The [unaddable reason](#group-dm-unaddable-reasons) |## Group DM unaddable reasons| Value | Name | Description || --- | --- | --- |-| unknown_user | Unknown user | The recipient does not resolve |-| not_friends | Not friends | The caller is an ordinary account and holds no friendship with the recipient |-| blocked<sup>1</sup> | Blocked | The caller is a bot account and shares no guild with the recipient |-| group_dm_add_disabled | Group DM add disabled | The recipient's [group DM add permission flags](/http-api/users/#group-dm-add-permission-flags) reject the caller |--<sup>1</sup> Reported only on the bot path. The ordinary path reports a missing friendship as `not_friends`+| unknown_user | Unknown user | The recipient does not exist |+| not_friends | Not friends | You are not friends with the recipient |+| blocked | Blocked | You are a bot and share no guild with the recipient |+| group_dm_add_disabled | Group DM add disabled | The recipient's [group DM add permission flags](/http-api/users/#group-dm-add-permission-flags) don't let you add them |## List private channels<RouteHeader method="GET" path="/v1/users/@me/channels" bot />-Returns the caller's open direct message and group DM [channel](/http-api/channels/#channel-object) objects.--A closed direct message is absent even though the channel and its history still exist. The response has no ordering guarantee and is unpaginated. The caller's personal notes channel is never returned.--Each returned channel has its recipients with the caller removed, so a direct message holds exactly one recipient and a group DM one fewer than its participant count. A group DM whose only participant is the caller omits the `recipients` key entirely.--Fluxer omits an open entry whose channel no longer lists the caller among its recipients, so leaving a group DM needs no separate cleanup call.+Returns your open direct message and group DM [channel](/http-api/channels/#channel-object) objects, unordered and unpaginated. Each channel's `recipients` leaves out the caller.### Response@@ -68,59 +52,35 @@ Fluxer omits an open entry whose channel no longer lists the caller among its re| --- | --- | --- || 200 | array[[channel](/http-api/channels/#channel-object) object] | Open private channels were returned |-### Rate limit--40 requests per 10 seconds for each authenticated user, on the `user:channels` bucket, shared with [Create private channel](#create-private-channel), [Pin private channel](#pin-private-channel), and [Unpin private channel](#unpin-private-channel).+The rate limit is 40 requests per 10 seconds, on the `user:channels` bucket.## Create private channel<RouteHeader method="POST" path="/v1/users/@me/channels" bot />-Opens a direct message with one account, or creates a group DM. Returns a [channel](/http-api/channels/#channel-object) object on success. Emits [Channel Create](/gateway/events/#channel-create) and [Message Create](/gateway/events/#message-create) Gateway events.--One body field selects the channel type. `recipient_id` opens a direct message. `recipients` always creates a group DM whatever its length. A single-element array creates a two-participant group DM, and an empty array creates a group DM whose only participant is the caller.+Opens a direct message with one account, or creates a group DM.-A request supplying `recipients` also consumes the `user:group_dm:create` bucket and is subject to the CAPTCHA check below, whatever the resulting participant count.+Send `recipient_id` to open a direct message or `recipients` to create a group DM. Opening a direct message you already have returns the same channel.-When the instance [community policy](/http-api/instance/#community-policy-object) sets `direct_messages_disabled` to true, every request returns 400 `DIRECT_MESSAGES_DISABLED` after the body has been validated and the group DM bucket and CAPTCHA have been applied.+An account that is not [verified](/http-api/users/#account-tiers) gets 403 `UNCLAIMED_ACCOUNT_CANNOT_JOIN_GROUP_DMS`, `UNCLAIMED_ACCOUNT_CANNOT_SEND_DIRECT_MESSAGES`, `DIRECT_MESSAGE_EMAIL_VERIFICATION_REQUIRED` or `ACCOUNT_VERIFICATION_REQUIRED`.-An unclaimed account holds no password and did not arrive through SSO. Fluxer rejects an unclaimed caller with 400 `UNCLAIMED_ACCOUNT_CANNOT_JOIN_GROUP_DMS` when `recipients` is supplied, and with 400 `UNCLAIMED_ACCOUNT_CANNOT_SEND_DIRECT_MESSAGES` otherwise. An ordinary caller then needs a verified email address, failing which the request returns 403 `DIRECT_MESSAGE_EMAIL_VERIFICATION_REQUIRED`. A bot caller is exempt from the email requirement and is never unclaimed.+When the instance [community policy](/http-api/instance/#community-policy-object) sets `direct_messages_disabled`, every request gets 400 `DIRECT_MESSAGES_DISABLED`.### New conversation limit-An account can be limited from starting new conversations. While the limit stands, opening a direct message with an account that is not a friend returns 403 `NEW_CONVERSATIONS_LIMITED`, unless the other account has already written in a direct message between the two. The same check applies to sending, editing, pinning and reacting in a direct message, to ringing a direct message call, and to sending a friend request.--Friends, bots, conversations where the other account has written, incoming friend requests, group DMs and guild channels are unaffected. Bots, staff and accounts marked as trusted are never limited. The limit ends on its own, and a moderator who restores the account, marks it trusted or removes a flag from it lifts the limit at once.--### Direct message admission--A request naming the caller as its own target returns 400 `CANNOT_DM_YOURSELF` as the field code on `recipient_id` under `INVALID_FORM_BODY`. An unresolved target returns 404 `UNKNOWN_USER`.--Fluxer reads no block state and no shared guild on this route, and it reads friendship only for a caller under a [new conversation limit](#new-conversation-limit). A target that resolves is admitted, so the caller opens a direct message with an account that has blocked them. `CANNOT_SEND_MESSAGES_TO_USER` is reachable from [Create message](/http-api/messages/#create-message) alone, which applies the recipient's direct message policy on every send.+When your account is limited from starting new conversations, opening a direct message with someone who is not your friend returns 403 `NEW_CONVERSATIONS_LIMITED`, unless they have already sent a message there. Bots, staff and trusted accounts are never limited.-:::caution[Blocking removes no channel from the blocked account]-Blocking closes no existing channel. The blocked account still opens the pair's direct message through this route and receives 200. Only the send is refused, with 400 `CANNOT_SEND_MESSAGES_TO_USER`.-:::+### Direct messages-:::caution[A SPAMMER caller receives a channel nobody sees]-An ordinary caller with the [SPAMMER](/http-api/users/#public-user-flags) flag never opens a shared direct message. An unresolved target returns 404 `UNKNOWN_USER`, and any other returns 200 with a channel that exists only for the caller. No Dispatch reaches the target.-:::+Your own ID returns 400 `CANNOT_DM_YOURSELF` on `recipient_id`, and an unknown user returns 404 `UNKNOWN_USER`. Blocks don't stop you from opening a direct message, but [Create message](/http-api/messages/#create-message) returns 400 `CANNOT_SEND_MESSAGES_TO_USER` when either of you has blocked the other.-### Group DM admission+### Group DMs-The participant set, meaning the supplied recipients plus the caller, stays within the instance `max_group_dm_recipients` limit resolved for the caller, which defaults to 50. Exceeding it returns 400 `MAX_GROUP_DM_RECIPIENTS` with the applied ceiling in the top-level `max_recipients` member. `recipients` is capped at 49 elements before the limit is read, so a raised instance limit does not raise the effective ceiling.+A [limited](/http-api/users/#account-limitation) account gets 403 `ACCOUNT_LIMITED`.-A duplicated ID within `recipients` returns 400 `DUPLICATE_RECIPIENTS_NOT_ALLOWED`, and the caller's own ID within it returns 400 `CANNOT_ADD_YOURSELF_TO_GROUP_DM`. Both are field codes on `recipients` under `INVALID_FORM_BODY`.+A group DM has at most `max_group_dm_recipients` participants including you (default 50), or the request returns 400 `MAX_GROUP_DM_RECIPIENTS` with `max_recipients`. Each participant must be in fewer than `max_group_dms_per_user` group DMs (default 150), or it returns 400 `MAX_GROUP_DMS` with `max_group_dms`.-Every participant, the caller included, holds fewer open group DMs than the instance `max_group_dms_per_user` limit resolved for that account, which defaults to 150. A participant at the ceiling makes the request return 400 `MAX_GROUP_DMS` with the applied ceiling in the top-level `max_group_dms` member.--Fluxer then evaluates each other recipient independently and collects every failure, using the [unaddable reasons](#group-dm-unaddable-reasons) above. One failing recipient rejects the whole request with 400 `GROUP_DM_RECIPIENTS_NOT_ADDABLE`. The response has the rejected entries in the top-level `unaddable_recipients` member and the accepted user IDs in `addable_recipients`, so the caller can retry with a smaller set.--An ordinary caller cannot add a recipient it has blocked or a recipient that has blocked it. Blocking deletes the friendship on both accounts, and a friend request between the two accounts creates no new friendship while either block exists.--:::note[Group DM admission reads no block state]-Fluxer holds a bot caller to no friendship. A recipient that has blocked the bot is added when the two share a guild and the recipient's [group DM add permission flags](/http-api/users/#group-dm-add-permission-flags) admit it.-:::+A repeated ID returns 400 `DUPLICATE_RECIPIENTS_NOT_ALLOWED` and your own ID returns 400 `CANNOT_ADD_YOURSELF_TO_GROUP_DM`, both as field errors on `recipients`. If any recipient can't be added, the request returns 400 `GROUP_DM_RECIPIENTS_NOT_ADDABLE` with [`unaddable_recipients`](#group-dm-unaddable-recipient-object) and the IDs that could be added in `addable_recipients`.### Request headers@@ -128,7 +88,7 @@ Fluxer holds a bot caller to no friendship. A recipient that has blocked the bot| --- | --- | --- || X-Captcha-Token?<sup>1</sup> | string | The solved ALTCHA challenge, see [CAPTCHA handling](/topics/captcha/) |-<sup>1</sup> Read only on a request supplying `recipients`, where a missing token returns 400 `CAPTCHA_REQUIRED` and a rejected token returns 400 `INVALID_CAPTCHA`, each with a new challenge. [CAPTCHA handling](/topics/captcha/#exemption) states when an instance skips verification+<sup>1</sup> Needed with `recipients` when the instance has CAPTCHA turned on, otherwise 400 `CAPTCHA_REQUIRED` or `INVALID_CAPTCHA`### JSON body@@ -137,45 +97,34 @@ Fluxer holds a bot caller to no friendship. A recipient that has blocked the bot| recipient_id?<sup>1</sup> | snowflake | The only recipient of a direct message || recipients?<sup>1</sup> | array[snowflake] | The other participants of a group DM, excluding the caller (max 49) |-<sup>1</sup> Exactly one of the two is supplied. Supplying both or neither fails validation with the entry path `root`+<sup>1</sup> Send exactly one of the two### Response| Status | Body | Condition || --- | --- | --- || 200 | [channel](/http-api/channels/#channel-object) object | The direct message was opened or the group DM was created |-| 400 | [error response](/http-api/#error-response) | CAPTCHA, account eligibility, the recipient set, relationship policy, a group DM limit, or instance policy rejects creation |-| 403 | [error response](/http-api/#error-response) | An ordinary caller's email address is unverified and the request returns `DIRECT_MESSAGE_EMAIL_VERIFICATION_REQUIRED`, or a limited caller opens a new conversation and the request returns `NEW_CONVERSATIONS_LIMITED` |-| 403 | [error response](/http-api/#error-response) | The account is [limited](/http-api/users/#account-limitation) and creates a group direct message, and the request returns `ACCOUNT_LIMITED` |-| 404 | [error response](/http-api/#error-response) | The caller or the direct message recipient does not resolve |+| 400 | [error response](/http-api/#error-response) | The request failed a check described above |+| 403 | [error response](/http-api/#error-response) | The account is not verified, is limited, or may not start a new conversation |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_USER` when `recipient_id` does not exist |### Side effects-A newly created direct message opens for the caller only and emits [Channel Create](/gateway/events/#channel-create) to the caller. The recipient's side stays closed until they open it themselves, or until the pair becomes friends through [Accept request or block user](/http-api/users/relationships/#accept-request-or-block-user), which opens both sides. Reopening an existing direct message always emits `CHANNEL_CREATE` to the caller.--Creating a group DM makes the caller its owner, adds the complete participant set, and emits [Channel Create](/gateway/events/#channel-create) to every participant. It creates one [RECIPIENT_ADD](/http-api/messages/#message-types) system message authored by the caller for each other recipient and emits [Message Create](/gateway/events/#message-create) for each to every participant. Initial creation emits no [Channel Recipient Add](/gateway/events/#channel-recipient-add), which is reserved for a recipient added later. A group DM created from an empty `recipients` array produces no system message.--### Rate limit--40 requests per 10 seconds for each authenticated user, on the `user:channels` bucket, shared with [List private channels](#list-private-channels), [Pin private channel](#pin-private-channel), and [Unpin private channel](#unpin-private-channel).+A new direct message opens only for you. The other side opens when a message is sent or a call rings in it, when they open it, or when you become friends. A new group DM makes you the owner, sends [Channel Create](/gateway/events/#channel-create) to every participant and posts a [RECIPIENT_ADD](/http-api/messages/#message-types) message, with its [Message Create](/gateway/events/#message-create) event, for each other recipient.-A request supplying `recipients` also draws on the `user:group_dm:create` bucket of 10 requests per hour for each authenticated user, which is exempt from the global HTTP limit.+The rate limit is 40 requests per 10 seconds, on the `user:channels` bucket. A request with `recipients` also uses the `user:group_dm:create` bucket, at 10 requests per hour.## Preload private channel messages<RouteHeader method="POST" path="/v1/users/@me/preload-messages" bot />-Returns the [preloaded messages](#preloaded-messages-object) object holding the latest readable message of each requested private channel.--Fluxer resolves each requested channel independently and reports an unknown channel, a missing permission, or a missing message as null for that channel. The request still answers 200. It applies the same read authorisation as ordinary message history. A channel the caller cannot see is indistinguishable from one whose history is empty.+Returns the latest message you can read in each requested channel as a [preloaded messages](#preloaded-messages-object) object.### JSON body| Field | Type | Description || --- | --- | --- |-| channels<sup>1</sup> | array[snowflake] | The private channels to preload (max 100) |--<sup>1</sup> Required. An empty array is accepted and returns an empty object, and more than 100 elements fails body validation before any channel is read+| channels | array[snowflake] | The private channels to preload (max 100) |### Response@@ -183,23 +132,19 @@ Fluxer resolves each requested channel independently and reports an unknown chan| --- | --- | --- || 200 | [preloaded messages](#preloaded-messages-object) object | The requested channels were resolved |-### Side effects--This read acknowledges no message and does not change the caller's read state. The caller's own user ID is the ID of their personal notes channel, and resolving it creates that channel row when the account holds none. The notes channel is neither a direct message nor a group DM, so the response has no property for it.--### Rate limit--40 requests per 10 seconds for each authenticated user, on the `user:preload_messages` bucket, shared with [Preload private channel messages by alias](#preload-private-channel-messages-by-alias).+The rate limit is 40 requests per 10 seconds, on the `user:preload_messages` bucket.## Preload private channel messages by alias<RouteHeader method="POST" path="/v1/users/@me/channels/messages/preload" bot />-An alias of [Preload private channel messages](#preload-private-channel-messages). The request body, response, authorisation, and side effects are identical, including the personal notes channel creation described there.+Works the same as [Preload private channel messages](#preload-private-channel-messages).### JSON body-The body is the same as [Preload private channel messages](#preload-private-channel-messages).+| Field | Type | Description |+| --- | --- | --- |+| channels | array[snowflake] | The private channels to preload (max 100) |### Response@@ -207,84 +152,34 @@ The body is the same as [Preload private channel messages](#preload-private-chan| --- | --- | --- || 200 | [preloaded messages](#preloaded-messages-object) object | The requested channels were resolved |-### Rate limit--40 requests per 10 seconds for each authenticated user, on the `user:preload_messages` bucket. The paths share one allowance.+The rate limit is 40 requests per 10 seconds, on the `user:preload_messages` bucket.## Pin private channel<RouteHeader method="PUT" path="/v1/users/@me/channels/{channel_id}/pin" bot />-Adds a direct message or group DM to the caller's pinned order. Returns 204 with an empty body. Emits a [User Pinned DMs Update](/gateway/events/#user-pinned-dms-update) Gateway event.--Fluxer resolves the channel with the caller's ordinary channel authorisation first. A private channel the caller is not a recipient of returns 404 `UNKNOWN_CHANNEL`, and a channel that does not exist returns the same. The channel then has to be a direct message or a group DM, so the caller's personal notes channel and a visible guild channel are rejected with 400 `CHANNEL_MUST_BE_DM_OR_GROUP_DM`, a field code on `channel_id` under `INVALID_FORM_BODY`.--A guild channel the caller cannot see fails resolution first and returns 403 `MISSING_PERMISSIONS`. A caller who lacks `VIEW_CHANNEL` in the parent of a thread, or cannot view a private thread, receives 403 `MISSING_ACCESS`. A thread, a forum channel, or a media channel returns 404 `UNKNOWN_CHANNEL` to a caller other than a bot or a user session that declares the [`channel_threads` client capability](/http-api/threads/#client-capability). Fluxer returns 404 `UNKNOWN_GUILD` for a channel row that outlived its guild. Where the guild record still exists and the caller's membership state cannot be resolved, the request returns 403 `ACCESS_DENIED`.--Fluxer appends a newly pinned channel after every channel already pinned. A channel later closed, left, or deleted stays in the pinned set, and only [Unpin private channel](#unpin-private-channel) or deletion of the caller's account removes an entry.--:::caution[Unpinning needs the channel to resolve]-Unpinning resolves the channel first, so an entry for a deleted channel, or for a group DM the caller is no longer a recipient of, stays in the pinned set.-:::--:::note[Pinning is idempotent and the Dispatch is unconditional]-Pinning an already pinned channel leaves the order untouched, yet the operation still returns 204 and emits [User Pinned DMs Update](/gateway/events/#user-pinned-dms-update) with the unchanged order.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the direct message or group DM |+Adds a direct message or group DM to the end of your pinned list and sends you a [User Pinned DMs Update](/gateway/events/#user-pinned-dms-update) Gateway event.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | The channel is present in the pinned set |-| 400 | [error response](/http-api/#error-response) | The channel is neither a direct message nor a group DM and the request returns `CHANNEL_MUST_BE_DM_OR_GROUP_DM` |-| 403 | [error response](/http-api/#error-response) | A guild channel is not visible and the request returns `MISSING_PERMISSIONS`, or the guild exists while membership cannot be resolved and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` in the parent of a thread, or cannot view a private thread, each returning `MISSING_ACCESS` |-| 404 | [error response](/http-api/#error-response) | The channel does not exist or the caller is not a recipient, each returning `UNKNOWN_CHANNEL`, or a guild channel outlived its guild and the request returns `UNKNOWN_GUILD` |-| 404 | [error response](/http-api/#error-response) | Channel is a thread, a forum channel, or a media channel and the caller is neither a bot nor a user session that declares the `channel_threads` client capability, returning `UNKNOWN_CHANNEL` |+| 204 | empty | The channel is pinned |+| 400 | [error response](/http-api/#error-response) | `CHANNEL_MUST_BE_DM_OR_GROUP_DM` when the channel is another type |-### Side effects--The channel is appended to the caller's pinned order, and [User Pinned DMs Update](/gateway/events/#user-pinned-dms-update) reaches only the caller with the complete resulting order as an array of channel ID strings. The channel itself is not modified, and no other participant can observe the caller's pinned order.--### Rate limit--40 requests per 10 seconds for each authenticated user, on the `user:channels` bucket, shared with [List private channels](#list-private-channels), [Create private channel](#create-private-channel), and [Unpin private channel](#unpin-private-channel).+The rate limit is 40 requests per 10 seconds, on the `user:channels` bucket.## Unpin private channel<RouteHeader method="DELETE" path="/v1/users/@me/channels/{channel_id}/pin" bot />-Removes a direct message or group DM from the caller's pinned order. Returns 204 with an empty body. Emits a [User Pinned DMs Update](/gateway/events/#user-pinned-dms-update) Gateway event.--Fluxer resolves and type checks the channel exactly as in [Pin private channel](#pin-private-channel), so a channel that no longer resolves cannot be unpinned through this route. Unpinning preserves the relative order of every channel that remains, and a later pin is appended to the end. Unpinning a channel that is not pinned still returns 204 and emits the same Dispatch.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the direct message or group DM |+Removes a direct message or group DM from your pinned list and sends you a [User Pinned DMs Update](/gateway/events/#user-pinned-dms-update) Gateway event.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | The channel is absent from the pinned set |-| 400 | [error response](/http-api/#error-response) | The channel is neither a direct message nor a group DM and the request returns `CHANNEL_MUST_BE_DM_OR_GROUP_DM` |-| 403 | [error response](/http-api/#error-response) | A guild channel is not visible and the request returns `MISSING_PERMISSIONS`, or the guild exists while membership cannot be resolved and the request returns `ACCESS_DENIED` |-| 403 | [error response](/http-api/#error-response) | Caller lacks `VIEW_CHANNEL` in the parent of a thread, or cannot view a private thread, each returning `MISSING_ACCESS` |-| 404 | [error response](/http-api/#error-response) | The channel does not exist or the caller is not a recipient, each returning `UNKNOWN_CHANNEL`, or a guild channel outlived its guild and the request returns `UNKNOWN_GUILD` |-| 404 | [error response](/http-api/#error-response) | Channel is a thread, a forum channel, or a media channel and the caller is neither a bot nor a user session that declares the `channel_threads` client capability, returning `UNKNOWN_CHANNEL` |--### Side effects--The channel is removed from the caller's pinned order, and [User Pinned DMs Update](/gateway/events/#user-pinned-dms-update) reaches only the caller with the complete resulting order as an array of channel ID strings. The channel itself is not closed or deleted, and its recipients receive no Dispatch.--### Rate limit+| 204 | empty | The channel is not pinned |+| 400 | [error response](/http-api/#error-response) | `CHANNEL_MUST_BE_DM_OR_GROUP_DM` when the channel is another type |-40 requests per 10 seconds for each authenticated user, on the `user:channels` bucket, shared with [List private channels](#list-private-channels), [Create private channel](#create-private-channel), and [Pin private channel](#pin-private-channel).+The rate limit is 40 requests per 10 seconds, on the `user:channels` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/users/push-notifications.mdx b/fluxer_docs/src/content/docs/http-api/users/push-notifications.mdxindex af14d2fd6..bbe629330 100644--- a/fluxer_docs/src/content/docs/http-api/users/push-notifications.mdx+++ b/fluxer_docs/src/content/docs/http-api/users/push-notifications.mdx@@ -1,106 +1,85 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Push notifications-description: Registering a device for push delivery and decrypting what arrives.+description: How to register a device for push notifications and decrypt the notifications it gets.---import RouteHeader from '@/components/RouteHeader.astro';-Fluxer delivers a notification to a registered device as [RFC 8291](https://datatracker.ietf.org/doc/html/rfc8291) Web Push. The client generates a P-256 key pair and an auth secret, registers the public half of the pair, and decrypts each delivery with the private half.--Every route here requires a user session. A bot or OAuth2 bearer credential is refused with 403 `ACCESS_DENIED`.+A Web Push registration gets each notification as an [RFC 8291](https://datatracker.ietf.org/doc/html/rfc8291) encrypted record. Your client generates a P-256 key pair and an auth secret, registers the public key and decrypts each record with the private key. These routes need a user session token.## Registration formats-On every platform a registration takes one of two forms.+A registration is Web Push when `token` is an endpoint URL sent with both keys, and raw when `token` is a vendor device token sent with no keys.-| Form | What `token` holds | Keys |+| Form | `token` | Keys || --- | --- | --- |-| Web Push | A publicly routable endpoint URL | Both `encryption_key` and `auth_secret` |-| Legacy | A raw vendor device token | Neither key is sent |--Fluxer works out which form you sent from the body rather than from `platform`. A `token` that parses as a URL without both keys is refused, and so is a pair of keys sent with a raw vendor token.+| Web Push | A publicly routable endpoint URL | `encryption_key` and `auth_secret` |+| Raw | A vendor device token | Neither |-`platform` names the transport the device was reached on.+`platform` is one of these values.-| Value | Meaning |+| Platform | Transport || --- | --- || `android_fcm` | Firebase Cloud Messaging || `ios_apns` | Apple Push Notification service |-| `ios_apns_voip` | Apple PushKit, the separate call registration of an iOS device |-| `android_unified_push` | UnifiedPush, on an Android build without Google services |--`android_unified_push` and `ios_apns_voip` are always Web Push registrations. Sending either with no keys is refused.+| `ios_apns_voip` | Apple PushKit, for incoming calls on iOS |+| `android_unified_push` | UnifiedPush |-Apple issues a PushKit device token separate from the alert token. An iOS device that answers calls registers both: the alert token as `ios_apns`, and the PushKit token as `ios_apns_voip`. Generate a separate key pair for the `ios_apns_voip` registration. The two registrations get two identifiers and two independent lifetimes. Removing one leaves the other in place.--Android registers once. One `android_fcm` Web Push registration receives notifications, clears and call rings. Android has no separate call registration and no second token. An `android_fcm` registration sent with neither key receives no call ring.+`android_unified_push` and `ios_apns_voip` only accept Web Push. An iOS device that answers calls registers both `ios_apns` and `ios_apns_voip`, each with its own key pair.## Device registration object-The identifier Fluxer assigns to one registration.-### Structure| Field | Type | Description || --- | --- | --- |-| device_id | string | The registration identifier, 32 lowercase hexadecimal characters |+| device_id | string | The registration ID, 32 lowercase hexadecimal characters |-Fluxer derives the identifier from `platform`, `app_id`, `provider_environment`, and `token`. The same four values always produce the same identifier, and registering them twice replaces the stored entry.+Registering again with the same `platform`, `app_id`, `provider_environment` and `token` replaces the registration and returns the same `device_id`.## Register mobile push device<RouteHeader method="POST" path="/v1/users/@me/mobile-devices" />-Stores a push registration for the current account and returns its [device registration](#device-registration-object) object.+Stores a push registration and returns its [device registration](#device-registration-object) object. Web Push endpoints must be `https` URLs on public hosts.### JSON body| Field | Type | Description || --- | --- | --- |-| platform | string | The [platform value](#registration-formats) the device was reached on |-| token<sup>1</sup> | string | The endpoint URL, or the raw vendor token on a legacy registration |-| encryption_key?<sup>2</sup> | string | The base64url P-256 public key (1-1024 characters) |-| auth_secret?<sup>2</sup> | string | The base64url auth secret (1-1024 characters) |-| app_id? | string | The client build, such as `stable`, `beta`, or `canary` (default `stable`) |-| provider_environment? | string | `production` or `development` |+| platform | string | The [platform](#registration-formats) of the device |+| token | string | The endpoint URL, or the vendor token on a raw registration (1-4096 characters) |+| encryption_key? | string | The base64url P-256 public key, Web Push only (1-1024 characters) |+| auth_secret? | string | The base64url auth secret, Web Push only (1-1024 characters) |+| app_id? | string | The client build, such as `stable`, `beta` or `canary` (default `stable`) |+| provider_environment? | string | `production` or `development`, used by APNs only || user_agent? | string | A user agent string describing the device (1-1024 characters) |-<sup>1</sup> 1 to 4096 characters. A value that parses as a URL is a Web Push registration and needs both keys, and a value that does not must be sent with neither--<sup>2</sup> Sent together or not at all. Sending one alone is refused at the missing field--An `ios_apns` or `ios_apns_voip` registration with no `provider_environment` is stored as `production`. Every other platform stores no environment.--Register an `https` endpoint. A Web Push registration whose `token` is not a valid URL is refused at `token`, and one whose host is a private or reserved address is refused with `URL_NOT_PUBLICLY_ROUTABLE`.--A registration receives a notification for a message in a thread, and for a [new post](/http-api/forums/#new-post-notifications), only when the registering request declares the [`channel_threads` client capability](/http-api/threads/#client-capability). Registering the same `platform`, `token`, `app_id`, and `provider_environment` again without the capability stops those notifications for the registration.+When `provider_environment` is omitted, it defaults to `production` on `ios_apns` and `ios_apns_voip` and stays empty on other platforms. To get thread and forum [new post](/http-api/forums/#new-post-notifications) notifications on this device, send the [`channel_threads` client capability](/http-api/threads/#client-capability) with the request.### Response| Status | Body | Condition || --- | --- | --- || 200 | [device registration](#device-registration-object) object | The registration was stored |-| 400 | [error response](/http-api/#error-response) | The body matches neither form and the request returns `INVALID_FORM_BODY` |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` when the body matches neither form |+| 400 | [error response](/http-api/#error-response) | `URL_NOT_PUBLICLY_ROUTABLE` on `token` when the endpoint is a private or reserved address |-### Rate limit--20 requests per minute for each authenticated user, on the `user:push:subscribe` bucket.+The rate limit is 20 requests per minute, on the `user:push:subscribe` bucket.## Unregister mobile push device<RouteHeader method="POST" path="/v1/users/@me/mobile-devices/unregister" />-Removes the registration named by the values the client already holds. Returns 200 whether or not a registration was there.--The four values below identify the registration the same way [Register mobile push device](#register-mobile-push-device) does. A value that differs from the one sent at registration names a different registration and removes nothing.+Removes the registration that matches `platform`, `token`, `app_id` and `provider_environment`, and returns 200 even when none matches.### JSON body| Field | Type | Description || --- | --- | --- |-| platform | string | The [platform value](#registration-formats) sent at registration |-| token | string | The endpoint URL or raw vendor token sent at registration (1-4096 characters) |+| platform | string | The [platform](#registration-formats) sent at registration |+| token | string | The token sent at registration (1-4096 characters) || app_id? | string | The client build sent at registration (default `stable`) || provider_environment? | string | The environment sent at registration |@@ -108,140 +87,67 @@ The four values below identify the registration the same way [Register mobile pu| Field | Type | Description || --- | --- | --- |-| success | boolean | Whether the removal ran, always true |+| success | boolean | Always `true` |### Response| Status | Body | Condition || --- | --- | --- || 200 | response body | The registration was removed, or there was none |-| 400 | [error response](/http-api/#error-response) | `platform` or `token` is missing or malformed and the request returns `INVALID_FORM_BODY` |-### Rate limit--40 requests per minute for each authenticated user, on the `user:push:unsubscribe` bucket.+The rate limit is 40 requests per minute, on the `user:push:unsubscribe` bucket.## Handling an incoming push-Fluxer posts one encrypted record to the registered endpoint for each notification. The push service that owns the endpoint hands that record to the client. [Register mobile push device](#register-mobile-push-device) states which registrations receive thread and new post notifications.--| Header | Value |-| --- | --- |-| Content-Encoding | Always `aes128gcm` |-| Content-Type | Always `application/octet-stream` |-| TTL | `86400` on a notification, `3600` on a clear, `0` on a call ring |-| Urgency | `high` on a notification and on a call ring, `low` on a clear |-| Authorization | A VAPID token and the instance public key |--The body is one `aes128gcm` record encrypted to the `encryption_key` and `auth_secret` the client registered. The client decrypts it locally with the private half of its key pair and its auth secret. Fluxer holds no key that opens the record after it is sealed.+Fluxer posts one `aes128gcm` record to a Web Push endpoint for each notification. A raw registration gets an unencrypted APNs or FCM message instead. A record has at most 2713 bytes of JSON. When a notification is too large, Fluxer leaves out media and icons and shortens the body text, and your client has to handle those fields being missing.-A record is 2816 bytes and its plaintext is at most 2713 bytes of JSON. A notification too large for that is shrunk before it is encrypted, one step at a time, until it fits.+Fluxer sets these Web Push headers on each record.-| Step | Effect |+| Header | Value || --- | --- |-| First | Media fields are dropped |-| Second | Icon fields are dropped |-| Third | The body text is shortened |-| Last | Only a minimal payload is left |+| TTL | `86400` on a notification and a clear, and `0` on a call ring |+| Urgency | `high` on a notification and a call ring, and `low` on a clear |-A client has to tolerate a missing field.+Each payload is one of these kinds.-Three kinds of payload arrive. A notification payload describes something to show. A clear payload sets `type` to `notification_clear` and `action` to `clear_channel`, and asks the client to dismiss what it already showed for one channel. A [call ring](#call-ring) payload sets `type` to `call_ring` and announces an incoming call.+| Kind | How to recognize it | What to do |+| --- | --- | --- |+| Notification | Any other payload | Show it, using `title`, `body`, `icon` and `image_url`, and open `data.url` when tapped |+| Clear | Top-level `type` is `notification_clear` and `action` is `clear_channel` | Dismiss what you showed for `data.channel_id` |+| Call ring | Top-level `type` is `call_ring` | See [Call ring](#call-ring) |-An endpoint that answers 404 or 410 removes the registration. Fluxer retries a transient failure and keeps the registration.+When an endpoint answers 404 or 410, Fluxer removes the registration. It retries a 429 or 5xx response and keeps the registration.### Call ring-Only two kinds of registration receive a call ring. On iOS it goes to the `ios_apns_voip` registration, which receives nothing else, while every other payload for that device goes to its `ios_apns` registration. An `android_fcm` Web Push registration receives call rings alongside its notifications and clears. No other registration receives one.--These fields are under `data`.+Only `ios_apns_voip` registrations and Web Push `android_fcm` registrations get call rings, and an `ios_apns_voip` registration gets nothing else. A call ring payload has these fields under `data`.| Field | Type | Description || --- | --- | --- || type | string | Always `call_ring` || channel_id | string | The private channel the call is in |-| message_id | string | The call message, which names the call |+| message_id | string | The call message, which identifies the call || target_user_id | string | The account being rung || started_at_ms | integer | When the ring started, in milliseconds since the Unix epoch |-| expires_at_ms | integer | When the ring window closes, in milliseconds since the Unix epoch |+| expires_at_ms | integer | When the ring ends, in milliseconds since the Unix epoch || caller_id? | string | The account placing the call |-| caller_name? | string | The name to show for the caller, resolved before the record was sealed |+| caller_name? | string | The name to show for the caller || caller_avatar_url? | string | An image URL for the caller |-Stop ringing at `expires_at_ms` rather than after a fixed number of seconds. The ring window can change without a client release.--`caller_name` is the caller's nickname in that channel if they have one, otherwise their display name, otherwise their username. Display it as sent. If you look the name up yourself from `caller_id` you can get a different answer in a group DM.--The three caller fields are sent together or not at all. An older server, or an account Fluxer could not read, omits all three.--| What arrived | What to show |-| --- | --- |-| The three caller fields | The name and the image |-| A name with no image URL | The name and a local placeholder |-| No caller fields | The channel name the client already holds, or a generic incoming call string |--Ring in all three cases. Showing a call without a name is better than not showing it at all.--A call ring is not stored for later delivery. A device that cannot be reached while the call rings does not get the ring afterwards.--Fluxer never sends a second push to cancel a ring. It ends the call over the gateway connection that the woken client opens.--A call also produces an ordinary notification for its call message, under the same `message_id` as the ring. Collapse the two into one rather than showing both.--### What PushKit requires of the client+`caller_id` and `caller_name` are sent together or not at all, and `caller_avatar_url` can be missing even when they are present. Ring until `expires_at_ms` even when they are missing. Fluxer sends no push when a call ends, and your client learns that from the Gateway connection.-iOS terminates an application that takes a PushKit push without reporting a call to CallKit. Repeated failures stop PushKit delivery to that device. You have to report the call before you decrypt the record, so decryption cannot decide whether to ring.+### Call rings on iOS-Report a call for every PushKit push, before decrypting. Then end that call at once in each of these three cases.+iOS ends an app that gets a PushKit push without reporting a call to CallKit. Report a call for every PushKit push before you decrypt it, and end the call right away in any of these cases.-| Case | What it means |+| Case | Cause || --- | --- |-| The record does not decrypt | The registered keys no longer match the pair the client holds |-| `type` is not `call_ring` | The push did not come from Fluxer |-| The gateway names no live call for `channel_id` | The call ended before the ring arrived |--Anyone who obtains a PushKit token can send to it. These three checks are what stop a forged push from showing a caller.--Derive the CallKit call identifier from `message_id`. The gateway uses the same identifier when it ends the call, and two rings for the same call resolve to a single CallKit call.--Keep the registered private key and auth secret readable while the device is locked, because call rings arrive on locked devices. If you cannot read the key you cannot decrypt the record, but CallKit still needs its report.--### What an Android client has to do--Android has no PushKit, so there is nothing to do before decrypting. Decrypt the record, read `type`, then decide whether to ring. The CallKit rule above applies only to iOS.+| The record does not decrypt | The registered keys no longer match your key pair |+| `type` is not `call_ring` | The push is not a call ring |+| The Gateway reports no live call for `channel_id` | The call ended before the ring arrived |-A ring arrives as a high priority data message and is never queued. Your own process handles it and has the registered private key, so decrypt it there. Do not make any network request before you have posted a notification.--Google lowers an app's message priority if its high priority messages stop producing a visible notification. This happens per device and can be reversed. Once downgraded, a ring waits for the device to leave Doze and arrives after the call has already ended, so every ring needs to put something on screen.--1. Post the incoming call notification first, ahead of any step that can fail. Use `Notification.CallStyle.forIncomingCall` from Android 12 on a high importance channel, with `CATEGORY_CALL`, a full screen intent, `setOngoing(true)`, and a timeout taken from `expires_at_ms`. Below Android 12 post a high importance notification with the same full screen intent.-2. Post with `caller_name` alone, then fetch `caller_avatar_url`, then post again under the same notification id with the image attached. Read the active notifications before that second post. Without that read a ring the user already dismissed comes back.-3. Show a fallback when the record does not decrypt, or when `type` is not `call_ring`. Returning without showing anything is what triggers the downgrade described above.-4. Let the system play the ringtone through the notification channel. A ringtone the app starts itself out of a push stops working on newer Android releases and reports no error.-5. Stop registering the device once notification permission is denied. An app that cannot show anything is spending its delivery priority for no reason.--Answering the call needs a foreground service. Ringing does not. Start a `phoneCall` service once the user answers. From Android 12 a backgrounded app may only start that service because the message arrived at high priority. Read the delivered priority rather than the priority Fluxer sent, and skip the service start when it came down as normal.--| Permission | Granted by default | Without it |-| --- | --- | --- |-| POST_NOTIFICATIONS | No, the user is asked from Android 13 | Nothing renders at all |-| USE_FULL_SCREEN_INTENT | Yes for a calling app, checked at runtime from Android 14 | The ring shows as a heads-up notification |-| MANAGE_OWN_CALLS | Yes, at install | The `phoneCall` service type is unusable |--Google Play grants `USE_FULL_SCREEN_INTENT` to an app whose stated function includes calling and revokes it for everything else. Read `NotificationManager.canUseFullScreenIntent()` at runtime and send the user to the system setting when it answers false. Losing it does not lose the ring.--In three situations nothing is delivered at all. These are worth documenting for support rather than treating as bugs.--| Situation | What happens |-| --- | --- |-| The user force stopped the app | Nothing is delivered until the app is opened again |-| The app is restricted from background work | Nothing is delivered |-| The device has not been unlocked since it booted | The key is unreadable and the ring cannot be decrypted |+Use `message_id` to build the CallKit call UUID, so every push for the same call maps to one CallKit call.### When decryption fails-A record that does not decrypt cannot be recovered. Discard it and show nothing.--Decryption fails when the registered keys no longer match the pair the client holds. Regenerating the key pair without registering again does that. Fluxer sees none of it. The push service already answered 2xx and the registration stays live.--The client is the only party that can repair it. Unregister the stale entry, then register again with the current public key and auth secret.+Discard the record and show nothing. Fluxer can't tell that decryption failed, and your client has to unregister and register again with its current keys.diff --git a/fluxer_docs/src/content/docs/http-api/users/relationships.mdx b/fluxer_docs/src/content/docs/http-api/users/relationships.mdxindex 6dc0c9d4c..f0b9327b9 100644--- a/fluxer_docs/src/content/docs/http-api/users/relationships.mdx+++ b/fluxer_docs/src/content/docs/http-api/users/relationships.mdx@@ -1,20 +1,14 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Relationships-description: Friendships, blocks, and pending friend requests in both directions.+description: Friends, blocks and pending friend requests for the current user.---import RouteHeader from '@/components/RouteHeader.astro';-A relationship describes a friendship, block, or pending friend request from the caller's perspective. Private notes belong to [User notes](/http-api/users/notes/).+A relationship is a friendship, block or pending friend request, seen from one account. Only user tokens can call these routes, and bot and OAuth2 tokens get 403 `ACCESS_DENIED`.-The routes here are user-only. A bot or OAuth2 bearer credential receives 403 `ACCESS_DENIED`.--:::note[Relationship records are directional]-A friendship is a FRIEND record on both accounts. A pending request is `OUTGOING_REQUEST` on the sender and `INCOMING_REQUEST` on the recipient. A block exists only on the account that created it, so the block adds no record to the blocked account and sends it no [Relationship Add](/gateway/events/#relationship-add).-:::--A deleted account has the deleted flag with no pending deletion timestamp, and is not a valid friend request target. An account inside a scheduled deletion window has a timestamp, so it stays a valid target.+Each account has its own record. A friendship is a `FRIEND` record on both accounts, a pending request is `OUTGOING_REQUEST` on the sender and `INCOMING_REQUEST` on the recipient, and a block is a `BLOCKED` record on the blocker only.## Relationship object@@ -22,23 +16,15 @@ A deleted account has the deleted flag with no pending deletion timestamp, and i| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | snowflake | The ID of the related account |+| id | snowflake | The ID of the related account || type | integer | The [relationship type](#relationship-types) || user | [partial user](/http-api/users/#partial-user-object) object | The related account |-| since?<sup>2</sup> | ISO8601 timestamp | The time at which the record's current type was established |-| nickname<sup>3</sup> | ?string | The caller-private nickname for the related account, or null when none is set |-| share_voice_activity<sup>4</sup> | boolean | Whether the caller shares voice activity with the related account |-| friend_shares_voice_activity<sup>5</sup> | boolean | Whether the related account shares voice activity with the caller |--<sup>1</sup> A relationship has no identifier of its own, so this is always the related account's ID--<sup>2</sup> Omitted when the stored record has no timestamp. A nickname write and a sharing rewrite both preserve it, so it does not track the last write--<sup>3</sup> Only a FRIEND record has one, and [Modify relationship nickname](#modify-relationship-nickname) is its only writer. A type change rewrites the record, so a nickname does not survive one+| since? | ISO8601 timestamp | When the record got its current type |+| nickname | ?string | Your private nickname for the related account |+| share_voice_activity | boolean | Whether you share voice activity with the related account |+| friend_shares_voice_activity<sup>1</sup> | boolean | Whether the related account shares voice activity with you |-<sup>4</sup> A FRIEND record is written with the owning account's default when the friendship is created. Every non-FRIEND record is written with true--<sup>5</sup> Only [List relationships](#list-relationships) resolves the reciprocal record. Every other operation reports true, and so does [List relationships](#list-relationships) for a record with no reciprocal of its type+<sup>1</sup> Only [List relationships](#list-relationships) and the [Relationship Update](/gateway/events/#relationship-update) sent by [Modify voice activity sharing](/http-api/users/settings/#modify-voice-activity-sharing) return the real value. Everything else returns `true`.### Example@@ -59,9 +45,9 @@ A deleted account has the deleted flag with no pending deletion timestamp, and i| Value | Name | Description || --- | --- | --- || 1 | FRIEND | The two accounts are friends |-| 2 | BLOCKED | The caller has blocked the related account |-| 3 | INCOMING_REQUEST | The related account has sent the caller a friend request |-| 4 | OUTGOING_REQUEST | The caller has sent the related account a friend request |+| 2 | BLOCKED | You have blocked the related account |+| 3 | INCOMING_REQUEST | The related account has sent you a friend request |+| 4 | OUTGOING_REQUEST | You have sent the related account a friend request |## Bulk ignore result object@@ -69,32 +55,24 @@ A deleted account has the deleted flag with no pending deletion timestamp, and i| Field | Type | Description || --- | --- | --- |-| ignored_count | integer | The number of incoming friend requests that were removed |+| ignored_count | integer | The number of incoming friend requests removed |## Bulk ignore filters| Value | Name | Description || --- | --- | --- || all | All | Matches every incoming friend request |-| new_accounts<sup>1</sup> | New accounts | Matches an incoming friend request whose sender account is younger than `max_account_age_seconds` |--<sup>1</sup> The age comparison applies only when `max_account_age_seconds` is supplied, so this filter matches every incoming request when that member is absent+| new_accounts | New accounts | Matches senders whose accounts are younger than `max_account_age_seconds`, or every request when it is left out |## Relationship limit-The `max_relationships` limit controls the combined number of friendship, block, and pending request records one account holds. Fluxer resolves it from the account's traits and premium state, so the value can be higher for a premium account. The fallback is 1000 when the deployment resolves no rule. The registry entry is listed under [limit keys](/http-api/instance/#limit-keys).--Fluxer refuses the write once the stored record count reaches the resolved value. It checks the caller and the target independently, and a request fails when either has reached that value.--A refusal returns 400 `MAX_FRIENDS` with the applied value in a top-level `max_relationships` member. Fluxer skips the limit for a bot account on either side, for a block, and under [staff forced acceptance](#send-friend-request-by-user-id).+The `max_relationships` [limit](/http-api/instance/#limit-keys) caps the friendships, blocks and pending requests one account has, and defaults to 1000. Adding a record fails with 400 `MAX_FRIENDS` when either account is at the limit, and the error has a `max_relationships` field with the limit. Bot accounts have no limit, and blocking skips the check.## List relationships<RouteHeader method="GET" path="/v1/users/@me/relationships" />-Returns every [relationship](#relationship-object) object the caller holds, covering friendships, blocks, and pending requests in both directions.--The operation is not paged, and the whole set comes back in one response. The order is not dependable.+Returns every [relationship](#relationship-object) you have, in no particular order.### Response@@ -102,267 +80,162 @@ The operation is not paged, and the whole set comes back in one response. The or| --- | --- | --- || 200 | array[[relationship](#relationship-object) object] | Relationships were returned |-### Rate limit--40 requests per 10 seconds for each authenticated user, on the `user:relationships:list` bucket.+The rate limit is 40 requests per 10 seconds, on the `user:relationships:list` bucket.## Send friend request by tag<RouteHeader method="POST" path="/v1/users/@me/relationships" />-Sends a friend request to the account identified by username and discriminator. Returns a [relationship](#relationship-object) object on success.--### Limitations--- An unresolved tag returns 400 `NO_USERS_WITH_FLUXERTAG_EXIST`.-- A resolved deleted account returns 400 `FRIEND_REQUEST_BLOCKED`.-- An existing friendship returns 400 `ALREADY_FRIENDS`.--Fluxer resolves the tag to exactly one account before any relationship rule runs. Every remaining admission rule is the one described under [Send friend request by user ID](#send-friend-request-by-user-id).+Sends a friend request to the account with the given username and discriminator, under the rules of [Send friend request by user ID](#send-friend-request-by-user-id). Returns a [relationship](#relationship-object) object.### JSON body| Field | Type | Description || --- | --- | --- |-| username<sup>1</sup> | string | The username of the target account |-| discriminator?<sup>2</sup> | string \| integer | The discriminator of the target account |+| username | string | The username of the target (1-32 characters) |+| discriminator? | string \| integer | The discriminator of the target (1-4 digits) |-<sup>1</sup> Trimmed before validation, then 1 to 32 characters of ASCII letters, digits, and underscores. It cannot be `everyone` or `here`, or contain `fluxer` or `system message`, in any casing--<sup>2</sup> An integer and a decimal string of 1 to 4 digits are both accepted, and `0007` and `7` resolve the same account. On an instance with the `none` tag style a person is reached by their username alone, or with the discriminator `0` or `"0000"`. Elsewhere a request without a discriminator returns 400 `DISCRIMINATOR_REQUIRED`. A bot keeps its own discriminator+You can leave out the discriminator only when the instance tag style is `none`.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [relationship](#relationship-object) object | A pending request, an existing relationship, or an accepted friendship was returned |-| 400 | [error response](/http-api/#error-response) | The tag is unresolved, the caller or target is ineligible, target or block policy rejects the request, deployment policy disables the operation, or the [relationship limit](#relationship-limit) is reached |-| 403 | [error response](/http-api/#error-response) | The caller's email address is unverified and the request returns `FRIEND_REQUEST_EMAIL_VERIFICATION_REQUIRED`, or the caller is under a new conversation limit and the request returns `NEW_CONVERSATIONS_LIMITED` |-| 404 | [error response](/http-api/#error-response) | The caller or resolved target no longer exists, or the pending request being accepted has been withdrawn |--### Side effects--The side effects are those of [Send friend request by user ID](#send-friend-request-by-user-id). Neither route opens a direct message channel.--### Rate limit+| 200 | [relationship](#relationship-object) object | The request or friendship was returned |+| 400 | [error response](/http-api/#error-response) | `NO_USERS_WITH_FLUXERTAG_EXIST`, `DISCRIMINATOR_REQUIRED`, `ALREADY_FRIENDS`, or a code from [the user ID route](#send-friend-request-by-user-id) |+| 403 | [error response](/http-api/#error-response) | `UNCLAIMED_ACCOUNT_CANNOT_SEND_FRIEND_REQUESTS`, `FRIEND_REQUEST_EMAIL_VERIFICATION_REQUIRED` or `NEW_CONVERSATIONS_LIMITED` |-10 requests per minute for each authenticated user, on the `user:friend_request:send` bucket, shared with [Send friend request by user ID](#send-friend-request-by-user-id).+The rate limit is 10 requests per minute, on the `user:friend_request:send` bucket.## Send friend request by user ID<RouteHeader method="POST" path="/v1/users/@me/relationships/{user_id}" />-Sends a friend request to the selected account. Returns a [relationship](#relationship-object) object on success.--Admission is ordered. The deployment friends policy runs first, so an ordinary caller receives 400 `FRIENDS_DISABLED` while the [community policy](/http-api/instance/#community-policy-object) sets `friends_disabled`. A caller with the `STAFF` flag skips that first evaluation, whether or not it requests forced acceptance. When the target has already sent a request, a staff caller's send turns into an acceptance and still receives 400 `FRIENDS_DISABLED`. An unresolved caller then returns 404 `UNKNOWN_USER`.--The caller's own ID returns 400 `CANNOT_SEND_FRIEND_REQUEST_TO_SELF`. An unresolved target returns 404 `UNKNOWN_USER`. A deleted target returns 400 `FRIEND_REQUEST_BLOCKED`.--Fluxer checks the current relationship state next. A pending request from the target is accepted. An existing friendship or outgoing request is returned unchanged. The rules that follow apply to a genuinely new request alone, so they never refuse an existing friend.--The remaining rules reject an unclaimed caller with 400 `UNCLAIMED_ACCOUNT_CANNOT_SEND_FRIEND_REQUESTS` and an unverified email with 403 `FRIEND_REQUEST_EMAIL_VERIFICATION_REQUIRED`. A bot target is rejected with 400 `FRIEND_REQUEST_BLOCKED` unless it has `FRIENDLY_BOT`. A target with the internal app store reviewer flag is rejected with the same code.--A target the caller has blocked returns 400 `CANNOT_SEND_FRIEND_REQUEST_TO_BLOCKED_USER`. A target that has blocked the caller returns 400 `FRIEND_REQUEST_BLOCKED`. Fluxer reads the target's [friend source flags](/http-api/users/#friend-source-flags) next<sup>1</sup>, and a target accepting requests only from mutual friends or mutual guild members rejects an unrelated caller with 400 `FRIEND_REQUEST_BLOCKED`. An account under a [new conversation limit](/http-api/users/private-channels/#new-conversation-limit) then returns 403 `NEW_CONVERSATIONS_LIMITED`, unless the target is a bot or has already written in a direct message with it. The [relationship limit](#relationship-limit) applies last, independently for both accounts.--<sup>1</sup> The friend source evaluation is skipped when the target has no stored settings, which admits the request as though the target permitted requests from anyone--:::caution[A flagged caller receives an indistinguishable success]-A caller with the `SPAMMER` [public user flag](/http-api/users/#public-user-flags) gets a one-sided request. Fluxer writes only the caller's `OUTGOING_REQUEST` record. [Relationship Add](/gateway/events/#relationship-add) reaches the caller alone. The response is an ordinary `OUTGOING_REQUEST` object.-:::--The one-sided request path also skips the rules that follow it: the target's block of the caller, the target's [friend source flags](/http-api/users/#friend-source-flags), the app store reviewer rule, the [relationship limit](#relationship-limit), and friendly bot auto-acceptance. The caller's own block of the target is still enforced and still returns 400 `CANNOT_SEND_FRIEND_REQUEST_TO_BLOCKED_USER`.--:::note[The suppression entries enter at different points]-Fluxer checks for the `SPAMMER` flag before it looks for a pending request from the target. A caller that already has the flag gets a one-sided request even when the target has a pending request, so it can hold both an `INCOMING_REQUEST` and an `OUTGOING_REQUEST` record for one account. A caller without the flag accepts a pending request from the target normally.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Sends a friend request to an account, or accepts the account's pending request to you. Returns a [relationship](#relationship-object) object.### JSON body-The body can be omitted, in which case it is treated as an empty object.+The body is optional.| Field | Type | Description || --- | --- | --- |-| staff_force_accept?<sup>1</sup> | boolean | Whether the friendship is created immediately without a pending request |--<sup>1</sup> Honoured only when the caller has the `STAFF` flag, and a caller without it is treated as though the member were absent. Fluxer reads the stored flag, so hidden staff status still qualifies+| staff_force_accept? | boolean | Whether to make the accounts friends directly, skipping blocks, friend source flags and the limit (`STAFF` only) |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [relationship](#relationship-object) object | A pending request, an existing relationship, or an accepted friendship was returned |-| 400 | [error response](/http-api/#error-response) | The caller or target is ineligible, target or block policy rejects the request, deployment policy disables the operation, or the [relationship limit](#relationship-limit) is reached |-| 403 | [error response](/http-api/#error-response) | The caller's email address is unverified and the request returns `FRIEND_REQUEST_EMAIL_VERIFICATION_REQUIRED`, or the caller is under a new conversation limit and the request returns `NEW_CONVERSATIONS_LIMITED` |-| 404 | [error response](/http-api/#error-response) | The caller, the target account, or the pending request being accepted does not exist |--### Side effects--A new request writes matching `OUTGOING_REQUEST` and `INCOMING_REQUEST` records and emits [Relationship Add](/gateway/events/#relationship-add) to both accounts. Both records are written with `share_voice_activity` set to true.--When the target has already sent the caller a request, the operation accepts that request. Acceptance replaces both pending records with FRIEND records and emits [Relationship Update](/gateway/events/#relationship-update) to both accounts, and each FRIEND record has `share_voice_activity` set to its owning account's `default_share_voice_activity`. No acceptance path on this route opens a direct message channel, unlike [Accept request or block user](#accept-request-or-block-user).+| 200 | [relationship](#relationship-object) object | The request or friendship was returned |+| 400 | [error response](/http-api/#error-response) | One of the codes below |+| 403 | [error response](/http-api/#error-response) | `UNCLAIMED_ACCOUNT_CANNOT_SEND_FRIEND_REQUESTS`, `FRIEND_REQUEST_EMAIL_VERIFICATION_REQUIRED` or `NEW_CONVERSATIONS_LIMITED` |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_USER` when the account does not exist |-A bot target that has `FRIENDLY_BOT` without `FRIENDLY_BOT_MANUAL_APPROVAL` accepts in the same call, so the caller observes [Relationship Add](/gateway/events/#relationship-add) followed by [Relationship Update](/gateway/events/#relationship-update). Both flags are read only on a bot account. The response body of that call is the bot's own record, and its `id` and `user` name the caller and its `share_voice_activity` is the bot's default. The Dispatch the caller receives has the caller's record.+A 400 has one of these codes.-Staff forced acceptance replaces every existing record between the two accounts, in either direction, with a friendship, and emits [Relationship Add](/gateway/events/#relationship-add) to both. A replaced record emits at most one [Relationship Remove](/gateway/events/#relationship-remove) to each account first. When the two accounts already hold a mutual friendship and nothing else, the existing record comes back unchanged. Forced acceptance still enforces the self rule, both unresolved account rules, the deleted account rule on both parties, the unclaimed account rule, and the email verification rule. It enforces no relationship rule, so it overrides a block in either direction, the target's [friend source flags](/http-api/users/#friend-source-flags), the bot target rule, and the [relationship limit](#relationship-limit).+| Code | Condition |+| --- | --- |+| `FRIENDS_DISABLED` | The [community policy](/http-api/instance/#community-policy-object) sets `friends_disabled` |+| `CANNOT_SEND_FRIEND_REQUEST_TO_SELF` | The target is you |+| `CANNOT_SEND_FRIEND_REQUEST_TO_BLOCKED_USER` | You have blocked the target |+| `FRIEND_REQUEST_BLOCKED` | The target is deleted, blocked you, is a bot without `FRIENDLY_BOT` or [excludes you](/http-api/users/#friend-source-flags) |+| `MAX_FRIENDS` | You are at the [relationship limit](#relationship-limit) |-### Rate limit+If you already have a friendship or outgoing request with the account, it comes back unchanged, and a pending request from the account is accepted. A new request sends [Relationship Add](/gateway/events/#relationship-add) to both accounts, and an acceptance sends [Relationship Update](/gateway/events/#relationship-update) to both. A bot with `FRIENDLY_BOT` and without `FRIENDLY_BOT_MANUAL_APPROVAL` accepts at once, and the response is then the bot's record, with your account as `user`. Accepting through this route does not open a direct message.-10 requests per minute for each authenticated user, on the `user:friend_request:send` bucket, shared with [Send friend request by tag](#send-friend-request-by-tag).+The rate limit is 10 requests per minute, on the `user:friend_request:send` bucket.## Accept request or block user<RouteHeader method="PUT" path="/v1/users/@me/relationships/{user_id}" />-Accepts a pending incoming friend request, or blocks the selected account when the body selects BLOCKED. Returns a [relationship](#relationship-object) object on success.--Acceptance evaluates the deployment friends policy first and returns 400 `FRIENDS_DISABLED` while the community policy sets `friends_disabled`, with no staff exemption. An unresolved caller or requester returns 404 `UNKNOWN_USER`. A deleted account on either side returns 400 `FRIEND_REQUEST_BLOCKED`. An unclaimed caller returns 400 `UNCLAIMED_ACCOUNT_CANNOT_ACCEPT_FRIEND_REQUESTS`. A missing pending incoming request returns 404 `UNKNOWN_USER`, and the [relationship limit](#relationship-limit) then applies to both accounts. Acceptance has no email verification requirement.--Blocking returns 404 `UNKNOWN_USER` for an unresolved target and 400 `CANNOT_BLOCK_SYSTEM_USER` for the Fluxer system account. Those are its only admission rules, so blocking runs regardless of the deployment friends policy, the unclaimed account rule, the email verification rule, and the [relationship limit](#relationship-limit). It applies no self-target rule.--:::caution[The type member selects the operation]-Only the exact value BLOCKED selects blocking. Every other accepted [relationship type](#relationship-types), an omitted `type`, and an omitted body all select acceptance of a pending incoming request. Sending FRIEND does not force a friendship where no request exists.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the target account |+Accepts a pending incoming friend request, or blocks the account when `type` is `BLOCKED`. Returns a [relationship](#relationship-object) object.### JSON body-The body can be omitted, in which case it is treated as an empty object and acceptance is selected.+The body is optional. Any `type` other than `BLOCKED`, or no body, accepts a pending incoming request.| Field | Type | Description || --- | --- | --- |-| type?<sup>1</sup> | integer | The [relationship type](#relationship-types) selecting the operation |--<sup>1</sup> One of the enumerated types when present. Only BLOCKED selects blocking, and every other accepted value selects acceptance+| type? | integer | The [relationship type](#relationship-types). Send `BLOCKED` to block the account |### Response| Status | Body | Condition || --- | --- | --- || 200 | [relationship](#relationship-object) object | The friendship or the block was returned |-| 400 | [error response](/http-api/#error-response) | An account is ineligible, the block target is the system account, deployment policy disables acceptance, or the [relationship limit](#relationship-limit) is reached |-| 404 | [error response](/http-api/#error-response) | The target account does not exist, or no pending incoming request exists |+| 400 | [error response](/http-api/#error-response) | One of the codes below |+| 403 | [error response](/http-api/#error-response) | Your account is unclaimed, or unverified while [`interaction_tier`](/http-api/users/#account-tiers) is `enforced` |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_USER` when the account does not exist, or when accepting and no incoming request exists |++A 400 has one of these codes.-### Side effects+| Code | Condition |+| --- | --- |+| `FRIENDS_DISABLED` | The [community policy](/http-api/instance/#community-policy-object) sets `friends_disabled` and you are accepting |+| `FRIEND_REQUEST_BLOCKED` | Either account is deleted |+| `CANNOT_BLOCK_SYSTEM_USER` | The block target is the Fluxer system account |+| `MAX_FRIENDS` | You are at the [relationship limit](#relationship-limit) |-Acceptance replaces the pending records with FRIEND records on both accounts and emits [Relationship Update](/gateway/events/#relationship-update) to each. It then opens the pair's direct message channel for both accounts, creating the channel when none exists, and emits [Channel Create](/gateway/events/#channel-create) to each account whose open state changed. No other relationship operation opens one.+A 403 has `UNCLAIMED_ACCOUNT_CANNOT_ACCEPT_FRIEND_REQUESTS` or `FRIEND_REQUEST_EMAIL_VERIFICATION_REQUIRED`.-Blocking replaces the caller's existing friendship or pending request with a BLOCKED record. Removing a friendship or an outgoing request also removes the target's reciprocal record, and [Relationship Remove](/gateway/events/#relationship-remove) reaches the target. Removing an incoming request touches the caller's record alone. [Relationship Add](/gateway/events/#relationship-add) then reaches the caller for the block. Blocking an already blocked target changes nothing. Blocking never closes or deletes the pair's direct message channel.+Accepting sends [Relationship Update](/gateway/events/#relationship-update) to both accounts, opens your direct message with the account for both of you, and sends [Channel Create](/gateway/events/#channel-create) to whoever did not already have it open.-### Rate limit+Blocking replaces any friendship or pending request with a `BLOCKED` record and sends [Relationship Add](/gateway/events/#relationship-add) to you. If the block ends a friendship or your outgoing request, the other account's record is deleted too and it gets [Relationship Remove](/gateway/events/#relationship-remove). Blocking works even when friends are disabled or your account is unclaimed, and it does not close the direct message.-20 requests per 10 seconds for each authenticated user, on the `user:friend_request:accept` bucket.+The rate limit is 20 requests per 10 seconds, on the `user:friend_request:accept` bucket.## Remove relationship<RouteHeader method="DELETE" path="/v1/users/@me/relationships/{user_id}" />-Removes the caller's current friendship, pending friend request in either direction, or block involving the selected account. Returns 204 with an empty body on success.--The route reads no request body. The caller's current record determines what is removed. A caller holding no record of any type receives 404 `UNKNOWN_USER`. Removal has no deployment policy, email verification, unclaimed account, or limit rule, so a relationship stays removable while every creation path is closed.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the related account |+Removes your friendship, pending request in either direction, or block with an account. Returns 204 with an empty body.### Response| Status | Body | Condition || --- | --- | --- || 204 | empty | The relationship was removed |-| 404 | [error response](/http-api/#error-response) | No relationship of any type exists with the target |--### Side effects--Removing a friendship or an outgoing request removes both accounts' records and emits [Relationship Remove](/gateway/events/#relationship-remove) to each account.--A block is stored on one account only, so removing one deletes the caller's record and emits [Relationship Remove](/gateway/events/#relationship-remove) to the caller alone.--:::caution[Rejecting an incoming request leaves the sender's record]-Removing an `INCOMING_REQUEST` record deletes only the caller's record and notifies only the caller. The sender keeps its `OUTGOING_REQUEST` record and cannot tell the request was rejected. [Ignore pending requests in bulk](#ignore-pending-requests-in-bulk) removes both records instead.-:::+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_USER` when you have no relationship with the account |-### Rate limit+Removing a friendship or outgoing request deletes both records and sends [Relationship Remove](/gateway/events/#relationship-remove) to both accounts. Removing a block or declining an incoming request deletes only your record and sends the event only to you, and the sender keeps its `OUTGOING_REQUEST`.-30 requests per 10 seconds for each authenticated user, on the `user:relationship:delete` bucket.+The rate limit is 30 requests per 10 seconds, on the `user:relationship:delete` bucket.## Modify relationship nickname<RouteHeader method="PATCH" path="/v1/users/@me/relationships/{user_id}" />-Sets or clears the caller's private nickname for a friend. Returns the updated [relationship](#relationship-object) object. Emits a [Relationship Update](/gateway/events/#relationship-update) Gateway event.--Only a FRIEND record accepts a nickname, and every other relationship state returns 404 `UNKNOWN_USER`.--:::note[The nickname is private to the caller]-Fluxer writes it only to the caller's record. The friend never reads it in a response and never receives it in a Dispatch.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | snowflake | The ID of the friend |+Sets or clears your private nickname for a friend, which the friend never sees. Returns the updated [relationship](#relationship-object) object and sends [Relationship Update](/gateway/events/#relationship-update) to you.### JSON body| Field | Type | Description || --- | --- | --- |-| nickname<sup>1</sup> | ?string | The nickname to store, or null to clear it |--<sup>1</sup> The member is required, so an empty body is rejected. The value is trimmed, stripped of the form feed and right-to-left override characters, and then at most 256 characters--A literal empty string clears the nickname, the same as null. A value that is only whitespace normalises to an empty string and is stored as one.+| nickname | ?string | The nickname (up to 256 characters), or null to clear it |### Response| Status | Body | Condition || --- | --- | --- || 200 | [relationship](#relationship-object) object | The updated relationship was returned |-| 404 | [error response](/http-api/#error-response) | No FRIEND record exists with the target |--### Side effects+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_USER` when the account is not your friend |-The record changes only for the caller, and the sharing preference keeps its stored value. A stored `since` value is preserved, and a record that has none is stamped with the current time. [Relationship Update](/gateway/events/#relationship-update) reaches the caller for every accepted request, including one that submits the value already stored.--### Rate limit--30 requests per 10 seconds for each authenticated user, on the `user:relationship:update` bucket.+The rate limit is 30 requests per 10 seconds, on the `user:relationship:update` bucket.## Ignore pending requests in bulk<RouteHeader method="POST" path="/v1/users/@me/relationships/bulk-ignore" />-Removes matching incoming friend requests. Returns a [bulk ignore result](#bulk-ignore-result-object) object on success.--Matching applies only to the caller's `INCOMING_REQUEST` records. Fluxer derives a sender's account age from the timestamp embedded in its [snowflake](/snowflakes/) and compares it against `max_account_age_seconds` as an exclusive upper bound, so a sender exactly that old is not matched. One call removes every matching request.--:::caution[An unbounded new_accounts filter removes everything]-The age comparison applies only when `max_account_age_seconds` is supplied. Selecting `new_accounts` without it removes every incoming friend request, exactly as `all` does.-:::+Removes your matching incoming friend requests. Returns a [bulk ignore result](#bulk-ignore-result-object) object.### JSON body-The body can be omitted, in which case it is treated as an empty object and the `all` filter applies.+The body is optional.| Field | Type | Description || --- | --- | --- |-| filter? | string | The [bulk ignore filter](#bulk-ignore-filters) to apply (default `all`) |-| max_account_age_seconds?<sup>1</sup> | integer | The exclusive maximum sender account age in seconds |--<sup>1</sup> A positive integer, read only by the `new_accounts` filter+| filter? | string | The [bulk ignore filter](#bulk-ignore-filters) (default `all`) |+| max_account_age_seconds? | integer | With `new_accounts`, only match senders whose accounts are younger than this many seconds |### Response@@ -370,12 +243,6 @@ The body can be omitted, in which case it is treated as an empty object and the| --- | --- | --- || 200 | [bulk ignore result](#bulk-ignore-result-object) object | Matching requests were removed |-### Side effects--Each matched request removes the caller's `INCOMING_REQUEST` record and the sender's `OUTGOING_REQUEST` record, and emits [Relationship Remove](/gateway/events/#relationship-remove) to the caller and to the sender. A call that matches nothing changes nothing.--A call that fails partway can remove some incoming friend requests and return no count. Call [List relationships](#list-relationships) again to read what remains.--### Rate limit+Each match deletes both records and sends [Relationship Remove](/gateway/events/#relationship-remove) to you and the sender.-5 requests per minute for each authenticated user, on the `user:friend_request:bulk_ignore` bucket.+The rate limit is 5 requests per minute, on the `user:friend_request:bulk_ignore` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/users/settings-protobuf.md b/fluxer_docs/src/content/docs/http-api/users/settings-protobuf.mdindex ad32b1a13..1ceb5f340 100644--- a/fluxer_docs/src/content/docs/http-api/users/settings-protobuf.md+++ b/fluxer_docs/src/content/docs/http-api/users/settings-protobuf.md@@ -1,219 +1,177 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: User settings Protobuf-description: The client preference snapshot in the user settings object.+description: The Protobuf messages and enumerations in the synced_preferences field of user settings.----A synced preferences snapshot holds the client settings an account shares between its devices. It is one base64-encoded `fluxer.user.preferences.v1.SyncedPreferences` message in the `synced_preferences` field of the [user settings object](/http-api/users/#user-settings-object). Fluxer stores it and interprets no field on this page.+The `synced_preferences` field of the [user settings object](/http-api/users/#user-settings-object) is a base64-encoded `fluxer.user.preferences.v1.SyncedPreferences` message with the client preferences an account shares between its devices. The API stores the snapshot and doesn't act on any field in it. The schema is in `packages/schema/proto/fluxer/user/preferences/v1`.## Reading and writing the snapshot-Decode the string before reading any preference, and encode a valid `SyncedPreferences` message when writing one. [Modify current user settings](/http-api/users/settings/#modify-current-user-settings) takes the complete snapshot every time.+[Modify current user settings](/http-api/users/settings/#modify-current-user-settings) replaces the whole snapshot. To change one preference, decode the stored snapshot, change it and send all of it back. Sending null or the empty string clears it, and the API returns the empty string when nothing is stored. Each change goes to every session of the account in [User Settings Update](/gateway/events/#user-settings-update).-The empty string in a response means nothing is stored. Sending null or the empty string clears it. A stored snapshot reaches the account's other sessions through [User Settings Update](/gateway/events/#user-settings-update).+The API accepts standard or URL-safe base64, with or without padding, and returns standard base64 with padding. The API re-encodes what you send and keeps unknown fields. A snapshot with only default values comes back as the empty string.-A returned snapshot can have a different encoding from the submitted one. Unknown fields and enum values survive the round trip. A snapshot containing only default values is returned as the empty string.--A submission may use either the standard or the URL-safe base64 alphabet, with or without padding. Fluxer always returns the standard alphabet with padding.--## How to read the type column--Types here are the declared Protobuf types. A field whose declared type is an enumeration appears as `int32`, its wire representation, and the Description column links the enumeration.--A field without the optional marker always decodes and holds its Protobuf zero value. That is false for a bool, 0 for a numeric type, the empty string, an empty repeated field, or an empty map. A field with the optional marker tracks presence and is absent until a value is stored. Every singular message field tracks presence the same way, so a preference group is absent from the snapshot until a client writes to it.--Fluxer applies no bound to any individual field of the message, so every length, range, and enumeration membership below describes what the first-party client writes and reads.--## Rejection grounds--Fluxer reports every entry in the resulting `errors` array against the path `synced_preferences`. It checks the encoded string first.+An invalid snapshot returns 400 with errors at the path `synced_preferences`.| Condition | Status and code | Element codes || --- | --- | --- || Encoded string longer than 699052 characters | 400 `INVALID_FORM_BODY` | `CONTENT_EXCEEDS_MAX_LENGTH` and `INVALID_FORMAT` || Encoded string outside the base64 alphabet | 400 `INVALID_FORM_BODY` | `INVALID_FORMAT` |-| Decoded message above 524288 bytes | 400 `VALIDATION_ERROR` | `TOO_LARGE` |-| Bytes that do not decode as `SyncedPreferences` | 400 `VALIDATION_ERROR` | `INVALID_FORMAT` |--An over-length string draws two entries for the one path.-+| Decoded message above 524288 bytes (512 KiB) | 400 `VALIDATION_ERROR` | `TOO_LARGE` |+| Bytes that don't decode as `SyncedPreferences` | 400 `VALIDATION_ERROR` | `INVALID_FORMAT` |## Synced preferences object-`SyncedPreferences` is the root message. Most fields are preference groups. Use the Protobuf schema for field numbers, not their position in this table.+A field marked `?` is absent until a client sets it. Every other scalar field is 0, false or empty when unset. An enumeration field has the type `int32` and links to its values.++`SyncedPreferences` is the root message.### Structure| Field | Type | Description || --- | --- | --- |-| accessibility? | [accessibility settings](#accessibility-settings-object) object | Accessibility, display, motion, media, and interaction preferences |-| accessibility_overrides? | [accessibility overrides](#accessibility-overrides-object) object | Dirty flags for media settings, with no live consumer |-| textual_preview? | [textual preview settings](#textual-preview-settings-object) object | Textual preview wrapping preferences |-| emoji_picker? | [emoji picker state](#emoji-picker-state-object) object | Emoji picker usage, favourites, and collapsed categories |-| sticker_picker? | [sticker picker state](#sticker-picker-state-object) object | Sticker picker usage, favourites, and collapsed categories |-| memes_picker? | [memes picker state](#memes-picker-state-object) object | Meme picker usage, favourites, and collapsed categories |-| emoji? | [emoji state](#emoji-state-object) object | Emoji skin tone preference |-| emoji_sticker_layout? | [emoji and sticker layout settings](#emoji-and-sticker-layout-settings-object) object | Emoji and sticker picker layout preferences |-| favorite_gifs?<sup>1</sup> | [favourite GIF settings](#favourite-gif-settings-object) object | Saved favourite GIF entries |-| favorites? | [favourites state](#favourites-state-object) object | Favourite channel and category layout |-| recent_mentions? | [recent mentions settings](#recent-mentions-settings-object) object | Recent mention inclusion filters |+| accessibility? | [accessibility settings](#accessibility-settings-object) object | Display, motion, media and other accessibility preferences |+| accessibility_overrides? | [accessibility overrides](#accessibility-overrides-object) object | Media setting dirty flags |+| textual_preview? | [textual preview settings](#textual-preview-settings-object) object | Textual attachment preview preferences |+| emoji_picker? | [emoji picker state](#emoji-picker-state-object) object | Emoji picker usage and favorites |+| sticker_picker? | [sticker picker state](#sticker-picker-state-object) object | Sticker picker usage and favorites |+| memes_picker? | [memes picker state](#memes-picker-state-object) object | Memes picker usage and favorites |+| emoji? | [emoji state](#emoji-state-object) object | Emoji skin tone |+| emoji_sticker_layout? | [emoji and sticker layout settings](#emoji-and-sticker-layout-settings-object) object | Emoji and sticker picker layout |+| favorite_gifs? | [favorite GIF settings](#favorite-gif-settings-object) object | Favorite GIFs |+| favorites? | [favorites state](#favorites-state-object) object | Favorite channels and their categories |+| recent_mentions? | [recent mentions settings](#recent-mentions-settings-object) object | Recent mentions filters || sidebar? | [sidebar preferences](#sidebar-preferences-object) object | Direct message sidebar state |-| member_list? | [member list state](#member-list-state-object) object | Member list visibility state |-| unread_channels? | [unread channels state](#unread-channels-state-object) object | Collapsed unread channel state |-| mention_frecency? | [mention frecency state](#mention-frecency-state-object) object | Per-guild mention frequency and recency state |-| nagbars? | [nagbar dismissals](#nagbar-dismissals-object) object | Dismissed account and guild notice state |-| dismissed_upsells? | [dismissed upsells](#dismissed-upsells-object) object | Dismissed upsell state |-| guild_nsfw_agreements? | [guild mature content agreements](#guild-mature-content-agreements-object) object | Accepted mature guild, category, and channel notices |+| member_list? | [member list state](#member-list-state-object) object | Member list visibility |+| unread_channels? | [unread channels state](#unread-channels-state-object) object | Collapsed unread channels |+| mention_frecency? | [mention frecency state](#mention-frecency-state-object) object | Mention autocomplete ranking per guild |+| nagbars? | [nagbar dismissals](#nagbar-dismissals-object) object | Dismissed notices |+| dismissed_upsells? | [dismissed upsells](#dismissed-upsells-object) object | Dismissed upsells |+| guild_nsfw_agreements? | [guild mature content agreements](#guild-mature-content-agreements-object) object | Accepted mature content notices || whats_new? | [what's new state](#whats-new-state-object) object | Last dismissed update entry |-| privacy? | [privacy preferences](#privacy-preferences-object) object | Stream preview, activity, and attachment privacy preferences |-| local_spam_overrides? | [local user spam overrides](#local-user-spam-overrides-object) object | Local user spam classification overrides |-| sanitize_urls<sup>2</sup> | bool | Whether tracking parameters are stripped from the URLs in an outgoing message |-| sound? | [sound settings](#sound-settings-object) object | Sound enablement, volume, and per-sound overrides |-| spellcheck? | [spellcheck settings](#spellcheck-settings-object) object | Spellcheck language, dictionary, and engine preferences |-| search_engines? | [search engine settings](#search-engine-settings-object) object | Text, reverse image, and translation provider choices |-| permission_layout? | [permission layout settings](#permission-layout-settings-object) object | Permission editor layout preferences |-| guild_member_layout? | [guild member layout settings](#guild-member-layout-settings-object) object | Guild member view layout preference |-| guild_folders?<sup>3</sup> | [guild folder expanded state](#guild-folder-expanded-state-object) object | Expanded guild folder identifiers |-| hidden_guild_buttons? | [hidden guild list buttons](#hidden-guild-list-buttons-object) object | Hidden guild list button state |+| privacy? | [privacy preferences](#privacy-preferences-object) object | Client privacy preferences |+| local_spam_overrides? | [local user spam overrides](#local-user-spam-overrides-object) object | Local spammer overrides |+| sanitize_urls | bool | Whether to strip tracking parameters from URLs in outgoing messages |+| sound? | [sound settings](#sound-settings-object) object | Sound preferences |+| spellcheck? | [spellcheck settings](#spellcheck-settings-object) object | Spellcheck preferences |+| search_engines? | [search engine settings](#search-engine-settings-object) object | Search and translation providers |+| permission_layout? | [permission layout settings](#permission-layout-settings-object) object | Permission editor layout |+| guild_member_layout? | [guild member layout settings](#guild-member-layout-settings-object) object | Guild member view layout |+| guild_folders? | [guild folder expanded state](#guild-folder-expanded-state-object) object | Expanded guild folders |+| hidden_guild_buttons? | [hidden guild list buttons](#hidden-guild-list-buttons-object) object | Hidden guild list buttons || keyboard_mode_intro? | [keyboard mode intro state](#keyboard-mode-intro-state-object) object | Keyboard mode introduction state || input_monitoring? | [input monitoring prompts state](#input-monitoring-prompts-state-object) object | Input monitoring prompt state |-| voice_prompts? | [voice prompts state](#voice-prompts-state-object) object | Suppressed voice confirmation prompt state |-| sudo_prompt? | [sudo prompt state](#sudo-prompt-state-object) object | Last used sudo verification method |-| keybinds? | [keybind settings](#keybind-settings-object) object | Custom keybinds and transmit mode preferences |-| chat_input? | [chat input settings](#chat-input-settings-object) object | Chat composer behaviour preferences |-| save_camera_uploads_to_device?<sup>4</sup> | bool | Whether a camera upload is also written to the device |-| double_tap_reaction? | [reaction emoji](#reaction-emoji-object) object | Emoji a double tap on a message adds as a reaction |-| announcement_prompts? | [announcement prompts state](#announcement-prompts-state-object) object | Hidden announcement channel prompt state |+| voice_prompts? | [voice prompts state](#voice-prompts-state-object) object | Skipped voice confirmations |+| sudo_prompt? | [sudo prompt state](#sudo-prompt-state-object) object | Last sudo verification method |+| keybinds? | [keybind settings](#keybind-settings-object) object | Custom keybinds and transmit mode |+| chat_input? | [chat input settings](#chat-input-settings-object) object | Message composer preferences |+| save_camera_uploads_to_device? | bool | Whether camera uploads are also saved to the device |+| double_tap_reaction? | [reaction emoji](#reaction-emoji-object) object | Emoji that a double tap on a message adds |+| channel_frecency? | [channel frecency state](#channel-frecency-state-object) object | Channel usage for ranking channel search |+| announcement_prompts? | [announcement prompts state](#announcement-prompts-state-object) object | Hidden announcement channel prompts || double_tap_action | int32 | [Double tap action](#double-tap-actions) on a message || swipe_right_to_left_action | int32 | [Swipe right to left action](#swipe-right-to-left-actions) in a channel |-<sup>1</sup> The entries are inside the snapshot, and the account [memes](/http-api/memes/) collection holds none of them--<sup>2</sup> The only bare scalar on the root message, so it has no presence and reads as false until a client stores true. It applies to the content a client is about to send, and the first-party client leaves the URLs inside inline code and code blocks unchanged--<sup>3</sup> Holds only which folders are expanded. The folder layout itself is `guild_folders` on the [user settings object](/http-api/users/#user-settings-object)--<sup>4</sup> The only optional scalar on the root message, so it tracks presence. No live surface reads or writes it-## Accessibility settings object-The `accessibility` field has display, motion, message, media, voice, and interaction preferences. Almost every field is optional, so distinguish an absent field from a stored zero value before applying a default.+Display, motion, message, media, voice and interaction preferences.### Structure| Field | Type | Description || --- | --- | --- |-| saturation_factor?<sup>1</sup> | double | Colour saturation multiplier |+| saturation_factor? | double | Color saturation multiplier, where 1 is unchanged || always_underline_links | bool | Whether links are always underlined || enable_text_selection? | bool | Whether message text can be selected |-| show_message_send_button? | bool | Whether the message composer shows a send button |-| show_textarea_focus_ring? | bool | Whether the message composer shows a focus ring |+| show_message_send_button? | bool | Whether the composer shows a send button |+| show_textarea_focus_ring? | bool | Whether the composer shows a focus ring || hide_keyboard_hints | bool | Whether keyboard shortcut hints are hidden || escape_exits_keyboard_mode? | bool | Whether Escape exits keyboard navigation mode |-| sync_reduced_motion_with_system? | bool | Whether reduced motion follows the operating system preference |-| reduced_motion_override?<sup>2</sup> | bool | Explicit reduced motion preference |-| message_group_spacing?<sup>3</sup> | double | Spacing between message groups |-| message_gutter?<sup>3</sup> | double | Horizontal message gutter size |-| font_size?<sup>3</sup> | double | Message font size |-| show_user_avatars_in_compact_mode? | bool | Whether compact messages show user avatars |-| mobile_sticker_animation_overridden<sup>4</sup> | bool | Whether the mobile sticker animation value applies on a mobile layout |-| mobile_gif_autoplay_overridden<sup>4</sup> | bool | Whether the mobile GIF autoplay value applies on a mobile layout |-| mobile_animate_emoji_overridden<sup>4</sup> | bool | Whether the mobile emoji animation value applies on a mobile layout |-| mobile_sticker_animation_value?<sup>5</sup> | int32 | Mobile [sticker animation setting](/http-api/users/#sticker-animation-settings) |-| mobile_gif_autoplay_value? | bool | Mobile GIF autoplay value |-| mobile_animate_emoji_value? | bool | Mobile emoji animation value |-| auto_send_klipy_gifs | bool | Whether selecting a GIF sends it immediately |+| sync_reduced_motion_with_system? | bool | Whether reduced motion follows the operating system |+| reduced_motion_override? | bool | Reduced motion setting, used when it doesn't follow the operating system |+| message_group_spacing? | double | Spacing between message groups in CSS pixels |+| message_gutter? | double | Message gutter width in CSS pixels |+| font_size? | double | Message font size in CSS pixels |+| show_user_avatars_in_compact_mode? | bool | Whether compact mode shows avatars |+| mobile_sticker_animation_overridden | bool | Whether the mobile sticker animation value is used |+| mobile_gif_autoplay_overridden | bool | Whether the mobile GIF autoplay value is used |+| mobile_animate_emoji_overridden | bool | Whether the mobile emoji animation value is used |+| mobile_sticker_animation_value? | int32 | Mobile [sticker animation setting](/http-api/users/#sticker-animation-settings) |+| mobile_gif_autoplay_value? | bool | Mobile GIF autoplay |+| mobile_animate_emoji_value? | bool | Mobile emoji animation |+| auto_send_klipy_gifs | bool | Whether picking a GIF sends it immediately || show_gif_button? | bool | Whether the composer shows the GIF button || show_memes_button? | bool | Whether the composer shows the memes button || show_stickers_button? | bool | Whether the composer shows the sticker button || show_emoji_button? | bool | Whether the composer shows the emoji button |-| show_media_favorite_button? | bool | Whether media actions show the favourite button |-| show_media_download_button? | bool | Whether media actions show the download button |-| show_media_delete_button? | bool | Whether media actions show the delete button |-| show_suppress_embeds_button? | bool | Whether message actions show the suppress embeds button |-| show_gif_indicator? | bool | Whether GIF media shows a GIF indicator |+| show_media_favorite_button? | bool | Whether media shows the favorite button |+| show_media_download_button? | bool | Whether media shows the download button |+| show_media_delete_button? | bool | Whether media shows the delete button |+| show_suppress_embeds_button? | bool | Whether messages show the suppress embeds button |+| show_gif_indicator? | bool | Whether GIFs show a GIF indicator || show_attachment_expiry_indicator? | bool | Whether attachments show their expiry indicator |-| use_browser_locale_for_time_format? | bool | Whether time formatting uses the browser locale |+| use_browser_locale_for_time_format? | bool | Whether times use the browser locale || channel_typing_indicator_mode | int32 | [Channel typing indicator mode](#channel-typing-indicator-modes) |-| show_selected_channel_typing_indicator? | bool | Whether the typing indicator is shown for the selected channel |+| show_selected_channel_typing_indicator? | bool | Whether the selected channel shows its typing indicator || show_message_action_bar? | bool | Whether messages show the action bar |-| show_message_action_bar_quick_reactions? | bool | Whether the message action bar shows quick reactions |-| show_message_action_bar_shift_expand? | bool | Whether holding Shift expands the message action bar |-| show_message_action_bar_only_more_button? | bool | Whether the message action bar shows only the more button |+| show_message_action_bar_quick_reactions? | bool | Whether the action bar shows quick reactions |+| show_message_action_bar_shift_expand? | bool | Whether holding Shift expands the action bar |+| show_message_action_bar_only_more_button? | bool | Whether the action bar shows only the more button || show_default_emojis_in_autocomplete? | bool | Whether autocomplete includes standard emoji || show_custom_emojis_in_autocomplete? | bool | Whether autocomplete includes custom emoji || show_stickers_in_autocomplete? | bool | Whether autocomplete includes stickers || show_memes_in_autocomplete? | bool | Whether autocomplete includes memes |-| voice_channel_join_requires_double_click? | bool | Whether joining a voice channel requires a double click |-| custom_theme_css?<sup>6</sup> | string | Custom theme CSS |-| show_favorites? | bool | Whether the favourites section is shown |-| zoom_level?<sup>7</sup> | double | Application zoom level |+| voice_channel_join_requires_double_click? | bool | Whether joining a voice channel needs a double click |+| custom_theme_css? | string | CSS of the synced custom theme |+| show_favorites? | bool | Whether the favorites section is shown |+| zoom_level? | double | App zoom multiplier, where 1 is unscaled || dm_message_preview_mode | int32 | [Direct message preview mode](#direct-message-preview-modes) |-| enable_tts_command? | bool | Whether the text-to-speech command is enabled |-| tts_rate?<sup>8</sup> | double | Text-to-speech playback rate |-| show_faded_unread_on_muted_channels? | bool | Whether muted channels retain a faded unread indicator |+| enable_tts_command? | bool | Whether the text-to-speech command is on |+| tts_rate? | double | Text-to-speech rate multiplier, where 1 is normal |+| show_faded_unread_on_muted_channels? | bool | Whether muted channels show a faded unread indicator || show_context_menu_shortcuts? | bool | Whether context menus show keyboard shortcuts |-| confirm_before_starting_calls? | bool | Whether starting a call requires confirmation |+| confirm_before_starting_calls? | bool | Whether starting a call asks for confirmation || hdr_display_mode | int32 | [HDR display mode](#hdr-display-modes) |-| preserve_edit_draft? | bool | Whether cancelling a message edit preserves its draft |-| stay_interactive_when_unfocused? | bool | Whether animation and interaction remain active while the application is unfocused |-| confirm_before_joining_voice_channels? | bool | Whether joining a voice channel requires confirmation |+| preserve_edit_draft? | bool | Whether canceling an edit keeps its draft |+| stay_interactive_when_unfocused? | bool | Whether animation and interaction continue while the app is unfocused |+| confirm_before_joining_voice_channels? | bool | Whether joining a voice channel asks for confirmation || screen_reader_announce_new_messages? | bool | Whether a screen reader announces new messages |-| first_click_pass_through_when_unfocused? | bool | Whether the first click also activates its control when the application is unfocused |-| compact_message_group_spacing?<sup>3</sup> | double | Spacing between compact message groups |-| scroll_to_bottom_on_message_send? | bool | Whether sending a message scrolls the channel to the bottom |-| dim_strikethrough_text? | bool | Whether strikethrough text is visually dimmed |-| sequential_file_send? | bool | Whether multiple selected files are sent one message at a time |+| first_click_pass_through_when_unfocused? | bool | Whether the first click on an unfocused app also activates the control |+| compact_message_group_spacing? | double | Spacing between compact message groups in CSS pixels |+| scroll_to_bottom_on_message_send? | bool | Whether sending a message scrolls to the bottom |+| dim_strikethrough_text? | bool | Whether strikethrough text is dimmed |+| sequential_file_send? | bool | Whether multiple files are sent one message at a time || mobile_splash_zoom_animation? | bool | Whether the mobile splash screen plays its zoom animation |-| message_double_click_actions? | bool | Whether double-clicking a message edits your own message or replies to someone else's |--<sup>1</sup> A multiplier applied to interface colour, where 1 leaves colour unchanged--<sup>2</sup> Read only while `sync_reduced_motion_with_system` is false--<sup>3</sup> A length in CSS pixels. The first-party client defaults to 16 for `message_group_spacing`, `message_gutter`, and `font_size`, and to 0 for `compact_message_group_spacing`--<sup>4</sup> The paired `mobile_*_value` field is read only while this flag is true, and only on a mobile layout. While the flag is false the first-party client falls back to the account-level setting for emoji animation, and to a fixed mobile default for GIF autoplay and sticker animation--<sup>5</sup> The same enumeration as `animate_stickers` on the [user settings object](/http-api/users/#user-settings-object). This field is the mobile-local replacement--<sup>6</sup> The complete CSS of the account's synced custom theme, stored inline. A client that has opted out of syncing its theme applies a local one instead and re-emits this value unchanged, so it does not overwrite the value on the devices that do sync--<sup>7</sup> A multiplier, where 1 is unscaled. Unused by the first-party client--<sup>8</sup> A multiplier, where 1 is the unmodified speaking rate--Field numbers 42 and 43 are reserved, together with the names `attachment_media_dimension_size` and `embed_media_dimension_size`. Neither number can be reused.+| message_double_click_actions? | bool | Whether double-clicking a message edits your own message or replies to others |### Channel typing indicator modes| Value | Name | Description || --- | --- | --- |-| 0 | CHANNEL_TYPING_INDICATOR_MODE_UNSPECIFIED | No explicit mode is selected |+| 0 | CHANNEL_TYPING_INDICATOR_MODE_UNSPECIFIED | No mode is set || 1 | CHANNEL_TYPING_INDICATOR_MODE_AVATARS | Show typing users as avatars |-| 2 | CHANNEL_TYPING_INDICATOR_MODE_INDICATOR_ONLY | Show a typing indicator without avatars |-| 3 | CHANNEL_TYPING_INDICATOR_MODE_HIDDEN | Hide the typing indicator |+| 2 | CHANNEL_TYPING_INDICATOR_MODE_INDICATOR_ONLY | Show the indicator without avatars |+| 3 | CHANNEL_TYPING_INDICATOR_MODE_HIDDEN | Hide the indicator |### Direct message preview modes| Value | Name | Description || --- | --- | --- |-| 0 | DM_MESSAGE_PREVIEW_MODE_UNSPECIFIED | No explicit mode is selected |-| 1 | DM_MESSAGE_PREVIEW_MODE_ALL | Show previews for all direct messages |-| 2 | DM_MESSAGE_PREVIEW_MODE_UNREAD_ONLY | Show previews only for unread direct messages |-| 3 | DM_MESSAGE_PREVIEW_MODE_NONE | Hide direct message previews |+| 0 | DM_MESSAGE_PREVIEW_MODE_UNSPECIFIED | No mode is set |+| 1 | DM_MESSAGE_PREVIEW_MODE_ALL | Preview all direct messages |+| 2 | DM_MESSAGE_PREVIEW_MODE_UNREAD_ONLY | Preview only unread direct messages |+| 3 | DM_MESSAGE_PREVIEW_MODE_NONE | Hide previews |### HDR display modes| Value | Name | Description || --- | --- | --- |-| 0 | HDR_DISPLAY_MODE_UNSPECIFIED | No explicit mode is selected |-| 1 | HDR_DISPLAY_MODE_FULL | Display HDR media without limiting its range |+| 0 | HDR_DISPLAY_MODE_UNSPECIFIED | No mode is set |+| 1 | HDR_DISPLAY_MODE_FULL | Show HDR media at full range || 2 | HDR_DISPLAY_MODE_STANDARD | Limit HDR media to standard dynamic range |## Accessibility overrides object-The `accessibility_overrides` field is unused by the first-party client. Use the `mobile_*_overridden` and matching `mobile_*_value` fields in [accessibility settings](#accessibility-settings-object).-### Structure| Field | Type | Description |@@ -224,83 +182,71 @@ The `accessibility_overrides` field is unused by the first-party client. Use the## Textual preview settings object-The `textual_preview` field controls line wrapping in the inline preview of a textual attachment.+Line wrapping in the inline preview of a text attachment.### Structure| Field | Type | Description || --- | --- | --- |-| wrap_text | bool | Whether long lines wrap in a textual preview |+| wrap_text | bool | Whether long lines wrap |## Usage stat object-The usage stat object records picker usage for one expression or one meme. It is the map value of the `usage` field in every picker state group, so the emoji, sticker, and meme pickers all rank their entries from the same shape.+How often and how recently one emoji, sticker or meme was used.### Structure| Field | Type | Description || --- | --- | --- |-| count | uint32 | Number of recorded uses |-| last_used_ms<sup>1</sup> | int64 | Unix timestamp in milliseconds of the most recent use |--<sup>1</sup> Milliseconds since 1970-01-01T00:00:00Z+| count | uint32 | Number of uses |+| last_used_ms | int64 | Unix time in milliseconds of the last use |## Emoji picker state object-The `emoji_picker` field records emoji usage, favourites, and collapsed picker categories.+Emoji usage, favorites and collapsed categories. Fluxer clients key emoji as `unicode:<name>` or `custom:<guild id>:<emoji id>`.### Structure| Field | Type | Description || --- | --- | --- |-| usage<sup>1</sup> <sup>2</sup> | map[string, [usage stat](#usage-stat-object) object] | Usage keyed by emoji usage key |-| favorite_emoji_ids<sup>1</sup> | array[string] | Favourite emoji usage keys in display order |-| collapsed_category_ids | array[string] | Collapsed emoji category identifiers |--<sup>1</sup> The first-party client writes `unicode:<unique name>` for a standard emoji and `custom:<guild id>:<emoji id>` for a custom emoji--<sup>2</sup> The first-party client drops a key matching neither form when it reads the snapshot, and applies no such filter to `favorite_emoji_ids`+| usage | map[string, [usage stat](#usage-stat-object) object] | Usage keyed by emoji key |+| favorite_emoji_ids | array[string] | Favorite emoji keys in display order |+| collapsed_category_ids | array[string] | Collapsed category IDs |## Sticker picker state object-The `sticker_picker` field records sticker usage, favourites, and collapsed picker categories.+Sticker usage, favorites and collapsed categories.### Structure| Field | Type | Description || --- | --- | --- |-| usage | map[string, [usage stat](#usage-stat-object) object] | Usage keyed by sticker identifier |-| favorite_sticker_ids | array[string] | Favourite sticker identifiers in display order |-| collapsed_category_ids | array[string] | Collapsed sticker category identifiers |+| usage | map[string, [usage stat](#usage-stat-object) object] | Usage keyed by sticker ID |+| favorite_sticker_ids | array[string] | Favorite sticker IDs in display order |+| collapsed_category_ids | array[string] | Collapsed category IDs |## Memes picker state object-The `memes_picker` field records meme usage, favourites, and collapsed picker categories. The memes themselves belong to the account [memes](/http-api/memes/) collection and are not stored here.+Meme usage, favorites and collapsed categories. The memes are in the account's [memes](/http-api/memes/).### Structure| Field | Type | Description || --- | --- | --- |-| usage | map[string, [usage stat](#usage-stat-object) object] | Usage keyed by meme identifier |-| favorite_meme_ids | array[string] | Favourite meme identifiers in display order |-| collapsed_category_ids | array[string] | Collapsed meme category identifiers |+| usage | map[string, [usage stat](#usage-stat-object) object] | Usage keyed by meme ID |+| favorite_meme_ids | array[string] | Favorite meme IDs in display order |+| collapsed_category_ids | array[string] | Collapsed category IDs |## Emoji state object-The `emoji` field holds the selected skin tone.-### Structure| Field | Type | Description || --- | --- | --- |-| skin_tone<sup>1</sup> | string | Selected Unicode skin tone modifier |--<sup>1</sup> One of the five Unicode skin tone modifiers, U+1F3FB through U+1F3FF. The empty string selects the default tone+| skin_tone | string | Unicode skin tone modifier (U+1F3FB to U+1F3FF), or empty for the default |## Emoji and sticker layout settings object-The `emoji_sticker_layout` field controls how the emoji and sticker pickers lay out their contents.-### Structure| Field | Type | Description |@@ -312,149 +258,117 @@ The `emoji_sticker_layout` field controls how the emoji and sticker pickers lay| Value | Name | Description || --- | --- | --- |-| 0 | EMOJI_PICKER_LAYOUT_UNSPECIFIED | No explicit layout is selected |-| 1 | EMOJI_PICKER_LAYOUT_LIST | Display emoji in a list layout |-| 2 | EMOJI_PICKER_LAYOUT_GRID | Display emoji in a grid layout |+| 0 | EMOJI_PICKER_LAYOUT_UNSPECIFIED | No layout is set |+| 1 | EMOJI_PICKER_LAYOUT_LIST | List layout |+| 2 | EMOJI_PICKER_LAYOUT_GRID | Grid layout |### Sticker picker view modes| Value | Name | Description || --- | --- | --- |-| 0 | STICKER_PICKER_VIEW_MODE_UNSPECIFIED | No explicit view mode is selected |-| 1 | STICKER_PICKER_VIEW_MODE_COZY | Display stickers with the roomy layout |-| 2 | STICKER_PICKER_VIEW_MODE_COMPACT | Display stickers with the compact layout |+| 0 | STICKER_PICKER_VIEW_MODE_UNSPECIFIED | No view mode is set |+| 1 | STICKER_PICKER_VIEW_MODE_COZY | Roomy layout |+| 2 | STICKER_PICKER_VIEW_MODE_COMPACT | Compact layout |-## Favourite GIF settings object+## Favorite GIF settings object-The `favorite_gifs` field stores the GIFs the account has favourited, together with the metadata needed to render one without another lookup. Favouriting a GIF writes an entry here or writes a meme to the account [memes](/http-api/memes/) collection, never both, and `save_as_saved_media` selects which.+Fluxer clients keep favorite GIFs here, or in the account's [memes](/http-api/memes/) when `save_as_saved_media` is true.### Structure| Field | Type | Description || --- | --- | --- |-| entries<sup>1</sup> | array[[favourite GIF entry](#favourite-gif-entry-object) object] | Favourite GIFs in display order |-| save_as_saved_media<sup>2</sup> | bool | Whether favouriting a GIF saves a meme to the account memes collection |-| seen_first_time_prompt | bool | Whether the first-time favourite prompt has been shown |--<sup>1</sup> The first-party client treats `url` as the identity of an entry and refuses to append a second entry with a `url` already present+| entries | array[[favorite GIF entry](#favorite-gif-entry-object) object] | Favorite GIFs in display order |+| save_as_saved_media | bool | Whether favoriting a GIF saves it as a meme |+| seen_first_time_prompt | bool | Whether the first-time favorite prompt was shown |-<sup>2</sup> While this is true the first-party client leaves `entries` untouched and favourites through [Save meme from message](/http-api/memes/#save-meme-from-message) instead+## Favorite GIF entry object-## Favourite GIF entry object--One entry describes one favourited GIF. Its fields mirror the [resolved GIF entry object](/http-api/memes/#resolved-gif-entry-object) returned by [Resolve GIF URLs](/http-api/memes/#resolve-gif-urls), so a client can store a resolved entry without reshaping it.+One favorite GIF, in the same format as a [resolved GIF entry](/http-api/memes/#resolved-gif-entry-object).### Structure| Field | Type | Description || --- | --- | --- || url | string | Source URL of the GIF |-| proxy_url | string | [Media Proxy](/media-proxy/overview/) URL for the preview format |-| width<sup>1</sup> | uint32 | Width of the preview format in pixels |-| height<sup>1</sup> | uint32 | Height of the preview format in pixels |-| media | map[string, [favourite GIF media format](#favourite-gif-media-format-object) object] | Formats keyed by [GIF media format name](/http-api/memes/#gif-media-format-names) |-| content_type<sup>2</sup> | string | Media type of the media addressed by `proxy_url` |-| placeholder<sup>3</sup> | string | Compact thumbhash placeholder |--<sup>1</sup> Zero when the dimensions could not be determined+| proxy_url | string | [Media Proxy](/media-proxy/overview/) URL of the preview |+| width | uint32 | Preview width in pixels, or 0 if unknown |+| height | uint32 | Preview height in pixels, or 0 if unknown |+| media | map[string, [favorite GIF media format](#favorite-gif-media-format-object) object] | Formats keyed by [format name](/http-api/memes/#gif-media-format-names) |+| content_type | string | Media type of the preview, or empty for `image/gif` |+| placeholder | string | Thumbhash placeholder, or empty |-<sup>2</sup> The empty string means the type is unknown, which a client reads as `image/gif`+## Favorite GIF media format object-<sup>3</sup> The empty string means the Media Proxy emitted none--## Favourite GIF media format object--One descriptor addresses one encoding of one favourited GIF. It mirrors the [GIF media format object](/http-api/memes/#gif-media-format-object).+One encoding of a favorite GIF, in the same format as a [GIF media format](/http-api/memes/#gif-media-format-object).### Structure| Field | Type | Description || --- | --- | --- |-| src | string | Direct media URL of this format |+| src | string | Direct URL of this format || proxy_src | string | [Media Proxy](/media-proxy/overview/) URL of this format |-| width | uint32 | Width of this format in pixels |-| height | uint32 | Height of this format in pixels |+| width | uint32 | Width in pixels |+| height | uint32 | Height in pixels |-## Favourites state object+## Favorites state object-The `favorites` field stores favourite channels, the categories they are grouped into, and the display state of that grouping. These categories are private to the favourites view.+Favorite channels and the categories they're grouped in. They aren't guild categories.### Structure| Field | Type | Description || --- | --- | --- |-| channels | array[[favourite channel](#favourite-channel-object) object] | Favourite channels |-| categories | array[[favourite category](#favourite-category-object) object] | Favourite categories |-| collapsed_category_ids | array[string] | Collapsed favourite category identifiers |-| hide_muted_channels | bool | Whether muted channels are hidden from favourites |-| muted | bool | Whether the favourites collection is muted |--## Favourite channel object+| channels | array[[favorite channel](#favorite-channel-object) object] | Favorite channels |+| categories | array[[favorite category](#favorite-category-object) object] | Favorite categories |+| collapsed_category_ids | array[string] | Collapsed favorite category IDs |+| hide_muted_channels | bool | Whether muted channels are hidden |+| muted | bool | Whether favorites are muted |-One entry marks one channel as a favourite. Channel and guild identifiers here are strings holding the decimal form of a [snowflake](/snowflakes/). Nothing removes an entry when the account loses access to the channel, so an entry can reference a channel the account can no longer resolve.+## Favorite channel object### Structure| Field | Type | Description || --- | --- | --- |-| channel_id | string | Channel ID |-| guild_id | string | Guild ID |-| parent_id?<sup>1</sup> | string | Favourite category the channel is grouped under |-| position<sup>2</sup> | int32 | Position across the whole favourites list |-| nickname? | string | User-assigned channel nickname |--<sup>1</sup> The `id` of a [favourite category](#favourite-category-object), not a guild category channel. An absent value groups the channel outside every category--<sup>2</sup> A single ordering over every favourite channel. The first-party client renumbers the whole list from 0 whenever an entry is removed or moved, and appends a new entry at the current entry count without renumbering+| channel_id | string | The ID of the channel |+| guild_id | string | The ID of the guild |+| parent_id? | string | The `id` of the [favorite category](#favorite-category-object) it's in |+| position | int32 | Position in the favorites list |+| nickname? | string | Nickname the user gave the channel |-## Favourite category object--One entry names one grouping in the favourites view. The client chooses the identifier, so it is not a [snowflake](/snowflakes/) and Fluxer never resolves it.+## Favorite category object### Structure| Field | Type | Description || --- | --- | --- |-| id | string | Category identifier |+| id | string | Category ID chosen by the client, not a snowflake || name | string | Category name |-| position<sup>1</sup> | int32 | Category position |--<sup>1</sup> Renumbered from 0 across every category whenever one is removed or moved+| position | int32 | Category position |## Recent mentions settings object-The `recent_mentions` field controls which mentions appear in the recent mentions view. Each filter set to false removes its mentions, and a mention appears only when no filter removes it. `include_guilds` tests the channel the mention is in.-### Structure| Field | Type | Description || --- | --- | --- |-| include_everyone?<sup>1</sup> | bool | Whether to include `@everyone` mentions |-| include_roles?<sup>1</sup> | bool | Whether to include role mentions |-| include_guilds?<sup>1</sup> <sup>2</sup> | bool | Whether to include mentions in a guild channel |--<sup>1</sup> The first-party client defaults every filter to true and omits the field while it holds that default. A client that reads an absent value as the Protobuf zero then filters out mentions the account expects to see--<sup>2</sup> False keeps direct message mentions and drops every mention whose channel belongs to a guild+| include_everyone? | bool | Whether to include `@everyone` mentions (true when absent) |+| include_roles? | bool | Whether to include role mentions (true when absent) |+| include_guilds? | bool | Whether to include mentions in guild channels (true when absent) |## Sidebar preferences object-The `sidebar` field stores direct message sidebar display state.-### Structure| Field | Type | Description || --- | --- | --- || inline_dms_collapsed | bool | Whether the inline direct message section is collapsed |-| show_collapsed_unread_dms_badge?<sup>1</sup> | bool | Whether the collapsed section shows an unread direct message badge |-| show_incoming_friend_request_badge?<sup>1</sup> | bool | Whether the sidebar shows an incoming friend request badge |--<sup>1</sup> The first-party client defaults it to true and omits the field while it holds that default, so a client that reads an absent value as the Protobuf zero hides a badge the account expects to see+| show_collapsed_unread_dms_badge? | bool | Whether the collapsed section shows an unread badge (true when absent) |+| show_incoming_friend_request_badge? | bool | Whether the sidebar shows a friend request badge (true when absent) |## Member list state object-The `member_list` field stores whether the member list panel is open.-### Structure| Field | Type | Description |@@ -463,211 +377,203 @@ The `member_list` field stores whether the member list panel is open.## Unread channels state object-The `unread_channels` field stores which channels are collapsed in the unread view.-### Structure| Field | Type | Description || --- | --- | --- |-| collapsed_channel_ids | array[string] | Collapsed channel IDs in decimal form |+| collapsed_channel_ids | array[string] | IDs of collapsed channels in the unread view |## Mention frecency state object-The `mention_frecency` field records how often and how recently the account mentioned each user, one record set per guild, so a client can rank mention autocomplete without a server call. It nests the messages `MentionFrecencyState.Scope` and `MentionFrecencyState.Entry`.+How often and how recently the account mentioned each user, per guild, for ranking mention autocomplete.### Structure| Field | Type | Description || --- | --- | --- |-| scopes | array[[mention frecency scope](#mention-frecency-scope-object) object] | Per-guild mention records |+| scopes | array[[mention frecency scope](#mention-frecency-scope-object) object] | Mention records per guild |## Mention frecency scope object-One scope holds every mention record for one guild. It is declared as `MentionFrecencyState.Scope`.+The mention records for one guild, declared as `MentionFrecencyState.Scope`.### Structure| Field | Type | Description || --- | --- | --- |-| guild_id | string | Guild ID in decimal form |-| entries | array[[mention frecency entry](#mention-frecency-entry-object) object] | User mention records for the guild |+| guild_id | string | The ID of the guild |+| entries | array[[mention frecency entry](#mention-frecency-entry-object) object] | Mention records for the guild |## Mention frecency entry object-One entry counts mentions of one user inside one scope. It is declared as `MentionFrecencyState.Entry`.+Mentions of one user, declared as `MentionFrecencyState.Entry`.### Structure| Field | Type | Description || --- | --- | --- |-| user_id | string | Mentioned user ID in decimal form |-| count | uint32 | Number of recorded mentions |-| last_at_ms<sup>1</sup> | int64 | Unix timestamp in milliseconds of the most recent mention |+| user_id | string | The ID of the mentioned user |+| count | uint32 | Number of mentions |+| last_at_ms | int64 | Unix time in milliseconds of the last mention |-<sup>1</sup> Milliseconds since 1970-01-01T00:00:00Z+## Channel frecency state object-## Nagbar dismissals object+How often and how recently the account opened each channel.-The `nagbars` field stores dismissed account-wide notices as bools and dismissed per-target notices as maps. Field number 13 is not assigned.+### Structure++| Field | Type | Description |+| --- | --- | --- |+| usage | map[string, [channel frecency entry](#channel-frecency-entry-object) object] | Usage keyed by channel ID |++## Channel frecency entry object### Structure| Field | Type | Description || --- | --- | --- |-| ios_install | bool | Whether the iOS installation notice is dismissed |-| pwa_install | bool | Whether the progressive web application installation notice is dismissed |-| push_notification | bool | Whether the push notification notice is dismissed |-| desktop_notification | bool | Whether the desktop notification notice is dismissed |-| premium_grace_period | bool | Whether the premium grace period notice is dismissed |-| premium_expired | bool | Whether the premium expiry notice is dismissed |-| premium_onboarding | bool | Whether the premium onboarding notice is dismissed |-| premium_trial_expiring | bool | Whether the premium trial expiry notice is dismissed |-| gift_inventory | bool | Whether the gift inventory notice is dismissed |-| desktop_download | bool | Whether the desktop download notice is dismissed |-| guild_membership_cta | bool | Whether the guild membership call to action notice is dismissed |-| visionary_mfa<sup>1</sup> | bool | Whether the lifetime premium MFA notice is dismissed |-| pending_bulk_deletion | map[string, bool] | Dismissal state keyed by pending bulk deletion identifier |-| invites_disabled<sup>2</sup> | map[string, bool] | Dismissal state keyed by guild ID for disabled-invite notices |-| guild_mfa_requirement<sup>2</sup> | map[string, bool] | Dismissal state keyed by guild ID for MFA requirement notices |+| total_uses | uint32 | Number of uses |+| recent_uses_ms | array[int64] | Unix times in milliseconds of recent uses |++## Nagbar dismissals object-<sup>1</sup> The notice this dismisses is shown only to an account holding lifetime premium with no MFA authenticator enrolled+Each field is true when the account dismissed that notice. In the map fields, a missing key means the notice wasn't dismissed.-<sup>2</sup> Keyed by the decimal form of a guild [snowflake](/snowflakes/). A missing key reads as not dismissed+### Structure-## Dismissed upsells object+| Field | Type | Description |+| --- | --- | --- |+| ios_install | bool | iOS install notice |+| pwa_install | bool | Progressive web app install notice |+| push_notification | bool | Push notification notice |+| desktop_notification | bool | Desktop notification notice |+| premium_grace_period | bool | Premium grace period notice |+| premium_expired | bool | Premium expired notice |+| premium_onboarding | bool | Premium onboarding notice |+| premium_trial_expiring | bool | Premium trial expiring notice |+| gift_inventory | bool | Gift inventory notice |+| desktop_download | bool | Desktop download notice |+| guild_membership_cta | bool | Guild membership notice |+| pending_bulk_deletion | map[string, bool] | Pending bulk deletion notices, keyed by deletion ID |+| invites_disabled | map[string, bool] | Disabled invites notices, keyed by guild ID |+| guild_mfa_requirement | map[string, bool] | Guild MFA requirement notices, keyed by guild ID |-The `dismissed_upsells` field stores dismissed upsells.+## Dismissed upsells object### Structure| Field | Type | Description || --- | --- | --- |-| picker_premium | bool | Whether the premium picker upsell is dismissed |+| picker_premium | bool | Whether the premium upsell in the picker is dismissed |## Guild mature content agreements object-The `guild_nsfw_agreements` field stores mature content acknowledgements. Acceptance is recorded per target, so accepting for a guild does not record acceptance for its categories or channels.+The guilds, categories and channels where the account accepted the mature content notice, each accepted separately.### Structure| Field | Type | Description || --- | --- | --- |-| agreed_channel_ids | array[string] | Channel IDs whose mature content notice was accepted |-| agreed_guild_ids | array[string] | Guild IDs whose mature content notice was accepted |-| agreed_category_ids | array[string] | Category IDs whose mature content notice was accepted |+| agreed_channel_ids | array[string] | Channel IDs |+| agreed_guild_ids | array[string] | Guild IDs |+| agreed_category_ids | array[string] | Category IDs |## What's new state object-The `whats_new` field stores the most recently dismissed update entry.-### Structure| Field | Type | Description || --- | --- | --- |-| last_dismissed_entry_id? | string | Most recently dismissed update entry ID |+| last_dismissed_entry_id? | string | ID of the last dismissed update entry |## Privacy preferences object-The `privacy` field stores client privacy behaviour. Fluxer reads none of it, and none of it changes the privacy fields of the [user settings object](/http-api/users/#user-settings-object), which control what Fluxer itself discloses about the account.+These preferences don't change the privacy fields of the [user settings object](/http-api/users/#user-settings-object).### Structure| Field | Type | Description || --- | --- | --- |-| disable_stream_previews<sup>1</sup> | bool | Whether stream previews are disabled |+| disable_stream_previews | bool | Whether the client stops uploading stream preview frames || show_active_now? | bool | Whether the active now view is shown |-| preupload_message_attachments? | bool | Whether message attachments are uploaded before the message is sent |--<sup>1</sup> The only field in this group whose effect reaches past the account's own view. While it is true the first-party client uploads no stream preview frame, so no other viewer receives one+| preupload_message_attachments? | bool | Whether attachments upload before the message is sent |## Local user spam overrides object-The `local_spam_overrides` field stores client-local classifications that override the [SPAMMER public user flag](/http-api/users/#public-user-flags) in display only. Fluxer neither reads these lists nor changes any flag because of them.+Overrides for how the client shows the [SPAMMER public user flag](/http-api/users/#public-user-flags). They change only the display, and `not_spammer_user_ids` wins over both the other list and the flag.### Structure| Field | Type | Description || --- | --- | --- |-| spammer_user_ids | array[string] | User IDs presented locally as spammers |-| not_spammer_user_ids<sup>1</sup> | array[string] | User IDs presented locally as not being spammers |--<sup>1</sup> This list wins over `spammer_user_ids` and over the `SPAMMER` flag, so a user ID present in both lists is presented as not a spammer+| spammer_user_ids | array[string] | User IDs shown as spammers |+| not_spammer_user_ids | array[string] | User IDs shown as not spammers |## Sound settings object-The `sound` field controls sound playback, master volume, and per-sound overrides.+Volumes are percentages from 0 to 200, where 100 is the default.### Structure| Field | Type | Description || --- | --- | --- |-| all_sounds_disabled | bool | Whether every application sound is disabled |-| master_volume?<sup>1</sup> | double | Master sound volume |-| disabled_sounds | map[string, bool] | Disabled state keyed by [sound identifier](#sound-identifiers) |-| sound_overrides<sup>2</sup> | map[string, double] | Volume override keyed by [sound identifier](#sound-identifiers) |--<sup>1</sup> A percentage. The first-party client clamps it to the range 0 through 200, treats 100 as the default, and omits the field entirely while it holds the default--<sup>2</sup> A percentage on the same scale, and the complete volume for that one sound+| all_sounds_disabled | bool | Whether all sounds are off |+| master_volume? | double | Master volume |+| disabled_sounds | map[string, bool] | Disabled sounds keyed by [sound identifier](#sound-identifiers) |+| sound_overrides | map[string, double] | Volume per sound, keyed by [sound identifier](#sound-identifiers) |### Sound identifiers-Both maps are keyed by an arbitrary string, and Fluxer stores and returns any key unchanged. The first-party client uses the identifiers below, and the first-party client ignores a key outside this set.+The API accepts any key. Fluxer clients use these.| Value | Description || --- | --- |-| deaf | Deafening sound |-| undeaf | Undeafening sound |-| mute | Muting sound |-| unmute | Unmuting sound |-| message | Message notification sound |-| direct-message | Direct message notification sound |-| same-channel-message | Notification sound for the channel already in view |-| incoming-ring | Incoming call sound |-| user-join | Voice participant join sound |-| user-leave | Voice participant leave sound |-| user-move | Voice participant move sound |-| viewer-join | Stream viewer join sound |-| viewer-leave | Stream viewer leave sound |-| voice-disconnect | Voice disconnection sound |-| camera-on | Camera enabled sound |-| camera-off | Camera disabled sound |-| screen-share-start | Screen share start sound |-| screen-share-stop | Screen share stop sound |+| deaf | Deafen |+| undeaf | Undeafen |+| mute | Mute |+| unmute | Unmute |+| message | Message notification |+| direct-message | Direct message notification |+| same-channel-message | Message in the channel you're viewing |+| incoming-ring | Incoming call |+| user-join | Someone joins voice |+| user-leave | Someone leaves voice |+| user-move | Someone is moved in voice |+| viewer-join | Stream viewer joins |+| viewer-leave | Stream viewer leaves |+| voice-disconnect | Voice disconnects |+| camera-on | Camera on |+| camera-off | Camera off |+| screen-share-start | Screen share starts |+| screen-share-stop | Screen share stops |## Spellcheck settings object-The `spellcheck` field controls spellchecking, the selected languages, and the personal dictionary.-### Structure| Field | Type | Description || --- | --- | --- |-| enabled? | bool | Whether spellchecking is enabled |-| languages<sup>1</sup> | array[string] | Selected spellcheck languages |-| personal_dictionary<sup>1</sup> | array[string] | Words in the personal dictionary |-| auto_detect? | bool | Whether spellcheck languages are detected automatically |-| engine?<sup>2</sup> | string | Selected spellcheck engine identifier |--<sup>1</sup> The first-party client drops an empty entry and a duplicate entry when it reads the snapshot--<sup>2</sup> The first-party client recognises `auto`, `system`, and `hunspell`, and ignores any other value+| enabled? | bool | Whether spellcheck is on |+| languages | array[string] | Spellcheck languages |+| personal_dictionary | array[string] | Words in the personal dictionary |+| auto_detect? | bool | Whether languages are detected automatically |+| engine? | string | Spellcheck engine (`auto`, `system` or `hunspell`) |## Search engine settings object-The `search_engines` field stores the selected external providers. Every identifier names a provider the client defines, and Fluxer neither validates nor resolves one.+Provider IDs that the client defines.### Structure| Field | Type | Description || --- | --- | --- |-| text_search_engine_id? | string | Text search engine identifier |-| reverse_image_search_engine_id? | string | Reverse image search engine identifier |-| translation_provider_id? | string | Translation provider identifier |+| text_search_engine_id? | string | Text search engine |+| reverse_image_search_engine_id? | string | Reverse image search engine |+| translation_provider_id? | string | Translation provider |## Permission layout settings object-The `permission_layout` field controls the layout of the [permission](/http-api/permissions/) editor.+Layout of the [permission](/http-api/permissions/) editor.### Structure@@ -680,22 +586,20 @@ The `permission_layout` field controls the layout of the [permission](/http-api/| Value | Name | Description || --- | --- | --- |-| 0 | PERMISSION_LAYOUT_MODE_UNSPECIFIED | No explicit layout is selected |-| 1 | PERMISSION_LAYOUT_MODE_COMFY | Use the roomy permission layout |-| 2 | PERMISSION_LAYOUT_MODE_DENSE | Use the dense permission layout |+| 0 | PERMISSION_LAYOUT_MODE_UNSPECIFIED | No layout is set |+| 1 | PERMISSION_LAYOUT_MODE_COMFY | Roomy layout |+| 2 | PERMISSION_LAYOUT_MODE_DENSE | Dense layout |### Permission grid modes| Value | Name | Description || --- | --- | --- |-| 0 | PERMISSION_GRID_MODE_UNSPECIFIED | No explicit grid mode is selected |-| 1 | PERMISSION_GRID_MODE_SINGLE | Show one permission category at a time |-| 2 | PERMISSION_GRID_MODE_GRID | Show permission categories in a grid |+| 0 | PERMISSION_GRID_MODE_UNSPECIFIED | No grid mode is set |+| 1 | PERMISSION_GRID_MODE_SINGLE | One category at a time |+| 2 | PERMISSION_GRID_MODE_GRID | Categories in a grid |## Guild member layout settings object-The `guild_member_layout` field controls how the guild member view presents its members.-### Structure| Field | Type | Description |@@ -706,26 +610,22 @@ The `guild_member_layout` field controls how the guild member view presents its| Value | Name | Description || --- | --- | --- |-| 0 | GUILD_MEMBER_VIEW_MODE_UNSPECIFIED | No explicit view mode is selected |-| 1 | GUILD_MEMBER_VIEW_MODE_TABLE | Display guild members in a table |-| 2 | GUILD_MEMBER_VIEW_MODE_GRID | Display guild members in a grid |+| 0 | GUILD_MEMBER_VIEW_MODE_UNSPECIFIED | No view mode is set |+| 1 | GUILD_MEMBER_VIEW_MODE_TABLE | Table |+| 2 | GUILD_MEMBER_VIEW_MODE_GRID | Grid |## Guild folder expanded state object-The `guild_folders` field stores which guild folders are expanded in the sidebar. The folders themselves are `guild_folders` on the [user settings object](/http-api/users/#user-settings-object).+The folders themselves are `guild_folders` on the [user settings object](/http-api/users/#user-settings-object).### Structure| Field | Type | Description || --- | --- | --- |-| expanded_folder_ids<sup>1</sup> | array[fixed64] | Expanded guild folder identifiers |--<sup>1</sup> Each value is the `id` of a [guild folder object](/http-api/users/#guild-folder-object). An identifier for a folder the layout no longer holds stays in the array and has no effect+| expanded_folder_ids | array[fixed64] | IDs of expanded [guild folders](/http-api/users/#guild-folder-object) |## Hidden guild list buttons object-The `hidden_guild_buttons` field stores which guild list controls are hidden.-### Structure| Field | Type | Description |@@ -735,103 +635,82 @@ The `hidden_guild_buttons` field stores which guild list controls are hidden.## Keyboard mode intro state object-The `keyboard_mode_intro` field stores whether the keyboard navigation introduction has been seen.-### Structure| Field | Type | Description || --- | --- | --- |-| seen | bool | Whether the keyboard navigation introduction was seen |+| seen | bool | Whether the keyboard navigation introduction was shown |## Input monitoring prompts state object-The `input_monitoring` field stores whether the input monitoring prompt has been seen. No live surface reads or writes it.-### Structure| Field | Type | Description || --- | --- | --- |-| seen_cta | bool | Whether the input monitoring call to action was seen |+| seen_cta | bool | Whether the input monitoring prompt was shown |## Voice prompts state object-The `voice_prompts` field stores which voice confirmation prompts the account has suppressed.+Voice confirmations the account chose to skip.### Structure| Field | Type | Description || --- | --- | --- |-| skip_hide_own_camera_confirm | bool | Whether hiding the caller's own camera skips confirmation |-| skip_hide_own_screenshare_confirm | bool | Whether hiding the caller's own screen share skips confirmation |+| skip_hide_own_camera_confirm | bool | Skip confirming before hiding your own camera |+| skip_hide_own_screenshare_confirm | bool | Skip confirming before hiding your own screen share |+| skip_p2p_join_confirm | bool | Skip confirming before joining a peer-to-peer call |## Announcement prompts state object-The `announcement_prompts` field stores which announcement channel prompts the account has hidden.-### Structure| Field | Type | Description || --- | --- | --- |-| hide_publish_nudge | bool | Whether the prompt to publish a new message in an [announcement channel](/topics/announcement-channels/) is hidden |+| hide_publish_nudge | bool | Whether the prompt to publish in an [announcement channel](/topics/announcement-channels/) is hidden |## Sudo prompt state object-The `sudo_prompt` field stores the verification method the account used most recently, so a client can preselect it the next time [sudo mode](/http-api/users/mfa/#sudo-mode) is required.+The verification method used last for [sudo mode](/http-api/users/mfa/#sudo-mode), which clients preselect next time.### Structure| Field | Type | Description || --- | --- | --- |-| last_used_mfa_method?<sup>1</sup> | int32 | [MFA method](#mfa-methods) most recently used for sudo verification |--<sup>1</sup> The assigned values correspond to `totp` and `webauthn` in `mfa_method` of the [sudo verification object](/http-api/users/mfa/#sudo-verification-object)+| last_used_mfa_method? | int32 | [MFA method](#mfa-methods) |### MFA methods| Value | Name | Description || --- | --- | --- || 0 | MFA_METHOD_UNSPECIFIED | No method is recorded |-| 1 | MFA_METHOD_TOTP | Time-based one-time password |-| 3 | MFA_METHOD_WEBAUTHN | WebAuthn credential |--The value 2 is not assigned.+| 1 | MFA_METHOD_TOTP | Authenticator app (`totp`) |+| 3 | MFA_METHOD_WEBAUTHN | Security key or passkey (`webauthn`) |## Keybind settings object-The `keybinds` field stores custom keybinds and voice transmit behaviour.-### Structure| Field | Type | Description || --- | --- | --- || custom_keybinds | array[[custom keybind](#custom-keybind-object) object] | Custom keybinds |-| transmit_mode<sup>1</sup> | string | Voice transmit mode |-| push_to_talk_release_delay_ms?<sup>2</sup> | uint32 | Push-to-talk release delay in milliseconds |--<sup>1</sup> The first-party client recognises `voice_activity` and `voice_push_to_talk`, and falls back to `voice_activity` for the empty string and for any other value--<sup>2</sup> Read only while `transmit_mode` is `voice_push_to_talk`. The first-party client clamps it to the range 20 through 2000, treats 20 as the default, and omits the field entirely while it holds the default+| transmit_mode | string | `voice_activity` (default) or `voice_push_to_talk` |+| push_to_talk_release_delay_ms? | uint32 | Push-to-talk release delay in milliseconds (20-2000) |## Custom keybind object-One entry binds one input combination to one action. The entry has its own `enabled` flag and its combination has another. The first-party client gates a custom keybind on the entry's flag alone, and reads `enabled` on a combination only for a built-in default binding.-### Structure| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | string | Keybind identifier |-| action?<sup>2</sup> | string | Action performed by the keybind |+| id | string | Keybind ID chosen by the client |+| action? | string | Action the client runs || combo? | [keybind combo](#keybind-combo-object) object | Input combination |-| enabled | bool | Whether the keybind is enabled |--<sup>1</sup> Chosen by the client. The first-party client generates a replacement when it reads an entry whose `id` is the empty string--<sup>2</sup> An action name the client defines. The first-party client keeps an entry whose action it does not recognise and clears `action`+| enabled | bool | Whether the keybind is on |## Keybind combo object-One combination describes the key, modifiers, and buttons that trigger a keybind. The modifier flags are independent of each other, and `ctrl_or_meta` is a modifier of its own.+The key, modifiers and buttons that trigger a keybind.### Structure@@ -839,62 +718,54 @@ One combination describes the key, modifiers, and buttons that trigger a keybind| --- | --- | --- || key | string | Key value || code? | string | Physical key code |-| ctrl_or_meta<sup>1</sup> | bool | Whether Control or Meta is required according to the platform |-| ctrl | bool | Whether Control is required |-| alt | bool | Whether Alt is required |-| shift | bool | Whether Shift is required |-| meta | bool | Whether Meta is required |-| global? | bool | Whether the combination is registered globally |-| enabled?<sup>2</sup> | bool | Whether the combination is active |-| modifier_only | bool | Whether the combination contains only modifier keys |-| both_sides | bool | Whether either side of a paired modifier is accepted |+| ctrl_or_meta | bool | Whether Meta on macOS or Control elsewhere is needed |+| ctrl | bool | Whether Control is needed |+| alt | bool | Whether Alt is needed |+| shift | bool | Whether Shift is needed |+| meta | bool | Whether Meta is needed |+| global? | bool | Whether the combination works when the app is unfocused |+| enabled? | bool | Ignored for custom keybinds, which use the keybind's own `enabled` |+| modifier_only | bool | Whether the combination is only modifier keys |+| both_sides | bool | Whether either side of a paired modifier works || mouse_button? | uint32 | Mouse button number || gamepad_button? | uint32 | Gamepad button number |-<sup>1</sup> Resolves to Meta on macOS and to Control on every other platform, so one stored combination expresses the platform-native accelerator--<sup>2</sup> An absent value here reads as active, the opposite of the default for `enabled` on the [custom keybind](#custom-keybind-object) that owns the combination-## Chat input settings object-The `chat_input` field controls message composer behaviour.-### Structure| Field | Type | Description || --- | --- | --- |-| convert_emoticons? | bool | Whether emoticons are converted to emoji |+| convert_emoticons? | bool | Whether emoticons turn into emoji |## Reaction emoji object-The `double_tap_reaction` field stores the emoji that a double tap on a message adds as a reaction. It has the same shape as the [reaction emoji object](/gateway/events/#reaction-emoji-object). A Unicode emoji sets only `name`, and a custom emoji sets both `id` and `name`.+The same format as the [reaction emoji object](/gateway/events/#reaction-emoji-object).### Structure| Field | Type | Description || --- | --- | --- |-| id?<sup>1</sup> | string | Custom emoji ID, absent for a Unicode emoji |-| name | string | Unicode emoji, or the custom emoji's name |--<sup>1</sup> The decimal form of a [snowflake](/snowflakes/). Fluxer never resolves it, so it can name a custom emoji the account can no longer use+| id? | string | The ID of a custom emoji, absent for a Unicode emoji |+| name | string | The Unicode emoji, or the custom emoji's name |## Double tap actions-The `double_tap_action` field selects what a double tap on a message does in the mobile client.+What a double tap on a message does on mobile.| Value | Name | Description || --- | --- | --- |-| 0 | DOUBLE_TAP_ACTION_UNSPECIFIED | No explicit action is selected, so the client uses its default of adding the `double_tap_reaction` emoji |-| 1 | DOUBLE_TAP_ACTION_REACT | Add the `double_tap_reaction` emoji as a reaction |-| 2 | DOUBLE_TAP_ACTION_EDIT | Edit the message, when it is the account's own message |+| 0 | DOUBLE_TAP_ACTION_UNSPECIFIED | No action is set, which Fluxer clients treat as react |+| 1 | DOUBLE_TAP_ACTION_REACT | React with `double_tap_reaction` |+| 2 | DOUBLE_TAP_ACTION_EDIT | Edit the message if it's your own || 3 | DOUBLE_TAP_ACTION_NONE | Do nothing |## Swipe right to left actions-The `swipe_right_to_left_action` field selects what a right to left swipe in a channel does in the mobile client.+What a right to left swipe in a channel does on mobile.| Value | Name | Description || --- | --- | --- |-| 0 | SWIPE_ACTION_UNSPECIFIED | No explicit action is selected |+| 0 | SWIPE_ACTION_UNSPECIFIED | No action is set || 1 | SWIPE_ACTION_CHANNEL_DETAILS | Open the channel details |-| 2 | SWIPE_ACTION_REPLY | Reply to the swiped message |+| 2 | SWIPE_ACTION_REPLY | Reply to the message |diff --git a/fluxer_docs/src/content/docs/http-api/users/settings.mdx b/fluxer_docs/src/content/docs/http-api/users/settings.mdxindex 60b6b8781..dead137e0 100644--- a/fluxer_docs/src/content/docs/http-api/users/settings.mdx+++ b/fluxer_docs/src/content/docs/http-api/users/settings.mdx@@ -1,39 +1,31 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: User settings-description: Account-wide settings, guild folders, notification settings, and voice activity sharing.+description: Get and change your account settings, guild folders and notification settings for guilds and DMs.---import RouteHeader from '@/components/RouteHeader.astro';-User settings include account-wide [preferences](/http-api/users/#user-settings-object) and [notification settings](#user-guild-settings-object) for each guild and for private channels.--Every route here is user-only and rejects a bot or OAuth2 bearer credential with 403 `ACCESS_DENIED`.+These routes change your account-wide [user settings](/http-api/users/#user-settings-object) and the [notification settings](#user-guild-settings-object) for each guild and for DMs. Only user tokens can call them, and bot and OAuth2 tokens get 403 `ACCESS_DENIED`.## Presence status values| Value | Description || --- | --- |-| online | User is presented as online |-| dnd | User is presented as do not disturb |-| idle | User is presented as idle |-| invisible<sup>1</sup> | User is presented as offline to everyone else |--<sup>1</sup> The account stays connected and keeps receiving Gateway traffic while this value is stored--:::note[The settings boundary accepts only a chosen status]-Gateway presence also uses offline, which describes an account with no active session. [Modify current user settings](#modify-current-user-settings) rejects offline in both `status` and `status_resets_to`, and invisible is the stored form of appearing offline while connected.-:::+| online | Shown as online |+| dnd | Shown as do not disturb |+| idle | Shown as idle |+| invisible | Shown as offline to everyone else while the account stays connected |## Theme values| Value | Description || --- | --- || dark | Dark theme |-| dark_legacy | Previous generation of the dark theme |+| dark_legacy | Previous dark theme || coal | Coal theme || light | Light theme |-| system | Theme follows the operating system |+| system | Follows the operating system |## Notification levels@@ -42,22 +34,18 @@ Gateway presence also uses offline, which describes an account with no active se| 0 | ALL_MESSAGES | Notify for every message || 1 | ONLY_MENTIONS | Notify only for mentions || 2 | NO_MESSAGES | Do not notify for messages |-| 3 | INHERIT | Inherit the parent setting |+| 3 | INHERIT | Use the parent setting |## Guild mute configuration object-Mute expiry for a guild, a private channel group, a channel override, or a [thread member](/http-api/thread-members/#thread-member-object).+Mute expiry for a guild, for DMs, for a channel override or for a [thread member](/http-api/thread-members/#thread-member-object).### Structure| Field | Type | Description || --- | --- | --- |-| end_time<sup>1</sup> | ?ISO8601 timestamp | The time at which the temporary mute stops applying, or null for no expiry |-| selected_time_window<sup>2</sup> | integer | The opaque mute duration the client selected |--<sup>1</sup> An `end_time` in the past no longer mutes notifications but can remain present in the response--<sup>2</sup> The value is returned unchanged and takes no part in notification delivery. An absent value is returned as 0+| end_time | ?ISO8601 timestamp | When the mute stops, or null for no expiry |+| selected_time_window | integer | The mute duration the client selected, or 0 |## Guild mute configuration input object@@ -67,31 +55,27 @@ The input form of the [guild mute configuration object](#guild-mute-configuratio| Field | Type | Description || --- | --- | --- |-| end_time?<sup>1</sup> | ?ISO8601 timestamp \| integer | The time at which the temporary mute stops applying, or null for no expiry |-| selected_time_window | integer | The opaque mute duration the client selected, stored verbatim |+| end_time?<sup>1</sup> | ?ISO8601 timestamp \| integer | When the mute stops, or null for no expiry |+| selected_time_window | integer | The mute duration the client selected |-<sup>1</sup> The value is an ISO 8601 timestamp string or Unix milliseconds. A string that is not a valid timestamp is rejected with `INVALID_ISO_TIMESTAMP`+<sup>1</sup> An ISO 8601 string or Unix milliseconds## Channel notification override object-Notification settings stored for one channel.+Notification settings for one channel.### Structure| Field | Type | Description || --- | --- | --- |-| collapsed<sup>1</sup> | boolean | Whether the channel category is collapsed |+| collapsed | boolean | Whether the channel category is collapsed || message_notifications | integer | [Notification level](#notification-levels) |-| muted | boolean | Whether channel notifications are muted |-| mute_config | ?[guild mute configuration](#guild-mute-configuration-object) object | The mute configuration of the channel, or null when none is stored |-| unread_badges<sup>1</sup> <sup>2</sup> | ?integer | [Notification level](#notification-levels) for unread badges, or null to inherit |-| flags?<sup>3</sup> | integer | The [new post notification](/http-api/forums/#new-post-notifications) flags, `NEW_FORUM_THREADS_OFF` (`1 << 13`) and `NEW_FORUM_THREADS_ON` (`1 << 14`) |--<sup>1</sup> The value controls client display and does not affect notification delivery--<sup>2</sup> Every response has the member, with null meaning no level is set+| muted | boolean | Whether the channel is muted |+| mute_config | ?[guild mute configuration](#guild-mute-configuration-object) object | The mute configuration, or null when none is stored |+| unread_badges | ?integer | [Notification level](#notification-levels) for unread badges, or null to inherit |+| flags?<sup>1</sup> | integer | [New post notification](/http-api/forums/#new-post-notifications) flags, `NEW_FORUM_THREADS_OFF` (`1 << 13`) and `NEW_FORUM_THREADS_ON` (`1 << 14`) |-<sup>3</sup> Present only in the settings of a guild, when the stored value is non-zero and the caller is a user session that declares the [`channel_threads` client capability](/http-api/threads/#client-capability)+<sup>1</sup> Only in guild settings, when the value is not zero and the session declares the [`channel_threads` client capability](/http-api/threads/#client-capability)## Channel notification override input object@@ -103,46 +87,38 @@ The input form of the [channel notification override object](#channel-notificati| --- | --- | --- || collapsed | boolean | Whether the channel category is collapsed || message_notifications | integer | [Notification level](#notification-levels) |-| muted | boolean | Whether channel notifications are muted |-| mute_config? | ?[guild mute configuration input](#guild-mute-configuration-input-object) object | The mute configuration of the channel, or null to clear it |+| muted | boolean | Whether the channel is muted |+| mute_config? | ?[guild mute configuration input](#guild-mute-configuration-input-object) object | The mute configuration, or null to clear it || unread_badges? | ?integer | [Notification level](#notification-levels) for unread badges, or null to inherit |-| flags?<sup>1</sup> | integer | The [new post notification](/http-api/forums/#new-post-notifications) flags |--<sup>1</sup> Fluxer discards every bit other than `NEW_FORUM_THREADS_OFF` and `NEW_FORUM_THREADS_ON`+| flags?<sup>1</sup> | integer | [New post notification](/http-api/forums/#new-post-notifications) flags |-Fluxer ignores `flags` in the private channel settings and from a caller other than a user session that declares `channel_threads`. An omitted or ignored `flags` keeps the stored value.+<sup>1</sup> Fluxer keeps only `NEW_FORUM_THREADS_OFF` and `NEW_FORUM_THREADS_ON`. It ignores `flags` in DM settings and when the session doesn't declare `channel_threads`. An omitted or ignored `flags` keeps the stored value## User guild settings object-Notification settings for one guild, or for every private channel when `guild_id` is null.+Notification settings for one guild, or for all DMs when `guild_id` is null.### Structure| Field | Type | Description || --- | --- | --- |-| guild_id<sup>1</sup> | ?snowflake | The ID of the guild, or null for direct message and group DM settings |+| guild_id | ?snowflake | The ID of the guild, or null for DM settings || message_notifications | integer | The default [notification level](#notification-levels) |-| muted | boolean | Whether the guild or private channel group is muted |+| muted | boolean | Whether the guild or DMs are muted || mute_config | ?[guild mute configuration](#guild-mute-configuration-object) object | The mute configuration, or null when none is stored |-| mobile_push | boolean | Whether notification delivery is enabled for the guild |+| mobile_push | boolean | Whether push notifications are enabled || suppress_everyone | boolean | Whether `@everyone` mentions are suppressed || suppress_roles | boolean | Whether role mentions are suppressed |-| hide_muted_channels<sup>3</sup> | boolean | Whether muted channels are hidden |-| channel_overrides<sup>2</sup> <sup>6</sup> | ?map[snowflake, [channel notification override](#channel-notification-override-object) object] | The per-channel overrides, or null when none are set |-| unread_badges<sup>3</sup> <sup>5</sup> | ?integer | The default [notification level](#notification-levels) for unread badges, or null to follow `message_notifications` |-| version<sup>4</sup> | integer | The monotonic revision of this settings object |--<sup>1</sup> The private channel settings are always serialised with `guild_id` null--<sup>2</sup> An override map holding no entry is serialised as null+| hide_muted_channels | boolean | Whether muted channels are hidden |+| channel_overrides<sup>1</sup> | ?map[snowflake, [channel notification override](#channel-notification-override-object) object] | The per-channel overrides, or null when none are set |+| unread_badges | ?integer | The default [notification level](#notification-levels) for unread badges, or null to follow `message_notifications` |+| version<sup>2</sup> | integer | The revision of this settings object |-<sup>3</sup> The value controls client display and does not affect notification delivery+<sup>1</sup> Without `channel_threads`, a session gets no override for a forum or media channel-<sup>4</sup> The value increases on every stored write, including one that changes no other member, so a client can discard a stale [User Guild Settings Update](/gateway/events/#user-guild-settings-update)+<sup>2</sup> Increases on every write. Ignore a [User Guild Settings Update](/gateway/events/#user-guild-settings-update) whose `version` is lower than the one you have-<sup>5</sup> Every response has the member, with null meaning no level is set--<sup>6</sup> A user session that does not declare `channel_threads` receives no override for a forum or media channel+`suppress_everyone` and `suppress_roles` apply only in guilds, and a suppressed mention doesn't add to `mention_count` or [recent mentions](/http-api/users/content/#list-recent-mentions).### Example@@ -164,60 +140,46 @@ Notification settings for one guild, or for every private channel when `guild_id## Guild settings update fields-Both notification settings operations accept exactly these fields. Every field is optional, and an omitted field leaves the stored value unchanged.+Both notification settings routes accept these fields. An omitted field keeps its stored value.### Structure| Field | Type | Description || --- | --- | --- |-| message_notifications? | integer | The default [notification level](#notification-levels), INHERIT for new settings |-| muted? | boolean | Whether the guild is muted, default false for new settings |+| message_notifications? | integer | The default [notification level](#notification-levels), default `INHERIT` |+| muted? | boolean | Whether the guild is muted, default false || mute_config? | ?[guild mute configuration input](#guild-mute-configuration-input-object) object | The mute configuration, or null to clear it |-| mobile_push? | boolean | Whether notification delivery is enabled, default true for new settings |-| suppress_everyone? | boolean | Whether `@everyone` mentions are suppressed, default false for new settings |-| suppress_roles? | boolean | Whether role mentions are suppressed, default false for new settings |-| hide_muted_channels? | boolean | Whether muted channels are hidden, default false for new settings |+| mobile_push? | boolean | Whether push notifications are enabled, default true |+| suppress_everyone? | boolean | Whether `@everyone` mentions are suppressed, default false |+| suppress_roles? | boolean | Whether role mentions are suppressed, default false |+| hide_muted_channels? | boolean | Whether muted channels are hidden, default false || channel_overrides?<sup>1</sup> | ?map[snowflake, [channel notification override input](#channel-notification-override-input-object) object] | The complete per-channel override map, or null to clear it || unread_badges? | ?integer | The default [notification level](#notification-levels) for unread badges, or null to follow `message_notifications` |-<sup>1</sup> The supplied map becomes the complete override set, and an empty map clears every override. A write from a user session that does not declare `channel_threads` keeps the stored overrides of forum and media channels--:::note[Which of these fields the server reads]-Fluxer reads `suppress_everyone` and `suppress_roles` when it counts the mentions in a guild message. Push notification delivery reads `muted`, `mute_config`, `mobile_push`, `message_notifications`, `suppress_everyone`, and `suppress_roles`, and the `muted`, `mute_config`, `message_notifications`, and `flags` members of a channel override. Every other field is stored and returned unchanged.-:::--For a message in a thread, push delivery reads the override of the parent channel and the `muted` and `mute_config` of the override of the parent category. It reads no override keyed by a thread ID. [Thread member flags](/http-api/thread-members/#thread-member-flags) and the thread mute set by [Modify thread member settings](/http-api/thread-members/#modify-thread-member-settings) apply to a member. A user who has not joined the thread is notified only for a direct mention or a role mention.--A direct mention of the account always counts. An `@everyone` or `@here` mention counts only while `suppress_everyone` is false, and a role mention only while `suppress_roles` is false. In a thread, an `@everyone` or `@here` mention counts only for a [thread member](/http-api/thread-members/). A mention that counts increments `mention_count` on the channel's [read state](/http-api/read-states/#read-state-object) and adds an entry to the [recent mention history](/http-api/users/content/#list-recent-mentions). A guild message whose every mention is suppressed records nothing.--Neither field is read outside a guild. A direct message and a group DM collect only direct mentions, and every one of them counts whatever the private channel settings hold.+<sup>1</sup> The map replaces every override, and an empty map clears them. Without `channel_threads`, the stored overrides of forum and media channels stay## User settings update object-The input form of the [user settings object](/http-api/users/#user-settings-object). Every field is optional, and an omitted field leaves the stored value unchanged. A field present with a value overwrites the stored value in full, including an array or object member.--The staff-only fields are the exception. Every update resets `suppress_unprivileged_self_mentions`, `suppress_unprivileged_self_mentions_bypass_user_ids`, and `staff_dm_access_user_ids` to false, empty, and empty for an ordinary account, including an update that names none of them.--Further members are accepted and ignored. Nothing reads `guild_positions`, and only [Modify voice activity sharing](#modify-voice-activity-sharing) writes `default_share_voice_activity`.+The input form of the [user settings object](/http-api/users/#user-settings-object). An omitted field keeps its stored value, and a field you send replaces the stored value in full.### Structure| Field | Type | Description || --- | --- | --- |-| status? | string | [Presence status](#presence-status-values) |-| status_resets_at?<sup>1</sup> | ?ISO8601 timestamp \| integer | The time at which the first-party client sets `status` to `status_resets_to`, or null to clear it |-| status_resets_to? | ?string | [Presence status](#presence-status-values) that the first-party client sets at `status_resets_at`, or null to clear it |+| status? | string | [Presence status](#presence-status-values), not `offline` |+| status_resets_at?<sup>1</sup> | ?ISO8601 timestamp \| integer | The time your client should switch `status` to `status_resets_to`, or null to clear it |+| status_resets_to? | ?string | [Presence status](#presence-status-values) to set at `status_resets_at`, not `offline`, or null to clear it || theme? | string | [Theme value](#theme-values) || locale?<sup>2</sup> | string | Interface [locale](/topics/locales/#supported-locales) || restricted_guilds?<sup>3</sup> | array[snowflake] | The guilds where member direct messages are restricted (max 200) || bot_restricted_guilds?<sup>3</sup> | array[snowflake] | The guilds where bot direct messages are restricted (max 200) |-| default_guilds_restricted? | boolean | Whether newly joined guilds restrict member direct messages |-| bot_default_guilds_restricted? | boolean | Whether newly joined guilds restrict bot direct messages |-| inline_attachment_media? | boolean | Whether attachment media is rendered inline |-| inline_embed_media? | boolean | Whether embed media is rendered inline |-| gif_auto_play? | boolean | Whether GIF media plays automatically |-| render_embeds? | boolean | Whether message embeds are rendered |-| render_reactions? | boolean | Whether message reactions are rendered |+| default_guilds_restricted? | boolean | Whether new guilds restrict member direct messages |+| bot_default_guilds_restricted? | boolean | Whether new guilds restrict bot direct messages |+| inline_attachment_media? | boolean | Whether attachment media is shown inline |+| inline_embed_media? | boolean | Whether embed media is shown inline |+| gif_auto_play? | boolean | Whether GIFs play automatically |+| render_embeds? | boolean | Whether message embeds are shown |+| render_reactions? | boolean | Whether message reactions are shown || animate_emoji? | boolean | Whether custom emoji animate || animate_stickers? | integer | [Sticker animation setting](/http-api/users/#sticker-animation-settings) || render_spoilers? | integer | [Spoiler rendering setting](/http-api/users/#spoiler-rendering-settings) |@@ -225,68 +187,48 @@ Further members are accepted and ignored. Nothing reads `guild_positions`, and o| flags?<sup>4</sup> | integer | [Friend source flags](/http-api/users/#friend-source-flags) || friend_source_flags?<sup>4</sup> | integer | [Friend source flags](/http-api/users/#friend-source-flags) || incoming_call_flags?<sup>5</sup> | integer | [Incoming call flags](/http-api/users/#incoming-call-flags) |-| group_dm_add_permission_flags?<sup>6</sup> | integer | [Group DM add permission flags](/http-api/users/#group-dm-add-permission-flags) |-| guild_folders?<sup>7</sup> | array[[guild folder input](#guild-folder-input-object) object] | The complete guild folder layout (max 100) |-| custom_status?<sup>8</sup> | ?[custom status input](#custom-status-input-object) object | The custom status, or null to clear it |-| afk_timeout? | integer | The idle seconds before the account is presented as away (60-600) |+| group_dm_add_permission_flags?<sup>5</sup> | integer | [Group DM add permission flags](/http-api/users/#group-dm-add-permission-flags) |+| guild_folders? | array[[guild folder input](#guild-folder-input-object) object] | The complete guild folder layout (max 100) |+| custom_status? | ?[custom status input](#custom-status-input-object) object | The custom status, or null to clear it |+| afk_timeout? | integer | Idle seconds before the account is shown as away (60-600) || time_format? | integer | [Time format setting](/http-api/users/#time-format-settings) |-| developer_mode? | boolean | Whether developer mode is enabled |-| trusted_domains?<sup>9</sup> | array[string] | The trusted external link domains (max 1000, each 1-253 characters) |-| default_hide_muted_channels? | boolean | Whether newly joined guilds hide muted channels |-| sensitive_content_friend_dm_filter?<sup>10</sup> | integer | [Sensitive media filter](/http-api/users/#sensitive-media-filters) for friend direct messages |-| sensitive_content_non_friend_dm_filter?<sup>11</sup> | integer | [Sensitive media filter](/http-api/users/#sensitive-media-filters) for non-friend direct messages |-| sensitive_content_guild_filter?<sup>11</sup> | integer | [Guild sensitive media filter](/http-api/users/#guild-sensitive-media-filters) |-| suppress_unprivileged_self_mentions?<sup>12</sup> | boolean | Whether direct and reply mentions from unprivileged users are suppressed |-| suppress_unprivileged_self_mentions_bypass_user_ids?<sup>12</sup> | ?array[snowflake] | The users exempt from mention suppression |-| staff_dm_access_user_ids?<sup>12</sup> | ?array[snowflake] | The users granted staff direct message access |+| developer_mode? | boolean | Whether developer mode is on |+| trusted_domains?<sup>6</sup> | array[string] | The trusted external link domains (max 1000, each 1-253 characters) |+| default_hide_muted_channels? | boolean | Whether new guilds hide muted channels |+| sensitive_content_friend_dm_filter?<sup>7</sup> | integer | [Sensitive media filter](/http-api/users/#sensitive-media-filters) for friend direct messages |+| sensitive_content_non_friend_dm_filter?<sup>7</sup> | integer | [Sensitive media filter](/http-api/users/#sensitive-media-filters) for non-friend direct messages |+| sensitive_content_guild_filter?<sup>8</sup> | integer | [Guild sensitive media filter](/http-api/users/#guild-sensitive-media-filters) |+| suppress_unprivileged_self_mentions?<sup>9</sup> | boolean | Whether direct and reply mentions from unprivileged users are suppressed |+| suppress_unprivileged_self_mentions_bypass_user_ids?<sup>9</sup> | ?array[snowflake] | The users exempt from mention suppression |+| staff_dm_access_user_ids?<sup>9</sup> | ?array[snowflake] | The users granted staff direct message access || profile_privacy? | integer | [Profile privacy level](/http-api/users/#profile-privacy-levels) |-| privacy_setup_version?<sup>14</sup> | integer | The privacy setup version the user just reviewed (1-1000) |-| synced_preferences?<sup>13</sup> | ?string | The base64-encoded `fluxer.user.preferences.v1.SyncedPreferences` snapshot, or null to clear it |-| synced_preferences_base_hash?<sup>15</sup> | string | The lowercase hex SHA-256 of the decoded bytes of the stored snapshot the new one was built on |+| privacy_setup_version? | integer | The privacy setup version the user reviewed (1-1000), which also sets `privacy_setup_completed_at` to now |+| synced_preferences?<sup>10</sup> | ?string | The base64 `fluxer.user.preferences.v1.SyncedPreferences` snapshot, or null to clear it |+| synced_preferences_base_hash?<sup>11</sup> | string | The lowercase hex SHA-256 of the decoded bytes of the stored snapshot the new one was built on || guild_positions? | array[snowflake] | Accepted and ignored (max 200) || default_share_voice_activity? | boolean | Accepted and ignored |-<sup>1</sup> A string matches ISO 8601 and an integer is Unix milliseconds between 0 and 8640000000000000. Anything else is rejected with `INVALID_ISO_TIMESTAMP`--<sup>2</sup> The value is an exact entry of the [supported locale registry](/topics/locales/#supported-locales), never a negotiated nearest match. A change also applies to email localisation--<sup>3</sup> Duplicate identifiers are removed before the bound is applied, and an empty array clears the stored set--<sup>4</sup> `flags` is a legacy alias for `friend_source_flags`, which wins when both are supplied. `friend_source_flags` is bounded to 0 through 2147483647 while `flags` accepts any integer--<sup>5</sup> Fluxer reduces the value before it stores it. A value with `FRIENDS_ONLY` is stored as `FRIENDS_ONLY`, and a value with `NOBODY` and no `FRIENDS_ONLY` is stored as `NOBODY`. Both keep `SILENT_EVERYONE` when it is supplied, and any other value is stored unchanged--<sup>6</sup> A value with `FRIENDS_ONLY`, `NOBODY`, or `EVERYONE` is stored as one of those flags alone. `FRIENDS_ONLY` wins over the other two, and `NOBODY` wins over `EVERYONE`. Any other value is stored unchanged+<sup>1</sup> An ISO 8601 string or Unix milliseconds. Anything else fails with the field code `INVALID_ISO_TIMESTAMP`-<sup>7</sup> The array replaces the layout in full+<sup>2</sup> Must match a supported locale exactly. It also sets the language of emails Fluxer sends you-<sup>8</sup> The object replaces the stored custom status in full, so an omitted member is cleared. [Input normalisation](/http-api/#input-normalisation) turns an all-empty object into null, which clears the status+<sup>3</sup> Duplicates are removed-<sup>9</sup> The single entry `*` trusts every domain and cannot be combined with a concrete domain, which fails against `trusted_domains` with `INVALID_TRUSTED_DOMAINS`. An empty array clears the set+<sup>4</sup> `flags` is a legacy alias for `friend_source_flags`, which wins when both are sent-<sup>10</sup> An account that is not a verified adult can set only blur or block. Any other value fails against that field with `AGE_RESTRICTED`+<sup>5</sup> When the value has `FRIENDS_ONLY`, Fluxer keeps only that flag. Otherwise, when it has `NOBODY`, Fluxer keeps only `NOBODY`. `incoming_call_flags` also keeps `SILENT_EVERYONE`-<sup>11</sup> An account that is not a verified adult cannot modify this field, and supplying it fails against that field with `AGE_RESTRICTED`+<sup>6</sup> The single entry `*` trusts every domain. Combining it with another entry fails with the field code `INVALID_TRUSTED_DOMAINS`-<sup>12</sup> The field is staff-only+<sup>7</sup> An account that isn't a verified adult can set only blur or block, and any other value fails with the field code `AGE_RESTRICTED`-<sup>13</sup> The value runs to at most 699052 characters of base64 and decodes to at most 524288 bytes, the 512 KiB ceiling. A longer string returns 400 `INVALID_FORM_BODY`, an oversized decode fails with `TOO_LARGE`, and an undecodable value fails with `INVALID_FORMAT`+<sup>8</sup> An account that isn't a verified adult can't change this field, and it fails with the field code `AGE_RESTRICTED`-<sup>14</sup> Fluxer stores the value as given and sets `privacy_setup_completed_at` to the time of the update+<sup>9</sup> Only staff accounts can set these fields-<sup>15</sup> Fluxer checks the hash only when `synced_preferences` is also present. It hashes the stored snapshot exactly as the settings object returns it, and an empty snapshot hashes as zero bytes. When the hashes differ, Fluxer writes nothing and returns 409 `SYNCED_PREFERENCES_CONFLICT`. Without the field, the snapshot replaces the stored one unchecked+<sup>10</sup> At most 524288 bytes once decoded. A value that is too large fails with the field code `TOO_LARGE`, and one that doesn't decode fails with `INVALID_FORMAT`-Fluxer decodes an accepted `synced_preferences` value, re-encodes it canonically, and stores the result, so a snapshot with only zero values is stored as cleared and read back as the empty string.--:::caution[A rebuilt folder layout drops unresolved references]-The submitted array replaces the stored layout in full, and Fluxer keeps guild IDs it cannot resolve. A client that rebuilds the array from only the guilds it can render deletes every other guild ID from the stored layout. Send those guild IDs back, and hide them only in the rendered view.-:::--:::note[Fluxer edits the layout on its own]-Joining a guild prepends it to the uncategorised folder unless some folder already lists it. Leaving or losing a guild removes its ID from every folder and drops any non-uncategorised folder left empty. Each edit emits [User Settings Update](/gateway/events/#user-settings-update).-:::--Fluxer prepends an empty uncategorised folder to a submitted layout that omits one. A guild ID listed in more than one folder is kept only in the highest-ranked folder. Fluxer ranks the folders in two steps. A folder with a non-blank name outranks a folder without one. Between two folders that are both named or both unnamed, an ordinary folder outranks the uncategorised folder. The earliest folder in the submitted order wins a tie.+<sup>11</sup> Fluxer checks the hash only when `synced_preferences` is also sent. It hashes the stored snapshot exactly as the settings object returns it, and an empty snapshot hashes as zero bytes. When the hashes differ, Fluxer writes nothing and returns 409 `SYNCED_PREFERENCES_CONFLICT`. Without this field, the new snapshot replaces the stored one unchecked## Guild folder input object@@ -296,22 +238,28 @@ One folder of a submitted guild folder layout.| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | integer | The identifier of the folder |+| id<sup>1</sup> | integer | The ID of the folder || name? | ?string | The name of the folder (0-100 characters) |-| color?<sup>2</sup> | ?integer | The packed 24-bit RGB colour of the folder (0-16777215) |-| flags?<sup>2</sup> | integer | [Guild folder flags](/http-api/users/#guild-folder-flags) |-| icon?<sup>2</sup> | string | [Guild folder icon](/http-api/users/#guild-folder-icons) |-| guild_ids<sup>3</sup> | array[snowflake] | The guild IDs in display order (max 200) |+| color?<sup>2</sup> | ?integer | The packed 24-bit RGB color (0-16777215), default 0 |+| flags? | integer | [Guild folder flags](/http-api/users/#guild-folder-flags), default 0 |+| icon? | string | [Guild folder icon](/http-api/users/#guild-folder-icons), default `folder` |+| guild_ids | array[snowflake] | The guild IDs in display order (max 200) |++<sup>1</sup> At least `-1`, which is the uncategorized folder-<sup>1</sup> The value is at least `-1`, and `-1` identifies the uncategorised folder+<sup>2</sup> Out-of-range values fail with `COLOR_VALUE_TOO_LOW` or `COLOR_VALUE_TOO_HIGH`-<sup>2</sup> An omitted `color` is stored as `0`, an omitted `flags` as `0`, and an omitted `icon` as `folder`. A `color` below 0 fails with `COLOR_VALUE_TOO_LOW` and one above 16777215 with `COLOR_VALUE_TOO_HIGH`+Fluxer adds an empty uncategorized folder when your layout has none. A guild ID in more than one folder stays in only one of them. A folder with a name wins over one without, then any folder wins over the uncategorized folder, then the earlier folder wins.++:::caution[Send back guild IDs you don't show]+The array replaces the stored layout, including guild IDs your client can't resolve. Send those IDs back too, or the update deletes them from the layout.+:::-<sup>3</sup> Duplicate identifiers within one folder are removed before the bound is applied+Joining a guild adds it to the uncategorized folder. Leaving a guild removes it from every folder and deletes every folder left empty except the uncategorized folder. Both send [User Settings Update](/gateway/events/#user-settings-update).## Custom status input object-A custom status as submitted with a settings update.+A custom status in a settings update.### Structure@@ -319,41 +267,35 @@ A custom status as submitted with a settings update.| --- | --- | --- || text?<sup>1</sup> | ?string | The status text (1-128 characters) || expires_at?<sup>2</sup> | ?ISO8601 timestamp \| integer | The expiry as a timestamp string or Unix milliseconds, or null for no expiry |-| emoji_id?<sup>3</sup> | ?snowflake | The custom emoji to display |-| emoji_name?<sup>3</sup> | ?string | The Unicode emoji to display (1-32 characters) |+| emoji_id?<sup>3</sup> | ?snowflake | The custom emoji to show |+| emoji_name?<sup>3</sup> | ?string | The Unicode emoji to show (1-32 characters) |-<sup>1</sup> Fluxer measures the length after [input normalisation](/http-api/#input-normalisation), which turns an empty string into null. Blocklisted text or a blocklisted link is rejected with 403 `CONTENT_BLOCKED`+<sup>1</sup> Blocked text or links fail with 403 `CONTENT_BLOCKED`-<sup>2</sup> The value is in the future, and a value at or before the current time is rejected+<sup>2</sup> Must be in the future-<sup>3</sup> `emoji_name` is ignored without validation when `emoji_id` has a value. An `emoji_id` of null leaves `emoji_name` in place, and it is then exactly one Unicode emoji+<sup>3</sup> `emoji_name` is ignored when `emoji_id` is set. An unknown `emoji_id` fails with `CUSTOM_EMOJI_NOT_FOUND`. Fluxer drops the emoji for an account whose `feature_global_expressions` [limit](/http-api/instance/#limit-keys) is 0-A custom emoji ID that does not resolve fails with `CUSTOM_EMOJI_NOT_FOUND` against `custom_status.emoji_id`. Fluxer drops the resolved emoji for an account whose `feature_global_expressions` [limit](/http-api/instance/#limit-keys) resolves to 0, so the request succeeds with text alone.--:::caution[Hide expired custom statuses]-An expired status can remain in settings without an expiry Dispatch. Compare `expires_at` with the current time before rendering. A new Gateway session omits the expired status.-:::+Settings can keep a custom status after it expires. Hide it once `expires_at` is in the past.## Initial settings-A new account starts with these values. Every field not listed starts empty, so there is no custom status and `synced_preferences` is the empty string.+A new account starts with these settings.| Setting | Initial value || --- | --- || Theme | The theme chosen at registration, or `dark` || Status | `online` |-| Rendering | Animated custom emoji, always-animated stickers, GIF autoplay, embeds and reactions rendered, spoilers on click, inline attachment and embed media |+| Rendering | Everything shown and animated, spoilers hidden until clicked || Incoming calls and group DM additions | Friends only |-| Guild DM restrictions | Unrestricted for both members and bots |-| Guild folders | One empty uncategorised folder |+| Guild DM restrictions | None for members and bots |+| Guild folders | One empty uncategorized folder || AFK timeout | 600 seconds || Time format | Automatic |-| Trusted domains | None || Profile privacy | Visible to all guild members |-| Voice activity sharing | Enabled |-| Friend sources | Mutual friends and mutual guilds, plus no relation for a verified adult |-| Sensitive media filters | Show for a verified adult and blur otherwise on friend DMs, block on non-friend DMs, blur in guilds |-| Developer mode | Enabled in development, disabled elsewhere |+| Voice activity sharing | On |+| Friend sources | Mutual friends and mutual guilds, and anyone for a verified adult |+| Sensitive media filters | Friend DMs show for a verified adult and blur otherwise, non-friend DMs block, guilds blur |## Get current user settings@@ -361,28 +303,22 @@ A new account starts with these values. Every field not listed starts empty, soReturns the [user settings](/http-api/users/#user-settings-object) object.-An account with no stored settings record returns 404 `UNKNOWN_USER`.-### Response| Status | Body | Condition || --- | --- | --- || 200 | [user settings](/http-api/users/#user-settings-object) object | Settings were returned |-| 404 | [error response](/http-api/#error-response) | Settings do not exist and the request returns `UNKNOWN_USER` |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_USER` when the account has no settings record |-### Rate limit--40 requests per 10 seconds for each authenticated user, on the `user:settings:get` bucket shared with [Get current user](/http-api/users/current-user/#get-current-user).+The rate limit is 40 requests per 10 seconds, on the `user:settings:get` bucket.## Modify current user settings<RouteHeader method="PATCH" path="/v1/users/@me/settings" />-Modifies the account-wide settings and returns the complete [user settings](/http-api/users/#user-settings-object) object. Emits a [User Settings Update](/gateway/events/#user-settings-update) Gateway event.--An account with no stored settings record returns 404 `UNKNOWN_USER`. A locale change also emits a [User Update](/gateway/events/#user-update) Gateway event.+Modifies the account-wide settings and returns the full [user settings](/http-api/users/#user-settings-object) object. Sends [User Settings Update](/gateway/events/#user-settings-update), and also [User Update](/gateway/events/#user-update) when the locale changes.-An unresolvable custom status emoji returns 400 `INVALID_FORM_BODY` with `CUSTOM_EMOJI_NOT_FOUND` against `custom_status.emoji_id`. Rejections of `trusted_domains`, of an age-restricted filter, and of an oversized or undecodable `synced_preferences` value return 400 `VALIDATION_ERROR` with their own codes in `errors`.+The `status` you set applies to every session of the account.### JSON body@@ -392,72 +328,44 @@ The body uses the [user settings update object](#user-settings-update-object).| Status | Body | Condition || --- | --- | --- |-| 200 | [user settings](/http-api/users/#user-settings-object) object | Settings were applied and returned |-| 400 | [error response](/http-api/#error-response) | A field value, the custom status emoji, the trusted domain combination, an age-restricted filter, or the synced preferences snapshot is invalid |-| 403 | [error response](/http-api/#error-response) | Custom status text is blocked and the request returns `CONTENT_BLOCKED` |-| 403 | [error response](/http-api/#error-response) | The account is [limited](/http-api/users/#account-limitation) and the body sets a custom status, and the request returns `ACCOUNT_LIMITED` |-| 404 | [error response](/http-api/#error-response) | Settings do not exist and the request returns `UNKNOWN_USER` |-| 409 | [error response](/http-api/#error-response) | `synced_preferences_base_hash` does not match the stored snapshot, and the request returns `SYNCED_PREFERENCES_CONFLICT`. Fetch the settings before retrying |--### Side effects--Fluxer emits [User Settings Update](/gateway/events/#user-settings-update) to the caller's own sessions. A value-identical patch still does the write and produces the Dispatch. A locale change also applies to email and notification localisation and emits [User Update](/gateway/events/#user-update). The user object has no locale member.--Every [User Settings Update](/gateway/events/#user-settings-update) republishes the caller's current [Presence Update](/gateway/events/#presence-update) to eligible sessions, so a custom status change becomes visible without a further request.--A status of invisible forces every one of the caller's sessions to invisible. When at least one session is invisible, a later status of online, idle, or dnd sets every one of the caller's sessions to that status.+| 200 | [user settings](/http-api/users/#user-settings-object) object | Settings were applied |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` or `VALIDATION_ERROR` when a field is invalid, with the field code from the footnotes |+| 403 | [error response](/http-api/#error-response) | `CONTENT_BLOCKED` for blocked status text |+| 403 | [error response](/http-api/#error-response) | `ACCOUNT_LIMITED` when a [limited](/http-api/users/#account-limitation) account sets a custom status |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_USER` when the account has no settings record |+| 409 | [error response](/http-api/#error-response) | `SYNCED_PREFERENCES_CONFLICT` when `synced_preferences_base_hash` doesn't match the stored snapshot |-### Rate limit--20 requests per 10 seconds for each authenticated user, on the `user:settings:update` bucket shared with [Modify voice activity sharing](#modify-voice-activity-sharing).+The rate limit is 20 requests per 10 seconds, on the `user:settings:update` bucket.## Modify voice activity sharing<RouteHeader method="PUT" path="/v1/users/@me/settings/voice-activity-sharing" />-Changes the default voice activity sharing value, applies it to the caller's side of every existing friendship, and returns the caller's [user](/http-api/users/#user-object) object. Emits [Relationship Update](/gateway/events/#relationship-update) and [User Update](/gateway/events/#user-update) Gateway events, and a [User Settings Update](/gateway/events/#user-settings-update) Gateway event only when the stored default changes.--A missing account or settings record returns 404 `UNKNOWN_USER`.+Sets the default for sharing voice activity, applies it to your side of every friendship and returns your [user](/http-api/users/#user-object) object. Sends [Relationship Update](/gateway/events/#relationship-update) and [User Update](/gateway/events/#user-update). When the default changes, it also sends [User Settings Update](/gateway/events/#user-settings-update).-Only this route writes `default_share_voice_activity`, which is read-only in the [user settings object](/http-api/users/#user-settings-object).+You can change this once every 24 hours, even to the same value. `last_voice_activity_sharing_change_at` on the user object has the time of the last change.### JSON body| Field | Type | Description || --- | --- | --- |-| share_voice_activity | boolean | Whether voice activity is shared, stored as the new default and applied to the caller's side of every friendship |--:::caution[The cooldown is evaluated before the value comparison]-A 24-hour cooldown recorded on the account is checked before the request is compared against the stored value, so re-sending the current value inside the window fails with `VOICE_ACTIVITY_SHARING_ON_COOLDOWN` on `share_voice_activity`. The remaining delay appears only inside the localised message.-:::--Outside the window the cooldown restarts on every accepted request, including one that sets the value it already holds. The [user object](/http-api/users/#user-object) has that moment as `last_voice_activity_sharing_change_at`.+| share_voice_activity | boolean | Whether voice activity is shared |### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [user](/http-api/users/#user-object) object | Sharing state was returned after applying the request |-| 400 | [error response](/http-api/#error-response) | The 24-hour cooldown remains active and the request returns `INVALID_FORM_BODY` |-| 404 | [error response](/http-api/#error-response) | The account or its settings do not exist and the request returns `UNKNOWN_USER` |--### Side effects--An accepted request writes `default_share_voice_activity` and then walks every friendship. A friendship whose caller-side value already equals the submitted value is skipped, and its stored `version` does not advance. Every friendship, skipped or rewritten, produces one [Relationship Update](/gateway/events/#relationship-update) to the caller and one to the friend, so re-sending the current value still sends those Dispatches for every friendship. The friend's Dispatch is emitted only when the reciprocal friendship exists.--It then records the change time in `last_voice_activity_sharing_change_at` and emits [User Update](/gateway/events/#user-update) to the caller.+| 200 | [user](/http-api/users/#user-object) object | The new sharing state was applied |+| 400 | [error response](/http-api/#error-response) | `INVALID_FORM_BODY` with `VOICE_ACTIVITY_SHARING_ON_COOLDOWN` and `retry_after` on `share_voice_activity` during the cooldown |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_USER` when the account has no settings record |-### Rate limit--20 requests per 10 seconds for each authenticated user, on the `user:settings:update` bucket shared with [Modify current user settings](#modify-current-user-settings).+The rate limit is 20 requests per 10 seconds, on the `user:settings:update` bucket.## Modify DM notification settings<RouteHeader method="PATCH" path="/v1/users/@me/guilds/@me/settings" />-Modifies and returns the [user guild settings](#user-guild-settings-object) object that controls direct messages and group DMs. Emits a [User Guild Settings Update](/gateway/events/#user-guild-settings-update) Gateway event on every success.--Fluxer creates the settings with the documented defaults when they are absent.+Modifies and returns the [user guild settings](#user-guild-settings-object) for direct messages and group DMs, with `guild_id` null. Sends [User Guild Settings Update](/gateway/events/#user-guild-settings-update) to your own sessions.### JSON body@@ -467,37 +375,15 @@ The body uses the [guild settings update fields](#guild-settings-update-fields).| Status | Body | Condition || --- | --- | --- |-| 200 | [user guild settings](#user-guild-settings-object) object | DM settings were returned after applying the request |--### Side effects--The private channel settings are returned with `guild_id` null. Fluxer does the write and emits the Dispatch to the caller's own sessions even when the request changes nothing, and `version` advances on that write. No other account receives a Dispatch.--### Rate limit+| 200 | [user guild settings](#user-guild-settings-object) object | The settings were applied |-30 requests per 10 seconds for each authenticated user, on the `user:guild_settings:update` bucket shared with [Modify guild notification settings](#modify-guild-notification-settings).+The rate limit is 30 requests per 10 seconds, on the `user:guild_settings:update` bucket.## Modify guild notification settings<RouteHeader method="PATCH" path="/v1/users/@me/guilds/{guild_id}/settings" />-Modifies and returns the [user guild settings](#user-guild-settings-object) object for the supplied guild ID. Emits a [User Guild Settings Update](/gateway/events/#user-guild-settings-update) Gateway event on every success.--Fluxer creates the settings with the documented defaults when they are absent.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The guild settings key |--:::note[No membership check runs here]-The operation neither confirms nor denies that the guild exists. A settings object written for a guild the caller has never joined is stored and returned like any other.-:::--:::note[`guild_id` of 0 is the DM alias]-`PATCH /v1/users/@me/guilds/0/settings` writes the same private channel record as the `@me` route and returns `guild_id` null.-:::+Modifies and returns the [user guild settings](#user-guild-settings-object) for a guild. Sends [User Guild Settings Update](/gateway/events/#user-guild-settings-update) to your own sessions.### JSON body@@ -507,12 +393,6 @@ The body uses the [guild settings update fields](#guild-settings-update-fields).| Status | Body | Condition || --- | --- | --- |-| 200 | [user guild settings](#user-guild-settings-object) object | Guild settings were returned after applying the request |--### Side effects--Fluxer does the write and emits the Dispatch to the caller's own sessions even when the request changes nothing, and `version` advances on that write. No guild member other than the caller receives a Dispatch.--### Rate limit+| 200 | [user guild settings](#user-guild-settings-object) object | The settings were applied |-30 requests per 10 seconds for each authenticated user, on the `user:guild_settings:update` bucket shared with [Modify DM notification settings](#modify-dm-notification-settings).+The rate limit is 30 requests per 10 seconds, on the `user:guild_settings:update` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/webhooks.mdx b/fluxer_docs/src/content/docs/http-api/webhooks.mdxindex b0260753a..5bbbe8e35 100644--- a/fluxer_docs/src/content/docs/http-api/webhooks.mdx+++ b/fluxer_docs/src/content/docs/http-api/webhooks.mdx@@ -1,71 +1,45 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Webhooks-description: Webhook objects, management, token-authenticated execution, and the third-party callbacks.+description: Webhook objects, management routes, token-authenticated execution and the GitHub, Slack, Instatus and Libredesk callbacks.---import RouteHeader from '@/components/RouteHeader.astro';-A webhook posts messages into one guild channel under a name and avatar of its own. An incoming webhook posts what its token holder sends, and a channel follower webhook posts the messages [published](/http-api/messages/#crosspost-message) in an announcement channel the channel follows.+A webhook posts messages into one guild channel under its own name and avatar. You manage webhooks with a user or bot token. To execute one, put the webhook ID and token in the path and send no `Authorization` header.-Management routes take a user session token or a bot token. Every other webhook operation uses the webhook ID and secret token in its own path as the complete credential. A sent `Authorization` header grants no access there, and Fluxer still resolves it, as [Rate limit keying](#rate-limit-keying) describes..+## Permissions-The [Messages resource](/http-api/messages/) defines the message, rich embed input, and message reference input objects.+Management routes need [MANAGE_WEBHOOKS](/http-api/permissions/) at guild level, and `VIEW_CHANNEL` and `MANAGE_WEBHOOKS` in the webhook's channel. In a guild with an elevated [MFA level](/http-api/guilds/#mfa-levels), a caller without multi-factor authentication gets 400 `TWO_FACTOR_REQUIRED`, because `MANAGE_WEBHOOKS` is an [elevated permission](/http-api/permissions/#elevated-permissions).-## Authorisation--A management operation requires [MANAGE_WEBHOOKS](/http-api/permissions/) at guild level and again in the webhook's channel. `MANAGE_WEBHOOKS` is an [elevated permission](/http-api/permissions/#elevated-permissions). In a guild whose [MFA level](/http-api/guilds/#mfa-levels) is elevated, a caller who is neither the guild owner nor enrolled in multi-factor authentication receives 400 `TWO_FACTOR_REQUIRED`. Fluxer confirms the permission before that check, so a caller who lacks it outright receives 403 `MISSING_PERMISSIONS`.--Fluxer resolves the guild before every management operation. A guild that does not exist returns 404 `UNKNOWN_GUILD`. A caller who is not a current member of an existing guild returns 403 `MISSING_PERMISSIONS`.--[List guild webhooks](#list-guild-webhooks), [List channel webhooks](#list-channel-webhooks), and [Create webhook](#create-webhook) name a guild or a channel in their paths, so the availability gate applies. A guild with [UNAVAILABLE_FOR_EVERYONE](/http-api/guilds/#guild-features) refuses an authenticated request with 403 `MISSING_ACCESS` before the operation runs. [UNAVAILABLE_FOR_EVERYONE_BUT_STAFF](/http-api/guilds/#guild-features) does the same for an account without the instance staff flag. The remaining management routes name only a webhook ID and are not gated.--On a management operation, a caller other than a bot or a user session that declares the [`channel_threads` client capability](/http-api/threads/#client-capability) sees no webhook of a forum or media channel. [List guild webhooks](#list-guild-webhooks) omits one, and [Get webhook](#get-webhook), [Update webhook](#update-webhook), and [Delete webhook](#delete-webhook) return 404 `UNKNOWN_WEBHOOK` for one. [List channel webhooks](#list-channel-webhooks) and [Create webhook](#create-webhook) on a forum or media channel return 404 `UNKNOWN_CHANNEL` to that caller. [Update webhook](#update-webhook) with a forum or media channel as `channel_id` returns the same.--A token-authenticated operation returns a webhook of a forum or media channel to any holder of the token.--Fluxer scans a submitted webhook `name` against the instance phrase and URL blocklists, and a match returns 403 `CONTENT_BLOCKED`. The same lists scan the resolved content, embed text, and embed link URLs of a created or edited message, and a match returns the same code. The `avatar` member is exempt from that scan, and Fluxer checks its decoded bytes against the banned asset hash list when it stores them.--## Rate limit keying--Every route bucket on this page is keyed on the caller identity as well as on the path parameter in its bucket name. The caller identity is the authenticated account when a request resolves one and the client IP address otherwise, so a token-authenticated operation is bounded per address.--When a request to a token-authenticated operation sends an `Authorization` header, Fluxer reads that credential only to choose the rate limit key. [Rate limits](/topics/rate-limits/) defines the keying in full.--The [global HTTP limit](/topics/rate-limits/) applies to every management route. [Get webhook with token](#get-webhook-with-token), [Update webhook with token](#update-webhook-with-token), and [Delete webhook with token](#delete-webhook-with-token) consume it under the caller identity. Every other route on this page is exempt and is bounded only by its own route bucket.+A user session that doesn't declare the [`channel_threads` client capability](/http-api/threads/#client-capability) can't see webhooks of forum or media channels and gets 404 for them.## Origin refusal-Fluxer refuses a call from a first-party web client on [Execute webhook](#execute-webhook), [Get webhook message](#get-webhook-message), [Edit webhook message](#edit-webhook-message), and [Delete webhook message](#delete-webhook-message). A request whose `Origin` header is one of the instance's own web app origins returns 403 `INVALID_API_ORIGIN`. Those are the origin of `FLUXER_APP_ENDPOINT` and every `FLUXER_APP_ORIGIN_ALIASES` entry.--A request that sends no `Origin`, or any other `Origin` value, passes the check. It runs after the route rate limit and before path validation.--`/v1/webhooks/{webhook_id}/{token}` and `/v1/webhooks/{webhook_id}/{token}/messages/{message_id}` also have a second CORS policy that allows every origin, which the [cross-origin request contract](/http-api/#cross-origin-requests) states in full.+[Execute webhook](#execute-webhook), the [GitHub](#execute-github-webhook), [Slack](#execute-slack-webhook), [Instatus](#execute-instatus-webhook) and [Libredesk](#execute-libredesk-webhook) callbacks, [Get webhook message](#get-webhook-message), [Edit webhook message](#edit-webhook-message) and [Delete webhook message](#delete-webhook-message) return 403 `INVALID_API_ORIGIN` when the `Origin` header is one of the instance's own web app origins. See [cross-origin requests](/http-api/#cross-origin-requests).## Webhook object-A webhook belongs to exactly one guild and posts into exactly one guild text, voice, announcement, forum, or media channel of that guild. Only those channel types can hold a webhook. Fluxer generates the execution token of an incoming webhook once at creation and never rotates it. The pair of ID and token is a bearer credential for the lifetime of the webhook. A channel follower webhook has no usable token.+A webhook belongs to one guild channel. Its token never changes, and anyone with the ID and token can execute, edit or delete the webhook.### Structure| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the webhook |-| guild_id | snowflake | The ID of the guild containing the webhook |-| channel_id | snowflake | The ID of the channel the webhook sends messages to |+| guild_id | snowflake | The ID of the guild the webhook is in |+| channel_id | snowflake | The ID of the channel the webhook posts to || name | string | The name the webhook posts under (1-80 characters) |-| avatar | ?string | The avatar hash the webhook posts under, or null when no avatar is set |+| avatar | ?string | The avatar hash the webhook posts under || type | integer | The [webhook type](#webhook-types) |-| token?<sup>1</sup> | string | The secret token that authorises execution of this webhook |-| user<sup>2</sup> | [partial user](/http-api/users/#partial-user-object) object | The account that created the webhook |-| source_guild?<sup>3</sup> | [webhook source guild](#webhook-source-guild-object) object | The guild of the followed announcement channel |-| source_channel?<sup>3</sup> | [webhook source channel](#webhook-source-channel-object) object | The followed announcement channel |+| token?<sup>1</sup> | string | The secret token that executes the webhook (64 characters) |+| user | [partial user](/http-api/users/#partial-user-object) object | The account that created the webhook |+| source_guild?<sup>2</sup> | [webhook source guild](#webhook-source-guild-object) object | The guild of the followed announcement channel |+| source_channel?<sup>2</sup> | [webhook source channel](#webhook-source-channel-object) object | The followed announcement channel |-<sup>1</sup> 64 characters drawn from the 62-character alphanumeric alphabet. No operation rotates or reissues it. Absent on a channel follower webhook+<sup>1</sup> Absent on a channel follower webhook-<sup>2</sup> Absent from the [token webhook object](#token-webhook-object). The value is the deleted user partial when the creating account no longer exists--<sup>3</sup> Present only on a channel follower webhook, and only while the account that created it can view the announcement channel+<sup>2</sup> Only on a channel follower webhook, while its creator can view the announcement channel### Example@@ -76,12 +50,16 @@ A webhook belongs to exactly one guild and posts into exactly one guild text, vo"channel_id": "1501314428688991111","name": "Build bot","avatar": "a1b2c3d4e5f60718293a4b5c6d7e8f90",+ "type": 1,"token": "Xk3Qw9ZpL2vB7nR4tY6uI8oP0aS1dF5gH2jK4lZ9xC7vB1nM3qW5eR8tY0uI2oP4","user": {"id": "1501314428688990001","username": "ada","discriminator": "0001",- "avatar": null+ "global_name": null,+ "avatar": null,+ "avatar_color": null,+ "flags": 0}}```@@ -90,16 +68,10 @@ A webhook belongs to exactly one guild and posts into exactly one guild text, vo| Value | Name | Description || --- | --- | --- |-| 1 | INCOMING | Webhook that posts the messages its token holder sends |-| 2 | CHANNEL_FOLLOWER<sup>1</sup> | Webhook that posts copies of the messages published in a followed announcement channel |--<sup>1</sup> Created by [Follow announcement channel](/http-api/channels/#follow-announcement-channel), never by [Create webhook](#create-webhook)--The `avatar` of a channel follower webhook is a copy of the source guild icon at the time of the follow, or null when the source guild had none. It never changes after that. Copies it delivers use the source guild icon at the time of delivery as their author avatar, stored under the webhook ID, and a null avatar when the source guild has no icon.--A channel follower webhook is managed through [Get webhook](#get-webhook), [Update webhook](#update-webhook), and [Delete webhook](#delete-webhook) with the same permissions as an incoming webhook, and both list routes return it. Every [token route](#token-routes) returns 404 `UNKNOWN_WEBHOOK` for it, so nothing can post through it except Fluxer.+| 1 | INCOMING | Posts the messages its token holder sends |+| 2 | CHANNEL_FOLLOWER | Posts copies of messages published in a followed announcement channel |-While the account that created a channel follower webhook cannot view the announcement channel, the webhook has no `source_guild` or `source_channel` and no new copies arrive through it. That covers a creator who left or was removed from the source guild, and one who lost `VIEW_CHANNEL` there. Delivery resumes for messages published after access returns. Deleting the webhook and following the channel again from an account that can view it also restores delivery.+[Follow announcement channel](/http-api/channels/#follow-announcement-channel) creates a channel follower webhook. You can get, update and delete it like an incoming webhook, but every token route returns 404 `UNKNOWN_WEBHOOK` for it. Copies stop arriving while its creator can't view the announcement channel.## Webhook source guild object@@ -109,9 +81,9 @@ The guild that owns the announcement channel a channel follower webhook follows.| Field | Type | Description || --- | --- | --- |-| id | snowflake | The ID of the guild that owns the followed announcement channel |-| name | string | The name of that guild |-| icon? | ?string | The icon hash of that guild, or null when it has none |+| id | snowflake | The ID of the guild |+| name | string | The name of the guild |+| icon? | ?string | The icon hash of the guild |## Webhook source channel object@@ -121,219 +93,448 @@ The announcement channel a channel follower webhook follows.| Field | Type | Description || --- | --- | --- |-| id | snowflake | The ID of the followed announcement channel |-| name | string | The name of that channel |+| id | snowflake | The ID of the announcement channel |+| name | string | The name of the announcement channel |## Token webhook object-Token-authenticated operations return this object. It has every field of the [webhook object](#webhook-object) except `user`, `source_guild`, and `source_channel`, and its `token` is always present.+Token routes return this shorter form of the [webhook object](#webhook-object).### Structure| Field | Type | Description || --- | --- | --- || id | snowflake | The ID of the webhook |-| guild_id | snowflake | The ID of the guild containing the webhook |-| channel_id | snowflake | The ID of the channel the webhook sends messages to |+| guild_id | snowflake | The ID of the guild the webhook is in |+| channel_id | snowflake | The ID of the channel the webhook posts to || name | string | The name the webhook posts under (1-80 characters) |-| avatar | ?string | The avatar hash the webhook posts under, or null when no avatar is set |-| type | integer | The [webhook type](#webhook-types), always `1` here |-| token | string | The secret token that authorises execution of this webhook |--:::danger[The token is returned in full]-Every operation returning a [webhook object](#webhook-object) of an incoming webhook or a token webhook object includes the complete execution token, so its response body grants full execution and management authority over each webhook it names.-:::+| avatar | ?string | The avatar hash the webhook posts under |+| type | integer | The [webhook type](#webhook-types), always `1` |+| token | string | The secret token that executes the webhook |## Webhook message body-[Execute webhook](#execute-webhook) accepts this JSON body. Every field may be omitted, and `{}` passes schema validation and then returns 400 `CANNOT_SEND_EMPTY_MESSAGE`. A webhook of a forum or media channel that sends it without `thread_id` returns 400 `WEBHOOK_FORUM_TARGET_REQUIRED` first.+[Execute webhook](#execute-webhook) takes this body. A body with nothing to post returns 400 `CANNOT_SEND_EMPTY_MESSAGE`. A webhook name, message content or embed text that matches the instance blocklists returns 403 `CONTENT_BLOCKED`.### Structure| Field | Type | Description || --- | --- | --- |-| content?<sup>1</sup> | ?string | Message content |-| embeds?<sup>2</sup> | array[[rich embed](/http-api/messages/#rich-embed-object) object] | Rich embeds |-| attachments?<sup>3</sup> | array[[pre-uploaded attachment](/http-api/messages/#pre-uploaded-attachment-object) object] | Attachment metadata |-| message_reference?<sup>4</sup> | ?[message reference input](/http-api/messages/#message-reference-input-object) object | Reply or forward reference, or null |-| allowed_mentions?<sup>5</sup> | ?[allowed mentions](/http-api/messages/#allowed-mentions-object) object | Mention parsing policy, or null |-| flags? | integer | [Message flags](/http-api/messages/#message-flags), where omission is treated as zero and every bit outside the sendable mask is cleared |-| favorite_meme_id? | ?snowflake | Favourite meme to attach |-| sticker_ids? | ?array[snowflake] | At most 3 sticker IDs |-| tts?<sup>6</sup> | boolean | Text-to-speech request |-| nonce?<sup>7</sup> | string \| integer | Client-generated message identifier (1-32 characters). A non-negative safe integer becomes its decimal string |-| username?<sup>8</sup> | ?string | Per-message webhook name override (1-80 characters), or null |-| avatar_url?<sup>8</sup> | ?string | Absolute `http` or `https` per-message webhook avatar URL override of at most 2,048 characters, or null |-| thread_name?<sup>9</sup> | string | The name of a new forum post (1-100 characters) |-| applied_tags?<sup>9</sup> | array[snowflake] | The IDs of the tags a new forum post applies (max 5) |+| content?<sup>1</sup> | ?string | The message content |+| embeds? | array[[rich embed](/http-api/messages/#rich-embed-object) object] | Up to [max_embeds_per_message](/http-api/instance/#limit-keys) embeds (default 10) |+| attachments? | array[[pre-uploaded attachment](/http-api/messages/#pre-uploaded-attachment-object) object] | Attachment metadata |+| message_reference?<sup>2</sup> | ?[message reference input](/http-api/messages/#message-reference-input-object) object | A reply or forward reference |+| allowed_mentions?<sup>3</sup> | ?[allowed mentions](/http-api/messages/#allowed-mentions-object) object | Which mentions notify |+| flags? | integer | [Message flags](/http-api/messages/#message-flags) |+| favorite_meme_id? | ?snowflake | Accepted, but webhook messages never attach a favorite meme |+| sticker_ids? | ?array[snowflake] | Up to 3 sticker IDs |+| tts? | boolean | Accepted, but webhook messages are never text-to-speech |+| nonce?<sup>4</sup> | string \| integer | A client-generated message identifier (1-32 characters) |+| username? | ?string | A name for this message only (1-80 characters) |+| avatar_url? | ?string | An `http` or `https` avatar URL for this message only, skipped when it can't be fetched |+| thread_name?<sup>5</sup> | string | The name of a new forum post (1-100 characters) |+| applied_tags?<sup>5</sup> | array[snowflake] | The IDs of the tags for a new forum post (max 5) |-<sup>1</sup> Webhook message content is limited to the resolved [max_message_length](/http-api/instance/#limit-keys) value for the guild or 4000 characters, whichever is larger. Exceeding it returns 400 `INVALID_FORM_BODY` with the validation code `CONTENT_EXCEEDS_MAX_LENGTH`+<sup>1</sup> Up to the guild's [max_message_length](/http-api/instance/#limit-keys) or 4,000 characters, whichever is larger-<sup>2</sup> Bounded by the resolved [max_embeds_per_message](/http-api/instance/#limit-keys) value for the guild, defaulting to 10. Exceeding it returns 400 `INVALID_FORM_BODY` with `TOO_MANY_EMBEDS`+<sup>2</sup> The referenced message must be in the webhook's channel, or in the thread from `thread_id`-<sup>3</sup> Each entry names a file uploaded earlier by its `upload_filename`. A multipart body also attaches direct files, as [Execute webhook](#execute-webhook) describes+<sup>3</sup> When omitted, no mention notifies anyone-<sup>4</sup> A forward reference requires both `channel_id` and `message_id`, and it must not accompany content, embeds, or attachments. See [message references](#message-references)+<sup>4</sup> Repeating a nonce within five minutes returns the first message and creates no new one-<sup>5</sup> An omitted policy suppresses every mention, which is the opposite of the [Create message](/http-api/messages/#create-message) default+<sup>5</sup> Only for a webhook in a forum or media channel. See [Webhooks in forums](/http-api/forums/#webhooks-in-forums)-<sup>6</sup> The field takes no part in the non-empty message check, so a body supplying `tts` and nothing else returns 400 `CANNOT_SEND_EMPTY_MESSAGE`. A webhook message is never marked text-to-speech+## Webhook message edit body-<sup>7</sup> The nonce is remembered per webhook for five minutes and is echoed on the [Message Create](/gateway/events/#message-create) Dispatch. A repeated execution presenting it inside that window creates no second message and returns the first one, and a repeat that names another `thread_id`, that sends `thread_name` again, or that follows a move of the webhook to another channel returns 404 `UNKNOWN_MESSAGE`+[Edit webhook message](#edit-webhook-message) takes this body. Each field you send replaces the stored value, and a body with no content, embeds or `flags` returns 400 `CANNOT_SEND_EMPTY_MESSAGE`.-<sup>8</sup> Applies to the created message, and the stored webhook keeps its own name and avatar+### Structure-<sup>9</sup> Accepted only from a webhook whose channel is a forum or media channel, and any other channel returns 400 `WEBHOOK_THREAD_NAME_REQUIRES_FORUM`+| Field | Type | Description |+| --- | --- | --- |+| content? | ?string | The new message content |+| embeds? | array[[rich embed](/http-api/messages/#rich-embed-object) object] | The new embeds, where an empty array removes them all |+| flags? | integer | The new [message flags](/http-api/messages/#message-flags) |+| allowed_mentions? | ?[allowed mentions](/http-api/messages/#allowed-mentions-object) object | Ignored, and the original mentions stay |-A forum or media channel webhook that sends `thread_id` ignores `applied_tags`. On a `thread_name` post, a moderated tag returns 403 `MISSING_PERMISSIONS`, and a tag the channel does not hold returns 404 `UNKNOWN_FORUM_TAG`. [Webhooks in forums](/http-api/forums/#webhooks-in-forums) describes posting into a forum or media channel.+## List guild webhooks-When `embeds` is absent, Fluxer rewrites the singular key `embed` to a one-element `embeds` array, and an `embed` of null becomes an empty array. When both are present, `embed` is dropped.+<RouteHeader method="GET" path="/v1/guilds/{guild_id}/webhooks" bot />-A multipart body accepts both [pre-uploaded attachments](/http-api/messages/#pre-uploaded-attachment-object) and [direct multipart attachment metadata](/http-api/messages/#direct-multipart-attachment-metadata-object).+Returns the [webhooks](#webhook-object) in a guild, limited to channels where you have `VIEW_CHANNEL` and `MANAGE_WEBHOOKS`.-## Message references+### Response-A webhook execution accepts the [message reference input](/http-api/messages/#message-reference-input-object) object. The constraints below are specific to webhooks.+| Status | Body | Condition |+| --- | --- | --- |+| 200 | array[[webhook](#webhook-object) object] | The webhooks were returned |-The `channel_id` field is required for a forward reference and must equal the webhook's own channel. A value naming any other channel returns 404 `UNKNOWN_MESSAGE`. A reply reference resolves in the webhook's own channel and ignores this field. With [`thread_id`](#execute-webhook), the reference resolves in that thread, and the `channel_id` of a forward reference must equal the thread ID.+The rate limit is 40 requests per 10 seconds, on the `webhook:list::guild_id` bucket.-The referenced message must exist in the webhook's channel, and a missing message returns 404 `UNKNOWN_MESSAGE`. A reply reference also requires the referenced message to be an ordinary or reply message. Any other type returns 400 `INVALID_FORM_BODY` with the validation code `CANNOT_REPLY_TO_SYSTEM_MESSAGE`.+## List channel webhooks-A forward reference must not accompany content, embeds, or attachments, and one that does returns 400 `INVALID_FORM_BODY` with the validation code `FORWARD_MESSAGES_CANNOT_CONTAIN_CONTENT`. A missing `channel_id` or `message_id` on a forward reference returns the same status with `FORWARD_REFERENCE_REQUIRES_CHANNEL_AND_MESSAGE`.+<RouteHeader method="GET" path="/v1/channels/{channel_id}/webhooks" bot />-## Webhook message edit body+Returns the [webhooks](#webhook-object) in a channel.-[Edit webhook message](#edit-webhook-message) accepts this JSON body. Every supplied field replaces the stored value outright, and an omitted field keeps it. A body with no visible `content`, no non-empty `embeds`, and no `flags` is rejected with 400 `CANNOT_SEND_EMPTY_MESSAGE`.+### Response-### Structure+| Status | Body | Condition |+| --- | --- | --- |+| 200 | array[[webhook](#webhook-object) object] | The webhooks were returned |++The rate limit is 40 requests per 10 seconds, on the `webhook:list::channel_id` bucket.++## Create webhook++<RouteHeader method="POST" path="/v1/channels/{channel_id}/webhooks" bot auditReason />++Creates an incoming webhook in a guild text, voice, announcement, forum or media channel and returns it with its token. A guild can have [max_webhooks_per_guild](/http-api/instance/#limit-keys) webhooks (default 1,000) and a channel [max_webhooks_per_channel](/http-api/instance/#limit-keys) (default 15).++### JSON body| Field | Type | Description || --- | --- | --- |-| content?<sup>1</sup> | ?string | Replacement message content, or null |-| embeds?<sup>2</sup> | array[[rich embed](/http-api/messages/#rich-embed-object) object] | Replacement collection of embeds |-| flags? | integer | Replacement [message flags](/http-api/messages/#message-flags) |-| allowed_mentions? | ?[allowed mentions](/http-api/messages/#allowed-mentions-object) object | Replacement mention parsing policy, or null |+| name | string | The webhook name (1-80 characters) |+| avatar? | ?base64 string | A base64 or data URI avatar image, up to [avatar_max_size](/http-api/instance/#limit-keys) (default 10 MiB) |-<sup>1</sup> The same effective maximum length as [Execute webhook](#execute-webhook) applies+### Response-<sup>2</sup> The supplied array becomes the complete embed collection, so an empty array removes every embed. The same resolved [max_embeds_per_message](/http-api/instance/#limit-keys) ceiling applies+| Status | Body | Condition |+| --- | --- | --- |+| 200 | [webhook](#webhook-object) object | The webhook was created |+| 400 | [error response](/http-api/#error-response) | `MAX_WEBHOOKS_PER_GUILD` or `MAX_WEBHOOKS_PER_CHANNEL` when the limit is hit |-`flags` replaces only the bits inside the sendable mask, and every other stored bit is kept.+Fluxer sends [Webhooks Update](/gateway/events/#webhooks-update) and records a `WEBHOOK_CREATE` audit log entry.-## Slack callback objects+The rate limit is 10 requests per minute, on the `webhook:create::channel_id` bucket.-These objects define the body [Execute Slack webhook](#execute-slack-webhook) accepts and the embed each part converts to.+## Get webhook-### Slack callback object+<RouteHeader method="GET" path="/v1/webhooks/{webhook_id}" bot />-#### Structure+Returns a [webhook object](#webhook-object).++### Response++| Status | Body | Condition |+| --- | --- | --- |+| 200 | [webhook](#webhook-object) object | The webhook was returned |++The rate limit is 100 requests per 10 seconds, on the `webhook:read::webhook_id` bucket.++## Update webhook++<RouteHeader method="PATCH" path="/v1/webhooks/{webhook_id}" bot auditReason />++Updates a webhook and returns the [webhook object](#webhook-object). To move it, you need `MANAGE_WEBHOOKS` in the new channel too, and the new channel must be in the same guild.++### JSON body| Field | Type | Description || --- | --- | --- |-| text?<sup>1</sup> | string | Message text |-| username? | string | Webhook name override for this message (1-80 characters) |-| icon_url?<sup>2</sup> | string | Webhook avatar URL override for this message |-| attachments? | array[[Slack attachment](#slack-attachment-object) object] | Slack attachments converted to embeds |+| name? | string | The new name (1-80 characters) |+| avatar?<sup>1</sup> | ?base64 string | The new avatar image, or null to remove it |+| channel_id?<sup>2</sup> | snowflake | The channel to move the webhook to |-<sup>1</sup> When text is omitted and at least one attachment converts to an embed, the created message content is the empty string+<sup>1</sup> Uses the same rules as [Create webhook](#create-webhook). A channel follower webhook returns 400 `INVALID_FORM_BODY` for any `avatar`-<sup>2</sup> The value is used only when it parses as an absolute `http` or `https` URL of at most 2,048 characters, and any other value is discarded silently+<sup>2</sup> A channel follower webhook can only move to a guild text channel that doesn't already follow the same announcement channel-### Slack attachment object+### Response-#### Structure+| Status | Body | Condition |+| --- | --- | --- |+| 200 | [webhook](#webhook-object) object | The webhook was updated |+| 400 | [error response](/http-api/#error-response) | `MAX_WEBHOOKS_PER_CHANNEL` when the new channel is full |+| 400 | [error response](/http-api/#error-response) | `INVALID_FOLLOW_TARGET_CHANNEL` or `CHANNEL_ALREADY_FOLLOWED` for a channel follower webhook |+| 400 | [error response](/http-api/#error-response) | `FOLLOW_TARGET_NOT_AGE_RESTRICTED` or `FOLLOW_TARGET_CONTENT_WARNING_REQUIRED` for a channel follower webhook |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_CHANNEL` when the new channel is missing or in another guild |++Fluxer sends [Webhooks Update](/gateway/events/#webhooks-update) for the old channel and, after a move, the new one. It records a `WEBHOOK_UPDATE` audit log entry.++The rate limit is 20 requests per 10 seconds, on the `webhook:update::webhook_id` bucket.++## Delete webhook++<RouteHeader method="DELETE" path="/v1/webhooks/{webhook_id}" bot auditReason />++Deletes a webhook for good. Messages it already posted stay in the channel, and deleting a channel follower webhook unfollows the announcement channel.++### Response++| Status | Body | Condition |+| --- | --- | --- |+| 204 | empty | The webhook was deleted |++Fluxer sends [Webhooks Update](/gateway/events/#webhooks-update) and records a `WEBHOOK_DELETE` audit log entry.++The rate limit is 20 requests per 10 seconds, on the `webhook:delete::webhook_id` bucket.++## Get webhook with token++<RouteHeader method="GET" path="/v1/webhooks/{webhook_id}/{token}" />++Returns a [token webhook object](#token-webhook-object).++### Response++| Status | Body | Condition |+| --- | --- | --- |+| 200 | [token webhook](#token-webhook-object) object | The webhook was returned |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_WEBHOOK` when the ID and token don't match |++The rate limit is 100 requests per 10 seconds, on the `webhook:read::webhook_id` bucket.++## Update webhook with token++<RouteHeader method="PATCH" path="/v1/webhooks/{webhook_id}/{token}" />++Updates a webhook and returns the [token webhook object](#token-webhook-object). It can't move the webhook, and sending `channel_id` returns 400 `INVALID_FORM_BODY`.++### JSON body| Field | Type | Description || --- | --- | --- |-| fallback?<sup>1</sup> | string | Fallback text |-| pretext?<sup>1</sup> | string | Text above the attachment |-| text?<sup>1</sup> | string | Main attachment text |-| color?<sup>2</sup> | string | Sidebar colour value |-| title? | string | Attachment title, mapped to the embed title |-| title_link?<sup>3</sup> | string | Title URL, mapped to the embed URL |-| fields?<sup>4</sup> | array[[Slack attachment field](#slack-attachment-field-object) object] | Fields mapped to embed fields |-| footer? | string | Footer text, mapped to the embed footer |-| ts?<sup>5</sup> | integer | Unix seconds, mapped to the embed timestamp |-| author_name?<sup>6</sup> | string | Author name, mapped to the embed author name |-| author_link?<sup>3</sup> | string | Author URL, mapped to the embed author URL |-| author_icon?<sup>3</sup> | string | Author icon URL, mapped to the embed author icon |-| image_url?<sup>3</sup> | string | Main image URL, mapped to the embed image |-| thumb_url?<sup>3</sup> | string | Thumbnail URL, mapped to the embed thumbnail |+| name? | string | The new name (1-80 characters) |+| avatar? | ?base64 string | The new avatar image, or null to remove it |++### Response++| Status | Body | Condition |+| --- | --- | --- |+| 200 | [token webhook](#token-webhook-object) object | The webhook was updated |-<sup>1</sup> The embed description is pretext and text joined by a newline in that order, and fallback is used only when both pretext and text are absent+Fluxer sends [Webhooks Update](/gateway/events/#webhooks-update) and records no audit log entry.-<sup>2</sup> The value is mapped to the embed colour only when it is exactly six hexadecimal digits with an optional leading `#`, and any other value leaves the embed without a colour+The rate limit is 20 requests per 10 seconds, on the `webhook:update::webhook_id` bucket.-<sup>3</sup> The value is used only when it parses as an absolute `http` or `https` URL of at most 2,048 characters, and any other value is discarded silently+## Delete webhook with token-<sup>4</sup> A field is converted only when it supplies both a title and a value, and any other field is discarded silently+<RouteHeader method="DELETE" path="/v1/webhooks/{webhook_id}/{token}" />-<sup>5</sup> The value is accepted as a JSON number or as a decimal string and must be a non-negative integer+Deletes a webhook for good, without an audit log entry.-<sup>6</sup> The embed author is emitted only when `author_name` is present, so `author_link` and `author_icon` alone produce no author+### Response-### Slack attachment field object+| Status | Body | Condition |+| --- | --- | --- |+| 204 | empty | The webhook was deleted |-#### Structure+Fluxer sends [Webhooks Update](/gateway/events/#webhooks-update).++The rate limit is 20 requests per 10 seconds, on the `webhook:delete::webhook_id` bucket.++## Execute webhook++<RouteHeader method="POST" path="/v1/webhooks/{webhook_id}/{token}" />++Posts a [message](/http-api/messages/#message-object) as the webhook. Send JSON, or `multipart/form-data` to upload files.++### Query parameters| Field | Type | Description || --- | --- | --- |-| title? | string | Field title, mapped to the embed field name |-| value? | string | Field value, mapped to the embed field value |-| short? | boolean | Whether the embed field is rendered inline (default false) |+| wait? | boolean | Whether to return the created message (default false) |+| thread_id? | snowflake | The ID of a thread in the webhook's channel to post in |++### JSON body++The body is a [webhook message body](#webhook-message-body).-:::caution[Slack embed fields have no individual length limits]-No per-embed title, description, footer, or field maximum applies to a Slack value.-:::+### Multipart body-The Slack schema bounds only `username`, which must be 1 through 80 characters and rejects a longer value with `WEBHOOK_NAME_LENGTH_INVALID`. Fluxer applies no bound to any other Slack string or to either array.+| Field | Type | Description |+| --- | --- | --- |+| payload_json? | string | A JSON [webhook message body](#webhook-message-body) |+| files[n]?<sup>1</sup> | binary | A file, where n is its index |+| content?<sup>2</sup> | string | The message content |+| nonce?<sup>2</sup> | string | A client-generated message identifier |+| tts?<sup>2</sup> | string | The text-to-speech flag |+| flags?<sup>2</sup> | string | The message flags |-A conversion yielding neither content nor an embed returns 400 `CANNOT_SEND_EMPTY_MESSAGE`. Content longer than the effective maximum returns 400 `INVALID_FORM_BODY` with the validation code `CONTENT_EXCEEDS_MAX_LENGTH`. More converted embeds than the resolved ceiling returns the same status with `TOO_MANY_EMBEDS`. Fluxer discards an attachment that produces no embed property.+<sup>1</sup> n runs from 0 to the [max_attachments_per_message](/http-api/instance/#limit-keys) limit minus one-## GitHub callback objects+<sup>2</sup> Overrides the same field in `payload_json`-These objects define the body [Execute GitHub webhook](#execute-github-webhook) accepts.+### Response-### GitHub callback object+| Status | Body | Condition |+| --- | --- | --- |+| 200 | [message](/http-api/messages/#message-object) object | The message was created and `wait` is true |+| 204 | empty | The message was created and `wait` is false |+| 400 | [error response](/http-api/#error-response) | `CANNOT_SEND_EMPTY_MESSAGE` when there is nothing to post |+| 400 | [error response](/http-api/#error-response) | `WEBHOOK_FORUM_TARGET_REQUIRED` when a forum or media webhook sends no `thread_id` or `thread_name` |+| 400 | [error response](/http-api/#error-response) | `WEBHOOK_FORUM_TARGET_CONFLICT` when a forum or media webhook sends both |+| 400 | [error response](/http-api/#error-response) | `WEBHOOK_THREAD_NAME_REQUIRES_FORUM` when `thread_name` or `applied_tags` targets another channel type |+| 400 | [error response](/http-api/#error-response) | `FORUM_TAG_REQUIRED` or `NO_TAGS_AVAILABLE_TO_NON_MODERATORS` when the forum needs a tag |+| 400 | [error response](/http-api/#error-response) | `THREAD_LOCKED` or `MAX_ACTIVE_THREADS` for the target thread |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_CHANNEL` when `thread_id` is not a thread in the webhook's channel |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_FORUM_TAG` when `applied_tags` has a tag the forum doesn't have |++Fluxer sends [Message Create](/gateway/events/#message-create).++The rate limit is 60 requests per minute, on the `webhook:execute::webhook_id` bucket.++## Get webhook message++<RouteHeader method="GET" path="/v1/webhooks/{webhook_id}/{token}/messages/{message_id}" />++Returns a [message](/http-api/messages/#message-object) the webhook posted in its current channel.++### Query parameters++| Field | Type | Description |+| --- | --- | --- |+| thread_id? | snowflake | The ID of the thread the message is in |++### Response++| Status | Body | Condition |+| --- | --- | --- |+| 200 | [message](/http-api/messages/#message-object) object | The message was returned |+| 403 | [error response](/http-api/#error-response) | `MISSING_PERMISSIONS` when another author posted the message |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_MESSAGE` when the message isn't in the webhook's channel or the `thread_id` thread |++The rate limit is 60 requests per minute, on the `webhook:message_get::webhook_id` bucket.++## Edit webhook message++<RouteHeader method="PATCH" path="/v1/webhooks/{webhook_id}/{token}/messages/{message_id}" />++Edits a message the webhook posted and returns the [message](/http-api/messages/#message-object). You can edit default messages and replies, but not forwards.++### Query parameters++| Field | Type | Description |+| --- | --- | --- |+| thread_id? | snowflake | The ID of the thread the message is in |++### JSON body++The body is a [webhook message edit body](#webhook-message-edit-body).++### Response++| Status | Body | Condition |+| --- | --- | --- |+| 200 | [message](/http-api/messages/#message-object) object | The message was edited |+| 400 | [error response](/http-api/#error-response) | `CANNOT_MODIFY_SYSTEM_WEBHOOK` when the message type can't be edited |+| 400 | [error response](/http-api/#error-response) | `THREAD_ARCHIVED` or `THREAD_LOCKED` for the thread |+| 403 | [error response](/http-api/#error-response) | `MISSING_PERMISSIONS` when another author posted the message |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_MESSAGE` when the message isn't in the webhook's channel or the `thread_id` thread |++Fluxer sends [Message Update](/gateway/events/#message-update).++The rate limit is 30 requests per minute, on the `webhook:message_edit::webhook_id` bucket.++## Delete webhook message++<RouteHeader method="DELETE" path="/v1/webhooks/{webhook_id}/{token}/messages/{message_id}" />++Deletes a message the webhook posted.++### Query parameters++| Field | Type | Description |+| --- | --- | --- |+| thread_id? | snowflake | The ID of the thread the message is in |++### Response++| Status | Body | Condition |+| --- | --- | --- |+| 204 | empty | The message was deleted |+| 403 | [error response](/http-api/#error-response) | `MISSING_PERMISSIONS` when another author posted the message |+| 404 | [error response](/http-api/#error-response) | `UNKNOWN_MESSAGE` when the message isn't in the webhook's channel or the `thread_id` thread |++Fluxer sends [Message Delete](/gateway/events/#message-delete).++The rate limit is 30 requests per minute, on the `webhook:message_delete::webhook_id` bucket.++## Slack callback objects++[Execute Slack webhook](#execute-slack-webhook) takes a Slack incoming webhook body and turns each attachment into an embed.++### Slack callback object++#### Structure++| Field | Type | Description |+| --- | --- | --- |+| text? | string | The message content |+| username? | string | A name for this message only (1-80 characters) |+| icon_url? | string | An avatar URL for this message only |+| attachments? | array[[Slack attachment](#slack-attachment-object) object] | Attachments to turn into embeds |++### Slack attachment object#### Structure| Field | Type | Description || --- | --- | --- |-| action?<sup>1</sup> | ?string | GitHub event action, or null |-| answer? | ?[GitHub comment](#github-comment-object) object | Accepted discussion answer, or null (validated, never rendered) |-| check_run? | ?[GitHub check run](#github-check-run-object) object | Check run data, or null |-| check_suite? | ?[GitHub check suite](#github-check-suite-object) object | Check suite data, or null |-| comment? | ?[GitHub comment](#github-comment-object) object | Issue, review, commit, or discussion comment, or null |-| commits? | ?array[[GitHub commit](#github-commit-object) object] | Push commits, or null |-| compare? | ?string | Absolute comparison URL, or null |-| discussion? | ?[GitHub discussion](#github-discussion-object) object | Discussion data, or null |-| forced? | ?boolean | Whether a push was forced, or null |-| forkee? | ?[GitHub service](#github-service-object) object | Fork repository, or null |-| head_commit? | ?[GitHub commit](#github-commit-object) object | Head commit, or null |-| issue? | ?[GitHub issue](#github-issue-object) object | Issue data, or null |-| member? | ?[GitHub user](#github-user-object) object | Repository member data, or null |-| pull_request?<sup>2</sup> | ?[GitHub issue](#github-issue-object) object | Pull request representation, or null |-| ref_type?<sup>3</sup> | ?string | Git reference type, or null |-| ref? | ?string | Git reference, or null |-| release? | ?[GitHub release](#github-release-object) object | Release data, or null |-| repository?<sup>4</sup> | ?[GitHub service](#github-service-object) object | Repository data, or null |-| review? | ?[GitHub review](#github-review-object) object | Pull request review data, or null |-| sender | [GitHub user](#github-user-object) object | Event sender |+| fallback? | string | The embed description when `pretext` and `text` are absent |+| pretext? | string | The first line of the embed description |+| text? | string | The rest of the embed description |+| color? | string | The embed color as six hex digits, with or without `#` |+| title? | string | The embed title |+| title_link? | string | The embed URL |+| fields? | array[[Slack attachment field](#slack-attachment-field-object) object] | The embed fields |+| footer? | string | The embed footer |+| ts? | integer | The embed timestamp in Unix seconds |+| author_name? | string | The embed author name |+| author_link? | string | The embed author URL, used with `author_name` |+| author_icon? | string | The embed author icon URL, used with `author_name` |+| image_url? | string | The embed image URL |+| thumb_url? | string | The embed thumbnail URL |++Fluxer drops a URL that isn't an absolute `http` or `https` URL of at most 2,048 characters.++### Slack attachment field object++#### Structure-<sup>1</sup> An event type that lists one or more required actions in [GitHub event types](#github-event-types) renders a message only when `action` is one of those values+| Field | Type | Description |+| --- | --- | --- |+| title? | string | The embed field name |+| value? | string | The embed field value |+| short? | boolean | Whether the embed field is inline (default false) |-<sup>2</sup> A pull request uses the same representation as an issue, so only the fields listed in the [GitHub issue structure](#github-issue-object) are consumed+A field without both a title and a value is dropped.-<sup>3</sup> Only the exact values `branch` and `tag` are rendered for a create or delete event, and any other reference type produces no message+## GitHub callback objects-<sup>4</sup> Every rendered event type requires repository, so a callback without it produces no message+[Execute GitHub webhook](#execute-github-webhook) takes the body GitHub sends. Fields outside these tables are ignored.-A top-level `pull_request` field selects the wording of an `issue_comment` rendering, which names a pull request when the field is present and an issue when it is absent.+### GitHub callback object-Every GitHub string in these objects accepts at most 152,133 characters unless a narrower bound is stated. Every field typed as an absolute URL must parse as an `http` or `https` URL of at most 2,048 characters. A field marked as accepted and validated still has its declared type and bound, so a malformed value rejects the callback with 400 `INVALID_FORM_BODY`.+#### Structure-Every rendered embed title is truncated to 70 characters, except the ordinary push, check run, and check suite titles, which are truncated to 256. Every rendered embed description is truncated to 350 characters, except the forced push description, which is the fixed compare link and is neither decoded nor truncated. Fluxer decodes HTML entities and trims each value before truncating it.+| Field | Type | Description |+| --- | --- | --- |+| action? | ?string | The event action |+| answer? | ?[GitHub comment](#github-comment-object) object | The accepted discussion answer |+| check_run? | ?[GitHub check run](#github-check-run-object) object | The check run |+| check_suite? | ?[GitHub check suite](#github-check-suite-object) object | The check suite |+| comment? | ?[GitHub comment](#github-comment-object) object | The issue, review, commit or discussion comment |+| commits? | ?array[[GitHub commit](#github-commit-object) object] | The pushed commits |+| compare? | ?string | The comparison URL of a push |+| discussion? | ?[GitHub discussion](#github-discussion-object) object | The discussion |+| forced? | ?boolean | Whether the push was forced |+| forkee? | ?[GitHub service](#github-service-object) object | The new fork |+| head_commit? | ?[GitHub commit](#github-commit-object) object | The head commit of a push |+| issue? | ?[GitHub issue](#github-issue-object) object | The issue |+| member? | ?[GitHub user](#github-user-object) object | The added collaborator |+| pull_request? | ?[GitHub issue](#github-issue-object) object | The pull request |+| ref_type? | ?string | `branch` or `tag` |+| ref? | ?string | The Git reference |+| release? | ?[GitHub release](#github-release-object) object | The release |+| repository? | ?[GitHub service](#github-service-object) object | The repository, needed for every event |+| review? | ?[GitHub review](#github-review-object) object | The pull request review |+| sender | [GitHub user](#github-user-object) object | The user who triggered the event |++A field with the wrong type returns 400 `INVALID_FORM_BODY`.### GitHub user object@@ -341,10 +542,10 @@ Every rendered embed title is truncated to 70 characters, except the ordinary pu| Field | Type | Description || --- | --- | --- |-| id | integer | Non-negative 32-bit GitHub user ID (validated, never rendered) |-| login | string | GitHub login, used as the rendered embed author name |-| html_url | string | Absolute profile URL |-| avatar_url | string | Absolute avatar URL |+| id | integer | The GitHub user ID |+| login | string | The GitHub login, shown as the embed author |+| html_url | string | The profile URL |+| avatar_url | string | The avatar URL |### GitHub service object@@ -352,12 +553,10 @@ Every rendered embed title is truncated to 70 characters, except the ordinary pu| Field | Type | Description || --- | --- | --- |-| id | integer | Non-negative 32-bit GitHub repository ID (validated, never rendered) |-| html_url | string | Absolute repository URL |-| name<sup>1</sup> | string | Repository name |-| full_name<sup>1</sup> | string | Owner-qualified repository name |--<sup>1</sup> The push, check run, and check suite renderings use name, and every other rendering uses `full_name`+| id | integer | The GitHub repository ID |+| html_url | string | The repository URL |+| name | string | The repository name |+| full_name | string | The repository name with its owner |### GitHub author object@@ -365,8 +564,8 @@ Every rendered embed title is truncated to 70 characters, except the ordinary pu| Field | Type | Description || --- | --- | --- |-| username? | ?string | GitHub username, or null (validated, never rendered) |-| name | string | Author display name, which is the value rendered beside each pushed commit |+| username? | ?string | The GitHub username |+| name | string | The author name shown beside each commit |### GitHub commit object@@ -374,14 +573,10 @@ Every rendered embed title is truncated to 70 characters, except the ordinary pu| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | string | Commit identifier |-| url | string | Absolute commit API URL |-| message<sup>2</sup> | string | Commit message |-| author | [GitHub author](#github-author-object) object | Commit author |--<sup>1</sup> Renderings shorten the identifier to its first seven characters--<sup>2</sup> Every `This reverts commit <sha>.` sentence with a 40-character identifier is rewritten to a Markdown link to the reverted commit+| id | string | The commit SHA |+| url | string | The commit URL |+| message | string | The commit message |+| author | [GitHub author](#github-author-object) object | The commit author |### GitHub comment object@@ -389,13 +584,11 @@ Every rendered embed title is truncated to 70 characters, except the ordinary pu| Field | Type | Description || --- | --- | --- |-| id | string \| integer (validated, never rendered) | Signed 64-bit comment ID, accepted as a decimal string or as a safe integer |-| html_url | string | Absolute comment URL |-| user | [GitHub user](#github-user-object) object | Comment author |-| commit_id?<sup>1</sup> | ?string | Associated commit identifier, or null |-| body | string | Comment body |--<sup>1</sup> The field is required for a `commit_comment` event and unused for every other comment-bearing event+| id | string \| integer | The comment ID |+| html_url | string | The comment URL |+| user | [GitHub user](#github-user-object) object | The comment author |+| commit_id? | ?string | The commit SHA, needed for `commit_comment` |+| body | string | The comment body |### GitHub discussion object@@ -403,12 +596,12 @@ Every rendered embed title is truncated to 70 characters, except the ordinary pu| Field | Type | Description || --- | --- | --- |-| title | string | Discussion title |-| number | integer | Non-negative 32-bit discussion number |-| html_url | string | Absolute discussion URL |-| answer_html_url? | ?string | Absolute accepted-answer URL, or null (validated, never rendered) |-| body? | ?string | Discussion body, or null |-| user | [GitHub user](#github-user-object) object | Discussion author |+| title | string | The discussion title |+| number | integer | The discussion number |+| html_url | string | The discussion URL |+| answer_html_url? | ?string | The accepted answer URL |+| body? | ?string | The discussion body |+| user | [GitHub user](#github-user-object) object | The discussion author |### GitHub issue object@@ -416,18 +609,12 @@ Every rendered embed title is truncated to 70 characters, except the ordinary pu| Field | Type | Description || --- | --- | --- |-| id<sup>1</sup> | string \| integer | Signed 64-bit issue or pull request ID, accepted as a decimal string or as a safe integer |-| number | integer | Non-negative 32-bit issue or pull request number |-| html_url | string | Absolute issue or pull request URL |-| user<sup>1</sup> | [GitHub user](#github-user-object) object | Issue or pull request author |-| title | string | Issue or pull request title |-| body?<sup>2</sup> | ?string | Issue or pull request body, or null |--<sup>1</sup> The field is accepted and validated and never rendered. The issue, pull request, and `issue_comment` renderings take their embed author from the callback sender or the comment author--<sup>2</sup> The body is rendered as the embed description only for the `opened` action, and a `closed` or `reopened` action renders no description--No other key is read. An unlisted key, including a `pull_request` marker that GitHub places on the issue itself, is discarded.+| id | string \| integer | The issue or pull request ID |+| number | integer | The issue or pull request number |+| html_url | string | The issue or pull request URL |+| user | [GitHub user](#github-user-object) object | The issue or pull request author |+| title | string | The issue or pull request title |+| body? | ?string | The body, shown only for the `opened` action |### GitHub release object@@ -435,10 +622,10 @@ No other key is read. An unlisted key, including a `pull_request` marker that Gi| Field | Type | Description || --- | --- | --- |-| id | integer | Non-negative 32-bit release ID (validated, never rendered) |-| tag_name | string | Git tag name |-| html_url | string | Absolute release URL |-| body? | ?string | Release body, or null (validated, never rendered) |+| id | integer | The release ID |+| tag_name | string | The Git tag name |+| html_url | string | The release URL |+| body? | ?string | The release notes |### GitHub review object@@ -446,12 +633,10 @@ No other key is read. An unlisted key, including a `pull_request` marker that Gi| Field | Type | Description || --- | --- | --- |-| user | [GitHub user](#github-user-object) object | Review author |-| body? | ?string | Review body, or null |-| html_url | string | Absolute review URL |-| state<sup>1</sup> | string | Review state |--<sup>1</sup> The field is accepted and validated but does not change the rendered message, so an approval, a change request, and a comment review all render the same embed+| user | [GitHub user](#github-user-object) object | The review author |+| body? | ?string | The review body |+| html_url | string | The review URL |+| state | string | The review state |### GitHub check pull request object@@ -459,9 +644,7 @@ No other key is read. An unlisted key, including a `pull_request` marker that Gi| Field | Type | Description || --- | --- | --- |-| number | integer | Non-negative 32-bit pull request number (validated, never rendered) |--The object exists only inside the `pull_requests` arrays of the [GitHub check suite structure](#github-check-suite-object) and the [GitHub check run structure](#github-check-run-object). Both arrays are validated and never read.+| number | integer | The pull request number |### GitHub check application object@@ -469,7 +652,7 @@ The object exists only inside the `pull_requests` arrays of the [GitHub check su| Field | Type | Description || --- | --- | --- |-| name | string | Check application name, rendered in the check suite embed title |+| name | string | The check application name |### GitHub check suite object@@ -477,13 +660,11 @@ The object exists only inside the `pull_requests` arrays of the [GitHub check su| Field | Type | Description || --- | --- | --- |-| conclusion?<sup>1</sup> | ?string | Check conclusion, or null |-| head_branch? | ?string | Head branch, or null |-| head_sha | string | Head commit identifier, used to build the rendered commit URL |-| pull_requests? | ?array[[GitHub check pull request](#github-check-pull-request-object) object] | Associated pull requests, or null (validated, never rendered) |-| app | [GitHub check application](#github-check-application-object) object | Check application |--<sup>1</sup> The exact value `skipped` suppresses the message entirely, the exact value `success` renders a green embed, and every other value renders a red embed+| conclusion? | ?string | The conclusion, where `skipped` posts nothing and `success` shows green |+| head_branch? | ?string | The head branch |+| head_sha | string | The head commit SHA |+| pull_requests? | ?array[[GitHub check pull request](#github-check-pull-request-object) object] | The pull requests |+| app | [GitHub check application](#github-check-application-object) object | The check application |### GitHub check run output object@@ -491,8 +672,8 @@ The object exists only inside the `pull_requests` arrays of the [GitHub check su| Field | Type | Description || --- | --- | --- |-| title? | ?string | Output title, or null (validated, never rendered) |-| summary? | ?string | Output summary, or null (validated, never rendered) |+| title? | ?string | The output title |+| summary? | ?string | The output summary |### GitHub check run object@@ -500,61 +681,43 @@ The object exists only inside the `pull_requests` arrays of the [GitHub check su| Field | Type | Description || --- | --- | --- |-| conclusion?<sup>1</sup> | ?string | Check conclusion, or null |-| name | string | Check run name |-| html_url<sup>2</sup> | string | Absolute check run URL |-| check_suite<sup>3</sup> | [GitHub check suite](#github-check-suite-object) object | Parent check suite |-| details_url?<sup>2</sup> | ?string | Absolute details URL, or null |-| output?<sup>2</sup> | ?[GitHub check run output](#github-check-run-output-object) object | Check output, or null |-| pull_requests?<sup>2</sup> | ?array[[GitHub check pull request](#github-check-pull-request-object) object] | Associated pull requests, or null |--<sup>1</sup> The exact value `success` renders a green embed and every other value renders a red embed--<sup>2</sup> The field is accepted and validated and never rendered. The check run embed links the commit built from the parent suite's `head_sha`--<sup>3</sup> A check run whose parent suite reports the conclusion `skipped` produces no message+| conclusion? | ?string | The conclusion, where `success` shows green |+| name | string | The check run name |+| html_url | string | The check run URL |+| check_suite | [GitHub check suite](#github-check-suite-object) object | The parent check suite |+| details_url? | ?string | The details URL |+| output? | ?[GitHub check run output](#github-check-run-output-object) object | The check output |+| pull_requests? | ?array[[GitHub check pull request](#github-check-pull-request-object) object] | The pull requests |## GitHub event types-The value of the `X-GitHub-Event` request header selects the rendering. An event type outside this registry, and an absent header, are both acknowledged without creating a message. Every listed type also requires repository.+The `X-GitHub-Event` header picks the event. Fluxer posts a message only for these events and actions, and accepts any other callback without posting.| Value | Description || --- | --- |-| commit_comment<sup>1</sup> | New comment on a commit, requiring the action `created` and a comment with commit_id |-| create<sup>2</sup> | Creation of a branch or a tag, requiring ref and ref_type |-| delete<sup>2</sup> | Deletion of a branch or a tag, requiring ref and ref_type |-| fork | Creation of a fork, requiring forkee |-| issue_comment<sup>1</sup> | New comment on an issue or a pull request, requiring the action `created` and both comment and issue |-| issues<sup>3</sup> | Issue lifecycle change, requiring issue and the action `opened`, `closed`, or `reopened` |-| member | Repository collaborator addition, requiring the action `added` and member |-| public | Repository becoming public |-| pull_request<sup>3</sup> | Pull request lifecycle change, requiring pull_request and the action `opened`, `closed`, or `reopened` |-| pull_request_review<sup>1</sup> | Pull request review, requiring the action `submitted` and both review and pull_request |-| pull_request_review_comment<sup>1</sup> | New review comment, requiring the action `created` and both comment and pull_request |-| push<sup>4</sup> | Git push, requiring ref |-| release | Release publication, requiring the action `published` and release |-| watch | Repository star, requiring the action `started` |-| check_run<sup>5</sup> | Check run completion, requiring the action `completed` and check_run |-| check_suite<sup>5</sup> | Check suite completion, requiring the action `completed` and check_suite |-| discussion<sup>1</sup> | New discussion, requiring the action `created` and discussion |-| discussion_comment<sup>1</sup> | New discussion comment, requiring the action `created` and both comment and discussion |-| repository | Repository creation, requiring the action `created` |--<sup>1</sup> The embed author is the comment, discussion, or review author--<sup>2</sup> Only the reference types `branch` and `tag` render, and any other `ref_type` produces no message--<sup>3</sup> The description is rendered only for the `opened` action--<sup>4</sup> A forced push requires `head_commit` and compare, and renders a compare link as its whole description--<sup>5</sup> A `check_suite` event whose check suite has the conclusion `skipped` produces no message. A `check_run` event produces no message when its parent check suite has the conclusion `skipped`--An ordinary push requires compare and at least one commit, and renders one line for each commit. The line set is not capped by count, and the description built from them is truncated to the ordinary 350-character ceiling.+| check_run | A finished check run, action `completed` |+| check_suite | A finished check suite, action `completed` |+| commit_comment | A comment on a commit, action `created` |+| create | A new branch or tag |+| delete | A deleted branch or tag |+| discussion | A new discussion, action `created` |+| discussion_comment | A comment on a discussion, action `created` |+| fork | A new fork |+| issue_comment | A comment on an issue or pull request, action `created` |+| issues | An issue, action `opened`, `closed` or `reopened` |+| member | A new collaborator, action `added` |+| public | The repository made public |+| pull_request | A pull request, action `opened`, `closed` or `reopened` |+| pull_request_review | A pull request review, action `submitted` |+| pull_request_review_comment | A pull request review comment, action `created` |+| push | A push, with one line per commit |+| release | A release, action `published` |+| repository | A new repository, action `created` |+| watch | A star, action `started` |## Instatus callback objects-These objects define the body [Execute Instatus webhook](#execute-instatus-webhook) accepts.+[Execute Instatus webhook](#execute-instatus-webhook) takes the body Instatus sends. A value that is too long returns 400 `INVALID_FORM_BODY`. Fluxer posts the incident if it has a name, then the maintenance if it has a name, and otherwise the component update.### Instatus callback object@@ -562,16 +725,12 @@ These objects define the body [Execute Instatus webhook](#execute-instatus-webho| Field | Type | Description || --- | --- | --- |-| meta? | ?[Instatus metadata](#instatus-metadata-object) object | Callback metadata, or null (validated, never rendered) |-| page?<sup>1</sup> | ?[Instatus page](#instatus-page-object) object | Status page data, or null |-| incident?<sup>2</sup> | ?[Instatus incident](#instatus-incident-object) object | Incident data, or null |-| maintenance?<sup>2</sup> | ?[Instatus maintenance](#instatus-maintenance-object) object | Maintenance data, or null |-| component_update?<sup>2</sup> | ?[Instatus component update](#instatus-component-update-object) object | Component transition data, or null |-| component?<sup>2</sup> | ?[Instatus component](#instatus-component-object) object | Component data, or null |--<sup>1</sup> The page supplies the embed footer text and the fallback embed URL when the incident or maintenance item supplies no URL of its own. A component transition always takes its URL from the page--<sup>2</sup> Exactly one rendering is selected in the order incident, maintenance, then component transition. A section with no non-empty name renders nothing, and the next section in that order is tried+| meta? | ?[Instatus metadata](#instatus-metadata-object) object | Callback metadata |+| page? | ?[Instatus page](#instatus-page-object) object | The status page, used for the embed footer and link |+| incident? | ?[Instatus incident](#instatus-incident-object) object | The incident |+| maintenance? | ?[Instatus maintenance](#instatus-maintenance-object) object | The maintenance |+| component_update? | ?[Instatus component update](#instatus-component-update-object) object | The component status change |+| component? | ?[Instatus component](#instatus-component-object) object | The component |### Instatus metadata object@@ -579,8 +738,8 @@ These objects define the body [Execute Instatus webhook](#execute-instatus-webho| Field | Type | Description || --- | --- | --- |-| unsubscribe? | ?string | Unsubscribe value (max 2,048 characters), or null |-| documentation? | ?string | Documentation value (max 2,048 characters), or null |+| unsubscribe? | ?string | The unsubscribe URL |+| documentation? | ?string | The documentation URL |### Instatus page object@@ -588,16 +747,10 @@ These objects define the body [Execute Instatus webhook](#execute-instatus-webho| Field | Type | Description || --- | --- | --- |-| id? | ?string | Page ID (max 256 characters), or null |-| status_indicator?<sup>1</sup> | ?string | Status indicator (max 256 characters), or null |-| status_description?<sup>1</sup> | ?string | Status description (max 1,024 characters), or null |-| url?<sup>2</sup> | ?string | Page URL (max 2,048 characters), or null |--<sup>1</sup> The footer text is `status_description` when it is non-empty, otherwise the humanised form of `status_indicator`--<sup>2</sup> Used as an embed URL only when it parses as an absolute `http` or `https` URL--A backfilled incident or maintenance item appends `Backfilled` to the footer text, so the footer is omitted only when both page values are empty and the rendered item is not backfilled.+| id? | ?string | The page ID |+| status_indicator? | ?string | The status indicator |+| status_description? | ?string | The status description, used as the footer |+| url? | ?string | The page URL |### Instatus affected component object@@ -605,13 +758,9 @@ A backfilled incident or maintenance item appends `Backfilled` to the footer tex| Field | Type | Description || --- | --- | --- |-| id? | ?string | Component ID (max 256 characters), or null |-| name?<sup>1</sup> | ?string | Component name (max 1,024 characters), or null |-| status?<sup>2</sup> | ?string | Component status (max 256 characters), or null |--<sup>1</sup> A component without a non-empty name is omitted from the rendered affected components field, and a callback whose components all lack names renders no such field--<sup>2</sup> A non-empty status is rendered in lower case in parentheses after the name, and a component without one renders its name alone+| id? | ?string | The component ID |+| name? | ?string | The component name |+| status? | ?string | The component status |### Instatus component object@@ -619,16 +768,10 @@ A backfilled incident or maintenance item appends `Backfilled` to the footer tex| Field | Type | Description || --- | --- | --- |-| id? | ?string | Component ID (max 256 characters), or null |-| name?<sup>1</sup> | ?string | Component name (max 1,024 characters), or null |-| status?<sup>2</sup> | ?string | Component status (max 256 characters), or null |-| created_at?<sup>3</sup> | ?string | Provider creation time (max 64 characters), or null |--<sup>1</sup> A component transition with no non-empty name renders the literal words `A component` in its place--<sup>2</sup> The value is the fallback for the rendered transition status when the [component update](#instatus-component-update-object) supplies no `new_status`--<sup>3</sup> The value is the fallback for the embed timestamp when the component update supplies no `created_at`, and a value the runtime cannot parse as a date leaves the embed without a timestamp+| id? | ?string | The component ID |+| name? | ?string | The component name |+| status? | ?string | The component status |+| created_at? | ?string | The creation time |### Instatus incident update object@@ -636,14 +779,14 @@ A backfilled incident or maintenance item appends `Backfilled` to the footer tex| Field | Type | Description || --- | --- | --- |-| id? | ?string | Update ID (max 256 characters), or null |-| incident_id? | ?string | Incident ID (max 256 characters), or null |-| markdown?<sup>1</sup> | ?string | Update body (max 65,536 characters), or null |-| status? | ?string | Update status (max 256 characters), or null (validated, never rendered) |-| created_at?<sup>1</sup> | ?string | Provider creation time (max 64 characters), or null |-| updated_at? | ?string | Provider update time (max 64 characters), or null (validated, never rendered) |+| id? | ?string | The update ID |+| incident_id? | ?string | The incident ID |+| markdown? | ?string | The update text |+| status? | ?string | The update status |+| created_at? | ?string | The creation time |+| updated_at? | ?string | The update time |-<sup>1</sup> Only the update with the latest `created_at` contributes. Its markdown becomes the embed description, truncated to 4,096 characters, and its `created_at` becomes the embed timestamp+Fluxer posts the latest update as the embed description.### Instatus incident object@@ -651,24 +794,16 @@ A backfilled incident or maintenance item appends `Backfilled` to the footer tex| Field | Type | Description || --- | --- | --- |-| id? | ?string | Incident ID (max 256 characters), or null |-| name?<sup>1</sup> | ?string | Incident name (max 1,024 characters), or null |-| url? | ?string | Incident URL (max 2,048 characters), or null |-| status?<sup>2</sup> | ?string | Incident status (max 256 characters), or null |-| backfilled?<sup>3</sup> | ?boolean | Whether the incident was backfilled, or null |-| created_at?<sup>4</sup> | ?string | Provider creation time (max 64 characters), or null |-| updated_at?<sup>4</sup> | ?string | Provider update time (max 64 characters), or null |-| resolved_at? | ?string | Provider resolution time (max 64 characters), or null (validated, never rendered) |-| incident_updates? | ?array[[Instatus incident update](#instatus-incident-update-object) object] | Incident updates, or null |-| affected_components? | ?array[[Instatus affected component](#instatus-affected-component-object) object] | Affected components, or null |--<sup>1</sup> The name becomes the embed title, truncated to 256 characters. An incident with no non-empty name is skipped, and the maintenance or component data in the same callback renders in its place--<sup>2</sup> The value selects the embed colour and the rendered Status field through [Instatus status values](#instatus-status-values), and an absent status renders the neutral colour and no Status field--<sup>3</sup> A true value appends `Backfilled` to the embed footer, separated from the page footer text by a vertical bar. When the page supplies no footer text, `Backfilled` is the whole footer--<sup>4</sup> The embed timestamp is the first of these values that parses as a date: the `created_at` of the latest update, then this object's `updated_at`, then this object's `created_at`+| id? | ?string | The incident ID |+| name? | ?string | The incident name, used as the embed title |+| url? | ?string | The incident URL |+| status? | ?string | An [Instatus status value](#instatus-status-values) |+| backfilled? | ?boolean | Whether the incident was backfilled |+| created_at? | ?string | The creation time |+| updated_at? | ?string | The update time |+| resolved_at? | ?string | The resolution time |+| incident_updates? | ?array[[Instatus incident update](#instatus-incident-update-object) object] | The incident updates |+| affected_components? | ?array[[Instatus affected component](#instatus-affected-component-object) object] | The affected components |### Instatus maintenance update object@@ -676,13 +811,11 @@ A backfilled incident or maintenance item appends `Backfilled` to the footer tex| Field | Type | Description || --- | --- | --- |-| id? | ?string | Update ID (max 256 characters), or null |-| maintenance_id? | ?string | Maintenance ID (max 256 characters), or null |-| markdown?<sup>1</sup> | ?string | Update body (max 65,536 characters), or null |-| created_at?<sup>1</sup> | ?string | Provider creation time (max 64 characters), or null |-| updated_at? | ?string | Provider update time (max 64 characters), or null (validated, never rendered) |--<sup>1</sup> Only the update with the latest `created_at` contributes. Its markdown becomes the embed description, truncated to 4,096 characters, and its `created_at` becomes the embed timestamp+| id? | ?string | The update ID |+| maintenance_id? | ?string | The maintenance ID |+| markdown? | ?string | The update text |+| created_at? | ?string | The creation time |+| updated_at? | ?string | The update time |### Instatus maintenance object@@ -690,26 +823,18 @@ A backfilled incident or maintenance item appends `Backfilled` to the footer tex| Field | Type | Description || --- | --- | --- |-| id? | ?string | Maintenance ID (max 256 characters), or null |-| name?<sup>1</sup> | ?string | Maintenance name (max 1,024 characters), or null |-| url? | ?string | Maintenance URL (max 2,048 characters), or null |-| status?<sup>2</sup> | ?string | Maintenance status (max 256 characters), or null |-| maintenance_start_date?<sup>3</sup> | ?string | Provider start time (max 64 characters), or null |-| maintenance_end_date?<sup>3</sup> | ?string | Provider end time (max 64 characters), or null |-| backfilled? | ?boolean | Whether the maintenance was backfilled, or null |-| created_at?<sup>4</sup> | ?string | Provider creation time (max 64 characters), or null |-| updated_at?<sup>4</sup> | ?string | Provider update time (max 64 characters), or null |-| resolved_at? | ?string | Provider resolution time (max 64 characters), or null (validated, never rendered) |-| maintenance_updates? | ?array[[Instatus maintenance update](#instatus-maintenance-update-object) object] | Maintenance updates, or null |-| affected_components? | ?array[[Instatus affected component](#instatus-affected-component-object) object] | Affected components, or null |--<sup>1</sup> The name becomes the embed title, truncated to 256 characters. A maintenance item with no non-empty name is skipped, and the component transition in the same callback renders in its place--<sup>2</sup> An absent status renders the maintenance colour--<sup>3</sup> Each parseable value renders as a full timestamp in the Window field, and the field is omitted when neither value parses--<sup>4</sup> The embed timestamp is the latest update's `created_at`, then `updated_at`, then `created_at`, and the first value the runtime can parse as a date wins+| id? | ?string | The maintenance ID |+| name? | ?string | The maintenance name, used as the embed title |+| url? | ?string | The maintenance URL |+| status? | ?string | An [Instatus status value](#instatus-status-values) |+| maintenance_start_date? | ?string | The start of the window |+| maintenance_end_date? | ?string | The end of the window |+| backfilled? | ?boolean | Whether the maintenance was backfilled |+| created_at? | ?string | The creation time |+| updated_at? | ?string | The update time |+| resolved_at? | ?string | The resolution time |+| maintenance_updates? | ?array[[Instatus maintenance update](#instatus-maintenance-update-object) object] | The maintenance updates |+| affected_components? | ?array[[Instatus affected component](#instatus-affected-component-object) object] | The affected components |### Instatus component update object@@ -717,37 +842,35 @@ A backfilled incident or maintenance item appends `Backfilled` to the footer tex| Field | Type | Description || --- | --- | --- |-| created_at? | ?string | Provider creation time (max 64 characters), or null |-| new_status?<sup>1</sup> | ?string | New component status (max 256 characters), or null |-| component_id? | ?string | Component ID (max 256 characters), or null (validated, never rendered) |--<sup>1</sup> The rendering prefers `new_status` and falls back to the status of the accompanying component, using the literal word `updated` when neither is present. The selected value is rendered in lower case+| created_at? | ?string | The time of the change |+| new_status? | ?string | The new component status |+| component_id? | ?string | The component ID |## Instatus status values-Fluxer normalises an incident, maintenance, or component status by uppercasing it and removing every character outside `A` to `Z`, so `degraded_performance` becomes `DEGRADEDPERFORMANCE`. A normalised value in this registry selects the rendered label and the embed colour, and any other value is rendered unchanged with a neutral colour.+Fluxer uppercases a status and drops everything except letters, which turns `degraded_performance` into `DEGRADEDPERFORMANCE`. Each value sets the label, and every value except `UP` and `HASISSUES` also sets the embed color. Any other status is shown as sent.| Value | Description || --- | --- |-| UP | Rendered as `All systems operational`, with the neutral colour |-| HASISSUES | Rendered as `Has issues`, with the neutral colour |-| OPERATIONAL | Rendered as `Operational`, with the operational colour |-| UNDERMAINTENANCE | Rendered as `Under maintenance`, with the maintenance colour |-| DEGRADEDPERFORMANCE | Rendered as `Degraded performance`, with the degraded colour |-| PARTIALOUTAGE | Rendered as `Partial outage`, with the partial outage colour |-| MAJOROUTAGE | Rendered as `Major outage`, with the major outage colour |-| INVESTIGATING | Rendered as `Investigating`, with the major outage colour |-| IDENTIFIED | Rendered as `Identified`, with the partial outage colour |-| MONITORING | Rendered as `Monitoring`, with the degraded colour |-| RESOLVED | Rendered as `Resolved`, with the operational colour |-| NOTSTARTEDYET | Rendered as `Scheduled`, with the maintenance colour |-| PLANNED | Rendered as `Planned`, with the maintenance colour |-| INPROGRESS | Rendered as `In progress`, with the maintenance colour |-| COMPLETED | Rendered as `Completed`, with the operational colour |+| UP | Shown as "All systems operational" |+| HASISSUES | Shown as "Has issues" |+| OPERATIONAL | Shown as "Operational" |+| UNDERMAINTENANCE | Shown as "Under maintenance" |+| DEGRADEDPERFORMANCE | Shown as "Degraded performance" |+| PARTIALOUTAGE | Shown as "Partial outage" |+| MAJOROUTAGE | Shown as "Major outage" |+| INVESTIGATING | Shown as "Investigating" |+| IDENTIFIED | Shown as "Identified" |+| MONITORING | Shown as "Monitoring" |+| RESOLVED | Shown as "Resolved" |+| NOTSTARTEDYET | Shown as "Scheduled" |+| PLANNED | Shown as "Planned" |+| INPROGRESS | Shown as "In progress" |+| COMPLETED | Shown as "Completed" |## Libredesk callback objects-These objects define the body [Execute Libredesk webhook](#execute-libredesk-webhook) accepts. Libredesk sends more members than these tables list, and Fluxer ignores every member they do not list.+[Execute Libredesk webhook](#execute-libredesk-webhook) takes the body Libredesk sends. Fields outside these tables are ignored, and Fluxer never posts contact email addresses, phone numbers or attachment URLs.### Libredesk callback object@@ -755,55 +878,41 @@ These objects define the body [Execute Libredesk webhook](#execute-libredesk-web| Field | Type | Description || --- | --- | --- |-| event | string | [Libredesk event type](#libredesk-event-types) |-| payload | [Libredesk payload](#libredesk-payload-object) object | Event data |+| event | string | The [Libredesk event type](#libredesk-event-types) |+| payload | [Libredesk payload](#libredesk-payload-object) object | The event data |### Libredesk payload object-Libredesk sends a conversation, a message, or a conversation wrapped with change details, depending on the event. Every member is optional, and each event reads only the members it renders.+Each event uses only the fields that apply to it.#### Structure| Field | Type | Description || --- | --- | --- |-| uuid?<sup>1</sup> | ?string | Conversation UUID on `conversation.created`, or null |-| reference_number? | ?string | Conversation reference number on `conversation.created`, or null |-| subject? | ?string | Conversation subject on `conversation.created`, or null |-| inbox_name? | ?string | Inbox name on `conversation.created`, or null |-| contact?<sup>2</sup> | ?[Libredesk person](#libredesk-person-object) object | Contact on `conversation.created`, or null |-| conversation_uuid?<sup>1</sup> | ?string | Conversation UUID on the other built-in events, or null |-| conversation? | ?[Libredesk conversation](#libredesk-conversation-object) object | Conversation after the change, or null |-| previous_status? | ?string | Status before a status change, or null |-| new_status?<sup>3</sup> | ?string | Status after a status change, or null |-| snooze_until?<sup>4</sup> | ?string | End of a snooze, or null |-| previous_tags?<sup>5</sup> | ?array[string] | Tags before a tag change, or null |-| new_tags?<sup>5</sup> | ?array[string] | Tags after a tag change, or null |-| assigned_to? | ?integer | Libredesk user ID of the new assignee, or null |-| type?<sup>6</sup> | ?string | Message type, or null |-| status?<sup>7</sup> | ?string | Message delivery status, or the conversation status on `conversation.created`, or null |-| text_content?<sup>8</sup> | ?string | Plain text of the message, or null |-| private? | ?boolean | Whether the message is a private note, or null |-| sender_type? | ?string | `contact` or `agent`, or null |-| meta? | ?[Libredesk message metadata](#libredesk-message-metadata-object) object | Message metadata, or null |-| attachments? | ?array[[Libredesk attachment](#libredesk-attachment-object) object] | Message attachments, or null |-| author?<sup>2</sup> | ?[Libredesk person](#libredesk-person-object) object | Message author, or null |-| name? | ?string | Libredesk webhook name on `webhook.test`, or null |--<sup>1</sup> The embed footer is `Conversation` followed by this value, truncated to 128 characters, and is omitted when the value is empty--<sup>2</sup> The person's name becomes the embed author name. Fluxer never renders an email address, phone number, or custom attribute--<sup>3</sup> A status change with an empty `new_status` renders nothing--<sup>4</sup> A date after 1970 renders as a timestamp after the new status. Any other value is left out--<sup>5</sup> Only the difference renders, as an Added field and a Removed field. A tag change that adds and removes nothing renders nothing--<sup>6</sup> A message of type `activity` renders nothing--<sup>7</sup> A `message.updated` event renders only when the status is `failed`--<sup>8</sup> Whitespace collapses to single spaces, and the excerpt is truncated to 1,000 characters. Fluxer never reads the HTML `content` member+| uuid?<sup>1</sup> | ?string | The conversation UUID |+| reference_number?<sup>1</sup> | ?string | The conversation reference number |+| subject?<sup>1</sup> | ?string | The conversation subject |+| inbox_name?<sup>1</sup> | ?string | The inbox name |+| contact?<sup>1</sup> | ?[Libredesk person](#libredesk-person-object) object | The contact |+| conversation_uuid? | ?string | The conversation UUID on other events |+| conversation? | ?[Libredesk conversation](#libredesk-conversation-object) object | The conversation after the change |+| previous_status? | ?string | The status before a status change |+| new_status? | ?string | The status after a status change |+| snooze_until? | ?string | The end of a snooze |+| previous_tags? | ?array[string] | The tags before a tag change |+| new_tags? | ?array[string] | The tags after a tag change |+| assigned_to? | ?integer | The Libredesk user ID of the new assignee |+| type? | ?string | The message type, where `activity` posts nothing |+| status? | ?string | The message delivery status, or the conversation status on `conversation.created` |+| text_content? | ?string | The plain text of the message, shortened to 1,000 characters |+| private? | ?boolean | Whether the message is a private note |+| sender_type? | ?string | `contact` or `agent` |+| meta? | ?[Libredesk message metadata](#libredesk-message-metadata-object) object | The message metadata |+| attachments? | ?array[[Libredesk attachment](#libredesk-attachment-object) object] | The message attachments |+| author? | ?[Libredesk person](#libredesk-person-object) object | The message author |+| name? | ?string | The Libredesk webhook name on `webhook.test` |++<sup>1</sup> Only on `conversation.created`### Libredesk conversation object@@ -811,17 +920,11 @@ Libredesk sends a conversation, a message, or a conversation wrapped with change| Field | Type | Description || --- | --- | --- |-| uuid?<sup>1</sup> | ?string | Conversation UUID, or null |-| reference_number?<sup>2</sup> | ?string | Reference number, or null |-| subject?<sup>2</sup> | ?string | Subject, or null |-| inbox_name?<sup>2</sup> | ?string | Inbox name, or null |-| status_category?<sup>3</sup> | ?string | `open`, `waiting`, or `resolved`, or null |--<sup>1</sup> Only an automation event takes its embed footer from this value--<sup>2</sup> A conversation event title is the inbox name in square brackets, the event label, then `#` with the reference number and the subject. The inbox name is truncated to 48 characters, the reference number to 32, and the subject to 128. An empty part is left out--<sup>3</sup> The value selects the colour of a status change embed+| uuid? | ?string | The conversation UUID |+| reference_number? | ?string | The reference number |+| subject? | ?string | The subject |+| inbox_name? | ?string | The inbox name |+| status_category? | ?string | `open`, `waiting` or `resolved` |### Libredesk person object@@ -829,10 +932,8 @@ Libredesk sends a conversation, a message, or a conversation wrapped with change| Field | Type | Description || --- | --- | --- |-| first_name? | ?string | First name, or null |-| last_name? | ?string | Last name, or null |--The non-empty names, joined by a space and truncated to 128 characters, form the rendered name. A message whose author has no name renders `Contact` or `Agent` instead.+| first_name? | ?string | The first name |+| last_name? | ?string | The last name |### Libredesk message metadata object@@ -840,791 +941,74 @@ The non-empty names, joined by a space and truncated to 128 characters, form the| Field | Type | Description || --- | --- | --- |-| is_automated?<sup>1</sup> | ?boolean | Whether an automation rule sent the message, or null |-| is_csat?<sup>2</sup> | ?boolean | Whether the message is a satisfaction survey request, or null |-| continuity_email?<sup>2</sup> | ?boolean | Whether the message is a continuity email digest, or null |+| is_automated? | ?boolean | Whether an automation rule sent the message |+| is_csat? | ?boolean | Whether the message is a satisfaction survey, which posts nothing |+| continuity_email? | ?boolean | Whether the message is a continuity email digest, which posts nothing |-<sup>1</sup> A true value titles an agent message `Automated reply`--<sup>2</sup> A true value renders nothing, so a survey link or a digest of earlier messages never reaches the channel--### Libredesk attachment object+### Libredesk attachment object#### Structure| Field | Type | Description || --- | --- | --- |-| name? | ?string | File name, or null |--The non-empty names form an Attachments field, truncated to 256 characters. Attachment URLs are never rendered.+| name? | ?string | The file name |## Libredesk event types-The `event` member selects the rendering. A built-in event renders as below only when its payload has that event's shape: `uuid` for `conversation.created`, `name` for `webhook.test`, and `conversation_uuid` for the others. Any other payload renders as an automation event.--- `conversation.created`: new conversation, with the contact name as the embed author-- `conversation.status_changed`: status change, rendered as the previous and new status-- `conversation.tags_changed`: tag change, rendered as the added and removed tags-- `conversation.assigned`: agent assignment, rendered with the agent's Libredesk user ID-- `conversation.unassigned`: agent removal-- `message.created`: new contact message, agent reply, private note, or automated reply, with the sender as the embed author-- `message.updated`: outgoing message that failed to send-- `webhook.test`: test delivery from the Libredesk webhook settings, rendered with the Libredesk webhook name--A contact message is titled `New message`, a private note `New private note`, an automated agent message `Automated reply`, and any other agent message `New reply`. Activity lines, satisfaction survey requests, and continuity digests render nothing.--A Libredesk automation rule can send any event name. Such an event renders the event name, truncated to 32 characters, as the title label when its payload carries a conversation, and renders nothing otherwise.--## List guild webhooks--<RouteHeader method="GET" path="/v1/guilds/{guild_id}/webhooks" bot />--Returns an array of [webhook objects](#webhook-object) in a guild. The caller must be a guild member holding [MANAGE_WEBHOOKS](/http-api/permissions/) at guild level.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | snowflake | The ID of the guild whose webhooks are returned |--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200<sup>1</sup> | array[[webhook](#webhook-object) object] | Webhooks were returned, and an empty array is returned when the guild has none |-| 400 | [error response](/http-api/#error-response) | Path parameter is not a valid snowflake |-| 400<sup>2</sup> | [error response](/http-api/#error-response) | The caller holds `MANAGE_WEBHOOKS` with no enrolled authenticator in an elevated-MFA guild |-| 403<sup>3</sup> | [error response](/http-api/#error-response) | Credential is a bearer token |-| 403<sup>3</sup> | [error response](/http-api/#error-response) | The guild is unavailable |-| 403<sup>3</sup> | [error response](/http-api/#error-response) | The caller is not a member of the guild or lacks `MANAGE_WEBHOOKS` |-| 404 | [error response](/http-api/#error-response) | Guild does not exist, returning `UNKNOWN_GUILD` |--<sup>1</sup> The array can be shorter than the number of stored webhooks--<sup>2</sup> The missing-authenticator code is `TWO_FACTOR_REQUIRED`, returned only after Fluxer confirms the permission itself--<sup>3</sup> `MISSING_ACCESS` for an unavailable guild, `MISSING_PERMISSIONS` for a membership or permission failure, and `ACCESS_DENIED` otherwise--A webhook is returned only when the caller also holds both `VIEW_CHANNEL` and `MANAGE_WEBHOOKS` in that webhook's own channel. A webhook with no channel target is never returned.--### Rate limit--40 requests per 10 seconds for each authenticated user and guild ID, on the `webhook:list::guild_id` bucket.--## List channel webhooks--<RouteHeader method="GET" path="/v1/channels/{channel_id}/webhooks" bot />--Returns an array of [webhook objects](#webhook-object) in a guild text, voice, announcement, forum, or media channel. The caller must be able to view the channel and hold the [MANAGE_WEBHOOKS](/http-api/permissions/) permission at guild level and in the channel.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the guild text, voice, announcement, forum, or media channel whose webhooks are returned |--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | array[[webhook](#webhook-object) object] | Webhooks were returned, and an empty array is returned when the channel has none |-| 400 | [error response](/http-api/#error-response) | Path parameter is not a valid snowflake |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The caller holds `MANAGE_WEBHOOKS` with no enrolled authenticator in an elevated-MFA guild |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | Credential is a bearer token |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | The guild is unavailable |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | The caller is not a member of the channel's guild |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | The caller lacks channel access or `MANAGE_WEBHOOKS` |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | The channel is age restricted and the account is not age verified |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or cannot hold a webhook, each returning `UNKNOWN_CHANNEL` |-| 404 | [error response](/http-api/#error-response) | Its guild does not resolve, returning `UNKNOWN_GUILD` |--<sup>1</sup> The missing-authenticator code is `TWO_FACTOR_REQUIRED`, returned only after Fluxer confirms the permission itself--<sup>2</sup> `MISSING_ACCESS` for an unavailable guild, `NSFW_CONTENT_AGE_RESTRICTED` for an unverified account in an age restricted channel, `MISSING_PERMISSIONS` for a membership, channel access, or permission failure, and `ACCESS_DENIED` otherwise--### Rate limit--40 requests per 10 seconds for each authenticated user and channel ID, on the `webhook:list::channel_id` bucket.--## Create webhook--<RouteHeader method="POST" path="/v1/channels/{channel_id}/webhooks" bot auditReason />--Creates a webhook in a guild text, voice, announcement, forum, or media channel and returns the new [webhook object](#webhook-object) with its execution token. The caller must be able to view the channel and hold the [MANAGE_WEBHOOKS](/http-api/permissions/) permission at guild level and in the channel. The operation accepts an audit reason.--Creation emits a [Webhooks Update](/gateway/events/#webhooks-update).--The guild allowance is the resolved [max_webhooks_per_guild](/http-api/instance/#limit-keys) value for the guild, defaulting to 1000. The channel allowance is the resolved [max_webhooks_per_channel](/http-api/instance/#limit-keys) value, defaulting to 15.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the guild text, voice, announcement, forum, or media channel the webhook is created in |--### JSON body--| Field | Type | Description |-| --- | --- | --- |-| name | string | Webhook name (1-80 characters) |-| avatar?<sup>1</sup> | ?base64 string | Base64-encoded avatar image, or null |--<sup>1</sup> A leading data URI header is stripped at the first comma before decoding, and the base64 payload is 1 through 139810136 characters--The decoded bytes must be at most the resolved [avatar_max_size](/http-api/instance/#limit-keys) value, which is the 10 MiB ceiling of 10485760 bytes by default. The image must be an accepted avatar upload format, and an animated AVIF is rejected.--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [webhook](#webhook-object) object | Webhook was created |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Body or avatar is invalid |-| 400<sup>2</sup> | [error response](/http-api/#error-response) | The guild or channel webhook allowance is already reached |-| 400 | [error response](/http-api/#error-response) | The caller holds `MANAGE_WEBHOOKS` with no enrolled authenticator in an elevated-MFA guild |-| 403 | [error response](/http-api/#error-response) | Credential is a bearer token |-| 403 | [error response](/http-api/#error-response) | The account is limited |-| 403 | [error response](/http-api/#error-response) | The guild is unavailable |-| 403 | [error response](/http-api/#error-response) | The caller is not a member of the channel's guild |-| 403 | [error response](/http-api/#error-response) | The caller lacks channel access or `MANAGE_WEBHOOKS` |-| 403 | [error response](/http-api/#error-response) | The channel is age restricted and the account is not age verified |-| 403 | [error response](/http-api/#error-response) | The name is blocked |-| 403 | [error response](/http-api/#error-response) | The avatar hash is banned |-| 404 | [error response](/http-api/#error-response) | Channel does not exist or cannot hold a webhook, returning `UNKNOWN_CHANNEL` |-| 404 | [error response](/http-api/#error-response) | Its guild does not resolve, returning `UNKNOWN_GUILD` |--<sup>1</sup> An avatar failure names the `avatar` path with `BASE64_LENGTH_INVALID`, `INVALID_BASE64_FORMAT`, `IMAGE_SIZE_EXCEEDS_LIMIT`, or `INVALID_IMAGE_FORMAT`--<sup>2</sup> The error response has a top-level `max_webhooks_per_guild` or `max_webhooks_per_channel` field whose value is the allowance that was reached--| Condition | Error |-| --- | --- |-| Guild or channel webhook allowance reached | 400 `MAX_WEBHOOKS_PER_GUILD` or 400 `MAX_WEBHOOKS_PER_CHANNEL` |-| Caller holds the permission but has no enrolled authenticator | 400 `TWO_FACTOR_REQUIRED` |-| Schema or image failure | 400 `INVALID_FORM_BODY` |-| Name is blocked, or the avatar hash is banned | 403 `CONTENT_BLOCKED` |-| Account is limited | 403 `ACCOUNT_LIMITED` |-| Guild is unavailable | 403 `MISSING_ACCESS` |-| Unverified account in an age restricted channel | 403 `NSFW_CONTENT_AGE_RESTRICTED` |-| Membership, channel access, or permission failure | 403 `MISSING_PERMISSIONS` |-| Any other credential refusal | 403 `ACCESS_DENIED` |--### Side effects--A successful call consumes one guild and channel webhook slot, generates a 64-character execution token, and stores the optional avatar. It records a `WEBHOOK_CREATE` guild audit entry naming the created webhook, with the target channel and the [webhook type](#webhook-types) in its metadata and the supplied reason. A failure to write that entry does not fail the request, and the webhook still exists.--Guild sessions that can view the channel receive [Webhooks Update](/gateway/events/#webhooks-update) with the guild and channel IDs. A failed creation leaves no webhook and consumes no slot.--### Rate limit--10 requests per minute for each authenticated user and channel ID, on the `webhook:create::channel_id` bucket.--## Get webhook--<RouteHeader method="GET" path="/v1/webhooks/{webhook_id}" bot />--Returns a [webhook object](#webhook-object). The caller must be a member of the webhook's guild and hold the [MANAGE_WEBHOOKS](/http-api/permissions/) permission at guild level and in the webhook's current channel.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| webhook_id | snowflake | The ID of the webhook to return |--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [webhook](#webhook-object) object | Webhook was returned |-| 400 | [error response](/http-api/#error-response) | Path parameter is not a valid snowflake |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The caller holds `MANAGE_WEBHOOKS` with no enrolled authenticator in an elevated-MFA guild |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | Credential is a bearer token |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | The caller is not a member of the webhook's guild or lacks `MANAGE_WEBHOOKS` in the webhook's channel |-| 404 | [error response](/http-api/#error-response) | Webhook does not exist, returning `UNKNOWN_WEBHOOK`, or its guild does not resolve, returning `UNKNOWN_GUILD` |--<sup>1</sup> The missing-authenticator code is `TWO_FACTOR_REQUIRED`, returned only after Fluxer confirms the permission itself--<sup>2</sup> `MISSING_PERMISSIONS` for a membership or permission failure, and `ACCESS_DENIED` otherwise--### Rate limit--100 requests per 10 seconds for each authenticated user and webhook ID, on the `webhook:read::webhook_id` bucket.--## Update webhook--<RouteHeader method="PATCH" path="/v1/webhooks/{webhook_id}" bot auditReason />--Updates a webhook and returns the modified [webhook object](#webhook-object). Emits a [Webhooks Update](/gateway/events/#webhooks-update) Gateway event.--### Limitations--- The caller is a member of the webhook's guild and holds [MANAGE_WEBHOOKS](/http-api/permissions/) at guild level and in the webhook's current channel.-- Moving the webhook also requires channel access and that permission in the destination channel, which must belong to the same guild.-- A channel follower webhook accepts only `name` and `channel_id`. Any `avatar` member, null included, returns 400 `INVALID_FORM_BODY` with an `INVALID_FORMAT` error at `avatar`, and nothing is updated.-- A channel follower webhook moves only into a guild text channel that does not already follow the same announcement channel, and the destination must meet the same age restriction and content warning rules as [Follow announcement channel](/http-api/channels/#follow-announcement-channel).-- The operation accepts an audit reason.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| webhook_id | snowflake | The ID of the webhook to update |--### JSON body--| Field | Type | Description |-| --- | --- | --- |-| name? | string | Replacement webhook name (1-80 characters) |-| avatar?<sup>1</sup> | ?base64 string | Base64-encoded replacement avatar, or null to remove the current avatar |-| channel_id?<sup>2</sup> | snowflake | Destination guild text, voice, announcement, forum, or media channel in the same guild |--<sup>1</sup> An omitted avatar leaves the stored hash unchanged, and an explicit null clears it. The same encoding, size, and format rules as [create webhook](#create-webhook) apply. A channel follower webhook rejects the member, null included--<sup>2</sup> A destination equal to the current channel is a no-op, and any other destination is subject to the destination channel's own [max_webhooks_per_channel](/http-api/instance/#limit-keys) allowance--The returned webhook object has the destination channel. Copies a channel follower webhook delivered before a move stay in the previous channel.--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [webhook](#webhook-object) object | Webhook was updated |-| 400 | [error response](/http-api/#error-response) | Body or avatar is invalid |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The destination channel already holds its maximum webhooks |-| 400<sup>3</sup> | [error response](/http-api/#error-response) | A channel follower webhook cannot move into the destination channel |-| 400 | [error response](/http-api/#error-response) | The caller holds `MANAGE_WEBHOOKS` with no enrolled authenticator in an elevated-MFA guild |-| 403 | [error response](/http-api/#error-response) | Credential is a bearer token |-| 403 | [error response](/http-api/#error-response) | The caller is not a member of the webhook's guild |-| 403 | [error response](/http-api/#error-response) | The caller lacks `MANAGE_WEBHOOKS` in the current or destination channel |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | The destination channel is age restricted and the account is not age verified |-| 403 | [error response](/http-api/#error-response) | The name is blocked |-| 403 | [error response](/http-api/#error-response) | The avatar hash is banned |-| 404 | [error response](/http-api/#error-response) | Webhook does not exist, returning `UNKNOWN_WEBHOOK` |-| 404 | [error response](/http-api/#error-response) | The destination channel is missing or cannot hold a webhook, returning `UNKNOWN_CHANNEL` |-| 404 | [error response](/http-api/#error-response) | The destination channel belongs to another guild, returning `UNKNOWN_CHANNEL` |-| 404 | [error response](/http-api/#error-response) | The webhook's guild does not resolve, returning `UNKNOWN_GUILD` |--<sup>1</sup> The destination allowance failure has the reached value in a top-level `max_webhooks_per_channel` member--<sup>2</sup> The age restriction applies to the destination channel--<sup>3</sup> `INVALID_FOLLOW_TARGET_CHANNEL`, `CHANNEL_ALREADY_FOLLOWED`, `FOLLOW_TARGET_NOT_AGE_RESTRICTED`, or `FOLLOW_TARGET_CONTENT_WARNING_REQUIRED`--| Condition | Error |-| --- | --- |-| Destination channel already holds its maximum webhooks | 400 `MAX_WEBHOOKS_PER_CHANNEL` |-| Follower webhook destination is not a guild text channel | 400 `INVALID_FOLLOW_TARGET_CHANNEL` |-| Destination already follows the same announcement channel | 400 `CHANNEL_ALREADY_FOLLOWED` |-| Destination fails the age restriction or content warning rule | 400 `FOLLOW_TARGET_NOT_AGE_RESTRICTED` or `FOLLOW_TARGET_CONTENT_WARNING_REQUIRED` |-| Caller holds the permission but has no enrolled authenticator | 400 `TWO_FACTOR_REQUIRED` |-| Schema or image failure, or an avatar on a channel follower webhook | 400 `INVALID_FORM_BODY` |-| Name is blocked, or the avatar hash is banned | 403 `CONTENT_BLOCKED` |-| Unverified account in an age restricted destination channel | 403 `NSFW_CONTENT_AGE_RESTRICTED` |-| Membership, channel access, or permission failure | 403 `MISSING_PERMISSIONS` |-| Any other credential refusal | 403 `ACCESS_DENIED` |--### Side effects--An update replaces the supplied fields, uploading a new avatar when one is supplied and clearing the stored hash when avatar is null. It records a `WEBHOOK_UPDATE` guild audit entry containing the previous and next webhook snapshots, the webhook's channel and type in its metadata, and the supplied audit reason.--It emits [Webhooks Update](/gateway/events/#webhooks-update) with the guild ID and the webhook's previous channel ID to guild sessions that can view that channel. A move emits a second Webhooks Update for the destination channel.--### Rate limit--20 requests per 10 seconds for each authenticated user and webhook ID, on the `webhook:update::webhook_id` bucket.--## Delete webhook--<RouteHeader method="DELETE" path="/v1/webhooks/{webhook_id}" bot auditReason />--Permanently deletes a webhook and returns 204 with an empty body on success. The caller must be a member of the webhook's guild with [MANAGE_WEBHOOKS](/http-api/permissions/) at guild level and in the webhook's channel. The operation accepts an audit reason.--Deletion emits a [Webhooks Update](/gateway/events/#webhooks-update). Deleting a channel follower webhook unfollows the announcement channel, and the copies it already delivered stay in the channel.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| webhook_id | snowflake | The ID of the webhook to delete |--:::caution[Deletion removes the webhook and its token permanently]-No operation restores the webhook or reissues its token. Messages it already created remain in the channel and can no longer be edited or deleted through a webhook route.-:::--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 204 | empty | Webhook was deleted |-| 400 | [error response](/http-api/#error-response) | Path parameter is not a valid snowflake |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The caller holds `MANAGE_WEBHOOKS` with no enrolled authenticator in an elevated-MFA guild |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | Credential is a bearer token |-| 403<sup>2</sup> | [error response](/http-api/#error-response) | The caller is not a member of the webhook's guild or lacks `MANAGE_WEBHOOKS` in the webhook's channel |-| 404 | [error response](/http-api/#error-response) | Webhook does not exist, returning `UNKNOWN_WEBHOOK`, or its guild does not resolve, returning `UNKNOWN_GUILD` |--<sup>1</sup> The missing-authenticator code is `TWO_FACTOR_REQUIRED`, returned only after Fluxer confirms the permission itself--<sup>2</sup> `MISSING_PERMISSIONS` for a membership or permission failure, and `ACCESS_DENIED` otherwise--### Side effects--The operation removes the webhook, frees its guild and channel webhook slot, and records a `WEBHOOK_DELETE` guild audit entry with the deleted webhook, its channel and type in the entry metadata, and the supplied reason. It emits [Webhooks Update](/gateway/events/#webhooks-update) with the guild and channel IDs to guild sessions that can view the channel.--### Rate limit--20 requests per 10 seconds for each authenticated user and webhook ID, on the `webhook:delete::webhook_id` bucket.--## Token routes--The routes below take the matching webhook ID and token in their paths as the complete credential. Each returns 404 `UNKNOWN_WEBHOOK` for a [channel follower webhook](#webhook-types). None of them requires the `Authorization` header, and a header sent to one grants no access. Fluxer still resolves it, as [Rate limit keying](#rate-limit-keying) describes.--## Get webhook with token--<RouteHeader method="GET" path="/v1/webhooks/{webhook_id}/{token}" />--Returns a [token webhook object](#token-webhook-object). No permission is evaluated.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| webhook_id | snowflake | The ID of the webhook to return |-| token<sup>1</sup> | string | Webhook execution token (1-256 characters) |--<sup>1</sup> A token outside that length returns 400 `INVALID_FORM_BODY`. A well-formed token that does not match the webhook is reported as an unknown webhook, so valid and invalid webhook IDs are indistinguishable--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [token webhook](#token-webhook-object) object | Webhook was returned |-| 404 | [error response](/http-api/#error-response) | Webhook and token pair does not exist, returning `UNKNOWN_WEBHOOK` |--### Rate limit--100 requests per 10 seconds for each caller identity and webhook ID, on the `webhook:read::webhook_id` bucket.--## Update webhook with token--<RouteHeader method="PATCH" path="/v1/webhooks/{webhook_id}/{token}" />--Updates a webhook and returns the modified [token webhook object](#token-webhook-object). This form cannot move the webhook and does not accept an audit reason.--A successful update emits a [Webhooks Update](/gateway/events/#webhooks-update).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| webhook_id | snowflake | The ID of the webhook to update |-| token | string | Webhook execution token (1-256 characters) |--### JSON body--| Field | Type | Description |-| --- | --- | --- |-| name? | string | Replacement webhook name (1-80 characters) |-| avatar?<sup>1</sup> | ?base64 string | Base64-encoded replacement avatar, or null to remove the current avatar |--<sup>1</sup> An omitted avatar leaves the stored hash unchanged and an explicit null clears it, as in [update webhook](#update-webhook). The same encoding, size, and format rules as [create webhook](#create-webhook) apply--:::note[The token body is strict]-Unlike [update webhook](#update-webhook), this body rejects any field it does not define. Sending `channel_id` or any other unknown key returns 400, so a token alone cannot move a webhook between channels.-:::--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [token webhook](#token-webhook-object) object | Webhook was updated |-| 400 | [error response](/http-api/#error-response) | Path, body, or avatar is invalid |-| 400 | [error response](/http-api/#error-response) | The body has an unknown field |-| 403 | [error response](/http-api/#error-response) | Name is blocked or the avatar hash is banned, each returning `CONTENT_BLOCKED` |-| 404 | [error response](/http-api/#error-response) | Webhook and token pair does not exist, returning `UNKNOWN_WEBHOOK` |--### Side effects--The operation replaces the supplied fields and emits [Webhooks Update](/gateway/events/#webhooks-update) with the guild and channel IDs to guild sessions that can view the channel. It records no guild audit entry.--### Rate limit--20 requests per 10 seconds for each caller identity and webhook ID, on the `webhook:update::webhook_id` bucket.--## Delete webhook with token--<RouteHeader method="DELETE" path="/v1/webhooks/{webhook_id}/{token}" />--Permanently deletes a webhook and returns 204 with an empty body on success. The operation does not accept an audit reason.--Deletion emits a [Webhooks Update](/gateway/events/#webhooks-update).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| webhook_id | snowflake | The ID of the webhook to delete |-| token | string | Webhook execution token (1-256 characters) |--:::caution[Any token holder can delete the webhook]-The route evaluates no guild permission and records no audit entry naming a user. The webhook and its token are permanently removed and cannot be restored.-:::--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 204 | empty | Webhook was deleted |-| 404 | [error response](/http-api/#error-response) | Webhook and token pair does not exist, returning `UNKNOWN_WEBHOOK` |--### Side effects--The operation removes the webhook, frees its guild and channel webhook slot, and emits [Webhooks Update](/gateway/events/#webhooks-update) with the guild and channel IDs to guild sessions that can view the channel. It records no guild audit entry.--### Rate limit--20 requests per 10 seconds for each caller identity and webhook ID, on the `webhook:delete::webhook_id` bucket.--## Execute webhook--<RouteHeader method="POST" path="/v1/webhooks/{webhook_id}/{token}" />--Creates a webhook-authored [message](/http-api/messages/#message-object) in the webhook's channel. When `wait` is true the created message is returned, and otherwise the operation returns 204 with an empty body.--The route refuses a call from a first-party web client. See [origin refusal](#origin-refusal). A successful execution emits a [Message Create](/gateway/events/#message-create) Gateway Dispatch whether or not wait is true.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| webhook_id | snowflake | The ID of the webhook to execute |-| token | string | Webhook execution token (1-256 characters) |--### Query parameters--| Field | Type | Description |-| --- | --- | --- |-| wait?<sup>1</sup> | boolean | Whether to return the created message (default false) |-| thread_id?<sup>2</sup> | snowflake | The ID of a thread of the webhook's channel to post into |--<sup>1</sup> Only the exact trimmed values `true`, `True`, and `1` are treated as true, and every other value, including `TRUE` and `yes`, is treated as false--<sup>2</sup> A value that names no thread of the webhook's channel returns 404 `UNKNOWN_CHANNEL`. [Webhooks in forums](/http-api/forums/#webhooks-in-forums) describes posting into a forum or media channel--### JSON body--The JSON representation of the request body is a [webhook message body](#webhook-message-body). Any request whose `Content-Type` does not contain `multipart/form-data` is read as JSON. Fluxer reads a body that is empty, whitespace-only, or unparseable as `{}`, and the request then fails as an empty message.--### Multipart body--| Field | Type | Description |-| --- | --- | --- |-| payload_json?<sup>1</sup> | string | JSON encoded [webhook message body](#webhook-message-body) |-| files[n]?<sup>2</sup> | binary | Direct attachment at zero-based index n |-| content?<sup>3</sup> | string | Message content, merged into the payload |-| nonce?<sup>3</sup> | string | Client-generated message identifier, merged into the payload |-| tts?<sup>3</sup> | string | Text-to-speech request, merged into the payload |-| flags?<sup>3</sup> | string | Message flags, merged into the payload |--<sup>1</sup> An absent `payload_json` is read as `{}`. A present value that is not a string, or that is not valid JSON, returns 400 `INVALID_FORM_BODY` with the validation code `INVALID_JSON_IN_PAYLOAD_JSON`--<sup>2</sup> The index must be a decimal integer from 0 through the resolved [max_attachments_per_message](/http-api/instance/#limit-keys) ceiling minus one, defaulting to 9. The indices may have gaps, and each index has at most one file. A field name beginning with `files[` that does not match the exact form is rejected, and the legacy names `file` and `file<n>` are also accepted--<sup>3</sup> Supplied as an ordinary form field, and it overrides the value in `payload_json` under the same name. Every other form field name is ignored--A multipart execution uploads every direct file as the webhook's creating account, and as the deleted user account when that creator no longer exists. The upload requires `VIEW_CHANNEL`, `SEND_MESSAGES`, and `ATTACH_FILES` in the webhook's channel, so a body with a direct file returns 403 `MISSING_PERMISSIONS` when the uploading account no longer holds them. A body with no direct file is unaffected.--An attachment metadata entry whose `id` matches a supplied file index supplies that file's filename, title, description, flags, duration, and waveform. An entry whose `id` matches no supplied file and that has a `filename` returns 400 `INVALID_FORM_BODY` with the validation code `NO_FILE_FOR_ATTACHMENT_METADATA`. Two entries claiming the same file index return `DUPLICATE_ATTACHMENT_IDS_NOT_ALLOWED`. When the payload supplies no attachment metadata at all, one entry is built for each file from its index and its own filename.--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [message](/http-api/messages/#message-object) object | Message was created and wait is true |-| 204 | empty | Message was created and wait is false or omitted |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | Path, query, multipart framing, or message input is invalid |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The resolved payload has no content, embed, or attachment |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The content exceeds the effective maximum length |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The embed or attachment count exceeds its effective ceiling |-| 400 | [error response](/http-api/#error-response) | A forum or media channel execution has no `thread_id` or `thread_name`, returning `WEBHOOK_FORUM_TARGET_REQUIRED` |-| 400 | [error response](/http-api/#error-response) | A forum or media channel execution has `thread_id` and `thread_name`, returning `WEBHOOK_FORUM_TARGET_CONFLICT` |-| 400 | [error response](/http-api/#error-response) | `thread_name` or `applied_tags` targets any other channel, returning `WEBHOOK_THREAD_NAME_REQUIRES_FORUM` |-| 400 | [error response](/http-api/#error-response) | A `thread_name` post names no tag under `REQUIRE_TAG`, returning `FORUM_TAG_REQUIRED` |-| 400 | [error response](/http-api/#error-response) | A `thread_name` post names no tag, with `REQUIRE_TAG` and no unmoderated tag, returning `NO_TAGS_AVAILABLE_TO_NON_MODERATORS` |-| 400 | [error response](/http-api/#error-response) | `thread_id` names a locked thread, returning `THREAD_LOCKED` |-| 400 | [error response](/http-api/#error-response) | The guild has 1,000 active threads and `thread_name` creates a post, returning `MAX_ACTIVE_THREADS` |-| 400 | [error response](/http-api/#error-response) | The guild has 1,000 active threads and `thread_id` names an archived thread, returning `MAX_ACTIVE_THREADS` |-| 403 | [error response](/http-api/#error-response) | Request has a first-party web client `Origin`, returning `INVALID_API_ORIGIN` |-| 403 | [error response](/http-api/#error-response) | The resolved content or embed text is blocked, returning `CONTENT_BLOCKED` |-| 403 | [error response](/http-api/#error-response) | A `thread_name` post names a moderated tag in `applied_tags`, returning `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Webhook and token pair does not exist, returning `UNKNOWN_WEBHOOK` |-| 404 | [error response](/http-api/#error-response) | The target channel is missing or cannot hold a webhook, or `thread_id` names no thread of it, returning `UNKNOWN_CHANNEL` |-| 404 | [error response](/http-api/#error-response) | The referenced message does not exist in the webhook's channel, returning `UNKNOWN_MESSAGE` |-| 404 | [error response](/http-api/#error-response) | A `thread_name` post names a tag the channel does not hold in `applied_tags`, returning `UNKNOWN_FORUM_TAG` |--<sup>1</sup> `CANNOT_SEND_EMPTY_MESSAGE` is returned as the 400 error code itself. Every other code below, including `CONTENT_EXCEEDS_MAX_LENGTH`, sits inside an `INVALID_FORM_BODY` body--| Condition | Error |-| --- | --- |-| Resolved payload has nothing sendable | `CANNOT_SEND_EMPTY_MESSAGE` |-| Content longer than the effective maximum | `CONTENT_EXCEEDS_MAX_LENGTH` |-| Payload the webhook message schema rejects | `INVALID_MESSAGE_DATA` |-| Embed or attachment count ceiling exceeded | `TOO_MANY_EMBEDS` or `TOO_MANY_FILES` |-| Forward reference omits `channel_id` or `message_id` | `FORWARD_REFERENCE_REQUIRES_CHANNEL_AND_MESSAGE` |-| Forward reference comes with content, embeds, or attachments | `FORWARD_MESSAGES_CANNOT_CONTAIN_CONTENT` |-| Reply reference names a system message | `CANNOT_REPLY_TO_SYSTEM_MESSAGE` |--### Side effects--The operation creates one webhook-authored message, attaches direct multipart files, and resolves forward snapshots and mentions under the allowed mentions policy.--A supplied `username` replaces the author name on this message. A supplied `avatar_url` is fetched for this message, and the webhook's stored name and avatar do not change. When the avatar cannot be fetched, Fluxer creates the message without the override.--The operation updates channel state and search results and emits [Message Create](/gateway/events/#message-create) to sessions that can read the channel.--### Rate limit--60 requests per minute for each caller identity and webhook ID, on the `webhook:execute::webhook_id` bucket, which is exempt from the global limit.--## Get webhook message--<RouteHeader method="GET" path="/v1/webhooks/{webhook_id}/{token}/messages/{message_id}" />--Returns a [message](/http-api/messages/#message-object) that the webhook authored.--The route refuses a call from a first-party web client. See [origin refusal](#origin-refusal).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| webhook_id | snowflake | The ID of the webhook that authored the message |-| token | string | Webhook execution token (1-256 characters) |-| message_id<sup>1</sup> | snowflake | The ID of the message to return |--<sup>1</sup> The message is resolved within the webhook's current channel, so a message the webhook created before it was moved to another channel is no longer reachable through this route--### Query parameters--| Field | Type | Description |-| --- | --- | --- |-| thread_id?<sup>1</sup> | snowflake | The ID of the thread of the webhook's channel that holds the message |--<sup>1</sup> A value that names no thread of the webhook's channel returns 404 `UNKNOWN_CHANNEL`--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [message](/http-api/messages/#message-object) object | Webhook message was returned |-| 403 | [error response](/http-api/#error-response) | Request has a first-party web client `Origin`, returning `INVALID_API_ORIGIN` |-| 403 | [error response](/http-api/#error-response) | The message was authored by another webhook, a user, or a bot, returning `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Webhook and token pair does not exist, returning `UNKNOWN_WEBHOOK` |-| 404 | [error response](/http-api/#error-response) | The webhook has no channel target, returning `UNKNOWN_CHANNEL` |-| 404 | [error response](/http-api/#error-response) | The message does not exist in that channel, returning `UNKNOWN_MESSAGE` |--### Rate limit--60 requests per minute for each caller identity and webhook ID, on the `webhook:message_get::webhook_id` bucket, which is exempt from the global limit.--## Edit webhook message--<RouteHeader method="PATCH" path="/v1/webhooks/{webhook_id}/{token}/messages/{message_id}" />--Updates a message that the webhook authored and returns the modified [message](/http-api/messages/#message-object).--The route refuses a call from a first-party web client. See [origin refusal](#origin-refusal). A successful edit emits a [Message Update](/gateway/events/#message-update).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| webhook_id | snowflake | The ID of the webhook that authored the message |-| token | string | Webhook execution token (1-256 characters) |-| message_id | snowflake | The ID of the message to update |--### Query parameters--| Field | Type | Description |-| --- | --- | --- |-| thread_id?<sup>1</sup> | snowflake | The ID of the thread of the webhook's channel that holds the message |--<sup>1</sup> A value that names no thread of the webhook's channel returns 404 `UNKNOWN_CHANNEL`--### JSON body--The body is a [webhook message edit body](#webhook-message-edit-body).--:::note[A default message and a reply are editable]-Any other type returns 400 `CANNOT_MODIFY_SYSTEM_WEBHOOK`, and a forward, which has message snapshots, returns 400 `INVALID_FORM_BODY` with the validation code `MESSAGES_WITH_SNAPSHOTS_CANNOT_BE_EDITED`. The body defines no field for the author name, avatar, attachments, message reference, or stickers, so an edit cannot change them.-:::--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [message](/http-api/messages/#message-object) object | Webhook message was updated |-| 400 | [error response](/http-api/#error-response) | Path, body, embed, flag, or mention input is invalid |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The body leaves the message empty |-| 400 | [error response](/http-api/#error-response) | The content or embed count exceeds its effective ceiling |-| 400 | [error response](/http-api/#error-response) | The target message is not an editable type |-| 400 | [error response](/http-api/#error-response) | The webhook's stored channel no longer resolves to a guild channel |-| 400 | [error response](/http-api/#error-response) | `thread_id` names an archived thread, returning `THREAD_ARCHIVED` |-| 400 | [error response](/http-api/#error-response) | `thread_id` names a locked thread, returning `THREAD_LOCKED` |-| 403 | [error response](/http-api/#error-response) | Request has a first-party web client `Origin`, returning `INVALID_API_ORIGIN` |-| 403 | [error response](/http-api/#error-response) | The message was authored by another webhook, a user, or a bot, returning `MISSING_PERMISSIONS` |-| 403 | [error response](/http-api/#error-response) | The replacement content or embed text is blocked, returning `CONTENT_BLOCKED` |-| 404 | [error response](/http-api/#error-response) | Webhook and token pair does not exist, returning `UNKNOWN_WEBHOOK` |-| 404 | [error response](/http-api/#error-response) | The message does not exist in the webhook's channel, returning `UNKNOWN_MESSAGE` |--<sup>1</sup> A `flags` member of any value, including zero, satisfies the non-empty check, so `{}` is rejected while `{"flags": 0}` is accepted--| Condition | Error |+| Value | Description || --- | --- |-| Target message type cannot be edited | 400 `CANNOT_MODIFY_SYSTEM_WEBHOOK` |-| Stored channel no longer resolves to a guild channel | 400 `CANNOT_EXECUTE_ON_DM` |-| Body has no visible content, no non-empty embeds, and no `flags` | 400 `CANNOT_SEND_EMPTY_MESSAGE` |-| Content longer than the effective maximum | 400 `INVALID_FORM_BODY` with the field code `CONTENT_EXCEEDS_MAX_LENGTH` |-| Anything else | 400 `INVALID_FORM_BODY` |--### Side effects--The operation replaces the supplied fields, and a content change marks the message edited. Existing mentions stay unchanged and `allowed_mentions` is ignored. Supplying embeds replaces the complete collection. An embed image or thumbnail URL of the form `attachment://{filename}` returns 400 `INVALID_FORM_BODY` unless `{filename}` names an attachment already on the message with a supported image file extension. Sessions that can read the channel receive [Message Update](/gateway/events/#message-update).--### Rate limit--30 requests per minute for each caller identity and webhook ID, on the `webhook:message_edit::webhook_id` bucket, which is exempt from the global limit.--## Delete webhook message--<RouteHeader method="DELETE" path="/v1/webhooks/{webhook_id}/{token}/messages/{message_id}" />--Deletes a message that the webhook authored and returns 204 with an empty body on success.--The route refuses a call from a first-party web client. See [origin refusal](#origin-refusal). Deletion emits a [Message Delete](/gateway/events/#message-delete).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| webhook_id | snowflake | The ID of the webhook that authored the message |-| token | string | Webhook execution token (1-256 characters) |-| message_id | snowflake | The ID of the message to delete |--### Query parameters--| Field | Type | Description |-| --- | --- | --- |-| thread_id?<sup>1</sup> | snowflake | The ID of the thread of the webhook's channel that holds the message |--<sup>1</sup> A value that names no thread of the webhook's channel returns 404 `UNKNOWN_CHANNEL`--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 204 | empty | Webhook message was deleted |-| 400 | [error response](/http-api/#error-response) | Path parameters are invalid |-| 400 | [error response](/http-api/#error-response) | The webhook's stored channel no longer resolves to a guild channel, returning `CANNOT_EXECUTE_ON_DM` |-| 403 | [error response](/http-api/#error-response) | Request has a first-party web client `Origin`, returning `INVALID_API_ORIGIN` |-| 403 | [error response](/http-api/#error-response) | The message was authored by another webhook, a user, or a bot, returning `MISSING_PERMISSIONS` |-| 404 | [error response](/http-api/#error-response) | Webhook and token pair does not exist, returning `UNKNOWN_WEBHOOK` |-| 404 | [error response](/http-api/#error-response) | The message does not exist in the webhook's channel, returning `UNKNOWN_MESSAGE` |--### Side effects--The operation permanently removes the message, purges its attachments, and removes it from search. It emits [Message Delete](/gateway/events/#message-delete) to sessions that can read the channel. Deleting a pinned message also removes the pin and emits [Channel Pins Update](/gateway/events/#channel-pins-update).--### Rate limit--30 requests per minute for each caller identity and webhook ID, on the `webhook:message_delete::webhook_id` bucket, which is exempt from the global limit.+| conversation.created | A new conversation |+| conversation.status_changed | A status change |+| conversation.tags_changed | Tags added or removed |+| conversation.assigned | An agent assigned |+| conversation.unassigned | An agent removed |+| message.created | A new contact message, agent reply, private note or automated reply |+| message.updated | An outgoing message that failed to send |+| webhook.test | A test delivery from the Libredesk webhook settings |## Execute GitHub webhook<RouteHeader method="POST" path="/v1/webhooks/{webhook_id}/{token}/github" />-Accepts a GitHub callback and creates one formatted message when the event renders. The route always returns 204 with an empty body, whether or not a message was created.--A rendered event emits a [Message Create](/gateway/events/#message-create).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| webhook_id | snowflake | The ID of the webhook to execute |-| token | string | Webhook execution token (1-256 characters) |+Posts one embed for a GitHub event, under the name "GitHub". Use this route's URL as the payload URL in GitHub, with the content type `application/json`. Mentions in GitHub text never notify anyone.### Query parameters| Field | Type | Description || --- | --- | --- |-| thread_id?<sup>1</sup> | snowflake | The ID of a thread of the webhook's channel to post into |--<sup>1</sup> A value that names no thread of the webhook's channel returns 404 `UNKNOWN_CHANNEL`. A webhook whose channel is a forum or media channel needs it, and returns 400 `WEBHOOK_SERVICE_FORUM_UNSUPPORTED` without it+| thread_id? | snowflake | The ID of a thread to post in, needed for a forum or media channel |### Request headers| Field | Type | Description || --- | --- | --- |-| X-GitHub-Event?<sup>1</sup> | string | [GitHub event type](#github-event-types) |-| X-GitHub-Delivery?<sup>2</sup> | string | Delivery identifier used for deduplication |--<sup>1</sup> Neither header is validated and neither is bounded in length. An absent header is read as the empty string, which matches no event type and therefore renders nothing--<sup>2</sup> An absent or empty delivery identifier disables deduplication for that request, so the callback is processed and no dedup marker is recorded+| X-GitHub-Event? | string | The [GitHub event type](#github-event-types) |+| X-GitHub-Delivery? | string | The delivery ID, where a repeat within 24 hours posts nothing |### JSON body-The body is a [GitHub callback](#github-callback-object) object. A body the schema rejects returns 400 `INVALID_FORM_BODY`.--:::note[Deduplication is per webhook and delivery]-Only the first callback for a webhook and non-empty delivery identifier is processed within a 24-hour window. A repeated delivery is acknowledged without creating a second message.-:::--A callback that renders nothing, and one whose message creation fails, both leave the delivery identifier free for a later retry.+The body is a [GitHub callback](#github-callback-object) object.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Callback was accepted, was not renderable, or repeated a delivery within the deduplication window |-| 400 | [error response](/http-api/#error-response) | The webhook's channel is a forum or media channel and `thread_id` is absent, returning `WEBHOOK_SERVICE_FORUM_UNSUPPORTED` |-| 400 | [error response](/http-api/#error-response) | `thread_id` names a locked thread, returning `THREAD_LOCKED` |-| 400 | [error response](/http-api/#error-response) | The guild has 1,000 active threads and `thread_id` names an archived thread, returning `MAX_ACTIVE_THREADS` |-| 403 | [error response](/http-api/#error-response) | Rendered embed text is blocked, returning `CONTENT_BLOCKED` |-| 404 | [error response](/http-api/#error-response) | Webhook and token pair does not exist, returning `UNKNOWN_WEBHOOK` |-| 404 | [error response](/http-api/#error-response) | The target channel is missing or cannot hold a webhook, or `thread_id` names no thread of it, returning `UNKNOWN_CHANNEL` |+| 204 | empty | The callback was accepted, whether or not it posted a message |+| 400 | [error response](/http-api/#error-response) | `WEBHOOK_SERVICE_FORUM_UNSUPPORTED` when a forum or media webhook sends no `thread_id` |-### Side effects--A renderable event creates one message with exactly one embed, authored under the fixed name `GitHub` with the bundled GitHub avatar. Sessions that can read the channel receive [Message Create](/gateway/events/#message-create). Mention parsing is disabled for the created message, so no mention in a commit message, issue title, or comment body notifies anyone.--An unrecognised event type, a recognised type whose required fields or action are absent, and a repeated non-empty delivery identifier all create nothing and emit no Dispatch.--### Rate limit--200 requests per minute for each caller identity and webhook ID, on the `webhook:github::webhook_id` bucket, which is exempt from the global limit.+The rate limit is 200 requests per minute, on the `webhook:github::webhook_id` bucket.## Execute Slack webhook<RouteHeader method="POST" path="/v1/webhooks/{webhook_id}/{token}/slack" />-Accepts a Slack-compatible callback, converts it to Fluxer message content and embeds, and creates one webhook-authored message.--A successful callback emits a [Message Create](/gateway/events/#message-create).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| webhook_id | snowflake | The ID of the webhook to execute |-| token | string | Webhook execution token (1-256 characters) |+Posts a message from a Slack incoming webhook body. Mentions never notify anyone, and a repeated callback posts again.### Query parameters| Field | Type | Description || --- | --- | --- |-| thread_id?<sup>1</sup> | snowflake | The ID of a thread of the webhook's channel to post into |--<sup>1</sup> A value that names no thread of the webhook's channel returns 404 `UNKNOWN_CHANNEL`. A webhook whose channel is a forum or media channel needs it, and returns 400 `WEBHOOK_SERVICE_FORUM_UNSUPPORTED` without it+| thread_id? | snowflake | The ID of a thread to post in, needed for a forum or media channel |### JSON body@@ -1634,134 +1018,52 @@ The body is a [Slack callback](#slack-callback-object) object.| Status | Body | Condition || --- | --- | --- |-| 200 | the literal string `ok` | Callback message was created |-| 400 | [error response](/http-api/#error-response) | Path or Slack callback is invalid |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The conversion yields neither content nor an embed |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The resulting content exceeds the effective maximum length |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The converted embed count exceeds its effective ceiling |-| 400 | [error response](/http-api/#error-response) | The webhook's channel is a forum or media channel and `thread_id` is absent, returning `WEBHOOK_SERVICE_FORUM_UNSUPPORTED` |-| 400 | [error response](/http-api/#error-response) | `thread_id` names a locked thread, returning `THREAD_LOCKED` |-| 400 | [error response](/http-api/#error-response) | The guild has 1,000 active threads and `thread_id` names an archived thread, returning `MAX_ACTIVE_THREADS` |-| 403 | [error response](/http-api/#error-response) | Converted content or embed text is blocked, returning `CONTENT_BLOCKED` |-| 404 | [error response](/http-api/#error-response) | Webhook and token pair does not exist, returning `UNKNOWN_WEBHOOK` |-| 404 | [error response](/http-api/#error-response) | The target channel is missing or cannot hold a webhook, or `thread_id` names no thread of it, returning `UNKNOWN_CHANNEL` |--<sup>1</sup> The [error code](/http-api/errors/) is `CANNOT_SEND_EMPTY_MESSAGE` for a conversion that yields nothing, `CONTENT_EXCEEDS_MAX_LENGTH` for content that is too long, and `INVALID_FORM_BODY` with the validation code `TOO_MANY_EMBEDS` for the embed ceiling--:::note[The Slack callback answers in HTML]-The success body is the literal string `ok` under the `text/html` content type, with no representation of the created message.-:::+| 200 | the text `ok` | The message was created |+| 400 | [error response](/http-api/#error-response) | `CANNOT_SEND_EMPTY_MESSAGE` when there is no text and no attachment becomes an embed |+| 400 | [error response](/http-api/#error-response) | `WEBHOOK_SERVICE_FORUM_UNSUPPORTED` when a forum or media webhook sends no `thread_id` |-### Side effects--Conversion creates one webhook-authored message with the converted content and embeds, and emits [Message Create](/gateway/events/#message-create) to sessions that can read the channel.--A supplied username replaces the author name on that message. A supplied `icon_url` that parses as an absolute URL is fetched through the Media Proxy and stored as the message avatar. The stored webhook name and avatar do not change. When the URL cannot be fetched, the callback still succeeds and the message has no avatar override.--Fluxer suppresses every mention in the converted content, as [Execute webhook](#execute-webhook) does when `allowed_mentions` is omitted. The callback has no nonce, so a repeated callback creates a second message.--### Rate limit--60 requests per minute for each caller identity and webhook ID, on the `webhook:execute::webhook_id` bucket, which is exempt from the global limit and is the same bucket [execute webhook](#execute-webhook) consumes.+The rate limit is 60 requests per minute, on the `webhook:execute::webhook_id` bucket.## Execute Instatus webhook<RouteHeader method="POST" path="/v1/webhooks/{webhook_id}/{token}/instatus" />-Accepts an Instatus callback and creates one formatted message when the callback renders. The route always returns 204 with an empty body, whether or not a message was created.--A rendered callback emits a [Message Create](/gateway/events/#message-create).--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| webhook_id | snowflake | The ID of the webhook to execute |-| token | string | Webhook execution token (1-256 characters) |+Posts one embed for an Instatus incident, maintenance or component update, under the name "Instatus". A repeat of the same update within 24 hours posts nothing.### JSON body-The body is an [Instatus callback](#instatus-callback-object) object. A body the schema rejects returns 400 `INVALID_FORM_BODY`.--:::note[Deduplication is per webhook and callback]-Only the first callback for a webhook and a given incident update, maintenance update, or component update is processed within a 24-hour window. A repeated callback is acknowledged and creates no second message. Fluxer processes every callback whose incident or maintenance item has no `id`, whose component update has no `component_id` or `created_at`, or that has no incident, maintenance item, or component update.-:::--A callback that renders nothing, and one whose message creation fails, both leave the identifier free for a later retry.+The body is an [Instatus callback](#instatus-callback-object) object.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Callback was accepted, was not renderable, or repeated a callback within the deduplication window |-| 400 | [error response](/http-api/#error-response) | The webhook's channel is a forum or media channel, returning `WEBHOOK_SERVICE_FORUM_UNSUPPORTED` |-| 403 | [error response](/http-api/#error-response) | Rendered embed text is blocked, returning `CONTENT_BLOCKED` |-| 404 | [error response](/http-api/#error-response) | Webhook and token pair does not exist, returning `UNKNOWN_WEBHOOK` |-| 404 | [error response](/http-api/#error-response) | The target channel is missing or cannot hold a webhook, returning `UNKNOWN_CHANNEL` |+| 204 | empty | The callback was accepted, whether or not it posted a message |+| 400 | [error response](/http-api/#error-response) | `WEBHOOK_SERVICE_FORUM_UNSUPPORTED` for a webhook in a forum or media channel |-### Side effects--An incident with a non-empty name, a maintenance item with a non-empty name, or a component transition creates one message with exactly one embed, authored under the fixed name `Instatus` with the bundled Instatus avatar. Fluxer emits [Message Create](/gateway/events/#message-create) to sessions that can read the channel.--Mention parsing is disabled for the created message, so no mention in a provider-supplied name or update body notifies anyone. A callback that selects none of those renderings creates nothing and emits no Dispatch. A repeated callback inside the deduplication window does the same.--### Rate limit--200 requests per minute for each caller identity and webhook ID, on the `webhook:instatus::webhook_id` bucket, which is exempt from the global limit.+The rate limit is 200 requests per minute, on the `webhook:instatus::webhook_id` bucket.## Execute Libredesk webhook<RouteHeader method="POST" path="/v1/webhooks/{webhook_id}/{token}/libredesk" />-Accepts a Libredesk callback and creates one formatted message when the event renders. The route always returns 204 with an empty body, whether or not a message was created.--A rendered event emits a [Message Create](/gateway/events/#message-create).--To connect a Libredesk help desk, add a webhook in its admin settings with this route's full URL and choose the events to send. Libredesk posts to the URL unchanged, so a `thread_id` query parameter in it applies to every delivery. The Libredesk secret is optional. Fluxer ignores the `X-Libredesk-Signature` header, because the token in the path is the credential.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| webhook_id | snowflake | The ID of the webhook to execute |-| token | string | Webhook execution token (1-256 characters) |+Posts one embed for a Libredesk help desk event, under the name "Libredesk". In the Libredesk admin settings, add a webhook with this route's URL and pick the events to send. The Libredesk secret is optional because the token in the URL is the credential.### Query parameters| Field | Type | Description || --- | --- | --- |-| thread_id?<sup>1</sup> | snowflake | The ID of a thread of the webhook's channel to post into |--<sup>1</sup> A value that names no thread of the webhook's channel returns 404 `UNKNOWN_CHANNEL`. A webhook whose channel is a forum or media channel needs it, and returns 400 `WEBHOOK_SERVICE_FORUM_UNSUPPORTED` without it+| thread_id? | snowflake | The ID of a thread to post in, needed for a forum or media channel |### JSON body-The body is a [Libredesk callback](#libredesk-callback-object) object. A body the schema rejects returns 400 `INVALID_FORM_BODY`.--:::note[No deduplication]-Libredesk sends each event once and includes no delivery identifier, so Fluxer processes every callback. Two identical callbacks create two messages.-:::+The body is a [Libredesk callback](#libredesk-callback-object) object.### Response| Status | Body | Condition || --- | --- | --- |-| 204 | empty | Callback was accepted or was not renderable |-| 400 | [error response](/http-api/#error-response) | The webhook's channel is a forum or media channel and `thread_id` is absent, returning `WEBHOOK_SERVICE_FORUM_UNSUPPORTED` |-| 400 | [error response](/http-api/#error-response) | `thread_id` names a locked thread, returning `THREAD_LOCKED` |-| 400 | [error response](/http-api/#error-response) | The guild has 1,000 active threads and `thread_id` names an archived thread, returning `MAX_ACTIVE_THREADS` |-| 403 | [error response](/http-api/#error-response) | Rendered embed text is blocked, returning `CONTENT_BLOCKED` |-| 404 | [error response](/http-api/#error-response) | Webhook and token pair does not exist, returning `UNKNOWN_WEBHOOK` |-| 404 | [error response](/http-api/#error-response) | The target channel is missing or cannot hold a webhook, or `thread_id` names no thread of it, returning `UNKNOWN_CHANNEL` |--### Side effects--A renderable event creates one message with exactly one embed, authored under the fixed name `Libredesk` with the webhook's own avatar. Sessions that can read the channel receive [Message Create](/gateway/events/#message-create).--Mention parsing is disabled for the created message. Fluxer also escapes every `\`, `<`, `@`, `[`, and `]` in Libredesk text it places in the embed title, description, or a field value, so no mention, timestamp, or masked link from a ticket renders. Inside a URL that starts with `http://` or `https://`, it percent-encodes those characters instead, so the link keeps its target. The embed author name and footer are plain text. Fluxer removes bidirectional control characters from all of them.--An event that renders nothing creates nothing and emits no Dispatch.--### Rate limit+| 204 | empty | The callback was accepted, whether or not it posted a message |+| 400 | [error response](/http-api/#error-response) | `WEBHOOK_SERVICE_FORUM_UNSUPPORTED` when a forum or media webhook sends no `thread_id` |-200 requests per minute for each caller identity and webhook ID, on the `webhook:libredesk::webhook_id` bucket, which is exempt from the global limit.+The rate limit is 200 requests per minute, on the `webhook:libredesk::webhook_id` bucket.diff --git a/fluxer_docs/src/content/docs/index.md b/fluxer_docs/src/content/docs/index.mdindex 24d6974a0..2c7b38567 100644--- a/fluxer_docs/src/content/docs/index.md+++ b/fluxer_docs/src/content/docs/index.md@@ -1,22 +1,21 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Fluxer API-description: Start using the Fluxer API.+description: Where to start with the Fluxer API and how to read the reference pages.----Fluxer is a self-hostable chat platform.+Fluxer is a self-hostable chat platform. You can build clients and bots with its HTTP API and Gateway, or run your own instance.-- To build a client or a bot, start with the [HTTP API](/http-api/) and the [Gateway](/gateway/overview/).-- For voice and screen sharing, read [Voice](/voice/).-- To run an instance, start with [Self-hosting](/operator/).+| Section | Description |+| --- | --- |+| [HTTP API](/http-api/) | Read and change users, guilds, channels and messages |+| [Gateway](/gateway/overview/) | Receive [events](/gateway/events/) over a WebSocket connection |+| [Voice](/voice/) | Join voice calls and share your screen |+| [Media Proxy](/media-proxy/overview/) | Load media and upload files |+| [Admin API](/admin-api/) | Manage an instance with admin access |+| [Self-hosting](/operator/) | Install and run an instance |-## Protocol surfaces--Use the HTTP API to read and change resources, and Gateway [events](/gateway/events/) to receive updates. The [Media Proxy](/media-proxy/overview/) serves media and uploads. The [Admin API](/admin-api/) provides privileged instance management.--## Shared contracts--See [Authentication](/authentication/), [Errors](/http-api/errors/), [Rate limits](/topics/rate-limits/) and [Locales](/topics/locales/) for shared behaviour. Most resource identifiers are [snowflakes](/snowflakes/). Each resource page states where it differs from this shared behaviour.+[Authentication](/authentication/), [Errors](/http-api/errors/), [Rate limits](/topics/rate-limits/) and [Locales](/topics/locales/) cover behavior the APIs share. Each page says where it differs. Most IDs are [snowflakes](/snowflakes/).## Field notation@@ -27,23 +26,21 @@ In field tables, `?` after a field name means optional. Before a type, it means| `name` | `string` | Required and cannot be `null` || `name?` | `string` | Optional, but cannot be `null` when present || `name` | `?string` | Required, but can be `null` |-| `name?` | `?string` | Nullish, so it can be omitted or set to `null` |+| `name?` | `?string` | Can be omitted or set to `null` |-An omitted field is different from a field set to `null`. Each operation explains how these values affect the resource.+In a request body, leaving a field out and sending `null` can do different things, and the endpoint says which.-In the type column, `array[type]` is an array of the named type, and `map[key, value]` is a JSON object keyed by the first type with values of the second.+| Type | Meaning |+| --- | --- |+| `array[type]` | An array of that type |+| `map[key, value]` | A JSON object with keys of the first type and values of the second |## Endpoint discovery-Start with `GET /.well-known/fluxer` on the instance origin. It requires no authentication and allows cross-origin requests.+Get `/.well-known/fluxer` on the instance origin to find its base URLs. It needs no authentication and allows cross-origin requests.```textGET https://example.com/.well-known/fluxer```-Read base URLs from the response's [endpoints](/http-api/instance/#instance-endpoints-object). Do not derive them from the origin or hard-code Fluxer domains.--- Bots, libraries and third-party clients use `endpoints.api_public`.-- The first-party web application uses `endpoints.api_client`. `endpoints.api` is an alias for it.--Use `/v1` paths and send credentials in the `Authorization` header as described in [Authentication](/authentication/).+Bots, libraries and third-party clients send requests to `endpoints.api_public` from the [endpoints object](/http-api/instance/#instance-endpoints-object) followed by a `/v1` path, such as `/v1/users/@me`. Connect to the Gateway at `endpoints.gateway`. Don't build base URLs from the origin or hard-code Fluxer domains. Send credentials in the `Authorization` header as described in [Authentication](/authentication/).diff --git a/fluxer_docs/src/content/docs/media-proxy/overview.md b/fluxer_docs/src/content/docs/media-proxy/overview.mdindex 3c766853d..a545a3bfe 100644--- a/fluxer_docs/src/content/docs/media-proxy/overview.md+++ b/fluxer_docs/src/content/docs/media-proxy/overview.md@@ -1,10 +1,10 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Media Proxy overview-description: Media Proxy surfaces, methods, byte ranges, response headers, and cache behaviour.+description: How the Media Proxy serves files, and the deployment modes, access policies and headers that apply to every route.----The Media Proxy serves Fluxer attachments, image assets, themes, entrance sound audio, and signed external media. It also accepts uploads authorised by a capability, a signed grant in the upload URL.+The Media Proxy serves attachments, image assets, themes, entrance sounds and signed external media, and accepts uploads to a signed upload URL. Read routes need no `Authorization` header.## Route families@@ -19,241 +19,122 @@ The Media Proxy serves Fluxer attachments, image assets, themes, entrance sound| Upload relay | `/v1/relay/{key}` | [Upload relay](/media-proxy/upload-relay/) || Operator and internal | `/_health`, `/_metrics`, `/_metadata`, `/_sniff`, `/_thumbnail`, `/_frames` | [Operator and internal endpoints](/media-proxy/routes/#operator-and-internal-endpoints) |-<sup>1</sup> Guild member avatars and banners are image assets too, at `/guilds/{guild_id}/users/{user_id}/avatars` and `/guilds/{guild_id}/users/{user_id}/banners`+<sup>1</sup> Guild member avatars and banners are image assets too, at `/guilds/{guild_id}/users/{user_id}/avatars` and `/guilds/{guild_id}/users/{user_id}/banners`.-<sup>2</sup> Served by a `static` endpoint alone+<sup>2</sup> Only a process in [`static` mode](#deployment-modes) serves this route.-[Transformations](/media-proxy/transformations/) defines the query parameters that select a representation for the families that accept them. [Responses and limits](/media-proxy/responses-and-limits/) lists statuses, size bounds, deadlines, and cache policies.+The attachment, signed external and image asset routes take [transformation parameters](/media-proxy/transformations/) in the query string.## Base URLs-Read paths have no `/v1` prefix. Take `endpoints.media` and `endpoints.static_cdn` from [instance discovery](/http-api/instance/#instance-endpoints-object).+Get the read base URLs `endpoints.media` and `endpoints.static_cdn` from [instance discovery](/http-api/instance/#instance-endpoints-object). Read paths have no `/v1` prefix. For an upload, use the full URL the HTTP API returned.-The upload relay is the exception in both respects. It is served below `/v1/relay/`, and its base comes from a deployment setting. A client MUST take that base from the upload URL the HTTP API issued and MUST NOT rebuild one.+## Authorization-## Authorisation--No public Media Proxy route reads the HTTP API `Authorization` header. An attachment is authorised by its path and, under the [signed attachment URL policy](#signed-attachment-urls), by the signature in its query string. Any other stored object is authorised by its path, signed external media by its path signature, and an upload by the capability in its URL. Only the internal `POST` endpoints read `Authorization`, and they require the exact value `Bearer {secret}` built from the deployment secret.--:::caution[A media URL is a bearer capability]-Anyone holding a URL reads the object without an account. Under `enforce`, an ordinary signed attachment URL works until its `ex` time, which is at most one day after it was signed, and a [data package URL](/http-api/messages/#data-package-attachment-urls) works until the secret that signed it is removed. Under `off` or `report`, an attachment path works for as long as the object exists. Leaving the channel does not revoke a URL already issued.-:::--The Media Proxy has no request-count rate limit, so no response has the [rate limit headers](/topics/rate-limits/#rate-limit-headers) of the versioned HTTP API. A failure returns a short `text/plain` body, and [media error response](/media-proxy/responses-and-limits/#media-error-response) defines that shape.+Anyone with a media URL can open the file without an account, and leaving a channel doesn't revoke a URL that was already issued. Only the internal `POST` endpoints use `Authorization`, and they need `Bearer {secret}` with the deployment secret. The Media Proxy has no rate limit.## Deployment modes-One Media Proxy process serves exactly one mode. The mode is fixed at startup and defaults to `mp`.+Each Media Proxy process serves one mode, set with `FLUXER_MEDIA_PROXY_MODE` at startup, and the default is `mp`.| Mode | Serves || --- | --- |-| `mp` | Attachments, signed external media, themes, entrance sounds, and every image asset route |-| `static` | Every read route as a raw object read from the static bucket, with no transformation and no SVG rasterisation<sup>1</sup> |-| `upload` | The [upload relay](/media-proxy/upload-relay/), plus every `mp` read route from the same buckets |-| `relay` | The [upload relay](/media-proxy/upload-relay/) alone. Every read path returns 404 |--<sup>1</sup> A `static` mode endpoint also strips `X-Robots-Tag` from every response and sends no `Content-Disposition`--The relay `PUT` returns 404 outside `upload` and `relay` mode. A `relay` endpoint returns 404 for a `GET` or `HEAD` of any read path and reads no object for it. On a read that requests no transformation, only an `mp` endpoint rasterises SVG, so an `upload` endpoint returns the original SVG bytes. The [operator and internal endpoints](/media-proxy/routes/#operator-and-internal-endpoints) behave the same in every mode.--The operator chooses which mode serves each published base URL. The reference self-hosted deployment serves `endpoints.media` from an `upload` mode process.--## Methods+| `mp` | Attachments, signed external media, themes, entrance sounds and every image asset route |+| `static` | Every read route as a raw object from the static bucket, with no transformation or SVG rasterization |+| `upload` | The [upload relay](/media-proxy/upload-relay/) and every `mp` read route, without SVG rasterization on a non-transforming read |+| `relay` | The [upload relay](/media-proxy/upload-relay/) alone, and every read path returns 404 |-Every read route accepts `GET` and `HEAD`. HEAD returns the same status and representation headers as GET with an empty body, and a `Range` on HEAD still selects 206 or 416. Any other method on a read route returns 405.--The relay path accepts `PUT`. Any other method there returns 405 with an `Allow` header. An unknown path returns 404.--On the [signed external route](/media-proxy/routes/#get-signed-external-media), a HEAD request can be answered from the headers of an origin HEAD response, so its representation headers can differ from GET.--## Request headers--Only `Range` affects the representation a public read returns. The [cross-origin read policy](#cross-origin-reads) reads `Origin`, and under `enforce` that header decides `Access-Control-Allow-Origin` and can turn a 200 into a 403. Every other request header, including `Authorization`, `Cookie`, `Accept`, `If-Range`, `If-None-Match`, `If-Modified-Since`, `If-Match`, and `If-Unmodified-Since`, is ignored on a public read route.--### Common request headers--| Field | Type | Description |-| --- | --- | --- |-| Range?<sup>1</sup> | string | One byte range under the [byte-range contract](#byte-ranges) |-| Origin?<sup>2</sup> | string | Serialised request origin read by the [cross-origin read policy](#cross-origin-reads) |--<sup>1</sup> A value whose unit is not the exact lowercase `bytes`, or that names more than one range, is ignored, and the response has the complete representation--<sup>2</sup> Read only when the cross-origin read policy is `report` or `enforce`+The [operator and internal endpoints](/media-proxy/routes/#operator-and-internal-endpoints) work in every mode. You choose which mode serves each base URL, and the reference self-hosted deployment serves `endpoints.media` from an `upload` process.## Cross-origin reads-An operator can limit which web origins read media through CORS. `FLUXER_MEDIA_PROXY_CORS_MODE` sets this cross-origin read policy, and it defaults to `off`.+`FLUXER_MEDIA_PROXY_CORS_MODE` limits which web origins can read media. The default is `off`.| Value | Description || --- | --- |-| `off` | A media representation has `Access-Control-Allow-Origin: *`, and no `Origin` is read |-| `report` | Every response is the same as under `off`, and each read `enforce` would refuse is logged |+| `off` | Media has `Access-Control-Allow-Origin: *` and `Origin` is not checked |+| `report` | Responses are the same as under `off`, and each read `enforce` would refuse is logged || `enforce` | A read from an origin outside the allowlist returns 403 |-Under `enforce`, an `Origin` is allowed when it equals the serialised form of an entry in `FLUXER_MEDIA_PROXY_CORS_ALLOWED_ORIGINS` byte for byte. The desktop app origin `fluxer-app://app` is always allowed and needs no entry. Anything else is refused, including `null`, a repeated `Origin` header, and a value that is not ASCII. A refused read returns 403 on every read path, and the Media Proxy reads no object and fetches no external URL for it.--A read with no `Origin` is served without `Access-Control-Allow-Origin`. A browser sends no `Origin` for an `<img>` or a `<video>` without `crossorigin`, so those elements still load. An allowed read gets its own origin back in `Access-Control-Allow-Origin` on a media representation and on a 416. No error has CORS headers.--A preflight `OPTIONS` request from an allowed origin gets a 204 that allows `GET` and `HEAD` with the `Range` header. A preflight from a refused origin gets the same 403 as a read.--Under `enforce`, every response to a `GET` or `HEAD` on a read path has `Vary: Accept-Encoding, Origin`, the 403 for a refused `Origin` included.--`report` changes no response. The Media Proxy logs a warning with the reason `cors_origin_would_deny` for each read `enforce` would refuse.+Under `enforce`, an `Origin` must match an entry in `FLUXER_MEDIA_PROXY_CORS_ALLOWED_ORIGINS` exactly, and the desktop app origin `fluxer-app://app` is always allowed. An allowed read gets its origin back in `Access-Control-Allow-Origin`. A read with no `Origin` is served without that header, and an `<img>` or `<video>` without `crossorigin` still loads.-The policy applies to a response the Media Proxy generates, and a shared cache in front of it answers a hit on its own. An entry stored while the policy was `off` holds `Access-Control-Allow-Origin: *` and a year of `Cache-Control`, and a foreign origin reading that URL gets both back until the entry goes. Purge `/attachments/` when you move the policy to `enforce`.+A preflight `OPTIONS` request from an allowed origin gets a 204 that allows `GET` and `HEAD` with the `Range` header, and a refused origin gets the same 403 as a read.-A `static` or `relay` endpoint ignores the policy. The [upload relay](/media-proxy/upload-relay/) and the [operator and internal endpoints](/media-proxy/routes/#operator-and-internal-endpoints) are exempt from it. A method other than `GET` or `HEAD` on a read path returns 405 whatever its `Origin`.--The reference self-hosted deployment leaves the policy `off`. An operator who turns it on gets the instance public origin as the only entry.+The policy applies to `mp` and `upload` processes and not to the upload relay or the operator endpoints. If a shared cache sits in front of the Media Proxy, purge `/attachments/` when you switch from `off` to `enforce`.## Signed attachment URLs-An operator can require a signature on every attachment read. `FLUXER_MEDIA_PROXY_ATTACHMENT_SIGNATURE_MODE` sets this signed attachment URL policy, and it defaults to `off`. The reference self-hosted deployment leaves it `off`, and turning it on takes a secret and the mode. The Media Proxy reads the mode once at start.+`FLUXER_MEDIA_PROXY_ATTACHMENT_SIGNATURE_MODE` can require a signature on every attachment read. The default is `off`, and turning it on needs `FLUXER_MEDIA_PROXY_ATTACHMENT_URL_SECRETS_BASE64`.| Value | Description || --- | --- |-| `off` | No signature is read, and an attachment read is served whatever its query string |-| `report` | Every attachment read is served, and each read `enforce` would refuse is logged |-| `enforce` | An attachment read without a valid signature returns 404 |+| `off` | No signature is checked |+| `report` | Every read is served, and each read `enforce` would refuse is logged |+| `enforce` | A read without a valid signature returns 404 |-An instance with attachment URL secrets signs every attachment URL it returns, and [Refresh attachment URLs](/http-api/messages/#refresh-attachment-urls) signs one again. An ordinary signed URL has three query parameters, and Fluxer places them first in this order:+An instance with attachment URL secrets signs every attachment URL it returns, and [Refresh attachment URLs](/http-api/messages/#refresh-attachment-urls) signs one again. An ordinary signed URL has three query parameters.```text?ex={expires}&is={issued}&hm={signature}```-`ex` and `is` are each exactly 8 lowercase hexadecimal digits, the Unix time in seconds at which the URL expires and at which it was issued. `hm` is exactly 64 lowercase hexadecimal digits. Any other parameter follows them after a single `&`. A client MUST keep them exactly as issued and MAY add or change any other parameter.--A [data package URL](/http-api/messages/#data-package-attachment-urls) has a fourth parameter, `uc`, and its `ex` is the single character `0`:+A [data package URL](/http-api/messages/#data-package-attachment-urls) never expires and has `ex=0` and `uc=dp`.```text?ex=0&is={issued}&hm={signature}&uc=dp```-`uc` is exactly `dp` and nothing else. `is` and `hm` have the same shape as on an ordinary URL. The 8-digit rule for `ex`, and the rule that `is` is no later than `ex`, hold for an ordinary URL alone. A data package URL never expires.--The Media Proxy reads the raw query string. It splits it on `&`, skips empty fields, and splits each field at its first `=`. It form-decodes each name and takes each value exactly as sent. A read is refused when any of these holds:--- There is no query string, or none of `ex`, `is`, `hm`, and `uc` is present.-- One or two of `ex`, `is`, and `hm` are present, so `uc` alone is refused too.-- Any of the four occurs more than once.-- `uc` is present with a value other than `dp`.-- `ex` is not 8 lowercase hexadecimal digits on an ordinary URL, or not the single character `0` on a data package URL.-- `is` is not 8 lowercase hexadecimal digits, or `hm` is not 64 lowercase hexadecimal digits.-- `is` is later than `ex` on an ordinary URL.-- `hm` does not verify against any configured secret.-- The current time is at or after `ex` on an ordinary URL.--A shared cache in front of the Media Proxy must leave the signature parameters `ex`, `is`, `hm`, and `uc` out of its cache key, and must decode each parameter name before it compares it. A cache that keeps them stores a new entry every time the same object is signed again.--Every other parameter is ignored, and so is the order of the parameters. The signature is over `ex`, `is`, `uc`, and the percent-decoded storage key, and never over the host, the scheme, the port, or another parameter. Because `uc` is signed, an ordinary URL relabelled `uc=dp` does not verify, and neither does a data package URL with `uc` removed. One signed URL therefore reads every [transformation](/media-proxy/transformations/) and `download` variant of its object. Every percent-encoded spelling of the same key verifies the same way, and a key whose decoded bytes are not valid UTF-8 is refused.+Keep `ex`, `is`, `hm` and `uc` as issued, and you can add or change any other parameter. One signed URL works for every [transformation](/media-proxy/transformations/) and `download` variant of its file. A read is refused when a signature parameter is missing or malformed, the signature doesn't match a configured secret, or the URL has expired. A shared cache must leave `ex`, `is`, `hm` and `uc` out of its cache key.-Under `enforce`, a refused read returns 404 with the body `This content is no longer available.`, `Cache-Control: no-store`, and no `Access-Control-Allow-Origin`. The Media Proxy reads no object for it. The response is the same for every reason, for `GET` and `HEAD`, with or without a `Range`, and whatever transformation or `download` the request names. A read whose object does not exist returns that same 404 under `enforce`, even with a valid signature, so a response never tells a missing object apart from a refused signature. `off` and `report` return the ordinary `Not found` body for a missing object.+Under `enforce`, a refused read returns the same 404 as a missing file, with the body `This content is no longer available.` Under `report`, each read that `enforce` would refuse logs a warning with the reason `attachment_signature_would_deny`. The policy covers `/attachments/` paths on `mp` and `upload` processes.-The Media Proxy checks the method first, then the `relay` mode, then the [cross-origin read policy](#cross-origin-reads), then the storage key, and only then the signature. A refused `Origin` returns 403 and an invalid storage key returns 400, and neither reads a signature.--`report` refuses nothing. Every status and body under `report` is the one `off` returns, and so is every header apart from the cache policy. A read whose signature is valid gets the same capped `Cache-Control` and `CDN-Cache-Control` that `enforce` sets, so the entries a cache stores during the dry run do not outlive the URLs that made them. A read `report` would refuse keeps the one-year policy `off` returns. The Media Proxy logs a warning with the reason `attachment_signature_would_deny` for each read `enforce` would refuse. The warning has the verdict `missing`, `malformed`, `mismatch`, or `expired`, the request identifier, and the user agent. Under every mode, the request log writes the values of `ex`, `is`, `hm`, and `uc` as `[redacted]`.--A `static` or `relay` endpoint ignores the policy. The policy covers `/attachments/` paths alone, so signed external media, image assets, themes, and entrance sounds need no signature. The [operator and internal endpoints](/media-proxy/routes/#operator-and-internal-endpoints) are exempt, and they read an attachment URL of this instance without a signature.--:::caution[A signature is not access control]-Refresh attachment URLs signs any well-formed attachment URL of the instance for any signed-in user or bot, with no membership check. A signature limits how long a copied URL works without a refresh. It does not decide who reads the object.-:::--## Selector parsing--A read route names its representation in its query string. The attachment, signed external, and image asset routes accept selectors. The theme and entrance sound routes accept none and ignore any query string.--Query names and values use URL form decoding, so `+` decodes to a space and a percent escape decodes to its byte. When a name occurs more than once, the final value wins. An unknown name is ignored. The [signed attachment URL policy](#signed-attachment-urls) reads `ex`, `is`, `hm`, and `uc` under its own rules.--The Media Proxy does not redirect alternative spellings to a canonical URL.--A Boolean is true only for case-insensitive `true` or the exact value `1`. Every other value, including `false` and `0`, is false. [Transformations](/media-proxy/transformations/) defines dimensions, formats, quality values, and animation flags.+Any signed-in user or bot can re-sign an attachment URL with [Refresh attachment URLs](/http-api/messages/#refresh-attachment-urls). A signature limits how long a copied URL works and not who can open the file.## Byte ranges-This contract controls every range the Media Proxy resolves itself. A range is recognised only when its unit is the exact lowercase `bytes`, so `bytes=0-99` selects an interval and `BYTES=0-99` is ignored. Surrounding spaces and tabs are trimmed. A range containing a comma names multiple ranges and is ignored. A malformed range is ignored and produces the complete representation. `HEAD` applies the same contract as `GET`.+The Media Proxy serves one range with the exact lowercase unit `bytes`, and ignores a range with another unit, more than one range or bad syntax.| Value | Description || --- | --- |-| `bytes={start}-{end}` | Selects the inclusive interval and clamps an end beyond the representation |-| `bytes={start}-` | Selects from start through the final byte |-| `bytes=-{length}` | Selects the final length bytes and selects the complete representation when length is larger |+| `bytes={start}-{end}` | The inclusive interval, with an end past the representation clamped |+| `bytes={start}-` | From start through the final byte |+| `bytes=-{length}` | The final length bytes |-A reversed range, a zero-length suffix, a start outside the representation, or any range over an empty representation returns 416 with `Content-Range: bytes */{size}` and `Accept-Ranges: bytes`. A satisfiable range returns 206, `Accept-Ranges: bytes`, and exact `Content-Range` and `Content-Length` values.+A satisfiable range returns 206 with `Accept-Ranges: bytes`, `Content-Range` and `Content-Length`. A reversed range, a zero-length suffix, a start outside the representation or any range on an empty representation returns 416 with `Content-Range: bytes */{size}`.### Transformed representations-A transformed representation is never served by range. Two Media Proxy instances can encode the same source to different bytes, so ranges answered by different instances do not join into one valid image. A response whose bytes a transformation produced ignores `Range`, returns the complete representation with 200, and has no `Accept-Ranges` header. `HEAD` does the same with an empty body. A rasterised SVG is a transformed representation, including the one an `mp` endpoint returns for a read that requests no transformation. A response that returns stored or origin bytes unchanged follows the contract above.--### Ranges on the signed external route--The route forwards a range to the origin only when no transformation is requested. It sends the range verbatim when the value after `bytes=` is non-empty and every byte of it is an ASCII graphic character. A multiple range therefore reaches the origin, and the origin decides how to answer it. A value with a space anywhere is dropped, and no range is sent. The route relays the origin partial response with the origin `Content-Range` unchanged.--A transformed response ignores the range and returns the complete result, as [Transformed representations](#transformed-representations) states. Without a transformation, an origin that ignores the range can produce a complete 200 response. Always check the response status and range headers.--:::caution[A mislabelled SVG reaches the client as bytes]-An origin that answers a forwarded range with SVG bytes under another media type can produce a 206 containing raw SVG.-:::--Content disposition follows the media type the origin declared, so SVG mislabelled as an image or video media type is served inline.+A response whose bytes come from a transformation ignores `Range`, returns the complete result with 200 and has no `Accept-Ranges` header. An SVG that an `mp` process rasterizes counts as transformed.## Representation headers+`HEAD` returns the same headers as `GET` with an empty body. On the signed external route, a `HEAD` with no transformation or range gets its headers from the origin `HEAD` response.+| Field | Type | Description || --- | --- | --- |-| Content-Type<sup>1</sup> | string | The detected or selected media type, or `text/plain; charset=utf-8` for a JavaScript type outside `static` mode |-| Content-Length?<sup>2</sup> | integer | The selected body length, including on HEAD |-| Content-Range? | string | Present on 206 as `bytes {start}-{end}/{size}` and on 416 as `bytes */{size}` |-| Content-Disposition?<sup>3</sup> | string | The route-selected inline or attachment disposition |-| Accept-Ranges? | string | The literal `bytes`. Absent on a [transformed representation](#transformed-representations) |-| Access-Control-Allow-Origin? | string | The literal `*` on media responses. Under `enforce` it is the request origin, or absent with no `Origin` |-| Cache-Control<sup>4</sup> | string | The browser cache policy for the representation |-| CDN-Cache-Control | string | The matching shared cache policy |-| Vary | string | The literal `Accept-Encoding`, or `Accept-Encoding, Origin` under `enforce` |+| Content-Type<sup>1</sup> | string | The detected or selected media type |+| Content-Length? | integer | The length of the selected body, including on HEAD |+| Content-Range? | string | `bytes {start}-{end}/{size}` on 206 and `bytes */{size}` on 416 |+| Content-Disposition?<sup>2</sup> | string | The inline or attachment disposition |+| Accept-Ranges? | string | The literal `bytes`, absent on a [transformed representation](#transformed-representations) |+| Access-Control-Allow-Origin? | string | `*`, or the request origin under `enforce` |+| Cache-Control<sup>3</sup> | string | The browser cache policy |+| CDN-Cache-Control<sup>3</sup> | string | The shared cache policy |+| Vary | string | `Accept-Encoding`, or `Accept-Encoding, Origin` under `enforce` || X-Content-Type-Options | string | The literal `nosniff` |-| X-Robots-Tag<sup>5</sup> | string | The indexing policy |-| X-Fluxer-Version | string | The serving Fluxer build identifier, or `dev` when none is configured |--<sup>1</sup> Fixed at `text/css; charset=utf-8` on the theme route. A 416 response has none--<sup>2</sup> Counts the selected bytes, so a 206 advertises the range length. Omitted from a streamed [signed external](/media-proxy/routes/#get-signed-external-media) response whose origin declared no length--<sup>3</sup> Present on the attachment, image asset, and signed external routes, absent on the theme and entrance sound routes, absent on every `static` mode read, and omitted when an image asset falls back to its original bytes after a failed transcode--<sup>4</sup> An audio or video representation appends `no-transform`. A route-produced error uses `no-store` instead--<sup>5</sup> The literal `noindex, nofollow, nosnippet, noimageindex, notranslate, max-snippet:0, max-image-preview:none, max-video-preview:0`. Present in `mp` and `upload` mode, and a `static` mode endpoint removes it--Every successful media representation uses `Cache-Control: public, max-age=31536000` and `CDN-Cache-Control: public, max-age=31536000`. An audio or video representation adds `no-transform` to `Cache-Control` only. No response repeats its policy in an `Expires` header. [Cache policies](/media-proxy/responses-and-limits/#cache-policies) lists every cache policy this surface sets, including the responses that set none.--The upload relay is the only route that returns an `ETag`, and it relays the object storage value for the stored object. No read route sends an `ETag` or a `Last-Modified`, so a cache revalidates a representation by fetching it again.--:::note[External media is cached for a year too]-The signed path is derived from the target URL, so the bytes behind one unchanged target are cached for a year by browsers under `Cache-Control` and by shared caches under `CDN-Cache-Control`.-:::--A 416 response has `Accept-Ranges`, `Content-Range`, `Access-Control-Allow-Origin`, `Vary`, and `X-Robots-Tag`, with no `Content-Type` and no cache policy. Its body is empty. The [cross-origin read policy](#cross-origin-reads) sets its `Access-Control-Allow-Origin` and `Vary` the same way it does on a 200.--## Content detection--Use the response's `Content-Type`. It can differ from the filename extension or the origin's declared type.--An endpoint in any mode other than `static` replaces a `Content-Type` that names a JavaScript media type with `text/plain; charset=utf-8`, at any status. It splits the value at every comma and reads each part on its own. In each part it skips leading spaces and tabs, then reads the type up to the first space, tab, semicolon, or opening parenthesis. The header is replaced when that type in any part equals one of these, ignoring ASCII case: `application/ecmascript`, `application/javascript`, `application/x-ecmascript`, `application/x-javascript`, `text/ecmascript`, `text/javascript`, `text/javascript1.0` through `text/javascript1.5`, `text/jscript`, `text/livescript`, `text/x-ecmascript`, and `text/x-javascript`. So `text/javascript x`, `TEXT/JAVASCRIPT (x)`, and `video/mp4, text/javascript` are replaced, and `text/javascript1.6` and `text/javascriptx` are left as they are.+| X-Robots-Tag? | string | A no-indexing policy in `mp` and `upload` mode |+| X-Fluxer-Version | string | The Fluxer build, or `dev` when none is configured |-The endpoint also replaces a `Content-Type` that is not visible ASCII, at any status. A 200 or 206 with no `Content-Type`, or with one that is empty or only spaces and tabs, gets `text/plain; charset=utf-8` too. A response with any other status and no `Content-Type` keeps none, so a 416 and the empty-body method rejection of a registered path still have no `Content-Type`. `Content-Disposition` is unchanged, so it still names the original filename.+<sup>1</sup> Fixed at `text/css; charset=utf-8` on the theme route, and absent on a 416.-A `static` endpoint is the one endpoint that changes no `Content-Type`. An `upload` or `relay` endpoint applies the same replacement an `mp` endpoint does, which is what makes the reference self-hosted deployment safe, because it serves `endpoints.media` from an `upload` endpoint.+<sup>2</sup> Sent on the attachment, image asset and signed external routes, and never in `static` mode.-## Content disposition+<sup>3</sup> See [Cache policies](/media-proxy/responses-and-limits/#cache-policies) for the values.-Disposition follows the resolved media type. An image other than SVG and a video are served inline. Every other type, including SVG and PDF, is served as an attachment. An explicit `download` request forces attachment disposition on every route that accepts the parameter.+## Content type and disposition-Use the filename from `Content-Disposition` when saving a response. Transformations can change its extension, and non-ASCII filenames can use the `filename*` parameter.+Use the response `Content-Type`. Outside `static` mode, the Media Proxy replaces a JavaScript type, a type that isn't visible ASCII, or a missing type on a 200 or 206 with `text/plain; charset=utf-8`.-:::caution[A scriptable document is never inline]-The attachment, image asset, and signed external routes rasterise SVG to WebP, so a browser does not execute the document in the Media Proxy origin.-:::+An image other than SVG and a video are served inline. Every other type, including SVG and PDF, is an attachment, and `download` forces an attachment on every route that accepts it. When you save a file, use the filename from `Content-Disposition`, which has the right extension for a transformed file.-On a non-transforming attachment read, an `mp` endpoint rasterises SVG to lossless WebP. A transforming request uses the `format` and `quality` it was given, and an image asset path uses `high` when the request gives no `quality`, except for animated WebP output, which uses `auto`. A `static` mode endpoint serves the original bytes.+An `mp` process rasterizes SVG to lossless WebP on a non-transforming read. An `upload` process returns the original SVG bytes as an attachment.diff --git a/fluxer_docs/src/content/docs/media-proxy/responses-and-limits.md b/fluxer_docs/src/content/docs/media-proxy/responses-and-limits.mdindex 89dfc2847..0c1fd851a 100644--- a/fluxer_docs/src/content/docs/media-proxy/responses-and-limits.md+++ b/fluxer_docs/src/content/docs/media-proxy/responses-and-limits.md@@ -1,137 +1,84 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Responses and limits-description: Media Proxy statuses, error bodies, size bounds, work admission, deadlines, and cache policies.+description: Media Proxy error responses, size limits, deadlines, cache policies and range headers.----Almost every failed Media Proxy request answers with a short `text/plain` reason phrase and nothing else. The Media Proxy has no request-count rate limit, so every bound below is a resource bound.+The Media Proxy has no request rate limit, only the size limits and deadlines below.## Media error response-An unsuccessful response body is an English reason phrase under the content type `text/plain; charset=utf-8`. The JSON [HTTP API error response](/http-api/#error-response) never appears here. `HEAD` returns the same status and headers with an empty body. The method rejection of a registered path<sup>2</sup> and a locally unsatisfiable range have neither a body nor a `Content-Type`.+A failed request returns an English reason phrase as `text/plain; charset=utf-8`, not the JSON [error response](/http-api/#error-response). `HEAD` returns the same status and headers with an empty body. Branch on the status and don't parse the body, because the phrases can change.| Status | Body | Condition || --- | --- | --- |-| 400 | Bad request | An invalid storage key, dimension, format, or external path, an unparsable relay `partNumber`, a failed attachment or external transformation, or a relay upload body the endpoint failed to read from the client<sup>1</sup> |-| 401 | Unauthorized | An invalid signed external path signature, a missing, malformed, or expired relay capability, or a missing or invalid internal bearer token |-| 403 | Forbidden | A relay capability presented for another bucket, key, method, `uploadId`, or `partNumber`, `/_metrics` requested from a non-loopback address, or a public read whose `Origin` the [cross-origin read policy](/media-proxy/overview/#cross-origin-reads) refuses |-| 404 | Not found | A `GET` or `HEAD` of an unrouted path or of any read path on a `relay` endpoint, an object that does not exist, or a relay `PUT` outside `upload` and `relay` mode |-| 404 | This content is no longer available.<sup>4</sup> | An attachment read `enforce` refuses, or a missing attachment object under `enforce` |-| 405 | Method not allowed<sup>2</sup> | A method other than `GET` or `HEAD` on a read route or on an unrouted path |-| 413 | Payload too large | A stored object, external body, upload body, or internal request body beyond its bound |-| 500 | Transcode failed | An image asset transcode failed and the source is not directly displayable |-| 500 | Internal server error | A relay spool write to the endpoint's own disk failed |-| 502 | Bad gateway | An object store read or write failed, an external origin fetch failed, an external origin redirected in a loop or more than five times, or an external origin returned an unsuccessful status that the Media Proxy does not pass through, or an outbound socket deadline or a relay object storage write deadline expired |-| 503 | Service unavailable | The upload relay spool budget is exhausted, an external buffer reservation or allocation failed, or an external origin answered `/_metadata` with 429<sup>3</sup> |-| 504 | Gateway timeout | A transformation admission slot was unavailable or the transformation deadline expired |--<sup>1</sup> The relay also answers 400 when the client connection fails part way through the body--<sup>2</sup> The registered paths, `/_health`, `/_metrics`, `/_metadata`, `/_sniff`, `/_thumbnail`, `/_frames`, and `/v1/relay/{key}`, answer an unaccepted method with an empty body, no `Content-Type`, and an `Allow` header. All seven are registered in every mode, so the method rejection is the same in every mode, even where the path itself answers 404--<sup>3</sup> `/_metadata` is the only endpoint that remaps an origin 429. The signed external read route retains 429 as 429--<sup>4</sup> Sent under the `enforce` [signed attachment URL policy](/media-proxy/overview/#signed-attachment-urls) alone, where it also replaces `Not found` for an attachment object that does not exist. Under `report` every response is the one `off` returns, so a missing object keeps the `Not found` body there--When the Media Proxy passes an external origin status through to the client, the body is `Upstream fetch failed` on the signed external read route. On `/_metadata`, the body is the canonical reason phrase of that status. An object store error that maps to no case above uses the canonical reason phrase of its status.--Every error a route produces uses `Cache-Control: no-store` and the standard [security headers](/media-proxy/overview/#representation-headers). The exceptions have the security headers and set no cache policy, and [Cache policies](#cache-policies) names them. No plain-text error has CORS headers unless it came from the [upload relay](/media-proxy/upload-relay/), and no error has `Retry-After` or a request identifier. Under the `enforce` [cross-origin read policy](/media-proxy/overview/#cross-origin-reads), every `GET` or `HEAD` error on a read path has `Vary: Accept-Encoding, Origin`. That includes the 403 for a refused `Origin`.--### Handling contract--The set of reason phrases is open. A client MUST branch on the HTTP status and MUST NOT parse, compare, or pattern-match the body. A phrase can be reworded and a new condition can introduce one without a version change. A client MUST NOT expect a JSON body on a failure, and MUST NOT expect a failure to name the key, parameter, or field that caused it.--## Status registry--Every `HEAD` response has an empty body, so the Body column describes `GET`, `PUT`, and `POST`.--| Status | Body | Condition |-| --- | --- | --- |-| 200<sup>1</sup> | Media bytes, or an empty `HEAD` or relay `PUT` body | A complete representation was served or a relay write succeeded |-| 206 | Selected media bytes for `GET` and empty for `HEAD` | One byte range is satisfiable |-| 400 | [Media error response](#media-error-response) | A path, query, target, transformation, or relay request is invalid |-| 401 | [Media error response](#media-error-response) | An external path signature, a relay capability, or an internal token is invalid |-| 403 | [Media error response](#media-error-response) | The cross-origin read policy denied the request, a relay capability does not match the request, or an external origin returned 403 |-| 404 | [Media error response](#media-error-response) | The route or object does not exist, a `relay` endpoint received a read, the relay is not served here, an attachment signature was refused, or an external origin returned 404 |-| 405<sup>2</sup> | [Media error response](#media-error-response) | The route rejects the method, or an external origin returned 405 |-| 406, 408, 409, 410, 411, 412, 414, 415, 428, 429<sup>3</sup> | [Media error response](#media-error-response) | An external origin returned that status |-| 413 | [Media error response](#media-error-response) | A source, external response, or upload exceeds its applicable bound |-| 416<sup>4</sup> | empty locally, otherwise [Media error response](#media-error-response) | A local range is unsatisfiable, or an external origin returned 416 |-| 500 | [Media error response](#media-error-response) | An image asset transcode failed with no usable source, or a relay spool write failed |-| 502 | [Media error response](#media-error-response) | An object store, external origin, or upload destination returned an unusable response |-| 503 | [Media error response](#media-error-response) | Upload spool capacity is exhausted, an external buffer reservation or allocation failed, or an external origin answered `/_metadata` with 429<sup>5</sup> |-| 504 | [Media error response](#media-error-response) | Transformation capacity was unavailable or a transformation deadline expired |--<sup>1</sup> The [internal endpoints](/media-proxy/routes/#operator-and-internal-endpoints) `/_metadata`, `/_sniff`, and `/_frames` answer 200 with JSON, `/_health` with plain text, and `/_metrics` with the Prometheus text exposition--<sup>2</sup> A read route path, or any other path outside the registered paths, answers with the [media error response](#media-error-response). Each registered path answers with an empty body, no `Content-Type`, and an `Allow` header--<sup>3</sup> These statuses occur only when an external origin returned that status and the Media Proxy passed it through--<sup>4</sup> A locally unsatisfiable range answers with an empty body, `Content-Range: bytes */{size}`, and `Accept-Ranges: bytes`, and has no `Content-Type` and no cache policy--<sup>5</sup> The remap produces a service unavailable response, which is indistinguishable from a budget exhaustion 503--An external origin status of 400, 401, 403, 404, 405, 406, 408, 409, 410, 411, 412, 413, 414, 415, 416, 428, or 429 reaches the client unchanged as an upstream fetch failure. The origin response body and headers are not forwarded. Any other unsuccessful origin status becomes 502.--The Media Proxy evaluates no conditional request header and never redirects a noncanonical target, so it returns no 304 and no 308.--:::note[A retained status describes the external URL]-The third-party origin chose the status, and Fluxer passed it through.-:::+| 400 | Bad Request | A storage key, dimension, format, external path or relay `partNumber` is invalid, a transformation fails, or the relay couldn't read the whole upload body from the client |+| 401 | Unauthorized | An external path signature, relay capability or internal bearer token is missing, invalid or expired |+| 403 | Forbidden | A relay capability doesn't match the request, or `/_metrics` is requested from a non-loopback address |+| 403 | Forbidden | The [cross-origin read policy](/media-proxy/overview/#cross-origin-reads) refuses the `Origin` |+| 404 | Not Found | The path or object doesn't exist, or a read is sent to a `relay` endpoint |+| 404 | This content is no longer available. | The [signed attachment URL policy](/media-proxy/overview/#signed-attachment-urls) is `enforce` and refuses the read, or the object is missing |+| 405 | Method Not Allowed | A method other than `GET` or `HEAD` is sent to a read route or an unrouted path |+| 405 | Empty, with an `Allow` header | A wrong method is sent to a registered path such as `/_health` or `/v1/relay/{key}` |+| 413 | Payload Too Large | An object, external body, upload body or internal request body is over its limit |+| 500 | Transcode Failed | An image asset transcode failed and the source can't be shown directly |+| 500 | Internal Server Error | A relay spool write to the endpoint's own disk failed |+| 502 | Bad Gateway | An object store or external origin request failed, redirected more than five times or hit a deadline |+| 503 | Service Unavailable | The relay spool is full, an external buffer couldn't be allocated or `/_metadata` got a 429 from the origin |+| 504 | Gateway Timeout | No transformation slot was free or the transformation deadline passed |++For signed external media, the Media Proxy passes these origin statuses through with the body `Upstream fetch failed`, and it doesn't forward the origin's own body or headers.++| Origin status | Result |+| --- | --- |+| 400, 401, 403, 404, 405, 406, 408, 409, 410, 411, 412, 413, 414, 415, 416, 428, 429 | The same status |+| Any other unsuccessful status | 502 |++For `/_metadata`, the body is the reason phrase of the origin status.## Request and media limits-Proxied or stored media is limited to 500 MiB, and exceeding that returns 413. The bound applies to a streamed object, a buffered object, an external response body, and any input selected for transformation. When a streamed external body passes the bound only after the response head is committed, the Media Proxy truncates it.--A decoded signed external target URL is limited to 8,192 bytes, and a longer URL returns 400. The route follows at most five redirects. A sixth redirect or a redirect loop returns 502. Every redirect target is subject to the same URL limit and the same public address check, which blocks non-public IP addresses and every port other than 80 and 443.--Decoded images are limited to 16,384 pixels on either edge and 268,435,456 pixels in total. Animated input is limited to 20,000 frames and 1,073,741,824 decoded pixels across all frames. No configuration changes these bounds. [Transformations](/media-proxy/transformations/#transformation-limits) defines the resulting failure statuses.--The upload relay limits a body to the smaller of the authorised upload size and the endpoint body limit. That endpoint limit defaults to 500 MiB and can be configured from 1 byte through 5 GiB.--An internal `/_metadata`, `/_sniff`, `/_thumbnail`, or `/_frames` request body is limited to the base64 expansion of the 500 MiB media bound plus 1 MiB. All answer a larger body with 413.--## Work admission--A transformation returns 504 when capacity is unavailable or its deadline expires. Upload and external-media requests can return 503 when their capacity is exhausted.--## Deadlines--| Deadline | Default | Configurable range |+| Limit | Value | Over the limit || --- | --- | --- |-| Outbound socket connect and total timeout<sup>1</sup> | 30,000 ms | 0 through 300,000 ms |-| Transformation | 15,000 ms | 1,000 through 120,000 ms |-| Upload relay object storage write<sup>2</sup> | 900,000 ms | 1,000 through 3,600,000 ms |--<sup>1</sup> One value sets both the connect timeout and the total request timeout, and it applies to external origin fetches, to object storage requests, and to the response body streamed back to the client+| Proxied or stored media | 500 MiB | 413 |+| Decoded signed external target URL | 8,192 bytes | 400 |+| External redirects | 5 | 502 |+| Decoded image width or height | 16,384 pixels | See [transformation limits](/media-proxy/transformations/#transformation-limits) |+| Decoded image area | 268,435,456 pixels | See [transformation limits](/media-proxy/transformations/#transformation-limits) |+| Animated input frames | 20,000 | See [transformation limits](/media-proxy/transformations/#transformation-limits) |+| Animated input decoded pixels | 1,073,741,824 across all frames | See [transformation limits](/media-proxy/transformations/#transformation-limits) |+| Upload relay body | The smaller of the authorized size and the endpoint limit, which defaults to 500 MiB | 413 |+| Internal `/_metadata`, `/_sniff`, `/_thumbnail` and `/_frames` body | About 668 MiB | 413 |++Each redirect target goes through the same URL length limit and the public address check, which blocks non-public IP addresses and every port except 80 and 443.-<sup>2</sup> A relay write with a declared `Content-Length` extends this deadline by one second for every 16 KiB of declared length--The same socket timeout bounds every streamed response body. A streamed stored object and a streamed signed external response terminate when the gap between two body chunks exceeds that timeout. The whole transfer has a second deadline of that timeout plus one second for every 16 KiB of expected length, which is a floor of 16 KiB per second. A body that ends before, or runs past, the advertised `Content-Length` also terminates with an error.+## Deadlines-An animated response can be shortened to meet its deadline or playback limit. See [Transformation limits](/media-proxy/transformations/#transformation-limits).+| Deadline | Default |+| --- | --- |+| Outbound request timeout | 30,000 ms |+| Transformation | 15,000 ms |+| Upload relay object storage write | 900,000 ms |-:::caution[A deadline after the head truncates the body]-A status and its headers are chosen before the body is sent. A streamed object store or external response that fails afterwards terminates the body, so the observed body can be shorter than the advertised `Content-Length`.-:::+The outbound request timeout is the connect and total timeout for object storage requests and the total timeout for external fetches. An external fetch has a fixed 3,000 ms connect timeout. A streamed body also ends when the gap between two chunks passes the timeout. It also ends if the whole transfer takes longer than the timeout plus one second for every 16 KiB, or if it runs short of or past its `Content-Length`. When a streamed body fails after the headers are sent, the response ends early and can be shorter than its `Content-Length`.## Cache policies-Every successful media representation uses `Cache-Control: public, max-age=31536000` and `CDN-Cache-Control: public, max-age=31536000`. An audio or video representation appends `no-transform` to `Cache-Control` only. Signed external media uses the same policy as stored media.+A successful media response, including signed external media, has `Cache-Control: public, max-age=31536000` and the same `CDN-Cache-Control`. Audio and video add `no-transform` to `Cache-Control` only.-No route sets `immutable`, `Expires`, `ETag`, or `Last-Modified` on a read response. A cache revalidates a representation by fetching it again.+No read route sends `ETag` or `Last-Modified`. A CDN or browser keeps serving a deleted or replaced object until its cache entry is purged or expires.-One read selects a shorter policy. Under the `report` or `enforce` [signed attachment URL policy](/media-proxy/overview/#signed-attachment-urls), an attachment read whose signature is valid gets `public, max-age=` the seconds left on that signature in both headers, so no entry outlives the URL that made it. A data package URL never expires, so it gets the one-day ceiling instead. Every other read, and every attachment read under `off`, keeps the year.+Under the `report` or `enforce` signed attachment URL policy, an attachment read with a valid signature gets `max-age` set to the seconds left on that signature in both headers. A data package URL never expires and gets one day (`max-age=86400`).-A one-year `max-age` is only safe where a purge path reaches every cache that stores media. With no `ETag` and no `Last-Modified` there is nothing to revalidate against, so a deleted or replaced object is served until its entry is purged or drops out. A cache with no purge path must set a shorter lifetime of its own instead.--Every route-produced error response uses `Cache-Control: no-store`, and a successful `/_metrics` read uses it too. A 416 response, a successful upload relay response, and the empty-body method rejection of a registered path set no cache policy at all.+Error responses use `Cache-Control: no-store`, except a 416, which has no cache policy. A successful relay response has none either.## Range response headers-A complete media response has `Accept-Ranges: bytes`, the representation `Content-Type`, and an exact `Content-Length`<sup>1</sup>. A [transformed representation](/media-proxy/overview/#transformed-representations) has no `Accept-Ranges` and is always complete. Outside `static` mode that `Content-Type` is `text/plain; charset=utf-8` when it names a JavaScript media type, and a 200 or 206 with no `Content-Type` gets the same value. [Content detection](/media-proxy/overview/#content-detection) defines both rules. A 206 also sets `Content-Range` to the selected interval over the complete size and `Content-Length` to the selected byte count. A 416 has `Content-Range: bytes */{size}` and `Accept-Ranges: bytes` with an empty body.--<sup>1</sup> A streamed signed external response omits `Content-Length` when the origin declared none+| Response | Headers |+| --- | --- |+| 200 | `Accept-Ranges: bytes`, `Content-Type` and the exact `Content-Length` |+| 206 | `Content-Range` with the selected interval over the full size, and `Content-Length` with the selected byte count |+| 416 | `Content-Range: bytes */{size}`, `Accept-Ranges: bytes` and an empty body |+| [Transformed media](/media-proxy/overview/#transformed-representations) | No `Accept-Ranges`, and always the whole body |-`HEAD` applies the same range contract as `GET` and returns 206 or 416 with an empty body. A forwarded external range is answered with the origin `Content-Range` and `Content-Length` unchanged. [Byte ranges](/media-proxy/overview/#byte-ranges) defines which request ranges are recognised.+Signed external media leaves out `Content-Length` when the origin sent none, and a forwarded range keeps the origin's `Content-Range` and `Content-Length`. `HEAD` follows the same rules with an empty body. See [byte ranges](/media-proxy/overview/#byte-ranges) for the `Range` values the Media Proxy accepts.diff --git a/fluxer_docs/src/content/docs/media-proxy/routes.mdx b/fluxer_docs/src/content/docs/media-proxy/routes.mdxindex 05873ce6f..3f85c7adc 100644--- a/fluxer_docs/src/content/docs/media-proxy/routes.mdx+++ b/fluxer_docs/src/content/docs/media-proxy/routes.mdx@@ -1,531 +1,226 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Read and asset routes-description: Every Media Proxy read path with its inputs, representations, and statuses.+description: The Media Proxy read paths with their parameters and statuses.---import RouteHeader from '@/components/RouteHeader.astro';-A Media Proxy read route resolves one path to one file and returns it. These paths are unversioned and sit under the base URL published as `endpoints.media` by [instance discovery](/http-api/instance/#instance-endpoints-object). The [static object read](#get-static-object) uses `endpoints.static_cdn`.--## Shared route contract--[Methods](/media-proxy/overview/#methods) and [Authorisation](/media-proxy/overview/#authorisation) define the contract every route here uses. No route here has a request-count rate limit.--[Selector parsing](/media-proxy/overview/#selector-parsing) defines query decoding. [Byte ranges](/media-proxy/overview/#byte-ranges) defines which ranges are recognised and which headers a 206 or 416 has.+Each route here returns one stored or external file. The paths are unversioned and are under the `endpoints.media` base URL from [instance discovery](/http-api/instance/#instance-endpoints-object), except [Get static object](#get-static-object), which uses `endpoints.static_cdn`. Every route accepts `GET` and `HEAD` and has no rate limit.## Common responses-Every media read route can produce these statuses in addition to the ones in its own table.+Every route can also return these statuses.| Status | Body | Condition || --- | --- | --- || 403 | Forbidden | The [cross-origin read policy](/media-proxy/overview/#cross-origin-reads) refuses the request `Origin` on an `mp` or `upload` endpoint |-| 404 | Not found | The path is not a media route, the endpoint runs in `relay` mode, or the object does not exist |-| 405 | Method not allowed | The method is neither `GET` nor `HEAD` |-| 413 | Payload too large | The stored object exceeds the 500 MiB media bound and the route neither streams it unchanged nor spools it |-| 502 | Bad gateway | The object store could not be read |+| 404 | Not Found | The path is not a media route, the endpoint runs in `relay` mode, or the object does not exist |+| 405 | Method Not Allowed | The method is neither `GET` nor `HEAD` |+| 413 | Payload Too Large | The route has to hold an object larger than 500 MiB in memory |+| 502 | Bad Gateway | The object store could not be read |-The 500 MiB media bound applies where a route holds an object in memory. A read that streams the stored object unchanged, such as an attachment read without a transformation parameter, has no size bound. An attachment read that asks for a frame of a video above the bound copies the video to the spool directory first, one video at a time, and returns 413 when the video exceeds the spool ceiling. Any other transformation of an object above the bound returns 413.+Attachments without a transformation, entrance sounds and static objects stream the stored bytes and have no size limit. Every route accepts `Range` when it returns the stored bytes unchanged. A transformed response ignores `Range` and is always complete. See [Byte ranges](/media-proxy/overview/#byte-ranges) for the 206 and 416 headers.## Get attachment<RouteHeader method="GET" path="/attachments/{path}" unauthenticated />-Returns the attachment identified by the path, optionally transformed. The path and its signature come from the attachment URL the HTTP API returned. Request that URL as issued. A transformation parameter can be added to its query string.--:::caution[An attachment URL is a bearer capability]-Anyone holding the URL reads the object from any origin the [cross-origin read policy](/media-proxy/overview/#cross-origin-reads) allows. Under the `enforce` [signed attachment URL policy](/media-proxy/overview/#signed-attachment-urls) it works until `ex`, and otherwise for as long as the object exists. A [data package URL](/http-api/messages/#data-package-attachment-urls) has no `ex` and works until the secret that signed it is removed. Leaving the guild does not revoke a URL a member already holds.-:::--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| path<sup>1</sup> | string | The attachment object path from a [message attachment object](/http-api/messages/#message-attachment-object) |--<sup>1</sup> Fluxer issues `{channel_id}/{attachment_id}/{filename}`. After percent-decoding, the storage key must be non-empty, must not begin with `/`, and must not contain an empty, `.`, or `..` segment, or the route returns 400+Returns the attachment at the `url` or `proxy_url` of a [message attachment object](/http-api/messages/#message-attachment-object). Use the URL as issued, and add a transformation parameter to its query string to resize or convert the file. Anyone with the URL can read the file, and the [signed attachment URL policy](/media-proxy/overview/#signed-attachment-urls) decides how long it works.### Query parameters| Field | Type | Description || --- | --- | --- |-| width? | integer | The output width in pixels (1 through the [decoded edge bound](/media-proxy/transformations/#allowed-dimensions), any other value returns 400) |-| height? | integer | The output height in pixels under the same rule |-| format? | string | The output format under the [attachment and external format contract](/media-proxy/transformations/#attachment-and-external-formats) (any other value returns 400) |-| quality? | string | The encoder profile under the [quality contract](/media-proxy/transformations/#quality) |+| width? | integer | The output width in pixels, up to the [decoded edge bound](/media-proxy/transformations/#allowed-dimensions) |+| height? | integer | The output height in pixels, up to the same bound |+| format? | string | The output [format](/media-proxy/transformations/#attachment-and-external-formats) |+| quality? | string | The encoder [quality](/media-proxy/transformations/#quality) profile || animated? | boolean | Whether animated output is requested |-| effort?<sup>1</sup> | integer | The WebP encoder effort, clamped to 9 |-| download? | boolean | Whether attachment disposition is requested |-| ex?<sup>2</sup> | string | The expiry of the signed URL, as 8 lowercase hexadecimal digits of Unix seconds, or `0` on a data package URL |-| is?<sup>2</sup> | string | The issue time of the signed URL, as 8 lowercase hexadecimal digits of Unix seconds |-| hm?<sup>2</sup> | string | The signature, as 64 lowercase hexadecimal digits |-| uc?<sup>2</sup> | string | The data package marker, always `dp` when present |--<sup>1</sup> Read only on this route, and an empty or unparsable value is ignored. Only lossless animated WebP output uses a value above 6--<sup>2</sup> Read under the `report` or `enforce` [signed attachment URL policy](/media-proxy/overview/#signed-attachment-urls), which also defines how they are parsed. `enforce` requires `ex`, `is`, and `hm`, and reads `uc` on every URL, where its presence selects the [data package URL](/http-api/messages/#data-package-attachment-urls) grammar+| effort? | integer | The WebP encoder effort (at most 9) |+| download? | boolean | Whether the response has attachment disposition |+| ex? | string | The URL expiry, from the issued URL |+| is? | string | The URL issue time, from the issued URL |+| hm? | string | The URL signature, from the issued URL |+| uc? | string | Set to `dp` on data package download URLs, from the issued URL |-[When a transformation runs](/media-proxy/transformations/#when-a-transformation-runs) defines the trigger.--A response with transformed bytes ignores `Range` and is always complete, as [Transformed representations](/media-proxy/overview/#transformed-representations) states.--An SVG attachment with a transformation parameter is rasterised, and `format` and `quality` select the output as they do for any other source, defaulting to WebP. Without a transformation parameter, only a Media Proxy in [`mp` deployment mode](/media-proxy/overview/#deployment-modes) rasterises it, always as lossless WebP. A Media Proxy in `upload` mode returns the stored SVG bytes.--A video source requires an explicit image `format`. A video request with `width`, `height`, `quality`, or `animated=true` and no `format` returns 400. A source that is neither an image nor a video returns 400 when `format` is present. Without `format`, Fluxer returns it unchanged.+Not every parameter starts a [transformation](/media-proxy/transformations/#when-a-transformation-runs). A video needs an image `format` to return a frame, and a video request that sets another transformation parameter without `format` returns 400. Setting `format` on a file that is neither an image nor a video also returns 400.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | Complete media representation | The object and selected representation are available |+| 200 | Complete media representation | The attachment was returned || 206 | Selected media bytes | One range over the stored bytes is satisfiable |-| 400 | Bad request | The decoded key, a dimension, the format, or the transformation request is invalid, or the transformation failed |-| 404 | Not found | The attachment object does not exist and the signed attachment URL policy is `off` or `report` |+| 400 | Bad Request | The path, a dimension, the format or the transformation is invalid, or the transformation failed || 404 | This content is no longer available. | The signed attachment URL policy refuses the signature, or the object does not exist under `enforce` || 416 | empty | A range over the stored bytes is unsatisfiable |-| 504 | Gateway timeout | Transformation capacity was unavailable or the transformation exceeded its deadline |--[Common responses](#common-responses) also apply.+| 503 | Service Unavailable | Fluxer has no transformation capacity free |+| 504 | Gateway Timeout | The transformation timed out |## Get signed external media-<RouteHeader method="GET" path="/external/{signature}/{target}" />--Returns external media through Fluxer, optionally transformed. Use the signed URL supplied by the HTTP API.--Fluxer constructs the signed path and exposes it on these fields:--- `proxy_url` of an [embed media object](/http-api/messages/#embed-media-object)-- `proxy_icon_url` of an [embed author object](/http-api/messages/#embed-author-object)-- `proxy_icon_url` of an [embed footer object](/http-api/messages/#embed-footer-object)-- `proxy_url` of a [resolved GIF entry](/http-api/memes/#resolved-gif-entry-object)-- `proxy_src` of a [GIF media format object](/http-api/memes/#gif-media-format-object)--A field holds a signed external path only when its source URL is external. A URL already under the Media Proxy endpoint keeps that endpoint, and gets an [attachment URL signature](/http-api/messages/#signed-attachment-urls) when it names an attachment of this instance. Any URL the deployment cannot sign is returned verbatim, so a client MUST request the value exactly as issued and MUST NOT assume it has the signed shape.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| signature | string | The signature from the issued URL |-| target | string | The opaque target from the issued URL |--A client MUST preserve both components exactly as issued and MUST NOT decode or reconstruct either one. The signature covers the target component alone, so adding or changing a query parameter does not invalidate it. A path with no `/` after `/external/` returns 400.--:::caution[The signed path is the only authorisation]-Anyone holding a signed path fetches that external target through Fluxer for as long as the deployment secret is unchanged, with no expiry, user binding, or individual revocation.-:::--### Target validation--Fluxer validates the decoded target before every request and again for every redirect hop. It must be at most 8,192 bytes, must use `http` or `https`, must have a non-zero port when it names one, and must not contain credentials or a control character. A fragment is dropped before the fetch.+<RouteHeader method="GET" path="/external/{signature}/{target}" unauthenticated />-The target must resolve to a public internet address. Private, local and reserved addresses are rejected, including through redirects.+Returns a third-party file through Fluxer, optionally transformed. The HTTP API returns these URLs in `proxy_url` on [embed media](/http-api/messages/#embed-media-object), `proxy_icon_url` on [embed authors](/http-api/messages/#embed-author-object) and [footers](/http-api/messages/#embed-footer-object), and `proxy_url` and `proxy_src` on [GIF results](/http-api/memes/#resolved-gif-entry-object). Use each URL exactly as the API returns it, and don't build `/external/` paths yourself.-A hostname whose lookup fails or resolves to no address returns 400.--A redirect beyond the [five-redirect bound](/media-proxy/responses-and-limits/#request-and-media-limits), a repeated URL, or a redirect without a `Location` header returns 502. A redirect to a rejected target returns 400.+The signature covers only the target and works until `FLUXER_MEDIA_PROXY_SECRET_KEY` changes. Fluxer fetches the target with the user agent `Mozilla/5.0 (compatible; Fluxerbot/1.0; +https://fluxer.app)` and follows at most five redirects to public `http` or `https` addresses.### Query parameters| Field | Type | Description || --- | --- | --- |-| width? | integer | The output width in pixels (1 through the [decoded edge bound](/media-proxy/transformations/#allowed-dimensions), any other value returns 400) |-| height? | integer | The output height in pixels under the same rule |-| format? | string | The output format under the [attachment and external format contract](/media-proxy/transformations/#attachment-and-external-formats) (any other value returns 400) |-| quality? | string | The encoder profile under the [quality contract](/media-proxy/transformations/#quality) |+| width? | integer | The output width in pixels, up to the [decoded edge bound](/media-proxy/transformations/#allowed-dimensions) |+| height? | integer | The output height in pixels, up to the same bound |+| format? | string | The output [format](/media-proxy/transformations/#attachment-and-external-formats) |+| quality? | string | The encoder [quality](/media-proxy/transformations/#quality) profile || animated? | boolean | Whether animated output is requested |-| download? | boolean | Whether attachment disposition is requested |--`effort` is read only on [Get attachment](#get-attachment) and is ignored here.--A transformation begins when `width`, `height`, `format`, or `quality` is present, when `animated` resolves to true, when the target filename ends in `.svg`, or when the origin body is SVG by media type or by its first bytes. A transforming request forwards no `Range` to the origin. A response with transformed bytes ignores the client range and is always complete, as [Transformed representations](/media-proxy/overview/#transformed-representations) states. A transforming request that returns the origin bytes unchanged applies the client range to those buffered bytes, so a satisfiable range returns 206 and an unsatisfiable range returns 416.--A non-transforming request can forward the range to the origin. Handle both 200 and 206 responses and use their range headers, as described in [Byte ranges](/media-proxy/overview/#byte-ranges).--Fluxer returns 503 when it cannot reserve or allocate a buffer for the origin body. A `HEAD` with no transformation and no forwarded range can build `Content-Type` and `Content-Length` from the origin's own `HEAD` response, so those headers can differ from a `GET` response.+| download? | boolean | Whether the response has attachment disposition |-A video target requires an explicit image `format` to produce a thumbnail. Without one, Fluxer returns the original bytes unchanged, and it does the same for a target that is neither an image nor a video.+When no transformation runs, Fluxer forwards `Range` to the origin, which can answer 200 or 206.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | Complete external representation | The validated origin returned a complete representation |-| 206<sup>1</sup> | Selected external bytes | The origin answered a forwarded range, or a range over buffered origin bytes is satisfiable |-| 400 | Bad request | The path shape, decoded URL, redirect target, transformation request, or transformation is invalid or prohibited |-| 401 | Unauthorized | The path signature is invalid |-| 413 | Payload too large | The origin declared or delivered more than 500 MiB |+| 200 | Complete external representation | The origin returned the file |+| 206 | Selected external bytes | The origin or Fluxer answered a range |+| 400 | Bad Request | The path, target, redirect or transformation is invalid or not allowed |+| 401 | Unauthorized | The signature is invalid |+| 413 | Payload Too Large | The origin sent more than 500 MiB || 416 | empty | A local range is unsatisfiable |-| 502 | Bad gateway | The origin could not be reached, exceeded the redirect bound, or returned an unsuccessful status that the paragraph below this table does not list |-| 503 | Service unavailable | Fluxer could not reserve or allocate a buffer for the origin body |-| 504 | Gateway timeout | Transformation capacity was unavailable or the transformation exceeded its deadline |+| 502 | Bad Gateway | The origin failed, was unreachable or redirected too many times |+| 503 | Service Unavailable | Fluxer could not allocate a buffer for the origin body or has no transformation capacity free |+| 504 | Gateway Timeout | The transformation timed out |-<sup>1</sup> A forwarded range relays the origin `Content-Range` and `Content-Length` unchanged and omits either header the origin did not send, so a chunked origin 206 produces a 206 with no `Content-Length`. A local range over buffered origin bytes always has both--An origin status of 400, 401, 403, 404, 405, 406, 408, 409, 410, 411, 412, 413, 414, 415, 416, 428, or 429 reaches the client unchanged with the plain-text body `Upstream fetch failed`, and the origin body and headers are not returned. Any other unsuccessful origin status becomes 502. [Common responses](#common-responses) also apply.--### Side effects--The route requests the target from the validated third-party origin using the user agent `Mozilla/5.0 (compatible; Fluxerbot/1.0; +https://fluxer.app)`, which is visible to that origin.+Most origin 4xx statuses, such as 403, 404 and 429, come back with the same status and the body `Upstream fetch failed`. Other origin errors become 502.## Get theme CSS<RouteHeader method="GET" path="/themes/{path}" unauthenticated />-Returns a theme stylesheet with the fixed media type `text/css; charset=utf-8`. The [themes resource](/http-api/themes/) writes the object to `themes/{theme_id}.css`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| path<sup>1</sup> | string | The path below `/themes/`, whose raw route path must end in the exact lowercase suffix `.css` |--<sup>1</sup> After percent-decoding, the storage key must be non-empty, must not begin with `/`, and must not contain an empty, `.`, or `..` segment, or the route returns 400--The route selects no representation and accepts a `Range`.--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | Complete CSS representation | The theme object is available |-| 206 | Selected CSS bytes | One range is satisfiable |-| 400 | Bad request | The decoded theme key is invalid |-| 416 | empty | The range is unsatisfiable |--[Common responses](#common-responses) also apply. A path that does not end in `.css` is not a theme path and falls through to 404.+Returns a theme stylesheet written by the [themes resource](/http-api/themes/) as `text/css; charset=utf-8`. The path must end in `.css`.## Get entrance sound<RouteHeader method="GET" path="/entrance-sounds/{user_id}/{filename}" unauthenticated />-Returns the stored audio of a user entrance sound. The [entrance sounds resource](/http-api/entrance-sounds/) writes the object to `entrance-sounds/{user_id}/{hash}.{ext}`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id<sup>1</sup> | string | The owning user [snowflake](/snowflakes/) |-| filename<sup>2</sup> | string | `{hash}.{ext}` for the stored sound |--<sup>1</sup> A non-empty run of ASCII digits. Any other value makes the path unroutable and returns 404--<sup>2</sup> Use the hash returned by the API. The extension is the exact lowercase `mp3`, `ogg`, `m4a`, or `wav`--The route selects no representation, accepts a `Range`, and sends no `Content-Disposition`. A successful response streams the stored bytes with the detected audio media type and the one-year `no-transform` cache policy.--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | Complete audio representation | The sound object is available |-| 206 | Selected audio bytes | One range is satisfiable |-| 416 | empty | The range is unsatisfiable |--[Common responses](#common-responses) also apply.+Returns the audio of an [entrance sound](/http-api/entrance-sounds/). `filename` is `{hash}.{ext}` with the hash from the API and an extension of `mp3`, `ogg`, `m4a` or `wav`.## Image asset contract-An image asset is a stored picture Fluxer serves at a requested size and format, such as an avatar, a guild icon, or an emoji. The asset hash comes from the resource object, and the path combines the owning resource, that hash, and a file extension. On an emoji or sticker path the filename is the identifier itself. The grammar, query parameters, and responses below apply to every image asset route. [Asset size selection](/media-proxy/transformations/#asset-size-selection) defines every size class.--A client builds the complete URL from the Media Proxy [base URL](/media-proxy/overview/#base-urls), the path template for the asset class, the hash, and a file extension.--:::note[Some resources publish their URL in the response]-An attachment has its own `url` and `proxy_url`, a signed external media path has its own signature, and endpoint discovery publishes the instance branding images as complete URLs.-:::--Fluxer matches an asset path by its shape alone. A path with the wrong number of segments, an empty owner segment, or a filename without exactly one dot is not an asset path and returns 404. A hash containing anything but ASCII letters, digits, and `_` returns 404 as well, as does an extension outside the known image set. The known set is `png`, `jpg`, `jpeg`, `webp`, `gif`, `apng`, `avif`, `heic`, `heif`, `jxl`, and `svg`, matched case-insensitively.+The image routes below all take the same query parameters and return the same statuses. Build the URL from the `endpoints.media` base URL, the route path, the hash from the resource object and an extension. An `a_` hash means the asset is animated.-Use the hash returned by the API. Do not calculate one from the image yourself.--An owner segment of the literal `.` or `..` parses as an asset path but produces an unsafe storage key and returns 400. So does a hash of the literal `a_` on an avatar, icon, branding, sign-in backdrop, banner, splash, embed splash, or guild member asset path.+The extension sets the output format and is one of `png`, `jpg`, `jpeg`, `webp`, `gif`, `apng`, `avif`, `heic`, `heif`, `jxl` or `svg`, in upper or lower case. Each route uses one [size class](/media-proxy/transformations/#asset-size-selection).### Query parameters| Field | Type | Description || --- | --- | --- |-| size?<sup>1</sup> | integer | The requested square edge in pixels, snapped to the [size ladder](/media-proxy/transformations/#allowed-dimensions) and clamped to the asset class |-| format?<sup>2</sup> | string | The requested output format, also accepted under the name `fmt` |-| quality? | string | The encoder profile under the [quality contract](/media-proxy/transformations/#quality), defaulting to `high` |-| animated?<sup>3</sup> | boolean | Whether animated output is requested |-| download? | boolean | Whether attachment disposition is requested |--<sup>1</sup> An absent or unparsable value selects 128 before clamping, except that an absent value on a branding or sign-in backdrop path keeps the original size. No value is rejected--<sup>2</sup> Accepts case-insensitive `auto`, `png`, `jpg`, `jpeg`, `webp`, `gif`, `apng`, and `avif`, where `auto` keeps path-based selection and `avif` selects WebP. Any other value falls back to path-based selection, and a sticker path always selects WebP and ignores the field--<sup>3</sup> An absent value keeps the hash-derived default, which is animated only for an `a_` hash. PNG and JPEG output has no animation--`width`, `height`, and `effort` are not read on an asset path, and no asset query value produces a 400. The route accepts a `Range` when it returns the stored bytes unchanged. A transformed asset ignores `Range` and is always complete, as [Transformed representations](/media-proxy/overview/#transformed-representations) states.+| size? | integer | The square edge in pixels, snapped to the [size ladder](/media-proxy/transformations/#allowed-dimensions) (default 128) |+| format? | string | The output format, also accepted as `fmt`, where `auto` uses the path extension |+| quality? | string | The encoder [quality](/media-proxy/transformations/#quality) profile, defaulting to `high` |+| animated? | boolean | Whether animated output is requested, defaulting to true for an `a_` hash |+| download? | boolean | Whether the response has attachment disposition |-<a id="image-asset-response"></a>+An unknown or invalid query value uses the default.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | Complete asset representation | The original or transformed asset is available |+| 200 | Complete asset representation | The asset was returned || 206 | Selected asset bytes | One range over the stored bytes is satisfiable |-| 400 | Bad request | An owner segment of `.` or `..`, or a hash of `a_` on a path other than an emoji or sticker path, makes the storage key unsafe |-| 404 | Not found | The path is not a valid asset path or the asset does not exist |+| 400 | Bad Request | The path makes an unsafe storage key |+| 404 | Not Found | The path is not a valid asset path or the asset does not exist || 416 | empty | A range over the stored bytes is unsatisfiable |-| 500<sup>1</sup> | Transcode failed | A required transcode failed and the source is not directly displayable |-| 504 | Gateway timeout | Transformation capacity was unavailable or the transformation exceeded its deadline |--<sup>1</sup> A failed transcode whose stored media type begins with `image/` and is not `image/avif`, `image/heic`, `image/heif`, or SVG instead returns 200 with the original stored bytes and media type but without `Content-Disposition`--[Common responses](#common-responses) also apply. [Transformations](/media-proxy/transformations/) defines geometry, animation, output formats, and original representation selection.+| 500 | Transcode Failed | A required transcode failed and the source can't be shown as it is |+| 503 | Service Unavailable | Fluxer has no transformation capacity free |+| 504 | Gateway Timeout | The transformation timed out |## Get user avatar<RouteHeader method="GET" path="/avatars/{user_id}/{hash}.{ext}" unauthenticated />-Returns the user avatar under the icon size class.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| user_id | string | The owning user [snowflake](/snowflakes/) paired with the avatar hash |-| hash | string | The avatar hash, under the [image asset contract](#image-asset-contract) |-| ext | string | The path extension, which selects the output format |--### Response--The [image asset response](#image-asset-response) applies.+Returns a user avatar in the icon size class.## Get guild icon<RouteHeader method="GET" path="/icons/{guild_id}/{hash}.{ext}" unauthenticated />-Returns the guild icon under the icon size class.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | string | The owning guild [snowflake](/snowflakes/) paired with the icon hash |-| hash | string | The icon hash, under the [image asset contract](#image-asset-contract) |-| ext | string | The path extension, which selects the output format |--### Response--The [image asset response](#image-asset-response) applies.+Returns a guild icon in the icon size class.## Get instance branding<RouteHeader method="GET" path="/branding/{entity_id}/{hash}.{ext}" unauthenticated />-Returns the instance branding image written by [Create branding asset](/admin-api/instance/#create-branding-asset), under the branding size class.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| entity_id | string | The instance branding entity key supplied by the branding URL |-| hash | string | The branding hash, under the [image asset contract](#image-asset-contract) |-| ext | string | The path extension, which selects the output format |--### Response--The [image asset response](#image-asset-response) applies.+Returns an instance branding image written by [Create branding asset](/admin-api/instance/#create-branding-asset), in the branding size class. Without `size`, it returns the image at its original size.## Get instance sign-in backdrop<RouteHeader method="GET" path="/branding-backdrops/{entity_id}/{hash}.{ext}" unauthenticated />-Returns the sign-in backdrop written by [Create branding asset](/admin-api/instance/#create-branding-asset) with the `sign_in_backdrop` kind, under the branding size class.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| entity_id | string | The instance branding entity key supplied by the backdrop URL |-| hash | string | The backdrop hash, under the [image asset contract](#image-asset-contract) |-| ext | string | The path extension, which selects the output format |--### Response--The [image asset response](#image-asset-response) applies.+Returns the sign-in backdrop written by [Create branding asset](/admin-api/instance/#create-branding-asset) with the `sign_in_backdrop` kind, in the branding size class. Without `size`, it returns the image at its original size.## Get owner banner<RouteHeader method="GET" path="/banners/{owner_id}/{hash}.{ext}" unauthenticated />-Returns the owner banner under the banner size class.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| owner_id | string | The owning user or guild [snowflake](/snowflakes/) paired with the banner hash |-| hash | string | The banner hash, under the [image asset contract](#image-asset-contract) |-| ext | string | The path extension, which selects the output format |--### Response--The [image asset response](#image-asset-response) applies.+Returns a user or guild banner in the banner size class.## Get guild splash<RouteHeader method="GET" path="/splashes/{guild_id}/{hash}.{ext}" unauthenticated />-Returns the guild splash under the banner size class.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | string | The owning guild [snowflake](/snowflakes/) paired with the splash hash |-| hash | string | The splash hash, under the [image asset contract](#image-asset-contract) |-| ext | string | The path extension, which selects the output format |--### Response--The [image asset response](#image-asset-response) applies.+Returns a guild splash in the banner size class.## Get guild embed splash<RouteHeader method="GET" path="/embed-splashes/{guild_id}/{hash}.{ext}" unauthenticated />-Returns the guild embed splash under the banner size class.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | string | The owning guild [snowflake](/snowflakes/) paired with the embed splash hash |-| hash | string | The embed splash hash, under the [image asset contract](#image-asset-contract) |-| ext | string | The path extension, which selects the output format |--### Response--The [image asset response](#image-asset-response) applies.+Returns a guild embed splash in the banner size class.## Get guild member avatar<RouteHeader method="GET" path="/guilds/{guild_id}/users/{user_id}/avatars/{hash}.{ext}" unauthenticated />-Returns the guild member avatar under the icon size class.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | string | The guild [snowflake](/snowflakes/) owning the member asset |-| user_id | string | The member user [snowflake](/snowflakes/) paired with the member avatar hash |-| hash | string | The member avatar hash, under the [image asset contract](#image-asset-contract) |-| ext | string | The path extension, which selects the output format |--### Response--The [image asset response](#image-asset-response) applies.+Returns a member's guild avatar in the icon size class.## Get guild member banner<RouteHeader method="GET" path="/guilds/{guild_id}/users/{user_id}/banners/{hash}.{ext}" unauthenticated />-Returns the guild member banner under the banner size class.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| guild_id | string | The guild [snowflake](/snowflakes/) owning the member asset |-| user_id | string | The member user [snowflake](/snowflakes/) paired with the member banner hash |-| hash | string | The member banner hash, under the [image asset contract](#image-asset-contract) |-| ext | string | The path extension, which selects the output format |--### Response--The [image asset response](#image-asset-response) applies.+Returns a member's guild banner in the banner size class.## Get emoji image<RouteHeader method="GET" path="/emojis/{emoji_id}.{ext}" unauthenticated />-Returns the emoji image under the emoji size class with a square cover crop.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| emoji_id<sup>1</sup> | string | The emoji [snowflake](/snowflakes/), which is also the storage key |-| ext<sup>2</sup> | string | The path extension, which selects the output format |--<sup>1</sup> Any non-empty run of ASCII letters, digits, and `_`. Fluxer clients request `{emoji_id}.webp`--<sup>2</sup> An extension whose encoder is not enabled for output selects WebP instead--Emoji requests default to static output. Use `animated=true` for animation, without adding an `a_` prefix to the identifier.--### Response--The [image asset response](#image-asset-response) applies.+Returns an emoji cropped to a square in the emoji size class, static unless you pass `animated=true`. The ID never has an `a_` prefix.## Get sticker image<RouteHeader method="GET" path="/stickers/{sticker_id}.{ext}" unauthenticated />-Returns the sticker image under the sticker size class with a square cover crop. Output is always WebP, except that an animated GIF source stays GIF when `animated` resolves to true.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| sticker_id<sup>1</sup> | string | The sticker [snowflake](/snowflakes/), which is also the storage key |-| ext | string | The path extension, used only as the source hint |--<sup>1</sup> Any non-empty run of ASCII letters, digits, and `_`. Fluxer clients request `{sticker_id}.webp`--Sticker requests default to static output. Use `animated=true` for animation, without adding an `a_` prefix to the identifier.--### Response--The [image asset response](#image-asset-response) applies.+Returns a sticker cropped to a square in the sticker size class. Output is always WebP and ignores `format`, except that an animated GIF stays GIF when `animated=true`. The ID never has an `a_` prefix.## Get static object<RouteHeader method="GET" path="/{key}" unauthenticated />-Returns a raw object from the static bucket. The route exists only on the `static` deployment mode, published as `endpoints.static_cdn` by [instance discovery](/http-api/instance/#instance-endpoints-object). It serves default avatars, client bundles, and other published files.--The complete request path is the storage key after percent-decoding. The route applies no transformation and reads no query parameter. The response uses the detected media type and the one-year cache policy, and a `static` endpoint omits `X-Robots-Tag`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| key<sup>1</sup> | string | The object key in the static bucket, taken from the complete request path |--<sup>1</sup> After percent-decoding, the key must be non-empty, must not begin with `/`, and must not contain an empty, `.`, or `..` segment, or the route returns 400--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | Complete object | The object is available |-| 206 | Selected bytes | One range is satisfiable |-| 400 | Bad request | The decoded key is invalid |-| 416 | empty | The range is unsatisfiable |--[Common responses](#common-responses) also apply.+Returns a file from the static bucket, such as a default avatar or a client bundle. The route exists only on a Media Proxy in [`static` mode](/media-proxy/overview/#deployment-modes). The whole path is the storage key, and query parameters are ignored.## Operator and internal endpoints-These paths are not part of the public API surface and are not published by instance discovery. A client MUST NOT depend on them.+These paths are for the instance itself and aren't published by instance discovery.| Path | Method | Description || --- | --- | --- || `/_health` | GET | Returns 200 while the process is running |-| `/_metrics` | GET | Returns the Prometheus text exposition of the process. A request from a non-loopback address returns 403 |-| `/_metadata` | POST | Extracts media metadata, a placeholder, and an optional NSFW verdict for the HTTP API |-| `/_sniff` | POST | Returns the media type detected in the first 8 KiB of a staged upload for the HTTP API |-| `/_thumbnail` | POST | Produces a WebP thumbnail of a staged upload for the HTTP API |+| `/_metrics` | GET | Returns Prometheus metrics to loopback requests and 403 to anything else |+| `/_metadata` | POST | Returns media metadata for the HTTP API |+| `/_sniff` | POST | Returns the media type of a staged upload for the HTTP API |+| `/_thumbnail` | POST | Makes a WebP thumbnail of a staged upload for the HTTP API || `/_frames` | POST | Extracts one JPEG video frame for the HTTP API |-`/_metadata`, `/_sniff`, `/_thumbnail`, and `/_frames` require `Authorization: Bearer {deployment secret key}` and return 401 without it. Their JSON request bodies are bounded, and a body beyond the bound returns 413.--`/_sniff` returns 200 with a JSON `content_type`. It is the image, video, or audio media type the Media Proxy detects in the upload, or null when the bytes are SVG or a type it cannot process. An upload key that names no object returns 404.+The four `POST` endpoints need `Authorization: Bearer {FLUXER_MEDIA_PROXY_SECRET_KEY}` and return 401 without it.diff --git a/fluxer_docs/src/content/docs/media-proxy/transformations.md b/fluxer_docs/src/content/docs/media-proxy/transformations.mdindex c438a58ca..683ca9ebb 100644--- a/fluxer_docs/src/content/docs/media-proxy/transformations.md+++ b/fluxer_docs/src/content/docs/media-proxy/transformations.md@@ -1,87 +1,69 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Image and video transformations-description: Transformation parameters, geometry, formats, quality, animation, and limits.+description: Query parameters that resize, convert and animate images and extract video thumbnails, with their formats, quality profiles and limits.----The Media Proxy resizes and converts images, preserves or removes animation, and extracts a still image from a video. The [attachment](/media-proxy/routes/#get-attachment) and [signed external media](/media-proxy/routes/#get-signed-external-media) routes share one parameter set, and the [image asset contract](/media-proxy/routes/#image-asset-contract) has a smaller one of its own.+The Media Proxy resizes and converts images, keeps or removes animation and extracts a still image from a video. The [attachment](/media-proxy/routes/#get-attachment) and [signed external media](/media-proxy/routes/#get-signed-external-media) routes share one parameter set, and the [image asset contract](/media-proxy/routes/#image-asset-contract) has a smaller one.## When a transformation runs-The theme, entrance sound, and static object routes read no parameter and never transform.+An attachment or signed external request transforms when `width`, `height`, `format` or `quality` is present, or when `animated` is true. `download` and `effort` don't start a transformation.-An attachment or signed external request transforms when `width`, `height`, `format`, or `quality` is present, or when `animated` resolves to true. `download` and `effort` select no transformation.+A signed external request also transforms when the target filename ends in `.svg` or the origin body is SVG. An SVG attachment with no transformation parameter is still rasterized to lossless WebP, but only in [`mp` mode](/media-proxy/overview/#deployment-modes).-A signed external request also transforms when the target filename ends in `.svg`, and when the origin body is SVG by media type or by its first bytes, whatever the filename. An SVG origin body is transformed. One case skips the transformation. When the origin answers a forwarded range with a 206 and a non-SVG media type, the proxy relays those raw bytes.--The Media Proxy still rasterises an SVG attachment that selects no transformation. That path always uses lossless WebP and runs only in [`mp` mode](/media-proxy/overview/#deployment-modes).--An image asset request always runs through the transformation engine. It returns the original bytes only when the resolved format already matches the source and the resolved size is at least the source dimensions.--The Media Proxy canonicalises nothing and issues no redirect, so two spellings of one selection are two separate HTTP cache entries.+An image asset request always transforms, unless the requested format matches the source and the requested size is at least the source size.## Representation parameters| Field | Type | Description || --- | --- | --- |-| width?<sup>1</sup> | integer | The output width for an attachment or signed external request |-| height?<sup>1</sup> | integer | The output height for an attachment or signed external request |-| size?<sup>2</sup> | integer | The requested square edge for an image asset request |-| format?<sup>3</sup> | string | The requested output format under [Attachment and external formats](#attachment-and-external-formats) or [Image asset formats](#image-asset-formats) |-| quality? | string | The requested [quality profile](#quality) |-| animated?<sup>4</sup> | boolean | Whether animated output is requested |-| effort?<sup>5</sup> | integer | The WebP encoder effort for an attachment request |+| width? | integer | The output width for an attachment or signed external request (see [allowed dimensions](#allowed-dimensions)) |+| height? | integer | The output height for an attachment or signed external request (see [allowed dimensions](#allowed-dimensions)) |+| size? | integer | The requested square edge for an image asset request, snapped to the [size ladder](#allowed-dimensions) |+| format?<sup>1</sup> | string | The output format, see [attachment and external formats](#attachment-and-external-formats) and [image asset formats](#image-asset-formats) |+| quality? | string | The [quality profile](#quality) |+| animated? | boolean | Whether animated output is requested |+| effort?<sup>2</sup> | integer | The WebP encoder effort for an attachment request || download? | boolean | Whether the response uses attachment disposition |-<sup>1</sup> An empty, unparsable, zero, or too large value returns 400. Any integer from 1 through 16,384 is accepted--<sup>2</sup> No value is rejected. An absent or unparsable value selects 128, a parsable value snaps to the ladder, and the result is then clamped by [asset size selection](#asset-size-selection)--<sup>3</sup> An image asset request accepts the same value under the name `fmt`, and reads `fmt` only when `format` is absent+<sup>1</sup> An image asset request also accepts `fmt`, which is used only when `format` is absent-<sup>4</sup> A true value requests animated output and a false value requests static output, whatever the route default+<sup>2</sup> Values above 9 count as 9-<sup>5</sup> An empty or unparsable value is ignored. A value from 10 through 255 is clamped to 9, and a value above 255 does not parse, so it too is ignored--A name that occurs more than once resolves to its final value, and an unknown name is ignored. `animated` and `download` are true only for case-insensitive `true` or the exact value `1`. Every other value, including `false` and `0`, is false.+A repeated parameter uses its last value, and an unknown parameter is ignored. `animated` and `download` are true only when set to `1` or `true` in any letter case.## Allowed dimensions-`width` and `height` are free integers from 1 through 16,384. Any other value returns 400, and neither is clamped into range. The decoded source is bounded separately by [transformation limits](#transformation-limits).+`width` and `height` are free integers from 1 through 16,384, and any other value returns 400.-`size` selects from a fixed ladder: 16, 20, 22, 24, 28, 32, 40, 44, 48, 56, 60, 64, 80, 96, 100, 128, 160, 240, 256, 300, 320, 480, 512, 600, 640, 1024, 1280, 1536, 2048, 3072, 4096, 8192, and 16,384. A requested value snaps up to the first rung that is at least as large, so 641 selects 1024. A request above 16,384 selects 16,384, and the class clamp in [asset size selection](#asset-size-selection) can reduce the result further.+`size` selects from a fixed ladder: 16, 20, 22, 24, 28, 32, 40, 44, 48, 56, 60, 64, 80, 96, 100, 128, 160, 240, 256, 300, 320, 480, 512, 600, 640, 1024, 1280, 1536, 2048, 3072, 4096, 8192, and 16,384. A requested value snaps up to the next rung (641 selects 1024), and a value above 16,384 selects 16,384.## Geometry-Transformations never enlarge an image.--`width` alone scales proportionally to the requested width, and `height` alone scales proportionally to the requested height. A fit inside a rectangle uses the smaller of the two ratios, so a dimension requested larger than the source still shrinks when the other requested dimension is smaller than the source.+Transformations never enlarge an image. `width` or `height` alone scales proportionally.-A cover crop scales a still image to cover the requested rectangle and crops it centrally. It applies to an attachment or signed external request that supplies both `width` and `height`, and to every emoji or sticker asset. Every other image asset fits inside the selected square and preserves its full aspect ratio.+A cover crop scales a still image to fill the rectangle and crops it from the center. It applies when an attachment or signed external request has both `width` and `height`, and to every emoji and sticker asset. Other image assets fit inside the square.-:::note[An animated transformation fits the whole frame]-Animated output fits inside the requested bounds without cropping, including animated emoji and stickers.-:::+Animated output always fits the whole frame without cropping.## Asset size selection-An asset request snaps `size` to the ladder and then clamps the result into the range of its asset class. The resolved value is applied to both dimensions, and the [geometry rules](#geometry) then decide whether the image is cropped or fitted inside that square.+An asset request snaps `size` to the ladder and clamps it to the range of its asset class.| Asset class | Routes | Range || --- | --- | --- || Icon | avatars, icons, guild member avatars | 128 through 1024 |-| Banner<sup>1</sup> | banners, splashes, embed splashes, guild member banners | 480 through 2400 |+| Banner | banners, splashes, embed splashes, guild member banners | 480 through 2400 || Emoji | emojis | 32 through 512 || Sticker | stickers | 128 through 512 || Branding | branding, sign-in backdrops | 16 through 4096 |-<sup>1</sup> The banner maximum of 2400 is not a ladder rung and is reachable only by clamping, so 3072 and every larger request collapse onto it--An absent `size` resolves to 128 before clamping, so an avatar defaults to 128 and a banner defaults to 480. Emoji and sticker assets also default to 128. A branding asset with no `size` is served at its original size. Every ladder value below a class minimum collapses onto that minimum, and every value above a class maximum collapses onto that maximum.+An absent `size` resolves to 128 before clamping, which gives a banner 480. A branding asset with no `size` is the exception and keeps its original size.## Attachment and external formats-Format matching is case-insensitive. A value outside this table returns 400, and `auto` is not a value here.+Matching is case-insensitive, and any value outside this table returns 400.| Value | Output format | Media type || --- | --- | --- |@@ -92,85 +74,71 @@ Format matching is case-insensitive. A value outside this table returns 400, and| `apng` | APNG | `image/apng` || `avif`, `heic`, `heif`, `jxl`, `svg` | WebP | `image/webp` |-<sup>1</sup> An APNG source requesting PNG output with `animated=true` keeps APNG and `image/apng`--<sup>2</sup> A GIF source requesting WebP output with `animated=true` keeps GIF and `image/gif`+<sup>1</sup> An APNG source with `animated=true` keeps APNG and `image/apng`-AVIF, HEIC, HEIF, JXL, and SVG decode but have no output encoder, so they are returned as WebP. SVG is rasterised, and a transforming route never returns SVG bytes.+<sup>2</sup> A GIF source with `animated=true` keeps GIF and `image/gif`-When `format` is omitted, an attachment uses the filename extension in its path. Signed external media uses the origin media type first and then the target filename. If neither identifies an image format, the output is WebP.+Without `format`, an attachment uses the extension in its path. Signed external media uses the origin media type, then the target filename. If neither is an image format, the output is WebP.## Image asset formats-An image asset path can use PNG, JPEG, WebP, GIF, APNG, AVIF, HEIC, HEIF, JXL, or SVG. A path extension without an output encoder selects WebP.+The path extension selects the output, and an extension with no encoder selects WebP. `format`, or `fmt`, overrides the extension when it is `png`, `jpg`, `jpeg`, `webp`, `gif` or `apng`. `avif` selects WebP, and `auto` or any other value keeps the path extension.-The `format` query parameter, also accepted as `fmt`, overrides the path extension. It recognises case-insensitive `auto`, `png`, `jpg`, `jpeg`, `webp`, `gif`, `apng`, and `avif`. `auto` leaves the path extension to select the output, and `avif` selects WebP. Any other value, including `heic`, `heif`, `jxl`, `svg`, and an unknown name, falls back to path-based selection.--A sticker always selects WebP and ignores `format`. An animated GIF sticker stays GIF when `animated` resolves to true.+A sticker returns WebP whatever `format` says, unless it is an animated GIF requested with `animated=true`, which stays GIF.## Quality-Quality names are matched exactly and are case-sensitive. An unrecognised value selects `high`.+Values are case-sensitive, and an unrecognized value selects `high`.| Value | Description || --- | --- |-| `low`<sup>1</sup> | Encodes at quality 65 with WebP encoder effort 2 |-| `auto`<sup>2</sup> | Resolves to `lossless` or `high` |+| `low` | Encodes at quality 65 with WebP effort 2 |+| `auto`<sup>1</sup> | Resolves to `lossless` or `high` || `high` | Encodes at quality 85 |-| `lossless`<sup>3</sup> | Selects lossless WebP encoding and JPEG quality 100 |--<sup>1</sup> PNG, APNG, and GIF have fixed encoder settings and ignore `quality`, so the quality number reaches WebP and JPEG output only+| `lossless` | Lossless WebP, or JPEG at quality 100 |-<sup>2</sup> Selects `lossless` for animated WebP output from a GIF or APNG source of at most 4 MiB and at most 16,777,216 pixels across all frames. Every other request selects `high`+PNG, APNG and GIF output ignores `quality`.-<sup>3</sup> Lossless applies to WebP alone, and JPEG at quality 100 is still a lossy encode+<sup>1</sup> Selects `lossless` for animated WebP from a GIF or APNG source of at most 4 MiB and 16,777,216 pixels across all frames, and `high` otherwise-An image asset defaults to `high`. An attachment or signed external image defaults to `lossless`, except that a JPEG, HEIC, or HEIF source defaults to `high`. Animated WebP output defaults to `auto` on every route that reads `quality`. Fluxer extracts a video thumbnail at `high`, and `quality` then applies only to the resize step that `width` or `height` requests. A non-transforming SVG rasterisation always uses `lossless`.+An image asset defaults to `high`. An attachment or signed external image defaults to `lossless`, except that a JPEG, HEIC, HEIF or JXL source defaults to `high`. Animated WebP output defaults to `auto`.-The attachment-only `effort` parameter controls WebP encoding effort. Fluxer clamps a value above 9 to 9. Only lossless animated WebP output uses a value above 6. Other output formats ignore it.+`effort` applies only to WebP output. Values from 7 to 9 only take effect for lossless animated WebP.## Animation-An owner-and-hash asset whose hash begins with `a_` requests animated output by default. A bare hash requests static output.--The `animated` parameter overrides that default in both directions. It is read whenever the name is present, so `animated=false` forces static output even for an `a_` hash. Omitting the name keeps the route default.--Fluxer issues emoji and sticker paths without an `a_` prefix, so those requests default to static output and need `animated=true` for animation. An attachment or signed external request also defaults to static output.+An avatar, icon, banner or other image asset whose hash starts with `a_` is animated by default, and one with a plain hash is static. Emojis, stickers, attachments and signed external media are static unless you pass `animated=true`, and `animated=false` turns animation off for an `a_` asset.-For transformed output, animation requires an animated request and WebP, GIF or APNG output. Static output contains one frame. A read that selects no transformation preserves the source animation.+Animation needs WebP, GIF or APNG output. Static output has one frame. A request with no transformation parameters returns the original file, animation included.-:::caution[PNG and JPEG output stacks the frames]-PNG and JPEG cannot represent animation. Requesting them with `animated=true` can produce one tall image with the frames stacked vertically.-:::--An animated GIF request for GIF output is resized in its original container, and is returned untouched when the requested size would not change it. Requesting a cover crop routes it through the image pipeline, which still emits GIF.+PNG and JPEG can't animate, and requesting them with `animated=true` for an animated source returns the frames stacked into one tall image.## Video thumbnails-Supply an image `format` to extract a video thumbnail. The video itself is never transcoded. `width` and `height` fit the thumbnail inside the requested rectangle without cropping.--An attachment video request with another transformation parameter but no `format` returns 400. A signed external video request without `format` returns the original bytes instead.+An image `format` extracts a thumbnail from a video, and the video is never transcoded. `width` and `height` fit the thumbnail inside the rectangle without cropping.-An attachment source that is neither an image nor a video returns 400 when `format` is present and is otherwise returned unchanged. The signed external route always returns such a source unchanged.+On an attachment, a video request with a transformation parameter but no `format` returns 400. On signed external media it returns the original video.## Original representations-The Media Proxy returns the original bytes when the source already has the selected format, no resize or crop is required, and no `effort` or `quality` value forces encoding. A source whose bytes sniff as animated also requires a request that resolves to animated, and a static request against it is encoded.+The Media Proxy returns the original bytes when the source already has the requested format and size and the request has no `effort` or `quality` parameter, though a GIF source ignores `quality` here. An animated source also needs `animated` to be true, explicitly or by default.-An `effort` value forces encoding, and a `quality` value forces encoding for every source except GIF. With neither `width` nor `height`, an animated attachment or signed external request for the source's own GIF, WebP, or APNG format ignores both the `effort` test and the `quality` test and can still reuse the original animation.--Use the response `Content-Type`, which can differ from the filename extension or stored metadata.+Check the response `Content-Type`, which can differ from the filename extension.## Transformation limits-A stored object above the [500 MiB media bound](/media-proxy/responses-and-limits/#request-and-media-limits) returns 413, and so does an external origin that declares or delivers more. The same bound applies to a transforming request and to every buffer it produces.+A stored object or external origin above the [500 MiB media bound](/media-proxy/responses-and-limits/#request-and-media-limits) returns 413.-Decoded images are limited to 16,384 pixels on either edge and 268,435,456 pixels in total. Animated input is also limited to 20,000 decoded frames and 1,073,741,824 decoded pixels across all frames. These bounds are fixed. Exceeding a decoded image or animation limit fails the transformation.+Decoded images are limited to 16,384 pixels on either edge and 268,435,456 pixels in total. Animated input is also limited to 20,000 frames and 1,073,741,824 pixels across all frames. Exceeding a limit fails the transformation.-Animated WebP and animated APNG output is bounded again at encode time, and exceeding one of those bounds truncates the output. The encoder stops adding frames after 20,000 frames, or once the accumulated frame delays reach 30,000 ms of playback, and emits the frames it already has. An operator can configure the frame cap from 1 through 100,000 and the playback cap from 100 through 600,000 ms. Animated GIF output has neither cap on any encoding path, so the decode limits above are its only bound.+Animated WebP and APNG output stops adding frames after 20,000 frames or 30,000 ms of playback and keeps the frames it has. Animated GIF output has no cap.-The transformation deadline defaults to 15,000 ms and can be configured from 1,000 through 120,000 ms. WebP or APNG animation can be shortened to meet it. A GIF resize that reaches the deadline fails.+The transformation deadline is 15,000 ms by default. WebP and APNG animation can be shortened to meet it, and a GIF resize that runs past it fails.-An attachment or signed external transformation failure returns 400. An image asset transformation failure returns 500 when the stored media type does not begin with `image/` or is `image/avif`, `image/heic`, `image/heif`, or SVG, and otherwise returns 200 with the original stored bytes and no `Content-Disposition`.+| Status | Condition |+| --- | --- |+| 400 | An attachment or signed external transformation failed |+| 500 | An image asset's stored file isn't an image, or is AVIF, HEIC, HEIF or SVG, and the transformation failed |+| 504 | The transformation was refused [admission](/media-proxy/responses-and-limits/) or exceeded its deadline |-A transformation refused admission returns 504, and so does one that exceeds its deadline. [Responses and limits](/media-proxy/responses-and-limits/) defines the admission capacity and the deadlines.+Any other failed image asset transformation returns 200 with the original bytes.diff --git a/fluxer_docs/src/content/docs/media-proxy/upload-relay.mdx b/fluxer_docs/src/content/docs/media-proxy/upload-relay.mdxindex 672f397dd..32ef4b1ce 100644--- a/fluxer_docs/src/content/docs/media-proxy/upload-relay.mdx+++ b/fluxer_docs/src/content/docs/media-proxy/upload-relay.mdx@@ -1,122 +1,57 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Upload relay-description: Capability-authorised uploads and the relay streaming limits.+description: How to send a file to an upload relay URL and what the relay returns.---import RouteHeader from '@/components/RouteHeader.astro';-The upload relay is where a client sends the bytes of a file. Each upload URL has a signed capability, and the relay stores the one object it authorises. [Request attachment upload URLs](/http-api/messages/#request-attachment-upload-urls) and [Create stream preview upload URL](/http-api/streams/#create-stream-preview-upload-url) issue them. [Attachment uploads](/topics/uploads/) states the flow the relay takes part in.+The upload relay stores the bytes of one file at a signed upload URL. [Request attachment upload URLs](/http-api/messages/#request-attachment-upload-urls) and [Create stream preview upload URL](/http-api/streams/#create-stream-preview-upload-url) issue these URLs. See [Attachment uploads](/topics/uploads/) for the whole flow.-## Base URL and authorisation+## Authorization-Paths here are relative to the relay base in the issued upload URL. That base is a deployment setting.--The capability is the complete authorisation. The relay reads no HTTP API `Authorization` header and has no request-count rate limit. The `PUT` has a [deployment mode](/media-proxy/overview/#deployment-modes) gate and returns 404 outside `upload` and `relay` mode.--:::note[Some upload URLs address object storage directly]-An upload URL points directly to object storage when the caller's IP address geolocates to a country the deployment lists in `keep_direct_countries`. Use the URL returned by the HTTP API. This page describes relay URLs only.-:::--:::caution[The complete URL is authenticated]-The path key and the `t` capability are bound together by the signature. A client MUST use the URL exactly as issued and MUST NOT rebuild, decode, reorder, or re-encode it. The URL is a bearer capability.-:::--## Relay capability object--The `t` query parameter is an opaque bearer token. Keep it private and use it only with the issued URL. Upload URLs expire after 900 seconds by default. A missing, invalid or expired token returns 401.+The `t` query parameter is a signed token for one object or multipart part, and the relay ignores the `Authorization` header. Send the request to the URL exactly as the HTTP API returned it and keep the URL private. The URL expires after 900 seconds unless the instance sets another lifetime.## Put relay object<RouteHeader method="PUT" path="/v1/relay/{key}" />-Uploads the object or part authorised by the [relay capability](#relay-capability-object). Returns 200 with an empty body and an optional `ETag` header.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| key<sup>1</sup> | string | The object key of the issued URL |--<sup>1</sup> Use the key exactly as it appears in the issued URL. Changing it returns 403+Stores the object or multipart part the upload URL authorizes, and returns the `ETag` from storage when storage sends one.### Query parameters| Field | Type | Description || --- | --- | --- |-| t<sup>1</sup> | string | The opaque upload token |-| uploadId?<sup>2</sup> | string | The multipart upload identifier, present only when the capability has one |-| partNumber?<sup>3</sup> | integer | The multipart part number, present only when the capability has one |--<sup>1</sup> A missing `t` returns 401--<sup>2</sup> Use the value from the issued URL. A missing or mismatched multipart upload identifier returns 403--<sup>3</sup> An empty or unparsable value returns 400. A part number that does not match the issued URL returns 403+| t | string | The upload token |+| uploadId? | string | The multipart upload ID, when the issued URL has one |+| partNumber? | integer | The multipart part number, when the issued URL has one |### Request headers| Field | Type | Description || --- | --- | --- |-| Content-Length?<sup>1</sup> | integer | The declared length of the request body |-| Content-Type?<sup>2</sup> | string | The media type to store, read only when the capability declares none |--<sup>1</sup> A declared length above the authorised upload size or the endpoint body limit returns 413--<sup>2</sup> The media type authorised by the upload URL takes precedence--The relay ignores every other request header.--### Request body--The body is arbitrary bytes.--When `Content-Length` is supplied, send exactly that many bytes. A longer body returns 413 and a shorter body returns 400. Without this header, a body above the authorised upload size or the endpoint body limit still returns 413. Interrupted uploads return 400, and insufficient relay capacity returns 503.+| Content-Length? | integer | The length of the body, which must match the bytes you send |+| Content-Type? | string | The media type to store, used when the upload URL sets none |### Response-The relay forwards no object storage response body and no arbitrary response headers.-| Status | Body | Condition || --- | --- | --- || 200 | empty | The object or part was stored |-| 400 | `Bad Request` | The `partNumber` value is unparsable or the client body ended early |-| 401 | `Unauthorized` | The capability is missing, malformed, incorrectly signed, or expired |-| 403 | `Forbidden` | The bucket, key, `uploadId`, or `partNumber` disagrees with the capability |-| 404 | `Not Found` | The endpoint does not serve the upload relay |-| 405<sup>1</sup> | empty | The method is not `PUT` |-| 413 | `Payload Too Large` | The body exceeds the authorised upload size or the endpoint body limit |+| 400 | `Bad Request` | `partNumber` is not a number, or the body ended before `Content-Length` or arrived too slowly |+| 401 | `Unauthorized` | `t` is missing, invalid or expired |+| 403 | `Forbidden` | The key, `uploadId` or `partNumber` does not match the token |+| 404 | `Not Found` | The Media Proxy is not running in `upload` or `relay` [mode](/media-proxy/overview/#deployment-modes) |+| 405 | empty | The method is not `PUT` or `OPTIONS` |+| 413 | `Payload Too Large` | The body is longer than `Content-Length`, the authorized size or the body limit || 500 | `Internal Server Error` | The relay could not store the upload locally |-| 502 | `Bad Gateway` | The object store refused the write or could not be written to |-| 503 | `Service Unavailable` | The relay has insufficient upload capacity |--<sup>1</sup> It has no relay CORS headers and no cache policy--:::caution[A message naming the key creates the attachment]-A successful relay request stores the bytes and creates no attachment. [Create message](/http-api/messages/#create-message), [Modify message](/http-api/messages/#modify-message), and [Execute webhook](/http-api/webhooks/#execute-webhook) are the requests that can name the key.-:::--[Complete attachment upload](/http-api/messages/#complete-attachment-upload) assembles a multipart upload once every part is stored, and a singlepart upload needs no completion step. A stream preview becomes readable as soon as the stored object is in place, and the [Streams resource](/http-api/streams/) defines that flow.+| 502 | `Bad Gateway` | Object storage refused the write |+| 503 | `Service Unavailable` | The request has no `Content-Length` and the relay's temporary upload space is full |-Repeating an upload replaces the object or part, and the last successful write wins. A multipart part can be retried after a 502 or 503 while its URL remains valid.+You can retry a 502 or 503 until the URL expires. Responses allow requests from any origin, and a preflight `OPTIONS` request gets a 204.-### Response headers--The 200, 400, 401, 403, 413, 500, 502, and 503 have the relay CORS headers. The 404 and the 405 have none of them.--Relay CORS means `Access-Control-Allow-Origin: *`, `Access-Control-Allow-Headers: Content-Type, Content-Length, Authorization, X-Fluxer-Features, X-Client-Context`, and `Access-Control-Expose-Headers: ETag, X-Fluxer-Version`.--### Side effects--A successful request writes the object the capability selects to the uploads bucket. It creates no attachment record and no message.--## Streaming limits--| Setting | Default | Configurable range |-| --- | --- | --- |-| Endpoint body limit | 500 MiB | 1 byte through 5 GiB |-| Object storage write deadline | 900,000 ms | 1,000 through 3,600,000 ms |+## Limits-The largest body the relay accepts is the smaller of the endpoint body limit and the authorised upload size.+`FLUXER_MEDIA_PROXY_UPLOAD_RELAY_MAX_BODY_BYTES` sets the body limit, which defaults to 500 MiB. `FLUXER_MEDIA_PROXY_UPLOAD_RELAY_S3_TIMEOUT_MS` sets the write deadline, which defaults to 900,000 ms.-When the request declares `Content-Length`, the relay extends the object storage write deadline by one second for every 16 KiB of declared length.+The largest body the relay accepts is the smaller of the body limit and the authorized upload size. When the request has `Content-Length`, the relay adds one second to the write deadline for every 16 KiB of declared length, and it returns 400 if the body takes longer.diff --git a/fluxer_docs/src/content/docs/operator/index.mdx b/fluxer_docs/src/content/docs/operator/index.mdxindex 792afc93a..75a1c29cf 100644--- a/fluxer_docs/src/content/docs/operator/index.mdx+++ b/fluxer_docs/src/content/docs/operator/index.mdx@@ -6,16 +6,16 @@ sidebar:label: Install----rexctl installs Fluxer on one machine and keeps it running. It checks the machine, gets a certificate for your domain and helps you create your admin account. To run Fluxer on a Kubernetes cluster, use the [Helm chart](/operator/kubernetes/).+rexctl installs Fluxer on one machine and keeps it running. To run Fluxer on a Kubernetes cluster, use the [Helm chart](/operator/kubernetes/).## What you need-- A 64-bit Linux, macOS or Windows machine with at least 4 GB of memory. On Linux, rexctl installs Docker for you if it's missing. On macOS and Windows, install [Docker Desktop](https://docs.docker.com/desktop/) first.+- A 64-bit Linux, macOS or Windows machine with at least 4 GB of memory.+- On macOS and Windows, [Docker Desktop](https://docs.docker.com/desktop/). On Linux, rexctl installs Docker for you if it's missing.- A domain or subdomain for your instance, such as `chat.example.com`.+- An `A` record for that domain pointing to the machine's public IP address. rexctl checks it before it asks for a certificate.-Add an `A` record for the domain that points to the machine's public IP address. rexctl checks the record before it asks for a certificate.--Your hosting provider or home router may have a firewall of its own. Open TCP ports 80, 443 and 7881 and UDP ports 443 and 7882 there, and forward them to the machine. rexctl can open these ports in the machine's own firewall, but it can't change a firewall outside the machine.+Open TCP ports 80, 443 and 7881 and UDP ports 443 and 7882 in any firewall outside the machine, such as your hosting provider's firewall. On a home network, forward the same ports from your router to the machine. rexctl can open them in the machine's own firewall for you.## Install@@ -31,14 +31,18 @@ On Windows, run this in PowerShell:irm https://fluxer.dev/install.ps1 | iex```-The script downloads rexctl and starts it. Answer Rex's questions, and when he's done, rexctl prints your instance's address.+The script downloads rexctl and starts it. Answer its questions, and when it's done, rexctl prints your instance's address.-rexctl asks where you want to create your admin account. If you choose "In my browser", it prints a setup token at the end, and your instance asks for that token the first time you open it.+rexctl asks where you want to create your admin account. "Here in the terminal" creates it during the install. "In my browser" prints a setup token at the end, and your instance asks for that token the first time you open it. If you lose the token, run `rexctl setup token` to show it again.-People can then open your instance's address in a browser, or enter it in the desktop and mobile apps.+Once you've created the admin account, people can open your instance's address in a browser or enter it in the desktop and mobile apps.## After you install-Once your instance is running, rexctl also [upgrades it, backs it up and manages accounts](/operator/running/). If another web server on the machine already uses ports 80 and 443, you can [put Fluxer behind your own proxy](/operator/reverse-proxy/). The [command reference](/operator/rexctl/) lists every rexctl command and flag.+Once your instance is running, these pages help you look after it.++- [Run your instance](/operator/running/) to upgrade, back up and manage people.+- [Put Fluxer behind your own proxy](/operator/reverse-proxy/) if another web server on the machine already uses ports 80 and 443.+- The [rexctl reference](/operator/rexctl/) lists every command and flag.If you get stuck, ask in [Fluxer Developers](https://fluxer.gg/fluxer-developers) or open an issue on [GitHub](https://github.com/fluxerapp/fluxer).diff --git a/fluxer_docs/src/content/docs/operator/kubernetes.mdx b/fluxer_docs/src/content/docs/operator/kubernetes.mdxindex 7a8927274..2fafc2c11 100644--- a/fluxer_docs/src/content/docs/operator/kubernetes.mdx+++ b/fluxer_docs/src/content/docs/operator/kubernetes.mdx@@ -4,44 +4,58 @@ title: Kubernetesdescription: Run a Fluxer instance on a Kubernetes cluster with the Helm chart.----The Helm chart in `deploy/helm/fluxer` runs the same Fluxer services as rexctl does on one machine, and it generates its own secrets. rexctl doesn't manage a Kubernetes install. You install and upgrade with Helm, and run the instance from the admin panel.+The Helm chart in `deploy/helm/fluxer` runs the same Fluxer services that rexctl runs on one machine. You install and upgrade it with Helm, because rexctl doesn't manage a Kubernetes install.## What you need-- Kubernetes 1.29 or newer, and Helm 3 or Helm 4.-- About 2 CPUs and 8 GB of memory free for the release.-- A default StorageClass with `ReadWriteOnce` volumes.-- An ingress controller and cert-manager. With `edge.expose: loadBalancer` you need neither, and Fluxer gets its own certificate.-- An `A` record for your domain that points to the ingress controller or the load balancer.-- TCP port 7881 and UDP port 7882 open on the node that runs LiveKit, for voice and video calls.+| Requirement | Details |+| --- | --- |+| Kubernetes | Version 1.29 or newer |+| Helm | Helm 3 or Helm 4 |+| Resources | The pods request about 1 CPU and 4.5 GB of memory, and their limits add up to about 19 GB |+| Storage | A default StorageClass with `ReadWriteOnce` volumes |+| Web traffic | An ingress controller and cert-manager, or a Gateway API gateway |+| Visitor addresses | The ingress controller sees each visitor's address, through `externalTrafficPolicy: Local` or the PROXY protocol |+| DNS | An `A` record for your domain that points to the ingress controller or the load balancer |+| Voice | TCP port 7881 and UDP port 7882 open to LiveKit |++With `edge.expose: loadBalancer` you need neither an ingress controller nor cert-manager, and Fluxer gets its own certificate.++If the ingress controller doesn't see each visitor's address, every visitor shares one address and hits the same sign-in limits.The install stops with a message when the cluster is missing something it needs.## Install-Get the chart and write a values file with your domain:+Get the chart and write a values file with your domain.-```bash+```shgit clone --depth 1 https://github.com/fluxerapp/fluxer.gitprintf 'domain: chat.example.com\n' > fluxer-values.yaml```-Install it into its own namespace:+Install it into its own namespace.-```bash+```shhelm install fluxer ./fluxer/deploy/helm/fluxer \--namespace fluxer --create-namespace \-f fluxer-values.yaml --wait --timeout 15m```-Keep `fluxer-values.yaml` for upgrades. When the install is done, `helm test fluxer -n fluxer` checks that your instance answers on your domain.+Keep `fluxer-values.yaml` for upgrades. When the install is done, `helm test fluxer -n fluxer` checks that the instance answers for your domain.-Open your domain in a browser to create your admin account. The setup page asks for the setup token, which is in the chart's Secret:+Open your domain in a browser to create your admin account. The setup page asks for the setup token in the `fluxer-env` Secret.-```bash+```shkubectl -n fluxer get secret fluxer-env -o jsonpath='{.data.FLUXER_SETUP_TOKEN}' | base64 -d```+If the Secret has no setup token, the API wrote one to its log when it first started.++```sh+kubectl -n fluxer logs deployment/api | grep -i 'setup token'+```+## ValuesThe chart's `values.yaml` explains every value. These are the ones most installs change.@@ -51,19 +65,34 @@ The chart's `values.yaml` explains every value. These are the ones most installs| `domain` | The address people use for your instance || `email` | The contact address for Let's Encrypt and web push || `edge.expose` | `ingress`, `gateway`, `loadBalancer` or `none` for a proxy of your own |-| `livekit.expose` | `hostNetwork`, `loadBalancer` or `nodePort` for the voice ports |+| `livekit.expose` | `hostNetwork` (the default, needs a privileged namespace), `loadBalancer` or `nodePort` || `env` | Fluxer settings as `NAME: value` |-| `secrets.extra` | Settings that hold a password or a key |+| `secrets.extra` | Settings that have a password or a key |++Under Argo CD or `helm template`, set `secrets.generate: false` and give every key in `secrets.values`, or put a Secret you manage in `secrets.existingSecret`.-The ingress controller in front of Fluxer must see the real address of each visitor. Set `externalTrafficPolicy: Local` on its Service, or turn on the PROXY protocol between the load balancer and the controller. Otherwise every visitor shares one address and hits the same sign-in limits.+## External services-Under Argo CD, set `secrets.generate: false` and give every secret in `secrets.values`, or name a Secret you manage in `secrets.existingSecret`.+To use a service you already run, turn off the bundled one and say where yours is.++| Service | Values to set |+| --- | --- |+| Postgres | `postgres.enabled: false` and `postgres.external.host`, or a URL in `secrets.extra.FLUXER_POSTGRES_URL` |+| Valkey | `valkey.enabled: false` and `valkey.external.url`, or a URL with a password in `secrets.extra.FLUXER_KV_URL` |+| NATS | `nats.enabled: false` and `nats.external.url` |+| Meilisearch | `meilisearch.enabled: false` and `meilisearch.external.url` |+| S3 storage | `seaweedfs.enabled: false` and `s3.endpoint` |+| LiveKit | `livekit.enabled: false`, `livekit.external.url` and `livekit.external.publicUrl` |++The Postgres database and role, and the S3 buckets in `s3.buckets`, must exist before you install. Put passwords and keys in `secrets.values` under the key `values.yaml` gives for each service.++Point your LiveKit server's webhook at `https://<your domain>/api/webhooks/livekit`, signed with the key in `FLUXER_LIVEKIT_API_KEY`.## Upgrade-Pull the chart and upgrade with the same values file. A new `image.revision` makes every pod pull the latest images:+Pull the chart and upgrade with the same values file. A new `image.revision` restarts every Fluxer pod, which pulls the newest Fluxer images.-```bash+```shgit -C fluxer pullhelm upgrade fluxer ./fluxer/deploy/helm/fluxer -n fluxer -f fluxer-values.yaml \--set-string image.revision=$(date +%s) --wait --timeout 15m@@ -71,48 +100,51 @@ helm upgrade fluxer ./fluxer/deploy/helm/fluxer -n fluxer -f fluxer-values.yaml`helm rollback` goes back to the previous values and images, but it doesn't undo changes to the database.-## Back up+## Back up and restore-Back up the Secret and the database:+Back up the Secret and the database.-```bash-kubectl -n fluxer get secret fluxer-env -o yaml > fluxer-env.yaml+```sh+kubectl -n fluxer get secret fluxer-env -o yaml \+ | grep -v -E '^ (resourceVersion|uid|creationTimestamp):' > fluxer-env.yamlkubectl -n fluxer exec postgres-0 -- sh -c 'pg_dump -U "$POSTGRES_USER" -d "$POSTGRES_DB" --format=custom' > fluxer.dump```-Keep `fluxer-env.yaml` as safe as the database. A restored database needs the same Secret to work.+A restored database only works with the same Secret. Keep `fluxer-env.yaml` as safe as the dump.Uploads are on the volume `data-seaweedfs-0`. Back it up with a snapshot from your storage provider.-## Restore+To restore, put the Secret back before you install, and the new release uses the same secrets.-Put the Secret back before you install, and the new release uses the same secrets:--```bash+```shkubectl create namespace fluxerkubectl apply -f fluxer-env.yamlhelm install fluxer ./fluxer/deploy/helm/fluxer -n fluxer -f fluxer-values.yaml --wait --timeout 15m```-Stop everything except Postgres, restore the database and restore the uploads volume from its snapshot:+Stop everything except Postgres and restore the database.-```bash+```shkubectl -n fluxer scale deployment,statefulset --replicas=0 \-l 'app.kubernetes.io/part-of=fluxer,app.kubernetes.io/name notin (postgres)'kubectl -n fluxer exec -i postgres-0 -- sh -c 'pg_restore -U "$POSTGRES_USER" -d "$POSTGRES_DB" --clean --if-exists' < fluxer.dump```-Then run the same `helm upgrade` without `image.revision` to start everything again.+Restore the `data-seaweedfs-0` volume from its snapshot with your storage provider. Then start everything again.++```sh+helm upgrade fluxer ./fluxer/deploy/helm/fluxer -n fluxer -f fluxer-values.yaml --wait --timeout 15m+```## Uninstall-```bash+```shhelm uninstall fluxer -n fluxer```-The Secret and the volumes stay, and a new install with the same release name and namespace uses them again. To delete everything, delete them too:+The Secret and the volumes stay, and a new install with the same release name and namespace uses them again. To delete everything, delete them too.-```bash+```shkubectl -n fluxer delete secret fluxer-envkubectl -n fluxer delete pvc -l app.kubernetes.io/instance=fluxerkubectl delete namespace fluxerdiff --git a/fluxer_docs/src/content/docs/operator/reverse-proxy.mdx b/fluxer_docs/src/content/docs/operator/reverse-proxy.mdxindex 2257c70ec..564ab3504 100644--- a/fluxer_docs/src/content/docs/operator/reverse-proxy.mdx+++ b/fluxer_docs/src/content/docs/operator/reverse-proxy.mdx@@ -6,33 +6,54 @@ description: Put nginx, Caddy or another reverse proxy in front of your Fluxer iBy default, Fluxer uses ports 80 and 443 and gets its own certificate from Let's Encrypt. If another web server on the machine already uses those ports, Fluxer can serve plain HTTP on a local port for your proxy to forward to.-## Turn it on+## Serve plain HTTP for your proxy```shrexctl proxy on```-Fluxer then listens on `127.0.0.1:8080`. To use another address or port, pass it with `--bind`:+Fluxer then listens on `127.0.0.1:8080`. Pass `--bind` to [`rexctl proxy on`](/operator/rexctl/#rexctl-proxy) to use another address or port.```shrexctl proxy on --bind 127.0.0.1:8081```-If your proxy runs on another machine, bind an address that machine can reach and only let the proxy connect to that port. You can also pass `--behind-proxy` to `rexctl install` to start this way, and `rexctl proxy off` goes back to Fluxer's own certificate.+On a new machine, pass `--behind-proxy` to [`rexctl install`](/operator/rexctl/#rexctl-install) to start in this mode.-Your proxy can use `/_health` as its health check.+## Go back to HTTPS++```sh+rexctl proxy off+```++Fluxer goes back to serving HTTPS with its own certificate, and ports 80 and 443 need to be open to the machine again.++## Run the proxy on another machine++Bind an address the proxy machine can connect to, and only let the proxy connect to that port.++```sh+rexctl proxy on --bind 10.0.0.5:8080+```++By default, Fluxer trusts `X-Forwarded-For` only from private addresses. If the proxy connects from a public address, set `edge.trusted_proxies` to that address, which replaces the default.++```sh+rexctl config set edge.trusted_proxies 203.0.113.10+```++Until you do, everyone who uses your instance shows up with your proxy's address, and they share its rate limits and bans.## What your proxy needs to do-- Serve your domain over HTTPS and accept TLS 1.2 as well as TLS 1.3. The mobile apps play videos with a library that only supports TLS 1.2.+- Serve your domain over HTTPS with TLS 1.2 and TLS 1.3 turned on, because video playback in the mobile apps needs TLS 1.2.- Forward WebSocket connections.- Set `X-Forwarded-For` to the address the request came from, and drop any value the visitor sent.- Accept request bodies of at least 512 MB for uploads.- Keep idle connections open for an hour.-- Pass the `Sec-Fetch-Site` header through unchanged.-- Don't add a `Content-Security-Policy` header. Fluxer sends its own.--Forward every path and query string to Fluxer unchanged.+- Don't add a `Content-Security-Policy` header, because Fluxer sends its own.+- Forward every path and query string unchanged.+- Use `/_health` as the health check if your proxy has one.## nginx@@ -50,9 +71,8 @@ server {}server {- listen 443 ssl;- listen [::]:443 ssl;- http2 on;+ listen 443 ssl http2;+ listen [::]:443 ssl http2;server_name chat.example.com;ssl_certificate /etc/letsencrypt/live/chat.example.com/fullchain.pem;@@ -78,7 +98,7 @@ server {}```-Use `$remote_addr` for `X-Forwarded-For`. `$proxy_add_x_forwarded_for` keeps the value the visitor sent, and anyone could then pretend to come from another address.+Don't change `$remote_addr` to `$proxy_add_x_forwarded_for`, which keeps the value the visitor sent and lets anyone pretend to come from another address.## Caddy@@ -88,17 +108,17 @@ chat.example.com {}```-Caddy's defaults already do everything in the list above, and Caddy gets the certificate for your domain itself.+Caddy's defaults do everything in the list above, and Caddy gets a certificate for your domain itself.## Cloudflare-If Cloudflare proxies your domain, change these settings in the Cloudflare dashboard:+If Cloudflare proxies your domain, change these settings in the Cloudflare dashboard.-- Turn Rocket Loader off. With it on, the web app shows a blank page.+- Turn Rocket Loader off, because the web app shows a blank page with it on.- Don't let a Cache Rule store HTML pages, or people get an old version of the web app after you upgrade.- Turn Bot Fight Mode off and don't add challenges for `/api/`, `/gateway` or `/livekit/`. The desktop and mobile apps can't solve a challenge.-- Set the SSL/TLS encryption mode to "Full (strict)" when Fluxer gets its own certificate.+- Set the SSL/TLS encryption mode to "Full (strict)".## Voice and video-Voice and video calls don't go through your proxy. They connect to TCP port 7881 and UDP port 7882 on the machine directly, and both ports need to stay open. A tunnel such as Cloudflare Tunnel can't forward them, and an instance that you only serve through a tunnel has no voice or video calls.+Call audio and video don't go through your proxy. They connect directly to the machine on TCP port 7881 and UDP port 7882, and both ports need to be open. A tunnel such as Cloudflare Tunnel can't forward them, and an instance you only serve through a tunnel has no voice or video calls.diff --git a/fluxer_docs/src/content/docs/operator/running.mdx b/fluxer_docs/src/content/docs/operator/running.mdxindex 49fd12139..b27b8bf67 100644--- a/fluxer_docs/src/content/docs/operator/running.mdx+++ b/fluxer_docs/src/content/docs/operator/running.mdx@@ -12,7 +12,7 @@ Run these commands on the machine where you installed Fluxer. The [command referrexctl upgrade```-This upgrades rexctl and Fluxer together. It backs up your instance first, and if the new version doesn't start, it goes back to the version you had before.+This upgrades rexctl and Fluxer together. It backs up your instance before Fluxer switches to the new version, and if the new version doesn't start, it goes back to the version you had before.To see whether there's a new version without upgrading, run `rexctl upgrade --check`.@@ -22,7 +22,7 @@ To see whether there's a new version without upgrading, run `rexctl upgrade --chrexctl rollback```-This goes back to the version you had before your last upgrade.+This goes back to the version you had before your last upgrade and keeps your database as it is. To also restore the backup rexctl made before the upgrade, add `--restore-database`.## Back up and restore@@ -30,9 +30,9 @@ This goes back to the version you had before your last upgrade.rexctl backup```-This saves your settings, database and uploads in one file in the `backups` folder of your instance. Keep a copy of your backups on another machine. `rexctl backup list` shows the backups you have.+This saves your settings, database and uploads in one file in the `backups` folder of your instance. Fluxer pauses while it copies uploads. Keep a copy of your backups on another machine.-To put your instance back the way it was when a backup was made, run `rexctl restore` with the path that `rexctl backup list` shows:+To put your instance back the way it was when a backup was made, find the file with `rexctl backup list` and pass its path to `rexctl restore`.```shrexctl restore /opt/fluxer/backups/fluxer-chat.example.com-20261105-120000.tar.zst@@ -40,7 +40,7 @@ rexctl restore /opt/fluxer/backups/fluxer-chat.example.com-20261105-120000.tar.z## Move to a new machine-Back up your instance on the old machine and copy the backup file to the new one. On the new machine, install rexctl and restore the backup in one go:+Back up your instance on the old machine and copy the backup file to the new one. On the new machine, install rexctl and restore the backup with one command, run from the folder you copied the backup to.```shcurl -fsSL https://fluxer.dev/install.sh | sh -s -- restore fluxer-chat.example.com-20261105-120000.tar.zst@@ -50,50 +50,50 @@ Then change your domain's `A` record to the new machine's address.## Manage people-Create an invite link that 10 people can use within a week:+Create an invite link that 10 people can use within a week.```shrexctl invites create --uses 10 --expires 7d```-Choose who can create an account with `open`, `approval`, `invite` or `closed`:+Choose who can create an account with `open`, `approval`, `invite` or `closed`.```shrexctl registration set approval```-When registration needs approval, `rexctl registration pending` lists the people waiting and `rexctl registration approve <id>` lets someone in.+When registration needs approval, `rexctl registration pending` lists the people waiting and `rexctl registration approve <id>` approves one of them.-Make someone an admin:+Make someone an admin.```shrexctl admins add alex```-Ban an account and delete its messages:+Ban an account and delete its messages.```sh-rexctl users ban spammer42 --reason "Spam" --delete-messages+rexctl users ban spammer42 --reason spam --delete-messages```When someone has lost their password and can't reset it themselves, [create a reset link](/operator/sign-in/#lost-passwords) for them.## Email and branding-Set up email for your instance, then send yourself a test email:+Set up email for your instance, then send yourself a test email.```shrexctl email set-rexctl email test+rexctl email test [email protected]```-Change your instance's name, colour, logo or icon:+Change your instance's name, color, logo or icon.```shrexctl branding set --name "Example Chat" --logo logo.png```-You can do both in the admin panel too, at your instance's address followed by `/admin`.+You can also change email and branding in the admin panel, at your instance's address followed by `/admin`.## Change a setting@@ -101,18 +101,22 @@ You can do both in the admin panel too, at your instance's address followed by `rexctl config list```-This lists every setting with its value and a line of help, and says which settings restart Fluxer when you change them. To change one, pass its name and the new value to `rexctl config set`:+This lists every setting with its value and a line of help, and says which settings restart Fluxer when you change them. To change one, pass its name and the new value to `rexctl config set`.```shrexctl config set <key> <value>```-To manage your instance yourself without rexctl, run `rexctl eject`. When you want rexctl to manage it again, run `rexctl takeover`.-## When something is wrong```shrexctl doctor```-This checks your instance and the machine, and tells you how to fix each problem it finds. `rexctl doctor --fix` fixes the problems that are safe to fix for you. `rexctl status` shows whether each Fluxer service is running, and `rexctl logs` shows what it's been doing.+This checks your instance and the machine, and tells you how to fix each problem it finds. `rexctl doctor --fix` fixes the problems rexctl can fix safely.++`rexctl status` shows whether each Fluxer service is running, and `rexctl logs` shows their logs.++## Manage it without rexctl++To run your instance yourself with docker compose, run `rexctl eject`. Fluxer keeps running, and `rexctl takeover` hands it back to rexctl.diff --git a/fluxer_docs/src/content/docs/operator/sign-in.mdx b/fluxer_docs/src/content/docs/operator/sign-in.mdxindex 53c6680eb..7529cabc9 100644--- a/fluxer_docs/src/content/docs/operator/sign-in.mdx+++ b/fluxer_docs/src/content/docs/operator/sign-in.mdx@@ -1,43 +1,41 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Sign-in methods-description: Usernames or email addresses, single sign-on, recovery kits and reset links on a self-hosted instance.+description: How people sign in to a self-hosted instance and how to help them back into their account.---People sign in to your instance with a username or with an email address. You choose one during setup, and it can't change once the first account exists.## Usernames-People create an account with a username and a password. The instance never asks for an email address and doesn't need to send email. Features that send email are off, such as email verification and password resets by email.+People create an account with a username and a password. The instance never asks for an email address, and features that send email, such as address verification and password resets, are off.-When someone forgets their password, they use their recovery kit. The app shows the kit right after the account is created, ready to download or print, and people can make a new one in their account settings. Using the kit sets a new password, signs the account out everywhere and gives the person a new kit to keep.+When someone forgets their password, they use their recovery kit. The app shows the kit when the account is created, and people can make a new one in their account settings. Using the kit sets a new password, signs the account out everywhere and gives the person a new kit.## Email addresses-People create an account with an email address, a username and a password. The instance sends email to verify addresses and to reset forgotten passwords, and rexctl asks for your email server during setup. To change it later, run `rexctl email set`.--Until email is set up, the instance can't check addresses, and nobody can reset a forgotten password by email.+People create an account with an email address, a username and a password. The instance sends email to verify addresses and reset forgotten passwords. rexctl asks for your email server during setup, and `rexctl email set` changes it later. Until email is set up, nobody can reset a forgotten password by email, and you can [create a reset link](#lost-passwords) for them.## Single sign-on-People can sign in through your own identity provider, such as Authentik or Keycloak, over OpenID Connect. Set it up in the admin panel on the "Instance Config" page, in the "Single Sign-On (SSO)" card. The card shows the redirect URI to give your provider.+People can sign in through your own identity provider, such as Authentik or Keycloak, over OpenID Connect. Set it up in the admin panel on the "Instance Config" page, in the "Single Sign-On (SSO)" card. Fill in the details from your provider, turn on "Enable SSO" and register the "Redirect URI" that the card shows with your provider.-With "Automatically provision users on first SSO login" on, the first sign-in from someone new creates their account. In single-community mode, "Community Roles From Groups" gives people roles in the community from their groups at your provider.+With "Automatically provision users on first SSO login" on, the first sign-in from someone new creates their account. In single-community mode, "Community Roles From Groups" maps groups at your provider to roles in the community, and each SSO sign-in adds or removes those roles.-"Require SSO" turns off passwords, passkeys and registration for everyone. Before you turn it on, make sure at least one admin can sign in through your provider.+"Require SSO" turns off password and passkey sign-in and local registration for everyone. Before you turn it on, make sure at least one admin can sign in through your provider.## Lost passwords-When someone has lost their password and can't reset it themselves, create a reset link for them:+On a username instance, or an email instance that doesn't send email, you can create a reset link for someone who has lost their password. The "Create Password Reset Link" button on the account's page in the admin panel does the same.```shrexctl users reset-link alex```-Anyone with the link can set a new password for the account until the link expires. Send it to the person over a channel you trust. The admin panel has the same action as "Create Password Reset Link" on the account's page.+The link works once and expires after an hour, and anyone who has it can set a new password for the account. Send it to the person over a channel you trust. Creating the link deletes their recovery kit, and they can make a new one in their account settings.-Keep the recovery kit for your own admin account somewhere safe, and add a passkey or a second admin account. If you still lose access, `rexctl users reset-link` works on the machine without signing in.+If you lose access to your own admin account on such an instance, `rexctl users reset-link` works on the machine without signing in. On an email instance that sends email, reset your password from the sign-in page.## More settings-The "Sign-in & new accounts" card on the "Instance Config" page has the other settings for new accounts, such as instant accounts and when unused accounts are deleted.+The "Sign-in & new accounts" card on the "Instance Config" page has the other settings for new accounts, such as letting people start with just a display name and deleting accounts that have no way to sign back in.diff --git a/fluxer_docs/src/content/docs/snowflakes.md b/fluxer_docs/src/content/docs/snowflakes.mdindex e926a27f4..d93ac7275 100644--- a/fluxer_docs/src/content/docs/snowflakes.md+++ b/fluxer_docs/src/content/docs/snowflakes.md@@ -1,85 +1,59 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Snowflakes-description: Fluxer's 64-bit identifiers, their bit layout, wire grammar, and pagination behaviour.+description: The 64-bit IDs Fluxer gives every resource, how to get their creation time and how to send and page with them.----A snowflake is a 64-bit identifier for a Fluxer resource such as a user, guild, channel, message, role, or attachment. It is the type written as `snowflake` in every wire table of this reference, and the HTTP API, the Admin API, and the Gateway all share this identifier space.--A snowflake is unique within the deployment that issued it. The value stays stable, and Fluxer does not reuse it after the resource is deleted. Separate deployments can issue the same numeric value, so a client MUST scope every snowflake to its deployment.+A snowflake is the 64-bit ID of a Fluxer resource, such as a user, guild, channel, message or role. The HTTP API, the Admin API and the Gateway all use the same IDs, and an ID is unique within the instance that issued it.:::caution[Never parse a snowflake as a JSON number]-Snowflake values exceed a JSON double's exact integer range, so parsing one as a number can silently change it. A client MUST parse the string into a 64-bit integer and MUST compare snowflakes as integers, because unequal-length decimal strings do not sort as text.+Fluxer sends every snowflake as a string of decimal digits, because a JSON number can't represent one exactly. Parse the string into a 64-bit integer and compare snowflakes as integers.:::## Format-A snowflake packs a timestamp, a worker ID, and a sequence into 64 bits. The worker and sequence fields distinguish identifiers issued during the same millisecond. Bit 63 is always zero, so an issued snowflake fits a signed 64-bit integer.+A snowflake packs a timestamp, a worker ID and a sequence into 64 bits. Bit 63 is always zero.| Field | Bits | Description || --- | --- | --- |-| Timestamp<sup>1</sup> | 62 to 22 | The number of milliseconds since `2015-01-01T00:00:00.000Z` |-| Worker ID | 21 to 12 | The unsigned allocator worker identifier, from `0` through `1023` |-| Sequence<sup>2</sup> | 11 to 0 | The unsigned per-worker sequence, from `0` through `4095` |--<sup>1</sup> The timestamp records the instant the identifier was issued, which can fall shortly before the resource exists--<sup>2</sup> A higher sequence value means a later identifier only when both identifiers come from one worker in one millisecond--The epoch is 1420070400000 milliseconds after the Unix epoch. Every Fluxer instance uses the same value. The lower 22 bits expose allocator details, so a client MUST NOT use them for routing or resource semantics.+| Timestamp | 62 to 22 | Milliseconds since the Fluxer epoch, `2015-01-01T00:00:00.000Z` |+| Worker ID | 21 to 12 | The worker that issued the ID, from `0` through `1023` |+| Sequence | 11 to 0 | A per-worker counter, from `0` through `4095` |-Treat the embedded timestamp as an approximate issue time, not proof that the resource already exists.+Every instance uses the same epoch. Don't rely on the worker ID or sequence.-## Extracting a timestamp+## Timestamps-To obtain the creation time in Unix milliseconds, shift the snowflake right by 22 bits and add the epoch.+To get the creation time in Unix milliseconds, shift the snowflake right by 22 bits and add the epoch. To build a cursor for a given time, reverse the calculation. The result is the smallest snowflake for that time.```texttimestamp_ms = (snowflake >> 22) + 1420070400000snowflake = (timestamp_ms - 1420070400000) << 22```-The representable range runs from `2015-01-01T00:00:00.000Z` through `2084-09-06T15:47:35.551Z`.+Snowflakes cover times from `2015-01-01T00:00:00.000Z` through `2084-09-06T15:47:35.551Z`.-## Wire representation+A thread started from a message has that message's ID, so its timestamp is when the message was sent. The thread's own creation time is `create_timestamp` in its [thread metadata](/http-api/threads/#thread-metadata-object).-Fluxer emits a snowflake as an unsigned decimal string in every JSON body, path parameter, query string parameter, and Gateway payload. An emitted value contains only ASCII digits. Inbound traffic is more permissive, and a client SHOULD send the emitted form everywhere.+## Wire format-### Accepted input+Send snowflakes as strings too. The HTTP API and the Gateway also accept a JSON integer.-| Surface | Accepted input |+| Surface | Accepts || --- | --- |-| HTTP request<sup>1</sup> | `0`, or a non-zero digit followed by further digits, sent as a JSON string or as a JSON integer |-| Gateway command<sup>2</sup> | A non-zero digit followed by further digits, sent as a string of ASCII digits or as a positive JSON integer |--<sup>1</sup> Fluxer removes leading and trailing whitespace before it reads the text. In that text a leading zero, a sign, a decimal point, and any other non-digit character are rejected with the validation code [`INVALID_SNOWFLAKE_FORMAT`](/http-api/errors/#validation-error-codes), and a well-formed value above 9223372036854775807 is rejected with [`SNOWFLAKE_OUT_OF_RANGE`](/http-api/errors/#validation-error-codes)--<sup>2</sup> The Gateway rejects `0`, a leading zero, a signed value, a negative integer, and a value above 9223372036854775807--Both HTTP validation codes are element codes inside a 400 [`INVALID_FORM_BODY`](/http-api/errors/#api-error-codes) response. Each Gateway [command](/gateway/commands/) states what its own rejection does, from discarding the field to abandoning the whole command.+| HTTP request | A string or JSON integer from `0` through `9223372036854775807`, with no leading zero |+| Gateway command | The same, except `0` is rejected |-A snowflake sent as a JSON number keeps its exact value at any size. A fractional JSON number is an ordinary type failure and reports [`INVALID_FORMAT`](/http-api/errors/#validation-error-codes). Fluxer reads an exponent form as the number it means, and one above 9007199254740991 reports [`INVALID_SNOWFLAKE_FORMAT`](/http-api/errors/#validation-error-codes). Path parameters and query string parameters always arrive as text.--:::note[`0` is the beginning of snowflake time]-An HTTP pagination cursor accepts `0`. An HTTP path parameter or field that identifies a real resource also accepts `0`, and the request then receives the ordinary not-found result for that resource.-:::+The HTTP API reports a malformed value as [`INVALID_SNOWFLAKE_FORMAT`](/http-api/errors/#validation-error-codes) and a value that is too large as [`SNOWFLAKE_OUT_OF_RANGE`](/http-api/errors/#validation-error-codes).## Pagination-A collection endpoint that pages over a snowflake-ordered resource accepts a cursor such as `before`, `after`, or `around`. The endpoint defines which cursors it supports, whether they are mutually exclusive, the result order, and how `limit` is applied.+Snowflakes sorted as integers are in creation order, and list endpoints use them as cursors. A cursor doesn't have to be the ID of a real resource, so a snowflake [built from a timestamp](#timestamps) works too.| Cursor | Selects || --- | --- |-| `before` | Identifiers lower than the cursor value, excluding it |-| `after` | Identifiers higher than the cursor value, excluding it |-| `around` | A window centred on the cursor value, including it |--[List channel messages](/http-api/messages/#list-channel-messages) accepts `around` as a query string parameter, and [List messages from multiple channels](/http-api/messages/#list-messages-from-multiple-channels) accepts it on each entry of its request body. No other operation accepts it.+| `before` | IDs lower than the cursor |+| `after` | IDs higher than the cursor |+| `around` | A window centered on the cursor, including it |-The type of a `before` or `after` cursor follows the operation. [List pinned messages](/http-api/messages/#list-pinned-messages) pages on the pin time, so its `before` is an ISO 8601 timestamp. [List blocklist entries](/admin-api/blocklists/#list-blocklist-entries) pages on the entry value. Its `after` is the stored value of the last entry on the previous page. Each operation states the type of its own cursors.--Because the timestamp uses the high bits, numeric snowflake order is creation time order at millisecond resolution. Threads started from a message sort by the time of their source message.--:::note[A cursor is a numeric boundary]-A cursor does not need to identify a resource, so a snowflake derived from a timestamp can delimit a time range without a dedicated timestamp parameter.-:::+Only [List channel messages](/http-api/messages/#list-channel-messages) and [List messages from multiple channels](/http-api/messages/#list-messages-from-multiple-channels) accept `around`. Each endpoint lists the cursors it accepts, and a few endpoints use something other than a snowflake as the cursor.diff --git a/fluxer_docs/src/content/docs/topics/announcement-channels.md b/fluxer_docs/src/content/docs/topics/announcement-channels.mdindex f3b538566..80c87c4e1 100644--- a/fluxer_docs/src/content/docs/topics/announcement-channels.md+++ b/fluxer_docs/src/content/docs/topics/announcement-channels.md@@ -4,95 +4,81 @@ title: Announcement channelsdescription: Publishing messages from an announcement channel into the channels that follow it.----An announcement channel is a guild text channel, [type](/http-api/channels/#channel-types) `5`, whose messages can be published. Other channels follow it, and each published message is copied into every following channel. The copy is posted by a channel follower [webhook](/http-api/webhooks/#webhook-types) that is in the following channel.--Every guild can create announcement channels. [Create guild channel](/http-api/guild-channels/#create-guild-channel) accepts `type` `5`, and an announcement channel has the fields, permissions, and slowmode of a text channel.+An announcement channel is a guild channel of [type](/http-api/channels/#channel-types) `5`. When you publish a message in it, Fluxer copies the message into every channel that follows it. Each copy is posted by the [channel follower webhook](/http-api/webhooks/#webhook-types) in the following channel.## Converting a channel-[Modify channel](/http-api/channels/#modify-channel) converts a guild text channel into an announcement channel and back through its `type` field. No other conversion exists. The caller needs `MANAGE_CHANNELS`, the same as for any other channel change.--A text channel that receives copies from a followed announcement channel cannot become an announcement channel, because an announcement channel cannot follow another one. Delete its channel follower webhooks first.+You can create one with [Create guild channel](/http-api/guild-channels/#create-guild-channel) and `type` set to `5`, or switch a text channel to an announcement channel and back with [Modify channel](/http-api/channels/#modify-channel). Both need `MANAGE_CHANNELS`.-A text channel that holds a private thread cannot become an announcement channel either, and the request returns 400 `CHANNEL_HAS_THREADS`. [Thread types](/http-api/threads/#thread-types) describes how a conversion changes the type of the public threads of the channel.--Converting an announcement channel into a text channel removes every follow of it. The copies already delivered stay, and they keep receiving later edits and deletions of the messages they came from.+Converting a text channel into an announcement channel returns 400 `CHANNEL_HAS_FOLLOWED_CHANNELS` while the text channel follows another announcement channel, and 400 `CHANNEL_HAS_THREADS` while it has a private thread. Delete its channel follower webhooks or private threads first.## Publishing-[Crosspost message](/http-api/messages/#crosspost-message) publishes one message. The author needs `SEND_MESSAGES`. Publishing another member's message, or a webhook's, also needs `MANAGE_MESSAGES`. A message is published once, and only a `DEFAULT` message that is not a reply, a forward, or a copy can be published. A message in an announcement thread cannot be published, as [Thread types](/http-api/threads/#thread-types) states.+[Crosspost message](/http-api/messages/#crosspost-message) publishes one message and sets its `CROSSPOSTED` [message flag](/http-api/messages/#message-flags). You need `SEND_MESSAGES`, and `MANAGE_MESSAGES` to publish someone else's message. You can publish a message only once, and only a `DEFAULT` message that isn't a reply, a forward or a copy from another announcement channel.-Publishing sets the `CROSSPOSTED` [message flag](/http-api/messages/#message-flags) and returns at once. The copies are created in the background, usually within seconds. A channel that follows the announcement channel after a message was published never receives that message.+Fluxer creates the copies in the background. A channel that starts following after a message was published never gets that message.## Following-[Follow announcement channel](/http-api/channels/#follow-announcement-channel) creates the channel follower webhook in a guild text channel of any guild, including the announcement channel's own guild. The caller needs `VIEW_CHANNEL` on the announcement channel and `MANAGE_WEBHOOKS` in the target, so a guild receives copies only in a channel one of its webhook managers chose. The follow posts a `CHANNEL_FOLLOW_ADD` [system message](/http-api/messages/#message-types) in the target channel.+[Follow announcement channel](/http-api/channels/#follow-announcement-channel) creates a channel follower webhook in a text channel of any guild. You need `VIEW_CHANNEL` on the announcement channel, and `VIEW_CHANNEL` and `MANAGE_WEBHOOKS` on the target channel. Fluxer posts a `CHANNEL_FOLLOW_ADD` [system message](/http-api/messages/#message-types) in the target channel.-[Get channel follower stats](/http-api/channels/#get-channel-follower-stats) counts the following channels and their guilds. Deleting the channel follower webhook with [Delete webhook](/http-api/webhooks/#delete-webhook) unfollows.+[Get channel follower stats](/http-api/channels/#get-channel-follower-stats) counts the followers, and deleting the follower webhook with [Delete webhook](/http-api/webhooks/#delete-webhook) unfollows.## What a copy has-A copy is an ordinary message in the following channel with the `IS_CROSSPOST` flag. Its `message_reference` has type `DEFAULT` and names the published message, its channel, and its guild. It never has `referenced_message`.+A copy is a message with the `IS_CROSSPOST` flag and a `message_reference` to the published message.| Part | In the copy || --- | --- |-| Author | The channel follower webhook, with its name and the source guild icon at the time of delivery |-| Content | The published content, character for character |-| Embeds | Every embed, with the same URLs as in the published message |-| Attachments | The attachments of the published message, in order, with the same IDs, file names, sizes, and metadata |+| Author | The follower webhook, with a name like `Fluxer #updates`, with the source guild icon at delivery time |+| Content | The published content |+| Embeds | The same embeds |+| Attachments | The same attachments, with the same IDs and URLs || Stickers | The same stickers |-| Flags | `IS_CROSSPOST` plus `SUPPRESS_EMBEDS`, `SUPPRESS_NOTIFICATIONS`, and `VOICE_MESSAGE` from the source |-| Mentions | None, so an `@everyone` in the published message notifies nobody in a following guild |--A copy has no files of its own. The `url` and `proxy_url` of each attachment in a copy point at the file of the published message, in the announcement channel, so every copy serves the same file. An attachment of a copy expires when the attachment of the published message does. An attachment removed from the published message by an edit leaves every copy, and one added by an edit appears in every copy.+| Flags | `IS_CROSSPOST` plus `SUPPRESS_EMBEDS`, `SUPPRESS_NOTIFICATIONS` and `VOICE_MESSAGE` from the source |+| Mentions | None, and `@everyone` notifies nobody in the following guild |-The follower webhook is named after the source guild and the announcement channel, as in `Fluxer #updates`, and its avatar is a copy of the source guild icon at the time of the follow. The following guild can rename it, and later copies use the new name. Its avatar cannot be changed and does not follow later icon changes.+When the published message is deleted or can't be shown, a copy becomes a placeholder with the content `[Original message deleted]` and the `SOURCE_MESSAGE_DELETED` flag.-A new copy uses the source guild icon at the time of delivery as its author avatar, not the webhook avatar. When the source guild has no icon, the copy has a null avatar and shows the default avatar for the webhook ID. Copies already delivered keep their name and avatar, edits included.--[Get message crosspost source](/http-api/messages/#get-message-crosspost-source) returns the public profile of the source guild of a copy, so a reader who is not a member of it can see where the copy came from.+[Get message crosspost source](/http-api/messages/#get-message-crosspost-source) returns the public profile of the source guild of a copy.## Content rules-An age restriction and a content warning each resolve through the channel, then its parent category, and then its guild.-- An age-restricted announcement channel can only be followed into an age-restricted channel.-- An announcement channel with a content warning can only be followed into a channel that has a content warning or an age restriction.-- An attachment or embed flagged as explicit media is left out of a copy when the following channel does not allow explicit media.+- An announcement channel with a content warning can only be followed into a channel with a content warning or an age restriction.+- Explicit media is left out of a copy when the following channel doesn't allow it.-Fluxer checks the first two rules when a follow is created and when a channel follower webhook is moved, and again at every delivery and update. When a following channel stops meeting them, new copies are skipped, and an update turns an existing copy into a deleted-source placeholder.+Fluxer checks the age-restriction and content-warning rules when a follow is created, at every delivery and at every edit. Age restrictions and content warnings come from the channel, then its category, then its guild.-A published message whose content, rich embed text, or attachment hash matches an instance blocklist cannot be published. A later edit that matches one turns every copy into a placeholder.+When a following channel stops meeting the age-restriction or content-warning rule, it gets no new copies, and its existing copies become placeholders the next time the published message is edited.## Delivery-Delivery is asynchronous. Fluxer retries a failed delivery to one channel 8 times over about 80 minutes and then drops it. A channel that already has its copy is never given a second one.+Fluxer retries a failed delivery 8 times over about 80 minutes and then drops it.-A follow is paused while the account that created it cannot view the announcement channel, for example after leaving the source guild or losing `VIEW_CHANNEL` there. A paused follow receives no copies, and its webhook has no `source_guild` or `source_channel`. Messages published after access returns are delivered again. Messages published during the pause are not. An edit of a published message during the pause turns its copy in that channel into a deleted-source placeholder.+A follow is paused while the person who created it can't view the announcement channel, and messages published during the pause are never delivered. Editing a published message during the pause turns its copy in that channel into a placeholder.-Nothing is delivered from a guild that has [ANNOUNCEMENT_CHANNELS_DISABLED](/http-api/guilds/#guild-features), from an unavailable guild, or from a guild whose message sending is disabled. A following guild that is unavailable or has message sending disabled receives nothing either.+Nothing is delivered from a guild with [ANNOUNCEMENT_CHANNELS_DISABLED](/http-api/guilds/#guild-features), or to or from a guild with message sending disabled. With `ANNOUNCEMENT_CHANNELS_DISABLED`, edits of published messages stop updating existing copies, except that attachments removed from a published message are also removed from its copies.## Edits and deletions-An edit of a published message reaches every copy that still exists, including copies in channels that have since unfollowed. Fluxer batches the edits of one message into 10-second windows and copies the latest state once per window, so a copy can briefly lag the published message. Each copy is announced by [Message Update](/gateway/events/#message-update).--Deleting a published message keeps each copy and edits it: the content becomes `[Original message deleted]`, attachments, embeds, and stickers are removed, `edited_timestamp` is set, and the `SOURCE_MESSAGE_DELETED` flag is added. The files of the published message are deleted with it. Deleting a copy removes that copy alone, and the files it showed stay with the published message.+Edits to a published message are applied to every copy, and each updated copy sends [Message Update](/gateway/events/#message-update). Deleting a published message turns every copy into a placeholder, and deleting a copy removes only that copy.-When an instance administrator removes a published message, every copy is deleted outright. When an instance administrator removes a copy, the published message and every other copy are deleted too, so identical content leaves every guild at once. A published message that link preview moderation deletes takes its copies with it the same way.+When an instance admin removes a published message or one of its copies, the published message and every copy are deleted.## Cleanup| Event | Follows | Copies || --- | --- | --- |-| Announcement channel deleted | Removed | Become deleted-source placeholders |+| Announcement channel deleted | Removed | Become placeholders || Announcement channel converted to text | Removed | Stay, and keep receiving edits and deletions |-| Source guild deleted by its owner | Removed | Become deleted-source placeholders |+| Source guild deleted by its owner | Removed | Become placeholders || Source guild deleted by an administrator | Removed | Deleted || Following channel deleted | Removed with the channel | Deleted with the channel || Follower webhook deleted | Removed | Stay, and keep receiving edits and deletions || Follower webhook moved | Kept | Stay in the previous channel |-The removal runs in the background after the triggering request. Each removed follow emits [Webhooks Update](/gateway/events/#webhooks-update) for its channel and writes no audit log entry. A follow or unfollow made through the API records `WEBHOOK_CREATE` or `WEBHOOK_DELETE` in the following guild's [audit log](/http-api/guild-audit-logs/).+Each removed follow sends [Webhooks Update](/gateway/events/#webhooks-update). Following or unfollowing through the API records `WEBHOOK_CREATE` or `WEBHOOK_DELETE` in the following guild's [audit log](/http-api/guild-audit-logs/).## Limits@@ -100,7 +86,7 @@ The removal runs in the background after the triggering request. Each removed fo| --- | --- || Publishes from one announcement channel | 10 in a row, then one every 6 minutes || Edits of one published message | 3 in a row, then one every 20 minutes |-| Webhooks in the following channel | 15, the `max_webhooks_per_channel` default, follower webhooks included |-| Webhooks in the following guild | 1000, the `max_webhooks_per_guild` default, follower webhooks included |+| Webhooks in the following channel | 15 by default (`max_webhooks_per_channel`) |+| Webhooks in the following guild | 1000 by default (`max_webhooks_per_guild`) |-An announcement channel has no cap on its follows, and a published message has no cap on its attachment size beyond the upload limits. The webhook limits are resolved against the following guild. The allowances are [enforced inside the handler](/topics/rate-limits/#limits-enforced-inside-a-handler) and answer 429 with their own codes. An edit by another member who holds `MANAGE_MESSAGES` draws on no edit allowance and still reaches the copies.+Follower webhooks count toward both webhook limits. Any number of channels can follow one announcement channel. The publish and edit limits return 429 with their own error codes, which are listed in [Rate limits](/topics/rate-limits/#announcement-channel-limits).diff --git a/fluxer_docs/src/content/docs/topics/captcha.md b/fluxer_docs/src/content/docs/topics/captcha.mdindex cc0aa922a..4370e8a19 100644--- a/fluxer_docs/src/content/docs/topics/captcha.md+++ b/fluxer_docs/src/content/docs/topics/captcha.md@@ -4,50 +4,46 @@ title: CAPTCHA handlingdescription: How a client answers the ALTCHA proof-of-work check.----Fluxer asks for a CAPTCHA on a small set of abuse-sensitive operations. The CAPTCHA is an [ALTCHA](https://altcha.org) proof-of-work challenge that the API issues and verifies itself. No third-party service or widget is involved, and a client solves the challenge without user input.+Some operations return 400 `CAPTCHA_REQUIRED` with an [ALTCHA](https://altcha.org) proof-of-work challenge when the request has no solved challenge. Your client solves it without user input and retries with the `X-Captcha-Token` header.-## Overview+## Turn the check on or off-The check is on by default. An administrator can turn it off, or change its `cost` and `max_counter`, in the [captcha configuration](/admin-api/instance/#captcha-configuration-object). While it is off, a gated operation proceeds with no CAPTCHA header.+The check is on by default. An administrator can turn it off or change its cost in the [captcha configuration](/admin-api/instance/#captcha-configuration-object). The `captcha.provider` field in [instance discovery](/http-api/instance/#captcha-configuration-object) is `altcha` while the check is on and `none` while it is off.-The `captcha` object in [instance discovery](/http-api/instance/#captcha-configuration-object) reports `altcha` while the check is on and `none` while it is off. A client does not need it, because every challenge arrives in the error response that asks for it.+## Solve a challenge-## The retry handshake+1. Send the request without `X-Captcha-Token`.+2. Read `altcha_challenge` from the 400 `CAPTCHA_REQUIRED` [error response](/http-api/#error-response).+3. Solve it with an ALTCHA v2 solver for `PBKDF2/SHA-256`.+4. Retry the same request with `X-Captcha-Token` set to the [token](#token-format).-Send the request without a CAPTCHA header. A gated operation answers 400 `CAPTCHA_REQUIRED`, and the [error response](/http-api/#error-response) has two more fields.+The error response has these fields next to `code` and `message`.| Field | Type | Description || --- | --- | --- || captcha_provider | string | Always `altcha` || altcha_challenge | object | An ALTCHA v2 challenge, with `parameters` and `signature` |-The challenge uses `PBKDF2/SHA-256`. Solve it with an ALTCHA v2 solver, then retry the same request with `X-Captcha-Token` set to the [token](#token-format). An accepted token lets the operation proceed.+A challenge works once and expires after 10 minutes. A rejected token returns 400 `INVALID_CAPTCHA` with a new challenge in the same fields.-A rejected token returns 400 `INVALID_CAPTCHA` with a new challenge in the same two fields. A client solves that challenge and retries again.+Some operations make their challenge harder after heavy use. Solve the challenge from the latest error response.-:::caution[A challenge is single-use]-Each challenge is accepted once and expires 10 minutes after it is issued. A replayed, expired or wrong token returns `INVALID_CAPTCHA`. A client MUST NOT resend a token after `INVALID_CAPTCHA`.-:::--The route rate limit on registration, login, password recovery and account recovery runs before the check. The challenge response and the retry each use one request from that allowance.--## Rising cost--Some operations raise the cost of their challenge with recent use. Each step doubles `cost`, up to 6 steps, which is 64 times the base cost. The challenge in the error response always has the cost the retry needs, and a token solved for a cheaper challenge returns `INVALID_CAPTCHA`.+## Token format-| Operation | What raises the cost |-| --- | --- |-| Sign-up without an email through [register an account](/http-api/authentication/#register-an-account) or the website | Each such account from the IP address in the last hour, and instance-wide volume |-| Registration with an email address and [identify an account](/http-api/authentication/#identify-an-account) | Each lookup of the same address past 10 in an hour |-| [Send an email code](/http-api/authentication/#send-an-email-code) | Each code to the same address past 5 in an hour |+The token is the base64 encoding of this JSON object, and it can be at most 4096 characters. Copy `parameters` and `signature` unchanged from `altcha_challenge`.-## Token format+```json+{+ "challenge": {"parameters": {}, "signature": "..."},+ "solution": {"counter": 0, "derivedKey": "..."}+}+```-The token is the base64 encoding of the UTF-8 JSON object `{"challenge": {"parameters": ..., "signature": ...}, "solution": {"counter": ..., "derivedKey": ...}}`. The solution can also have `time`. Copy `parameters` and `signature` unchanged from `altcha_challenge`. A token longer than 4096 characters, or one that does not decode to this shape, returns `INVALID_CAPTCHA`.+`solution.time` is optional.## Gated operations-The following operations verify a CAPTCHA while the check is on.+These operations need a solved challenge while the check is on.| Method | Route | Operation || --- | --- | --- |@@ -61,19 +57,13 @@ The following operations verify a CAPTCHA while the check is on.| POST | /v1/users/@me/channels | [Create private channel](/http-api/users/private-channels/#create-private-channel) || PUT | /v1/channels/{channel_id}/recipients/{user_id} | [Add group direct message recipient](/http-api/channels/#add-group-direct-message-recipient) |-[Identify an account](/http-api/authentication/#identify-an-account) and [send an email code](/http-api/authentication/#send-an-email-code) ask for a challenge only after heavy use, as described on each, and a sign-up through send an email code always asks for one.--Create private channel is gated only on the group direct message path, where the request body has a `recipients` member. A one-to-one direct message request omits the field and is never gated.+Create private channel needs a challenge only when the body has `recipients`, which makes a group direct message. [Send an email code](/http-api/authentication/#send-an-email-code) needs one on sign-up. Send an email code, [identify an account](/http-api/authentication/#identify-an-account) and [verify an email code](/http-api/authentication/#verify-an-email-code) also need one after heavy use from one network, for one email address or across the instance.-## Exemption--Fluxer skips the check in three cases, and the operation then proceeds with no CAPTCHA header. The authenticated account's email address is on an exempt domain. The authenticated account holds the [`APP_STORE_REVIEWER`](/admin-api/users/#account-flags) flag. The request body has an `email` that belongs to an account holding that flag. Discovery does not report exemptions, so clients must handle a challenge on every gated operation.+Some accounts skip the check. Handle a challenge on every gated operation anyway.## Error codes| Code | Status | Description || --- | --- | --- || CAPTCHA_REQUIRED | 400 | The operation is gated and the request has no token |-| INVALID_CAPTCHA | 400 | The token is malformed, expired, already used, or wrong |--Both codes are listed under [API error codes](/http-api/errors/#api-error-codes). Both bodies are the ordinary [error response](/http-api/#error-response) envelope with `captcha_provider` and `altcha_challenge` added.+| INVALID_CAPTCHA | 400 | The token is malformed, expired, already used or wrong |diff --git a/fluxer_docs/src/content/docs/topics/locales.md b/fluxer_docs/src/content/docs/topics/locales.mdindex 4c32c36f1..79b5375f9 100644--- a/fluxer_docs/src/content/docs/topics/locales.md+++ b/fluxer_docs/src/content/docs/topics/locales.md@@ -1,14 +1,14 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Locales-description: The supported locale registry and how Fluxer resolves a response locale.+description: The supported locales and how the API picks one for a request.----A locale tells Fluxer which language to write human-readable text in. Each one is a BCP 47 tag from the registry below, either a bare language subtag such as `de`, or one joined to a region or numeric subtag by a hyphen, such as `en-GB`, `pt-BR`, and `es-419`.+A locale is a BCP 47 tag that sets the language of human-readable text, such as the `message` in an [error response](/http-api/#error-response). Everything else in a response is the same in every locale.## Supported locales-The registry below is the complete set for every Fluxer surface. Wherever Fluxer stores a locale, such as in [user settings](/http-api/users/settings/), it requires an exact value from this table.+A `locale` field in a request, such as the one in [user settings](/http-api/users/settings/), has to be one of these values exactly, with the same case.| Value | Description || --- | --- |@@ -19,7 +19,7 @@ The registry below is the complete set for every Fluxer surface. Wherever Fluxer| de | German || el | Greek || en-GB | English (United Kingdom) |-| en-US<sup>1</sup> | English (United States) |+| en-US | English (United States) || es-ES | Spanish (Spain) || es-419 | Spanish (Latin America) || fi | Finnish |@@ -39,7 +39,7 @@ The registry below is the complete set for every Fluxer surface. Wherever Fluxer| pt-BR | Portuguese (Brazil) || ro | Romanian || ru | Russian |-| sv-SE<sup>2</sup> | Swedish |+| sv-SE | Swedish || th | Thai || tr | Turkish || uk | Ukrainian |@@ -47,32 +47,18 @@ The registry below is the complete set for every Fluxer surface. Wherever Fluxer| zh-CN | Chinese (Simplified) || zh-TW | Chinese (Traditional) |-<sup>1</sup> [Negotiation](#negotiation) resolves to this value whenever it selects no other registry value. The bare tag `en` is a registered alias for it during negotiation and is not itself a storable value--<sup>2</sup> The bare tag `sv` is a registered alias for it during negotiation and is not itself a storable value-## Negotiation-An authenticated user's saved locale takes precedence over `Accept-Language`. Otherwise, Fluxer negotiates that header against the [supported locales](#supported-locales), falling back to `en-US` when none matches.--Set the account locale through [user settings](/http-api/users/settings/) to make the choice persistent.+When you're signed in and your account has a saved locale, the API uses it. Otherwise the API picks a locale from the `Accept-Language` header and uses `en-US` when the header is missing or nothing in it matches.-Matching ignores case and accepts underscores in place of hyphens. Fluxer first looks for an exact supported tag, or the alias `en` or `sv`, anywhere in the header. It uses a regional fallback only when the header has none. In each of those two passes, Fluxer takes the tag with the highest quality weight, and header order breaks ties.+The API sorts the `Accept-Language` tags by `q` weight and makes two passes over them. Matching ignores case and accepts `_` in place of `-`.-An unsupported tag such as `fr-CA` or `de-AT` matches no locale. An unsupported tag whose language subtag is in this table selects the locale beside it:+1. The first tag that is a supported locale wins. `sv` counts as `sv-SE`, and `nb` and `nn` count as `no`.+2. If no tag matched, the first tag whose language subtag has a locale wins, and `fr-CA` picks `fr`. A Chinese tag with `Hant`, `TW`, `HK` or `MO` picks `zh-TW`. The language subtags below pick a set locale.-| Language subtag | Selected locale |+| Language subtag | Locale || --- | --- || `en` | `en-US` || `es` | `es-ES` || `pt` | `pt-BR` || `zh` | `zh-CN` |-| `sv` | `sv-SE` |--For example, `en-AU` selects `en-US` and `pt-PT` selects `pt-BR`. A weight of 0 does not exclude a language, and `*` matches no locale. Send an explicit supported tag for a predictable result.--The resolved locale selects the localised `message` in an [error response](/http-api/#error-response) and in each element of a validation `errors` array.--:::note[Locale selection changes human-readable text only]-A field name, an enumeration value, an error `code`, a [snowflake](/snowflakes/), and a timestamp representation are identical under every locale.-:::diff --git a/fluxer_docs/src/content/docs/topics/rate-limits.md b/fluxer_docs/src/content/docs/topics/rate-limits.mdindex c57656b59..2027b8c4e 100644--- a/fluxer_docs/src/content/docs/topics/rate-limits.md+++ b/fluxer_docs/src/content/docs/topics/rate-limits.md@@ -1,55 +1,37 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Rate limits-description: The route and global buckets, the denial body, and the rate limit headers.+description: How the HTTP API limits requests, the 429 response and the rate limit headers.----Fluxer bounds HTTP API traffic with a per-route bucket and one global bucket. A bucket is one allowance counted over one window. Fluxer denies an over-allowance request with 429, `code` set to `RATE_LIMITED`, a [rate limit response object](#rate-limit-response-object), and the [rate limit headers](#rate-limit-headers).+When you send too many requests, the HTTP API returns 429 with `code` set to `RATE_LIMITED`. Wait `retry_after` seconds from the [response body](#rate-limit-response-object) and send the request again.-## Buckets and scope+## Buckets-Nearly every route declares its own bucket. A bucket name can have a path parameter placeholder written as a colon followed by the parameter name, as in `guild:emojis:list::guild_id`. Fluxer substitutes the request value before keying the bucket, so one route holds a separate allowance for each path resource.+Every HTTP API and Admin API operation declares a bucket, and its reference section says how many requests the bucket allows. A bucket name with a path parameter, such as `guild:emojis:list::guild_id`, has a separate allowance for each value of that parameter.-Every bucket is also keyed by the caller's identity. An authenticated request is keyed by the account and its credential kind, and an OAuth2 bearer credential is keyed by the owning application as well. A session, a bot token, an Admin API key, and each bearer application therefore draw on separate allowances for the same account.+Each caller has its own allowance, and a user session, a bot token, an Admin API key and an OAuth2 application count as separate callers even on the same account. A request with no token counts against the client IP address, or its `/64` for IPv6.-A request that resolves no account is keyed by the client IP address, exactly for IPv4 and by the `/64` for IPv6, so clients in the same `/64` share an allowance. Where the deployment is configured to read the address from a header the request does not have, Fluxer refuses the request with 403 `FORBIDDEN` before evaluating any bucket.+Each request also counts against a global bucket of 50 requests per second for each caller. An account with the [`HIGH_GLOBAL_RATE_LIMIT`](/admin-api/users/#account-flags) flag gets 1,200 requests per second, and an account with [`RATE_LIMIT_BYPASS`](/admin-api/users/#account-flags) skips the global bucket and every route bucket. Executing a webhook, and getting, editing or deleting its messages through the webhook's token URL, don't count against the global bucket.-A request also counts against the global bucket, unless its route bucket is declared exempt. The global bucket is keyed by the same identity, so a request that resolves no account consumes the global allowance of its client IP address.+Buckets refill continuously. A request still counts when the API rejects it with an error.-These buckets are exempt, and each is the only bucket its route declares: `webhook:execute::webhook_id`, `webhook:message_get::webhook_id`, `webhook:message_edit::webhook_id`, `webhook:message_delete::webhook_id`, `webhook:github::webhook_id`, `webhook:instatus::webhook_id`, `webhook:libredesk::webhook_id`, and `stripe:webhook`. Those routes draw on no global allowance. The `user:group_dm:create` and `user:group_dm:recipient:add` buckets are exempt as well. Each is a second bucket on a route whose first bucket is not exempt, so both routes still draw on the global allowance.--Every HTTP API and Admin API operation declares a bucket. A caller that sends no credential on a [Bluesky client document](/http-api/connections/#get-bluesky-client-metadata) is keyed by the client IP address.--The global window is one second. The default allowance is 50 requests per second, and an account holding the [`HIGH_GLOBAL_RATE_LIMIT`](/admin-api/users/#account-flags) flag receives 1,200 requests per second instead. The [`RATE_LIMIT_BYPASS`](/admin-api/users/#account-flags) flag exempts an account from the global bucket and from every route bucket. A successful response to that account has no rate limit header.--Some operations enforce a further limit inside the handler. `RATE_LIMIT_BYPASS` exempts an account from none of them. [Limits enforced inside a handler](#limits-enforced-inside-a-handler) has the complete set.--:::note[An allowance drains continuously]-Every bucket is a leaky bucket. It admits at most the declared limit at once and refills continuously at that limit for each declared window, so a client that exhausts an allowance can send again as soon as enough of it has drained.+:::caution[A global denial signs the user out]+When the global bucket denies a request made with a user session token, the API revokes that token and the client has to log in again. Bot tokens, OAuth2 access tokens and Admin API keys are never revoked this way.:::## Rate limit response object-The denial body has the members of the ordinary [error response](/http-api/#error-response) and two further members.+A 429 body has the fields of the [error response](/http-api/#error-response) and two more.### Structure| Field | Type | Description || --- | --- | --- |-| code<sup>1</sup> | string | `RATE_LIMITED` on a bucket denial |-| message<sup>2</sup> | string | The localised rate limit message |-| global | boolean | Whether the global bucket produced the denial, present and false on a route denial |-| retry_after<sup>3</sup> | number | The delay in fractional seconds before another request is admitted |--<sup>1</sup> A limit enforced outside the route bucket middleware can reuse this body with its own code. [Allowances answering 429](#allowances-answering-429) and [Announcement channel allowances](#announcement-channel-allowances) list every live one--<sup>2</sup> The locale [resolved](/topics/locales/#negotiation) for the request, which the account setting selects ahead of [Accept-Language](/http-api/#standard-request-headers)--<sup>3</sup> Never below 0.001, falling back to the whole-second `Retry-After` value when no fractional delay was computed--The [Resend IP authorisation](/http-api/authentication/#resend-ip-authorisation) cooldown answers 429 with its own code and a different body. [Allowances answering 429](#allowances-answering-429) states what that body has.--A [slowmode](#slowmode) denial answers 400 `SLOWMODE_RATE_LIMITED`.+| code | string | `RATE_LIMITED`, or a more specific code from one of the [operation limits](#limits-enforced-inside-a-handler) |+| message | string | The rate limit message in the request's [locale](/topics/locales/#negotiation) |+| global | boolean | Whether the global bucket denied the request |+| retry_after | number | The seconds to wait, as a decimal (at least 0.001) for a bucket denial and in whole seconds for most operation limits |### Example@@ -64,122 +46,91 @@ A [slowmode](#slowmode) denial answers 400 `SLOWMODE_RATE_LIMITED`.## Rate limit headers-These headers describe a rate limit decision. An operation that answers 429 returns this set.+Every 429 has `Retry-After`. A 429 with the [rate limit response object](#rate-limit-response-object) also has `X-RateLimit-Scope`, and a route bucket denial has the other `X-RateLimit-*` headers too. Successful responses have the route headers only for a bot token or a webhook token.| Field | Type | Description || --- | --- | --- |-| Retry-After?<sup>1</sup> | string | The delay in whole seconds before another request is admitted, rounded up and never below 1 |-| X-RateLimit-Scope?<sup>1</sup> | string | The [rate limit scope](#rate-limit-scopes) that produced the denial |-| X-RateLimit-Global?<sup>2</sup> | string | The literal value `true` on a global HTTP 429 |-| X-RateLimit-Limit?<sup>3</sup> | string | The maximum requests the route allowance admits at once |-| X-RateLimit-Remaining?<sup>3</sup> | string | The whole requests the route allowance still admits, always 0 on a denial |-| X-RateLimit-Reset?<sup>3</sup> <sup>4</sup> | string | The Unix timestamp in seconds at which the whole route allowance is available again |-| X-RateLimit-Reset-After?<sup>3</sup> <sup>5</sup> | string | The seconds until the whole route allowance is available again |-| X-RateLimit-Bucket?<sup>3</sup> <sup>6</sup> | string | The stable 16-character hexadecimal identifier of the route bucket |--<sup>1</sup> Sent on every rate limit denial and on no successful response--<sup>2</sup> Sent only when the global bucket produced the denial, in which case none of the route bucket headers is sent--<sup>3</sup> Sent on a route HTTP 429, subject to footnote 6 for `X-RateLimit-Bucket`. On a successful response they are sent only when the credential resolves to a bot account, or when the request resolves no account at all on a route with both a `webhook_id` and a `token` path parameter+| Retry-After? | string | The seconds to wait, rounded up to a whole number (at least 1) |+| X-RateLimit-Scope? | string | The [scope](#scopes) that denied the request |+| X-RateLimit-Global? | string | `true` when the global bucket denied the request, sent with no route headers |+| X-RateLimit-Limit? | string | The most requests the route bucket allows at once |+| X-RateLimit-Remaining? | string | The requests the route bucket allows right now, 0 on a denial |+| X-RateLimit-Reset? | string | The Unix time in seconds when the route bucket is full again |+| X-RateLimit-Reset-After? | string | The seconds until the route bucket is full again |+| X-RateLimit-Bucket? | string | A 16-character hex ID for the route bucket, left out on an operation limit |-<sup>4</sup> A value at or before the current second is replaced with the next second+The reset headers say when the bucket is full again, and `retry_after` says when you can send one more request. Browser clients can't read these headers across origins and should use `retry_after` from the body.-<sup>5</sup> Rounded to millisecond precision with trailing zeros removed on a successful response, and emitted as the exact computed decimal on a denial+### Scopes-<sup>6</sup> An opaque identifier for the route's bucket, not the caller+| Value | Description |+| --- | --- |+| user | A route bucket, counted for you alone |+| global | The global bucket |+| shared | An allowance shared with other members, such as the announcement channel limits |-A 429 from a limit enforced inside a handler has the other route headers and no `X-RateLimit-Bucket`.+## Handling a 429-:::note[Cross-origin clients cannot read rate-limit headers]-The [cross-origin policy](/http-api/#cross-origin-requests) does not expose these headers. Use the response body's `retry_after` value.-:::+- Use `retry_after` from the body over the `Retry-After` header, which is rounded up to whole seconds.+- When `global` is true, pause every request with that token.+- For a bot, read `X-RateLimit-Remaining` on successful responses and slow down before it gets to 0.## Limits enforced inside a handler-An allowance enforced inside a handler is keyed independently of the route bucket and of the global bucket, so exhausting it denies the request while both buckets still have room. The set below is complete.--The `disable_rate_limits` deployment switch turns off the login allowances along with both buckets. `relax_registration_rate_limits` turns off the registration allowances. Every other allowance below is enforced on every deployment.+Some operations have extra limits apart from the route and global buckets, and `RATE_LIMIT_BYPASS` doesn't skip them.-A denial takes one of the shapes below. An allowance in [Allowances answering 429](#allowances-answering-429) or [Announcement channel allowances](#announcement-channel-allowances) answers 429 with the [rate limit response object](#rate-limit-response-object) and the [rate limit headers](#rate-limit-headers) minus `X-RateLimit-Bucket`. An allowance in [Allowances answering 400](#allowances-answering-400) answers 400 `INVALID_FORM_BODY` with one [validation error](/http-api/#validation-error-object) entry whose `code` names the exhausted allowance.+### Limits that return 429-The 400 shape has no `retry_after` member, no `X-RateLimit-*` header, and no `Retry-After` header. The remaining delay appears only in the entry's localised `message`.+These return 429 with the [rate limit response object](#rate-limit-response-object) and [headers](#rate-limit-headers).-### Allowances answering 429--| Operation | Allowance | Code |-| --- | --- | --- |-| [Log in with a password](/http-api/authentication/#log-in-with-a-password) | 5 per 15 minutes, keyed by the submitted email address | `RATE_LIMITED` |-| [Log in with a password](/http-api/authentication/#log-in-with-a-password) | 10 per 30 minutes, keyed by the client IP address, exactly for IPv4 and by the `/64` for IPv6 | `RATE_LIMITED` |-| [Register an account](/http-api/authentication/#register-an-account) | 3 per 15 minutes, keyed by the submitted email address | `RATE_LIMITED` |-| [Register an account](/http-api/authentication/#register-an-account) | 3 per hour, keyed by the client IP address | `RATE_LIMITED` |-| [Register an account](/http-api/authentication/#register-an-account) | 15 per hour, keyed by the client subnet, the IPv4 `/24` or the IPv6 `/48` | `RATE_LIMITED` |-| [Resend email verification](/http-api/authentication/#resend-email-verification) | 3 per 15 minutes, keyed by the account's stored email address | `RATE_LIMITED` |-| [Request password recovery](/http-api/authentication/#request-password-recovery) | 20 per 30 minutes, keyed by the client IP address | `RATE_LIMITED` |-| [Request password recovery](/http-api/authentication/#request-password-recovery) | 5 per 30 minutes, keyed by the submitted email address | `RATE_LIMITED` |-| [Start email change](/http-api/users/email-and-password/#start-email-change) and [Resend original email code](/http-api/users/email-and-password/#resend-original-email-code) | 3 sends per 15 minutes, keyed by the authenticated account | `RATE_LIMITED` |-| [Request new email](/http-api/users/email-and-password/#request-new-email), [Resend new email code](/http-api/users/email-and-password/#resend-new-email-code), and both [bounced email recovery](/http-api/users/email-and-password/#bounced-email-recovery) sends | 5 sends per 15 minutes, keyed by the authenticated account | `RATE_LIMITED` |-| [Start password change](/http-api/users/email-and-password/#start-password-change) | 3 sends per 15 minutes, keyed by the authenticated account | `RATE_LIMITED` |-| [Resend password change code](/http-api/users/email-and-password/#resend-password-change-code) | 3 sends per 15 minutes, keyed by the authenticated account | `RATE_LIMITED` |-| Every code resend and every new-address request on an email or password change ticket | 1 send per 30 seconds, keyed by the ticket and counted from its previous send | `RATE_LIMITED` |-| [Submit message report flow](/http-api/reports/#submit-message-report-flow), [Submit user report flow](/http-api/reports/#submit-user-report-flow), and [Create DSA report](/http-api/reports/#create-dsa-report) | 5 per hour, keyed by the reporter, an account or a verified email address | `RATE_LIMITED` |-| [Submit message report flow](/http-api/reports/#submit-message-report-flow) | 3 per hour, keyed by the reporter and the channel together | `RATE_LIMITED` |-| [Submit message report flow](/http-api/reports/#submit-message-report-flow) | 20 per hour, keyed by the reported message, across all reporters | `RATE_LIMITED` |-| [Submit message report flow](/http-api/reports/#submit-message-report-flow) | 4 per hour, keyed by the reporter and the guild together, for a guild message | `RATE_LIMITED` |-| [Resend IP authorisation](/http-api/authentication/#resend-ip-authorisation) | Nothing in the first 30 seconds after the ticket was issued, keyed by the authorisation ticket | `IP_AUTHORIZATION_RESEND_COOLDOWN` |--The Resend IP authorisation cooldown has no `X-RateLimit-*` header. It has a `Retry-After` header in whole seconds, and the body reports that delay again as a top-level `resend_available_in` and `retry_after`. A second resend on one ticket returns 400 `IP_AUTHORIZATION_RESEND_LIMIT_EXCEEDED`. The allowance never refills, and the ticket expires 15 minutes after it was issued.--### Announcement channel allowances--These allowances answer 429 the same way as the ones above, with `X-RateLimit-Scope` set to `shared`.--| Allowance | Code |+| Operation | Limit || --- | --- |-| Publishes from one announcement channel through [Crosspost message](/http-api/messages/#crosspost-message), 10 in a row, then one every 6 minutes | `MESSAGE_CROSSPOST_RATE_LIMITED` |-| Edits of one published message through [Modify message](/http-api/messages/#modify-message) and the other edit routes, 3 in a row, then one every 20 minutes | `PUBLISHED_MESSAGE_EDIT_RATE_LIMITED` |+| [Log in with a password](/http-api/authentication/#log-in-with-a-password) | 5 per 15 minutes for one email address, and 10 failed logins per 30 minutes from one IP address |+| [Register an account](/http-api/authentication/#register-an-account) | 3 per 15 minutes for one email address, 3 per hour for one IP address and 15 per hour for one subnet |+| [Resend email verification](/http-api/authentication/#resend-email-verification) | 3 per 15 minutes for one account |+| [Request password recovery](/http-api/authentication/#request-password-recovery) | 5 per 30 minutes for one email address and 20 per 30 minutes for one IP address |+| [Start email change](/http-api/users/email-and-password/#start-email-change) | 3 code sends to the current address and 5 to the new one per 15 minutes, and one every 30 seconds per ticket |+| [Start password change](/http-api/users/email-and-password/#start-password-change) | 3 code sends per 15 minutes, and one every 30 seconds per ticket |+| [Submit message report flow](/http-api/reports/#submit-message-report-flow) | 5 reports per hour for one reporter, 3 in one channel, 4 in one community and 20 for one message from all reporters |+| [Create DSA report](/http-api/reports/#create-dsa-report) | 5 reports per hour for one reporter, shared with the other report routes |-Each is a leaky bucket like the route buckets. It admits a burst of its full size and then refills one slot at the stated interval, so a caller that waits one interval can act once more. A moderator edit of another member's published message draws on no allowance. [Announcement channels](/topics/announcement-channels/#limits) lists them with the other announcement channel limits.+On an instance where people sign in with a username, a password login allows 5 attempts per 15 minutes for one username from one IP address and 100 failed logins per hour for one username, and the IP address limit still applies.-### Allowances answering 400+Registering an [instant account](/admin-api/instance/#auth-configuration-object) allows 5 per hour and 20 per day from one IP address and 40 per hour from one subnet instead.-| Operation | Allowance | Validation code |-| --- | --- | --- |-| [Modify current user](/http-api/users/current-user/#modify-current-user) | 5 per 3 hours on the resulting username or discriminator | `USERNAME_CHANGED_TOO_MANY_TIMES` |-| [Modify current user](/http-api/users/current-user/#modify-current-user) | 25 per 30 minutes on the biography, when the submitted value differs | `BIO_CHANGED_TOO_MANY_TIMES` |-| [Modify current user](/http-api/users/current-user/#modify-current-user) | 25 per 30 minutes on the pronouns, when the submitted value differs | `PRONOUNS_CHANGED_TOO_MANY_TIMES` |-| [Modify current user](/http-api/users/current-user/#modify-current-user) | 25 per 30 minutes on the accent colour, when the submitted value differs | `ACCENT_COLOR_CHANGED_TOO_MANY_TIMES` |-| [Modify current user](/http-api/users/current-user/#modify-current-user) | 25 per 30 minutes on any non-null avatar | `AVATAR_CHANGED_TOO_MANY_TIMES` |-| [Modify current user](/http-api/users/current-user/#modify-current-user) | 25 per 30 minutes on any banner value past the entitlement check | `BANNER_CHANGED_TOO_MANY_TIMES` |-| [Update bot profile](/http-api/applications/#update-bot-profile) | 5 per 3 hours on the bot's resulting username or discriminator | `USERNAME_CHANGED_TOO_MANY_TIMES` |-| [Modify current guild member](/http-api/guild-members/#modify-current-guild-member) | 25 per 30 minutes on the guild avatar, whenever supplied | `AVATAR_CHANGED_TOO_MANY_TIMES` |-| [Modify current guild member](/http-api/guild-members/#modify-current-guild-member) | 25 per 30 minutes on the guild banner, whenever supplied | `BANNER_CHANGED_TOO_MANY_TIMES` |-| [Modify current guild member](/http-api/guild-members/#modify-current-guild-member) | 25 per 30 minutes on the guild biography, when the submitted value differs | `BIO_CHANGED_TOO_MANY_TIMES` |-| [Modify current guild member](/http-api/guild-members/#modify-current-guild-member) | 25 per 30 minutes on the guild pronouns, when the submitted value differs | `PRONOUNS_CHANGED_TOO_MANY_TIMES` |-| [Modify current guild member](/http-api/guild-members/#modify-current-guild-member) | 25 per 30 minutes on the guild accent colour, when the submitted value differs | `ACCENT_COLOR_CHANGED_TOO_MANY_TIMES` |-| [Modify voice activity sharing](/http-api/users/settings/#modify-voice-activity-sharing) | 1 per 24 hours on the sharing default | `VOICE_ACTIVITY_SHARING_ON_COOLDOWN` |-| [Complete login with TOTP](/http-api/authentication/#complete-login-with-totp), and [Complete login with WebAuthn MFA](/http-api/authentication/#complete-login-with-webauthn-mfa) | 10 multi-factor attempts per 15 minutes | `INVALID_CODE` |-| [Complete login with TOTP](/http-api/authentication/#complete-login-with-totp), and [Complete login with WebAuthn MFA](/http-api/authentication/#complete-login-with-webauthn-mfa) | 5 multi-factor attempts per 5 minutes on one MFA ticket | `INVALID_CODE` |-| [Sudo mode](/http-api/users/mfa/#sudo-mode) with the `totp` method | 10 multi-factor attempts per 15 minutes | `INVALID_MFA_CODE` |+[Resend IP authorization](/http-api/authentication/#resend-ip-authorization) allows one resend per ticket, 30 seconds or more after the ticket was issued. An earlier resend returns 429 `IP_AUTHORIZATION_RESEND_COOLDOWN` with `retry_after` and `resend_available_in` in the body, a `Retry-After` header and no `X-RateLimit-*` headers. A second resend returns 400 `IP_AUTHORIZATION_RESEND_LIMIT_EXCEEDED`.-Every Modify current user allowance is keyed by the authenticated account, and the bot tag allowance by the bot account, so an owner changing a bot's tag draws on the bot's allowance. The guild member allowances are keyed by the guild and the member together, and one account holds a separate allowance in each guild. The login allowances are keyed by the account and by the MFA ticket respectively, and the sudo allowance by the account.+### Announcement channel limits-Fluxer consumes every multi-factor allowance before it checks the code, so a correct code drawn against an exhausted allowance is reported exactly like a wrong one. A correct code clears the counter. The ticket allowance also destroys the MFA ticket as it denies, and the client restarts from [Log in with a password](/http-api/authentication/#log-in-with-a-password).+These return `X-RateLimit-Scope` set to `shared`, because every member who publishes or edits uses the same allowance. [Announcement channels](/topics/announcement-channels/#limits) has the other limits.-### Allowances answering neither shape--[Get desktop handoff information](/http-api/authentication/#get-desktop-handoff-information) and [Complete desktop handoff](/http-api/authentication/#complete-desktop-handoff) share one failed-attempt counter keyed by the client IP address. Five failures block both operations for 15 minutes from the most recent failure, and a blocked request returns 400 `INVALID_HANDOFF_CODE` as a top-level code with no validation entry. Get desktop handoff information separately permits three successful lookups for each handoff code and reports a fourth with the same top-level code.+| Limit | Code |+| --- | --- |+| 10 [crossposts](/http-api/messages/#crosspost-message) from one channel, then one every 6 minutes | `MESSAGE_CROSSPOST_RATE_LIMITED` |+| 3 edits of one published message, then one every 20 minutes | `PUBLISHED_MESSAGE_EDIT_RATE_LIMITED` |-[Slowmode](#slowmode) is enforced inside the handler as well.+### Limits that return 400-## Slowmode+These return 400 `INVALID_FORM_BODY` with a [validation error](/http-api/#validation-error-object) whose `code` says which limit you hit, and no `retry_after` or rate limit headers. The username limit applies to [Modify current user](/http-api/users/current-user/#modify-current-user) and [Update bot profile](/http-api/applications/#update-bot-profile). The other profile limits apply to [Modify current user](/http-api/users/current-user/#modify-current-user) and to [Modify current guild member](/http-api/guild-members/#modify-current-guild-member), which counts them separately in each guild.-Slowmode limits how often one account sends a message in one channel. Fluxer reports a denial as an ordinary request failure. A denied send returns 400 `SLOWMODE_RATE_LIMITED` with a top-level `retry_after` in fractional seconds and a `Retry-After` header in whole seconds. The response has no `X-RateLimit-*` header, so a client tells it apart from a bucket denial by the status and the code.+| Change | Limit | Validation code |+| --- | --- | --- |+| Username | 5 username or discriminator changes per 3 hours | `USERNAME_CHANGED_TOO_MANY_TIMES` |+| Biography | 25 changes per 30 minutes | `BIO_CHANGED_TOO_MANY_TIMES` |+| Pronouns | 25 changes per 30 minutes | `PRONOUNS_CHANGED_TOO_MANY_TIMES` |+| Accent color | 25 changes per 30 minutes | `ACCENT_COLOR_CHANGED_TOO_MANY_TIMES` |+| Avatar | 25 changes per 30 minutes | `AVATAR_CHANGED_TOO_MANY_TIMES` |+| Banner | 25 changes per 30 minutes | `BANNER_CHANGED_TOO_MANY_TIMES` |+| [Voice activity sharing](/http-api/users/settings/#modify-voice-activity-sharing) | 1 change per 24 hours | `VOICE_ACTIVITY_SHARING_ON_COOLDOWN` |+| [TOTP login](/http-api/authentication/#complete-login-with-totp) | 10 attempts per 15 minutes, and 5 per 5 minutes on one MFA ticket | `INVALID_CODE` |+| [Sudo mode](/http-api/users/mfa/#sudo-mode) with TOTP | 10 attempts per 15 minutes | `INVALID_MFA_CODE` |++The TOTP login limits also apply to [Complete login with WebAuthn MFA](/http-api/authentication/#complete-login-with-webauthn-mfa), and when you hit the MFA ticket limit, the ticket is deleted and you have to log in again.-The allowance is one message for each interval the channel configures in `rate_limit_per_user`, counted separately for each account and channel pair. Fluxer counts it for a non-bot account in a guild channel whose configured interval is above zero. A caller holding [BYPASS_SLOWMODE](/http-api/permissions/) is exempt. [Get channel slowmode state](/http-api/channels/#get-channel-slowmode-state) reports the caller's remaining delay before a send is attempted.+## Slowmode-Starting a thread uses the parent slowmode on its own counter, as [Start thread from message](/http-api/threads/#start-thread-from-message) states. The same applies to a post in a forum or media channel, as [Forum channel fields](/http-api/forums/#forum-channel-fields) states. For a guild text or announcement channel, [Get channel slowmode state](/http-api/channels/#get-channel-slowmode-state) reports the message counter alone. [Indicate typing](/http-api/messages/#indicate-typing) returns the remaining delay of both counters to a user session that declares the [`channel_threads` client capability](/http-api/threads/#client-capability).+When a channel's `rate_limit_per_user` is N, each member can send one message every N seconds. A send that comes too early returns 400 `SLOWMODE_RATE_LIMITED` with `retry_after` in the body and a `Retry-After` header. Bots and members with [BYPASS_SLOWMODE](/http-api/permissions/) aren't limited. [Get channel slowmode state](/http-api/channels/#get-channel-slowmode-state) returns how long you have to wait.-## Other surfaces+## Gateway and media-Each protocol surface documents its own rate limit contract. The [main Gateway](/gateway/overview/) states its session, command, replay, backpressure, and admission limits in [Gateway limits and rate limits](/gateway/limits-and-rate-limits/). The [Media Proxy API](/media-proxy/overview/) has no request-count rate limit and bounds work through concurrency, payload, and deadline limits. The [upload relay](/media-proxy/upload-relay/) authorises each transfer with an upload URL that expires and limits the body size.+The Gateway has its own limits in [Gateway limits and rate limits](/gateway/limits-and-rate-limits/). The [Media Proxy API](/media-proxy/overview/) doesn't count requests.diff --git a/fluxer_docs/src/content/docs/topics/uploads.md b/fluxer_docs/src/content/docs/topics/uploads.mdindex a710a3490..9b01ff19b 100644--- a/fluxer_docs/src/content/docs/topics/uploads.md+++ b/fluxer_docs/src/content/docs/topics/uploads.md@@ -1,99 +1,58 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Attachment uploads-description: Upload attachments and claim them in a message.+description: Upload message attachments and stream previews before you use them.----Send attachments as `files[n]` parts in a [multipart message](/http-api/#request-body-formats), or upload them before creating the message. Pre-uploading has four steps:+You can send attachments as `files[n]` parts in a [multipart message](/http-api/#request-body-formats), or upload them first and attach them by their upload key (`upload_filename`). Uploading first takes four steps.1. Request an upload plan.2. Send the bytes to its upload URLs.3. Complete the upload if it is multipart.-4. Include its `upload_filename` when creating or editing a message.+4. Attach the upload by its upload key when you create or edit a message or start a thread.-:::caution[Pre-uploads can be switched off]-When [instance features](/http-api/instance/#instance-features-object) reports `presigned_attachment_uploads` false, use inline multipart uploads. Plan and completion requests return 403 `FEATURE_TEMPORARILY_DISABLED`.-:::+Uploading first needs `presigned_attachment_uploads` set to true in [instance features](/http-api/instance/#instance-features-object). When it is off, the plan and completion requests return 403 `FEATURE_TEMPORARILY_DISABLED`.-## Requesting an upload plan+## Request an upload plan-[Request attachment upload URLs](/http-api/messages/#request-attachment-upload-urls) accepts up to 10 files. Declare each file's ID, name, exact byte count and content type. The endpoint reference defines the fields, permissions and file size limits.+Call [Request attachment upload URLs](/http-api/messages/#request-attachment-upload-urls) with up to 10 files, each with its exact byte count. Each file in the plan has an `upload_mode` that decides which fields it gets.-Keep the returned plan, including its `upload_filename`. Use the returned `content_type`, which Fluxer derives from the file name and which can therefore differ from the declared value. The `upload_mode` determines the next steps.--### Upload modes--| Value | Selected for | Added fields |+| Value | When | Added fields || --- | --- | --- |-| singlepart<sup>1</sup> | A declared `file_size` of at most 10485760 bytes | `upload_url` |-| multipart<sup>2</sup> | A declared `file_size` above 10485760 bytes | `upload_id`, `part_size`, and `parts` |--<sup>1</sup> Stored as soon as its `PUT` succeeds, so it is never sent to [Complete attachment upload](/http-api/messages/#complete-attachment-upload)--<sup>2</sup> Each `parts` entry has a one-based `part_number` and its own `upload_url`, and the array is ordered by ascending part number--## Part geometry+| singlepart | A `file_size` of at most 10485760 bytes (10 MiB) | `upload_url` |+| multipart | A `file_size` above 10485760 bytes | `upload_id`, `part_size` and `parts` |-Use the `part_size` and `parts` returned in the upload plan. Every part must contain exactly `part_size` bytes except the last, which contains the remainder. Do not calculate a different part layout.+Each `parts` entry has a `part_number` starting at 1 and its own `upload_url`.-## Transferring the bytes+## Upload the bytes-Send `PUT` requests to the returned `upload_url` values without an `Authorization` header. The URLs can target storage or the [upload relay](/media-proxy/upload-relay/). Do not rewrite their paths or query strings.+Send a `PUT` to each `upload_url` exactly as returned, with no `Authorization` header. Fluxer picks `content_type` from the file name, and a singlepart upload must send the whole file with it as `Content-Type`. A multipart upload sends each part to its own URL, with exactly `part_size` bytes in every part except the last.-Send exactly the declared byte count. The relay returns 413 for an oversized body and 401 for a missing, invalid, or expired capability. It also returns 413 for a body above its own limit, which is 500 MiB by default.+An upload URL points to storage or to the [upload relay](/media-proxy/upload-relay/), and it expires after the time below.-A singlepart transfer sends the whole file with the entry's `content_type` as its `Content-Type` header. A multipart transfer sends each part separately.--### Capability lifetimes--| Capability | Lifetime |+| Upload URL | Lifetime || --- | --- |-| Direct singlepart upload URL | 5 minutes |-| Direct multipart part URL | 1 hour |-| Relay URL of either kind<sup>1</sup> | The relay token lifetime the deployment configures, 900 seconds by default |--<sup>1</sup> A relay expiry is exclusive, so the capability is already rejected at its expiry second--:::caution[The complete URL is the credential]-An issued upload URL authorises writing one object or one part. A client treats the whole URL, query string included, as secret until it expires, and keeps it out of logs, referrers, and redirect targets.-:::+| Storage, singlepart | 5 minutes |+| Storage, multipart part | 1 hour |+| Upload relay | 15 minutes by default, and the instance can change it |-## Completing a multipart upload+Keep upload URLs out of logs, because anyone who has one can upload to it until it expires. When a URL expires, request a new plan and upload the file again.-[Complete attachment upload](/http-api/messages/#complete-attachment-upload) finishes from 1 through 10 multipart uploads. Send the `upload_filename` and `upload_id` from each plan after all its parts succeed. Do not send a part list or entity tags.+## Complete a multipart upload-Completion checks permissions and file size limits again. See the endpoint's [response table](/http-api/messages/#complete-attachment-upload) for errors. If completion aborts the upload, request a new plan and upload the file again.+After every part has uploaded, call [Complete attachment upload](/http-api/messages/#complete-attachment-upload) with the `upload_filename` and `upload_id` of up to 10 uploads. Fluxer checks permissions and the file size limit again. If completion fails because no parts arrived, the parts are too large or storage can't finish the upload, Fluxer cancels the upload and you need a new plan.-## Claiming the upload+## Attach the upload-Include the `upload_filename` in a [pre-uploaded attachment](/http-api/messages/#pre-uploaded-attachment-object) when calling [Create message](/http-api/messages/#create-message) or [Modify message](/http-api/messages/#modify-message). Uploading alone does not create a message or emit a Gateway event.+Put the `upload_filename` in a [pre-uploaded attachment](/http-api/messages/#pre-uploaded-attachment-object) when you call [Create message](/http-api/messages/#create-message), [Modify message](/http-api/messages/#modify-message) or [Start thread](/http-api/threads/#start-thread) in a forum or media channel.-The `message` of a forum or media post in [Start thread](/http-api/threads/#start-thread) claims uploads the same way. Request the plan for the forum or media channel.--An upload is bound to the identity and the channel that planned it, and a key is single use. A key the authenticated identity does not own, a key planned for another channel, and a key an attachment has already consumed each return 400 `INVALID_FORM_BODY` with `UPLOADED_ATTACHMENT_NOT_FOUND` on `attachments.{index}.upload_filename`. Where the object is absent from storage, which is what an untransferred plan leaves behind, the claim returns the same status with `FILE_NOT_FOUND` on the same path.--:::caution[There is no resume operation]-Once a capability expires it cannot be refreshed, and a plan cannot be re-read. A client that loses its plan, or whose part capabilities expire mid transfer, requests a new plan for the file and starts again.-:::+An upload key works once, for the user and channel that requested it. Using a key that belongs to someone else, was requested for another channel or was already used returns 400 `INVALID_FORM_BODY` with `UPLOADED_ATTACHMENT_NOT_FOUND`. A key whose bytes never uploaded returns the same error with `FILE_NOT_FOUND`.## Stream previews-A stream preview is a JPEG attached to a voice connection. It uses the user-only [Streams API](/http-api/streams/), not the attachment flow. Follow its [access rules](/http-api/streams/#access-rules) to read or change a preview.--:::note[Treat a stored preview as publisher-asserted]-A preview does not prove that its connection is currently publishing a stream.-:::--Use [Upload stream preview](/http-api/streams/#upload-stream-preview) to send the image as base64 in JSON. Canonical base64 uses the standard alphabet, a length divisible by four and at most two trailing `=` characters. Decoding and re-encoding must produce the same string. Invalid encoding returns 400 `INVALID_STREAM_THUMBNAIL_PAYLOAD`.--Alternatively, [request an upload URL](/http-api/streams/#create-stream-preview-upload-url) and send the JPEG with `PUT`. Use the returned `content_type`, send at most `max_bytes` bytes and upload before `expires_at`. The URL can be reused until it expires.--Send a valid JPEG of at most 1000000 bytes. [Get stream preview](/http-api/streams/#get-stream-preview) reads it, and [Delete stream preview](/http-api/streams/#delete-stream-preview) removes it.--A preview expires one day after an inline upload or the request that issued its upload URL. Reusing the URL does not extend the preview's lifetime. An expired preview returns an empty 404.--## Failures+A stream preview is a JPEG of at most 1000000 bytes that shows for a voice stream. You can upload it with either of these [Streams API](/http-api/streams/) endpoints.-API requests return the standard [error response](/http-api/#error-response). Relay requests return [plain-text media errors](/media-proxy/responses-and-limits/#media-error-response). Direct storage errors use the storage provider's format.+- [Upload stream preview](/http-api/streams/#upload-stream-preview) takes the image as canonical base64 in JSON, using the standard alphabet with padding. Other encodings return 400 `INVALID_STREAM_THUMBNAIL_PAYLOAD`.+- [Create stream preview upload URL](/http-api/streams/#create-stream-preview-upload-url) returns a URL. Send the JPEG to it with `PUT` and the returned `content_type` before `expires_at`, and keep it at or under `max_bytes`.-Each API endpoint documents its [rate limit](/topics/rate-limits/). The relay has no request-count rate limit.+A preview expires one day after you upload it or request its upload URL, and after that [Get stream preview](/http-api/streams/#get-stream-preview) returns 404.diff --git a/fluxer_docs/src/content/docs/voice/index.md b/fluxer_docs/src/content/docs/voice/index.mdindex 90314ffae..50f575448 100644--- a/fluxer_docs/src/content/docs/voice/index.md+++ b/fluxer_docs/src/content/docs/voice/index.md@@ -1,190 +1,102 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Voice-description: Voice placement, guild voice channels, calls, Go Live, and entrance sounds.+description: How sessions join voice channels and calls, and the limits and permissions that apply.----Fluxer runs voice over LiveKit. The [main Gateway](/gateway/overview/) places a session into a voice channel and hands it one credential. The client presents that credential to a media server, and every track goes over the connection it opens there. Microphone, camera, and screen share are track sources on that one connection, so going live opens nothing new.+Fluxer runs voice over LiveKit. The Gateway places a session in a voice channel and sends it a grant, which the client uses to connect to a LiveKit media server.-[Client commands](/gateway/commands/) and [Gateway events](/gateway/events/) define the placement protocol.--## Voice surfaces--| Surface | What it is | Reference |+| Surface | Description | Reference || --- | --- | --- |-| Guild voice channel | A channel of [type](/http-api/channels/#channel-types) `2`, which also has messages, pins, and slowmode | [Channels](/http-api/channels/) |-| Private call | The direct message and group direct message counterpart of a voice channel | [Calls](/http-api/calls/) |-| Go Live stream<sup>1</sup> | Screen share published as an extra track on a voice connection the member already holds | [Streams](/http-api/streams/) |-| Entrance sound<sup>2</sup> | A short clip announced to everyone already connected to a voice channel | [Entrance sounds](/http-api/entrance-sounds/) |-| Voice activity sharing | Whether a friend is told which voice channel the account is in | [User settings](/http-api/users/settings/#modify-voice-activity-sharing) |--<sup>1</sup> Going live opens no second connection and issues no second credential--<sup>2</sup> The one surface that publishes no media track+| Guild voice channel | A channel of [type](/http-api/channels/#channel-types) `2` | [Channels](/http-api/channels/) |+| Private call | The voice channel of a DM or group DM | [Calls](/http-api/calls/) |+| Stream | A screen share published on an existing connection | [Streams](/http-api/streams/) |+| Entrance sound | A clip played for everyone in a voice channel when you join | [Entrance sounds](/http-api/entrance-sounds/) |+| Voice activity sharing | Whether friends see which voice channel you are in | [User settings](/http-api/users/settings/#modify-voice-activity-sharing) |## Media transport-Media never crosses the HTTP API. No route returns an audio or video track, the credential a media connection presents, or the key material an end-to-end encrypted channel uses.+No HTTP route returns media or the grant. A client sends [Voice State Update](/gateway/commands/#voice-state-update) and gets a [Voice Server Update](/gateway/events/#voice-server-update). The client connects to its `endpoint` with its `token`, using the LiveKit protocol. The grant also has an `e2ee_key` when the channel is end-to-end encrypted.-Fluxer runs media over LiveKit and publishes no signalling protocol of its own. There is no voice websocket, no voice opcode set, no UDP discovery step, and no separate encryption handshake. A client connects to the `endpoint` the [Voice Server Update](/gateway/events/#voice-server-update) grant names, presents the grant `token`, and speaks the LiveKit protocol from there.+A [peer-to-peer](/gateway/events/#peer-to-peer-voice) grant has ICE servers and no `endpoint` or `token`.-A peer-to-peer grant is the one exception. It has ICE servers and no `endpoint` or `token`, and the peers signal through the Gateway as [Peer-to-peer voice](/gateway/events/#peer-to-peer-voice) describes.+LiveKit room and participant names use these formats.-| Concept | Value |+| Name | Format || --- | --- |-| Room name, guild voice channel | `guild_{guild_id}_channel_{channel_id}` |-| Room name, private call | `dm_channel_{channel_id}` |+| Guild voice channel room | `guild_{guild_id}_channel_{channel_id}` |+| Private call room | `dm_channel_{channel_id}` || Participant identity | `user_{user_id}_{connection_id}` |-The grant lives for 600 seconds.--One room is one voice channel, and one participant is one voice connection. A member holding several connections in the same channel is several participants in the same room, which is how one account is present from more than one device.--The grant also names the track sources the connection may publish. SPEAK allows the microphone source, and STREAM allows the camera source together with the screen share sources. A server-deafened connection may neither publish nor subscribe.+The grant is valid for 600 seconds. It lets the connection publish the microphone with SPEAK, and the camera and screen share with STREAM. A connection a moderator has deafened can't publish or subscribe.-## Deployment feature state--A deployment can be configured without voice. The [instance discovery document](/http-api/instance/#instance-features-object) reports that state as `features.voice_enabled`. No other surface warns a client in advance.--Where `features.voice_enabled` is false, Fluxer issues no media credential, so a placement request is refused with `VOICE_TOKEN_FAILED`. [List RTC regions](/http-api/channels/#list-rtc-regions) answers 200 with an empty array before it resolves the channel, and [Modify call region](/http-api/calls/#modify-call-region) accepts any region string.+If `features.voice_enabled` is false in the [instance features](/http-api/instance/#instance-features-object), joining voice fails with `VOICE_TOKEN_FAILED`.## Placement-[Voice State Update](/gateway/commands/#voice-state-update) declares where a session wants to be. It has the target `guild_id`, `channel_id`, and `connection_id` together with `self_mute`, `self_deaf`, `self_video`, and `self_stream`. A null `channel_id` leaves, and a call placement always has a null `guild_id`.--`channel_id` and `connection_id` together select the operation.+The `channel_id` and `connection_id` you send in Voice State Update decide what happens. For a private call, send a null `guild_id`.-| Command shape | Result |+| What you send | Result || --- | --- || `channel_id` and no `connection_id` | Opens a new connection || `channel_id` and a `connection_id` | Updates or moves that connection |-| Null `channel_id` and a `connection_id`, in a guild | Drops that connection |+| Null `channel_id` and a `connection_id` | Drops that connection || Null `channel_id` and no `connection_id`, in a guild | Refused with `VOICE_MISSING_CONNECTION_ID` |-| Null `channel_id` and no `connection_id`, in a call | Drops every voice membership the session holds |-| Null `channel_id` with a non-string, non-null `connection_id` | Refused with `VALIDATION_INVALID_PARAMS` |--The server answers with [Voice State Update](/gateway/events/#voice-state-update) for the resulting membership, delivered to every session that can view the channel, and with [Voice Server Update](/gateway/events/#voice-server-update) for the requesting session alone. That grant has the `token`, `endpoint`, `channel_id`, and `connection_id` of the media server the deployment selected. `guild_id` is present for a guild voice channel and omitted for a call, so a client reads the scope of the grant from that field. It also has an `e2ee_key` when the channel is end-to-end encrypted.--A grant is issued when a connection opens, when it moves to another channel, and when the region changes. An update that stays in the same channel reissues nothing, so toggling `self_mute`, `self_video`, or `self_stream` produces one [Voice State Update](/gateway/events/#voice-state-update) and no new grant.+| Null `channel_id` and no `connection_id`, in a call | Drops every voice connection of the session |-The grant `token` is issued for the media server and consumed by the media connection alone. No route on this API accepts it.--Fluxer reports a refusal by sending no Dispatch. A client observes most refused placements only as the absence of a grant. A refusal with `VOICE_CHANNEL_FULL`, `VOICE_P2P_CONSENT_REQUIRED`, or `VOICE_P2P_UNAVAILABLE` also sends the requesting session a [Gateway Error](/gateway/opcodes-and-close-codes/#gateway-error) payload.+The server sends [Voice State Update](/gateway/events/#voice-state-update) to every session that can view the channel. It sends a new grant only when a connection opens, moves or changes region. Changing `self_mute`, `self_video` or `self_stream` sends no grant.## Guild voice channels-A guild voice channel stores its `bitrate`, `user_limit`, `voice_connection_limit`, `rtc_region`, and `rtc_p2p` on the [channel object](/http-api/channels/#channel-object). It also has ordinary messages, pins, and slowmode, so its text history is read and written through the [Messages resource](/http-api/messages/).--A new voice channel stores a `bitrate` of 64000. The ceiling is 96000, and the `AUDIO_BITRATE_128_KBPS`, `AUDIO_BITRATE_256_KBPS`, and `AUDIO_BITRATE_384_KBPS` [guild features](/http-api/guilds/#guild-features) raise it to 128000, 256000, and 384000. A direct message and a group direct message call have no `bitrate` and always run at 64000.+A voice channel has `bitrate`, `user_limit`, `voice_connection_limit`, `rtc_region` and `rtc_p2p` on the [channel object](/http-api/channels/#channel-object). The default `bitrate` is 64000 and the maximum is 96000. The `AUDIO_BITRATE_128_KBPS`, `AUDIO_BITRATE_256_KBPS` and `AUDIO_BITRATE_384_KBPS` [guild features](/http-api/guilds/#guild-features) raise the maximum to 128000, 256000 and 384000. Calls run at 64000.### Permissions| Permission | Effect on voice || --- | --- |-| VIEW_CHANNEL and CONNECT<sup>1</sup> | Both are required to hold a voice connection in the channel |-| SPEAK<sup>2</sup> | Publish audio |-| STREAM<sup>3</sup> | Publish camera video and Go Live media |-| MUTE_MEMBERS<sup>4</sup> | Apply and clear a moderator mute |-| DEAFEN_MEMBERS<sup>4</sup> | Apply and clear a moderator deafen |-| MOVE_MEMBERS | Move a member to another guild voice channel, or disconnect it |+| VIEW_CHANNEL and CONNECT | Both are needed to connect, or the join fails with `VOICE_PERMISSION_DENIED` |+| SPEAK | Publish audio, and without it the member joins with `suppress` true |+| STREAM | Publish camera video and streams |+| MUTE_MEMBERS | Apply a moderator mute with the `mute` member field |+| DEAFEN_MEMBERS | Apply a moderator deafen with the `deaf` member field |+| MOVE_MEMBERS | Move a member to another voice channel or disconnect them || UPDATE_RTC_REGION | Change the channel's `rtc_region` |-<sup>1</sup> A member missing either bit is refused with `VOICE_PERMISSION_DENIED`--<sup>2</sup> A member without it is admitted, and its voice state is published with `suppress` true--<sup>3</sup> One bit gates both, so there is no separate camera permission--<sup>4</sup> MUTE_MEMBERS covers the `mute` field and DEAFEN_MEMBERS the `deaf` field of the [guild member update object](/http-api/guild-members/#guild-member-update-object). `PRIORITY_SPEAKER` and `USE_VAD` are defined and assignable [permission bits](/http-api/permissions/#permissions) that no HTTP route and no Gateway command evaluates--[ADMINISTRATOR](/http-api/permissions/) resolves to the complete mask before any channel overwrite is applied, so it satisfies every row of that table. Two cases skip the VIEW_CHANNEL and CONNECT check. A member the guild is already moving is admitted. So is a member holding virtual access to the channel. The guild grants virtual access to a connected member that loses VIEW_CHANNEL or that a moderator moves into a channel it cannot see. Virtual access also grants SPEAK and STREAM in that channel on its own.--Fluxer checks the permissions in the table above when it issues a grant, and the guild checks them again for a connection that is already open. Joining, moving, a region change, a role edit, an overwrite edit, and a member role change each recompute SPEAK and STREAM.--The guild applies the new result to a live connection and issues no new [Voice Server Update](/gateway/events/#voice-server-update). The media server mutes a published microphone, camera, or screen share track the member may no longer publish, and drops a connection that fails the VIEW_CHANNEL and CONNECT check.--Moderation is an HTTP operation on the guild membership. [Modify guild member](/http-api/guild-members/#modify-guild-member) and [Modify current guild member](/http-api/guild-members/#modify-current-guild-member) share one request body. Each applies a moderator mute and a moderator deafen, moves a member between guild voice channels, and forces a disconnect. Both require the caller to hold MUTE_MEMBERS, DEAFEN_MEMBERS, and MOVE_MEMBERS for those changes, including when the target is the caller itself. No other HTTP route and no Gateway command does any of it.--That mute and that deafen reach the media server without a new credential. The change applies to every connection the account holds in that channel, and no [Voice Server Update](/gateway/events/#voice-server-update) follows.+[Modify guild member](/http-api/guild-members/#modify-guild-member) and [Modify current guild member](/http-api/guild-members/#modify-current-guild-member) apply mute, deafen, move and disconnect to every connection the member has in the channel. When a role or overwrite change removes SPEAK or STREAM, the media server mutes the affected tracks without a new grant.### Capacity-| Bound | Refusal |+| Condition | Code || --- | --- |-| `user_limit`<sup>1</sup> | `VOICE_CHANNEL_FULL` |-| `voice_connection_limit`<sup>2</sup> | `VOICE_CONNECTION_LIMIT_REACHED` |-| 25 members with a camera on<sup>3</sup> | `VOICE_CAMERA_USER_LIMIT` |--<sup>1</sup> A stored `0` means no limit. While any member in the channel has a camera on, the effective occupancy limit becomes the lower of `user_limit` and 25, and a channel with no limit is capped at 25 for as long as that holds+| The channel has `user_limit` members (0 is no limit, and 25 is the limit while anyone has a camera on) | `VOICE_CHANNEL_FULL` |+| The member has `voice_connection_limit` connections in the channel (5 by default, 100 at most, 5 in a private call) | `VOICE_CONNECTION_LIMIT_REACHED` |+| 25 members already have a camera on | `VOICE_CAMERA_USER_LIMIT` |+| The member has an active timeout | `VOICE_MEMBER_TIMED_OUT` |+| An unclaimed account joins a one-on-one call or a voice channel in a guild it doesn't own | `VOICE_UNCLAIMED_ACCOUNT` |+| Voice encryption is on, everyone in the channel is `e2ee_capable`, and the session (not a bot) didn't identify with it | `VOICE_E2EE_REQUIRED` |-<sup>2</sup> The ceiling on simultaneous connections one member may hold in the channel. A channel that stores no usable value is evaluated at 5, and a stored value above 100 is evaluated at 100--<sup>3</sup> One member with several connections counts once, and the requesting member is counted before the comparison--A private call reads no `voice_connection_limit` and applies a fixed ceiling of 5 connections for each member.--A member whose `communication_disabled_until` is still in the future is refused with `VOICE_MEMBER_TIMED_OUT` before any permission or capacity check runs. An [unclaimed account](/http-api/authentication/#register-an-account) is refused with `VOICE_UNCLAIMED_ACCOUNT` for a one-on-one direct message call and for any guild voice channel whose guild it does not own. A group direct message call is not refused. A session that did not identify with `e2ee_capable` is refused with `VOICE_E2EE_REQUIRED` while the guild has voice encryption enabled and every connection already in the channel is capable. A bot is exempt from that one.+A refused join sends no Voice Server Update. The client gets a [Gateway Error](/gateway/opcodes-and-close-codes/#gateway-error) only for `VOICE_CHANNEL_FULL`, `VOICE_P2P_CONSENT_REQUIRED` and `VOICE_P2P_UNAVAILABLE`, and gets nothing back for the other refusals on this page.### Regions-[List RTC regions](/http-api/channels/#list-rtc-regions) returns the [RTC region objects](/http-api/channels/#rtc-region-object) the caller MAY select for one guild voice channel. A region is returned only when the caller passes every restriction configured for it and at least one voice server accessible to the caller is active in it. The array can be empty.--`rtc_region` is written by [Modify channel](/http-api/channels/#modify-channel) and requires UPDATE_RTC_REGION. A null value selects automatic routing, and so does a stored value the placing account cannot reach.--Automatic routing selects an available server, using the supplied `latitude` and `longitude` when possible. Participants in the same channel share a server. Always use the endpoint returned in [Voice Server Update](/gateway/events/#voice-server-update).--The literal `automatic` is not a channel region. Only the `region` field of [Modify call region](/http-api/calls/#modify-call-region) accepts it, as a synonym for null.--An operator manages the regions and the voice servers registered inside them through the [Admin voice resource](/admin-api/voice/).+[List RTC regions](/http-api/channels/#list-rtc-regions) returns the regions the caller can pick for a channel, and the list can be empty. [Modify channel](/http-api/channels/#modify-channel) sets `rtc_region`, which needs UPDATE_RTC_REGION, and a null region lets Fluxer pick one. Instance admins manage regions and voice servers through the [Admin voice resource](/admin-api/voice/).## Private calls-A private call has no moderator, no permission overwrites, and no moderator mute, deafen, or disconnect.--The [Calls resource](/http-api/calls/) owns its HTTP surface, which reads whether the caller may ring, changes the region of an active call, rings recipients, and stops ringing them. [End call session](/http-api/calls/#end-call-session) ends no call. [Call Create](/gateway/events/#call-create), [Call Update](/gateway/events/#call-update), and [Call Delete](/gateway/events/#call-delete) publish the call state, and both joining and leaving are the same [Voice State Update](/gateway/commands/#voice-state-update) a guild voice channel uses.--A recipient's [incoming call flags](/http-api/users/#incoming-call-flags) decide whether it is rung. The flags can admit nobody, friends only, friends of friends, guild members, or everyone, and they can admit everyone silently.--[Get call eligibility](/http-api/calls/#get-call-eligibility) checks two conditions on the caller before it reads that policy. A caller already connected to the channel's call is reported as not ringable. So is an unclaimed account in a direct message. The operation applies no recipient policy to a group direct message, and reports one as ringable unless the caller is already connected to its call.--[Ring call recipients](/http-api/calls/#ring-call-recipients) applies neither of those conditions and evaluates the policy once per targeted recipient, in a group direct message as well as in a direct message. The result selects who is rung, so a recipient the policy excludes and a recipient it admits silently are both left out of the ringing set while the request still answers 204.+A private call has no moderators, permission overwrites or moderator actions. The [Calls resource](/http-api/calls/) rings recipients and changes the region, and [Call Create](/gateway/events/#call-create), [Call Update](/gateway/events/#call-update) and [Call Delete](/gateway/events/#call-delete) send the call state. Joining and leaving use Voice State Update.-## Go Live streams+A recipient's [incoming call flags](/http-api/users/#incoming-call-flags) decide whether the call rings for them. [Ring call recipients](/http-api/calls/#ring-call-recipients) skips recipients the flags exclude and still returns 204.-Going live publishes a screen share track, and its screen share audio track, on the LiveKit participant the member already holds in the channel. There is no second connection, no second participant, and no second `connection_id`. A member that held STREAM at placement already has both screen share sources in its grant, so no new credential is issued and no [Voice Server Update](/gateway/events/#voice-server-update) follows.+## Streams-The publisher advertises the stream by setting `self_stream` on that connection with [Voice State Update](/gateway/commands/#voice-state-update), naming the connection's own `connection_id`. The server increments the voice state `version` and rebroadcasts the state as one [Voice State Update](/gateway/events/#voice-state-update).+A stream publishes screen share tracks on the connection the member already has, with no new connection or grant. The client sets `self_stream` on that connection with Voice State Update. A connection without STREAM always has `self_stream` and `self_video` false.-The voice state of a connection without STREAM in its channel has `self_stream` and `self_video` false, whatever the client sent. The guild clears both when a live connection loses STREAM, and rebroadcasts the state.--A viewer declares which streams it watches with `viewer_stream_keys` on its own voice state, and a channel move resets that list to empty.--That connection's `connection_id` is the last segment of the [stream key](/http-api/streams/#stream-key), which is `{guild_id}:{channel_id}:{connection_id}` for a guild voice channel and `dm:{channel_id}:{connection_id}` for a private call.--The [Streams resource](/http-api/streams/) owns the operations addressed by that key, which record a region preference and read, upload, and delete a JPEG preview image. Reading a preview takes the same access that lets a member join the channel, so any member holding CONNECT there MAY read it without owning the connection. Mutating one also requires STREAM on a guild channel and a voice state matching exactly the channel and the connection the key names.--:::caution[An oversized track loses only its own source]-On an instance that is not self-hosted, Fluxer mutes a camera or screen share track above 1280x720 from a member without the higher video quality entitlement, and removes that source from the connection's grant. The voice connection stays up.-:::--Losing screen share permission also stops its audio. Other permitted track sources remain available.+A viewer lists the streams it watches in `viewer_stream_keys` in its Voice State Update, and moving to another channel clears the list. The [stream key](/http-api/streams/#stream-key) ends in the publisher's `connection_id`. The [Streams resource](/http-api/streams/) sets a stream's region and uploads and returns preview images.## Entrance sounds-An entrance sound is a short clip an account plays for everyone already connected to a voice channel. An account keeps a personal library of at most eight clips, each 100 through 5200 milliseconds and at most 1048576 decoded bytes, stored as `mp3`, `ogg`, `m4a`, or `wav`. It then assigns one clip per [scope](/http-api/entrance-sounds/#entrance-sound-scopes): `global`, `guilds`, `dms`, and `guild:{guild_id}`.--Fluxer records which clip belongs to which scope and nothing more. [Play entrance sound](/http-api/entrance-sounds/#play-entrance-sound) names the clip explicitly, so the client decides which selection applies to a given channel.--Playback requires a voice state in the target channel and no channel permission. A caller that holds none is refused at the `channel_id` path with the validation code `ENTRANCE_SOUND_INVALID_SCOPE`, and a channel ID naming no channel is refused the same way. A successful call sends one [ENTRANCE_SOUND_PLAY](/gateway/events/#entrance-sound-play) Dispatch to every other account with a voice state in the channel, at most once per account and never back to the caller. That Dispatch has the clip's CDN URL, and each recipient fetches and plays it locally, so no audio track is published for it.--Every session the account holds receives the Dispatch, including sessions that are not in the channel. A client filters on `channel_id`.+An account uploads [entrance sounds](/http-api/entrance-sounds/#clip-limits) and assigns one to each [scope](/http-api/entrance-sounds/#entrance-sound-scopes), and the client picks which one to play. [Play entrance sound](/http-api/entrance-sounds/#play-entrance-sound) needs a voice state in the channel and sends [ENTRANCE_SOUND_PLAY](/gateway/events/#entrance-sound-play) to every other account in it. Each of those accounts gets it on every session, so a client checks `channel_id` before playing it.## Voice activity sharing-An account chooses whether a friend is told which voice channel it is in. [Modify voice activity sharing](/http-api/users/settings/#modify-voice-activity-sharing) writes the account's default and rewrites the caller's side of every existing friendship to the same value in one operation. It then holds a 24 hour cooldown, and a second attempt inside that window is refused at the `share_voice_activity` path with the validation code `VOICE_ACTIVITY_SHARING_ON_COOLDOWN` and a `retry_after` in seconds.--The stored result is `share_voice_activity` on the caller's own [relationship object](/http-api/users/relationships/#relationship-object), and `friend_shares_voice_activity` reports the reciprocal record. [List relationships](/http-api/users/relationships/#list-relationships) reads `friend_shares_voice_activity` from that reciprocal record. So do the [Relationship Update](/gateway/events/#relationship-update) Dispatches this operation emits for each rewritten friendship, one to the caller and one to the friend. Every other operation that returns a relationship object reports `friend_shares_voice_activity` as true.--:::caution[The Gateway does not enforce voice activity sharing]-A [voice state](/gateway/events/#voice-state-object) reaches every session that can view the channel whatever `share_voice_activity` holds, so an account that shares nothing is still visible there. A client MUST NOT present the flag as concealment.-:::+[Modify voice activity sharing](/http-api/users/settings/#modify-voice-activity-sharing) sets the default and changes every existing friendship to match. The values show as `share_voice_activity` and `friend_shares_voice_activity` on the [relationship object](/http-api/users/relationships/#relationship-object). The setting doesn't hide voice state, and every session that can view the channel still gets the [voice state](/gateway/events/#voice-state-object).