refactor: simplify account standing and verification levels (#3130)

This commit is contained in:
Hampus
2026-10-02 18:17:41 +02:00
committed by GitHub
parent 1abde06824
commit 1ec8f31253
488 changed files with 10390 additions and 47117 deletions
+17 -349
View File
@@ -1683,7 +1683,7 @@
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
}
},
"description": "Enqueue one background administrative job. The `task` discriminator selects both the body variant and the ACL evaluated for the request: `update_user_flags` needs bulk:update:user_flags, `update_suspicious_activity_flags` needs bulk:update:suspicious_activity, `update_guild_features` needs bulk:update:guild_features, `add_guild_members` needs bulk:add:guild_members, `schedule_user_deletion` needs bulk:delete:users, and `delete_user_messages` needs bulk:delete:user_messages. Returns a job_id immediately; observe progress at /admin/jobs/:job_id.",
"description": "Enqueue one background administrative job. The `task` discriminator selects both the body variant and the ACL evaluated for the request: `update_user_flags` needs bulk:update:user_flags, `update_guild_features` needs bulk:update:guild_features, `add_guild_members` needs bulk:add:guild_members, `schedule_user_deletion` needs bulk:delete:users, and `delete_user_messages` needs bulk:delete:user_messages. Returns a job_id immediately; observe progress at /admin/jobs/:job_id.",
"security": [{"adminApiKey": []}],
"requestBody": {
"required": true,
@@ -7190,74 +7190,6 @@
]
}
},
"/admin/users/{user_id}/phone-verification": {
"put": {
"operationId": "update_admin_user_phone_verification",
"summary": "Update user phone verification flag",
"tags": ["Admin"],
"responses": {
"200": {
"description": "Success",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserMutationResponse"}}}
},
"400": {
"description": "Bad Request - The request was malformed or contained invalid data",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
},
"401": {
"description": "Unauthorized - Authentication is required or the token is invalid",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
},
"403": {
"description": "Forbidden - You do not have permission to perform this action",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
},
"429": {
"description": "Too Many Requests - You are being rate limited",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ThrottledError"}}},
"headers": {
"Retry-After": {
"description": "Number of seconds to wait before retrying (only on 429)",
"schema": {"type": "integer"}
},
"X-RateLimit-Limit": {
"description": "The number of requests that can be made in the current window",
"schema": {"type": "integer"}
},
"X-RateLimit-Remaining": {
"description": "The number of remaining requests that can be made",
"schema": {"type": "integer"}
},
"X-RateLimit-Reset": {
"description": "Unix timestamp when the rate limit resets",
"schema": {"type": "integer"}
}
}
},
"500": {
"description": "Internal Server Error - An unexpected error occurred",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
}
},
"description": "Set whether a user is treated as having completed phone verification. This is the only supported path for clearing the irreversible user-facing phone verification flag. Requires USER_UPDATE_PHONE permission.",
"security": [{"adminApiKey": []}],
"parameters": [
{
"name": "user_id",
"in": "path",
"required": true,
"schema": {"description": "The ID of the user", "allOf": [{"$ref": "#/components/schemas/SnowflakeType"}]},
"description": "The ID of the user"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {"schema": {"$ref": "#/components/schemas/AdminUserPhoneVerificationRequest"}}
}
}
}
},
"/admin/users/{user_id}/premium-flags": {
"patch": {
"operationId": "update_admin_user_premium_flags",
@@ -7851,142 +7783,6 @@
]
}
},
"/admin/users/{user_id}/suspicious-activity-disablement": {
"put": {
"operationId": "disable_admin_user_suspicious",
"summary": "Disable user for suspicious activity",
"tags": ["Admin"],
"responses": {
"200": {
"description": "Success",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserMutationResponse"}}}
},
"400": {
"description": "Bad Request - The request was malformed or contained invalid data",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
},
"401": {
"description": "Unauthorized - Authentication is required or the token is invalid",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
},
"403": {
"description": "Forbidden - You do not have permission to perform this action",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
},
"429": {
"description": "Too Many Requests - You are being rate limited",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ThrottledError"}}},
"headers": {
"Retry-After": {
"description": "Number of seconds to wait before retrying (only on 429)",
"schema": {"type": "integer"}
},
"X-RateLimit-Limit": {
"description": "The number of requests that can be made in the current window",
"schema": {"type": "integer"}
},
"X-RateLimit-Remaining": {
"description": "The number of remaining requests that can be made",
"schema": {"type": "integer"}
},
"X-RateLimit-Reset": {
"description": "Unix timestamp when the rate limit resets",
"schema": {"type": "integer"}
}
}
},
"500": {
"description": "Internal Server Error - An unexpected error occurred",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
}
},
"description": "Disable user account due to suspicious activity or abuse. Account is locked pending review. User cannot access services. Emails the user unless notify_user is false. Creates audit log entry. Requires USER_DISABLE_SUSPICIOUS permission.",
"security": [{"adminApiKey": []}],
"parameters": [
{
"name": "user_id",
"in": "path",
"required": true,
"schema": {"description": "The ID of the user", "allOf": [{"$ref": "#/components/schemas/SnowflakeType"}]},
"description": "The ID of the user"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {"schema": {"$ref": "#/components/schemas/AdminUserSuspiciousDisableRequest"}}
}
}
}
},
"/admin/users/{user_id}/suspicious-activity-flags": {
"put": {
"operationId": "update_admin_user_suspicious_activity_flags",
"summary": "Update suspicious activity flags",
"tags": ["Admin"],
"responses": {
"200": {
"description": "Success",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserMutationResponse"}}}
},
"400": {
"description": "Bad Request - The request was malformed or contained invalid data",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
},
"401": {
"description": "Unauthorized - Authentication is required or the token is invalid",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
},
"403": {
"description": "Forbidden - You do not have permission to perform this action",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
},
"429": {
"description": "Too Many Requests - You are being rate limited",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ThrottledError"}}},
"headers": {
"Retry-After": {
"description": "Number of seconds to wait before retrying (only on 429)",
"schema": {"type": "integer"}
},
"X-RateLimit-Limit": {
"description": "The number of requests that can be made in the current window",
"schema": {"type": "integer"}
},
"X-RateLimit-Remaining": {
"description": "The number of remaining requests that can be made",
"schema": {"type": "integer"}
},
"X-RateLimit-Reset": {
"description": "Unix timestamp when the rate limit resets",
"schema": {"type": "integer"}
}
}
},
"500": {
"description": "Internal Server Error - An unexpected error occurred",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
}
},
"description": "Flag user as suspicious for account abuse, fraud, or policy violations. Enables enforcement actions and rate limiting. Creates audit log entry. Requires USER_UPDATE_SUSPICIOUS_ACTIVITY permission.",
"security": [{"adminApiKey": []}],
"parameters": [
{
"name": "user_id",
"in": "path",
"required": true,
"schema": {"description": "The ID of the user", "allOf": [{"$ref": "#/components/schemas/SnowflakeType"}]},
"description": "The ID of the user"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {"schema": {"$ref": "#/components/schemas/AdminUserSuspiciousActivityFlagsRequest"}}
}
}
}
},
"/admin/users/{user_id}/system-status": {
"put": {
"operationId": "set_admin_user_system_status",
@@ -9506,31 +9302,6 @@
},
"required": ["system"]
},
"AdminUserSuspiciousActivityFlagsRequest": {
"type": "object",
"properties": {
"flags": {
"description": "Bitmask of suspicious activity flags",
"allOf": [{"$ref": "#/components/schemas/SuspiciousActivityFlags"}]
}
},
"required": ["flags"]
},
"AdminUserSuspiciousDisableRequest": {
"type": "object",
"properties": {
"flags": {
"description": "Bitmask of suspicious activity flags that triggered the disable",
"allOf": [{"$ref": "#/components/schemas/SuspiciousActivityFlags"}]
},
"notify_user": {
"default": true,
"description": "Whether to email the user that the account was disabled",
"type": "boolean"
}
},
"required": ["flags"]
},
"AdminStorePurchaseListResponse": {
"type": "object",
"properties": {
@@ -9685,16 +9456,6 @@
}
}
},
"AdminUserPhoneVerificationRequest": {
"type": "object",
"properties": {
"has_verified_phone": {
"type": "boolean",
"description": "Whether the user should be treated as having completed phone verification"
}
},
"required": ["has_verified_phone"]
},
"DeleteAllUserMessagesResponse": {
"type": "object",
"properties": {
@@ -10110,7 +9871,7 @@
"type": "object",
"properties": {
"acls": {
"maxItems": 108,
"maxItems": 104,
"type": "array",
"items": {"$ref": "#/components/schemas/AdminAclType"},
"description": "List of access control permissions to assign"
@@ -12436,37 +12197,6 @@
},
"required": ["user_ids", "task"]
},
{
"type": "object",
"properties": {
"user_ids": {
"maxItems": 1000,
"type": "array",
"items": {"$ref": "#/components/schemas/SnowflakeType"},
"description": "List of user IDs to update"
},
"add_flags": {
"default": [],
"description": "Suspicious activity flag names to add to all specified users",
"maxItems": 32,
"type": "array",
"items": {"type": "string"}
},
"remove_flags": {
"default": [],
"description": "Suspicious activity flag names to remove from all specified users",
"maxItems": 32,
"type": "array",
"items": {"type": "string"}
},
"task": {
"type": "string",
"enum": ["update_suspicious_activity_flags"],
"description": "Adds and removes verification requirements on every targeted user"
}
},
"required": ["user_ids", "task"]
},
{
"type": "object",
"properties": {
@@ -12999,7 +12729,7 @@
},
"acls": {
"description": "Replacement list of access control permissions for the key",
"maxItems": 108,
"maxItems": 104,
"type": "array",
"items": {"$ref": "#/components/schemas/AdminAclType"}
}
@@ -13017,7 +12747,7 @@
"type": "string"
},
"acls": {
"maxItems": 108,
"maxItems": 104,
"type": "array",
"items": {"type": "string"},
"description": "List of access control permissions for the key"
@@ -13047,7 +12777,7 @@
"maximum": 365
},
"acls": {
"maxItems": 108,
"maxItems": 104,
"type": "array",
"items": {"$ref": "#/components/schemas/AdminAclType"},
"description": "List of access control permissions for the key"
@@ -13068,7 +12798,7 @@
"type": "string"
},
"acls": {
"maxItems": 108,
"maxItems": 104,
"type": "array",
"items": {"type": "string"},
"description": "List of access control permissions for the key"
@@ -13081,7 +12811,7 @@
"type": "object",
"properties": {
"acls": {
"maxItems": 108,
"maxItems": 104,
"type": "array",
"items": {"type": "string", "minLength": 1, "maxLength": 64},
"description": "Every admin access control permission the admin API recognises"
@@ -13135,7 +12865,6 @@
"bulk:delete:users",
"bulk:delete:user_messages",
"bulk:update:guild_features",
"bulk:update:suspicious_activity",
"bulk:update:user_flags",
"csam:submit_ncmec",
"discovery:remove",
@@ -13171,7 +12900,6 @@
"system_dm:send",
"user:cancel:bulk_message_deletion",
"user:delete",
"user:disable:suspicious",
"user:list:dm_channels",
"user:list:guilds",
"user:list:relationships",
@@ -13188,9 +12916,7 @@
"user:update:email",
"user:update:flags",
"user:update:mfa",
"user:update:phone",
"user:update:profile",
"user:update:suspicious_activity",
"user:update:traits",
"user:update:username",
"voice:region:create",
@@ -13637,11 +13363,6 @@
},
{"name": "SPAMMER", "value": "64", "description": "User is flagged as a spammer"},
{"name": "DELETED", "value": "17179869184", "description": "User account has been deleted"},
{
"name": "DISABLED_SUSPICIOUS_ACTIVITY",
"value": "34359738368",
"description": "User account disabled due to suspicious activity"
},
{"name": "SELF_DELETED", "value": "68719476736", "description": "User account was self-deleted"},
{"name": "DISABLED", "value": "274877906944", "description": "User account is disabled"},
{"name": "HAS_SESSION_STARTED", "value": "549755813888", "description": "User has started a session"},
@@ -13652,6 +13373,7 @@
"value": "562949953421312",
"description": "User is verified as not underage"
},
{"name": "ACCOUNT_LIMITED", "value": "1125899906842624", "description": "User account is limited"},
{
"name": "HAS_DISMISSED_PREMIUM_ONBOARDING",
"value": "2251799813685248",
@@ -13669,14 +13391,9 @@
"description": "User has verified their age as an adult via credit card verification"
},
{
"name": "FORCE_INBOUND_PHONE_VERIFICATION",
"value": "2305843009213693952",
"description": "User is forced through inbound phone verification, for debugging"
},
{
"name": "NOT_SUSPICIOUS",
"name": "LIMIT_EXEMPT",
"value": "4611686018427387904",
"description": "User is permanently exempt from automatic suspicious-activity flagging"
"description": "User is permanently exempt from account limitation"
}
]
},
@@ -15019,15 +14736,14 @@
"GuildVerificationLevel": {
"description": "Required verification level for members",
"type": "integer",
"enum": [0, 1, 2, 3, 4],
"enum": [0, 1, 2, 3],
"format": "int32",
"x-enumNames": ["NONE", "LOW", "MEDIUM", "HIGH", "VERY_HIGH"],
"x-enumNames": ["NONE", "LOW", "MEDIUM", "HIGH"],
"x-enumDescriptions": [
"Unrestricted",
"Must have verified email",
"Registered for more than 5 minutes",
"Member of the server for more than 10 minutes",
"Must have a verified phone number"
"Member of the server for more than 10 minutes"
]
},
"GuildOperations": {
@@ -15109,15 +14825,14 @@
"minimum": 0,
"maximum": 2147483647,
"format": "int32",
"x-enumNames": ["NONE", "LOW", "MEDIUM", "HIGH", "VERY_HIGH"],
"x-enumNames": ["NONE", "LOW", "MEDIUM", "HIGH"],
"x-enumDescriptions": [
"Unrestricted",
"Must have verified email",
"Registered for more than 5 minutes",
"Member of the server for more than 10 minutes",
"Must have a verified phone number"
"Member of the server for more than 10 minutes"
],
"enum": [0, 1, 2, 3, 4]
"enum": [0, 1, 2, 3]
},
"PurgeGuildAssetErrorSchema": {
"type": "object",
@@ -15887,7 +15602,6 @@
"email": {"nullable": true, "type": "string"},
"email_verified": {"type": "boolean"},
"email_bounced": {"type": "boolean"},
"has_verified_phone": {"type": "boolean"},
"date_of_birth": {"nullable": true, "type": "string"},
"locale": {"nullable": true, "type": "string"},
"premium_type": {"nullable": true, "allOf": [{"$ref": "#/components/schemas/Int32Type"}]},
@@ -15895,11 +15609,6 @@
"premium_until": {"nullable": true, "type": "string"},
"premium_grace_ends_at": {"nullable": true, "type": "string"},
"premium_lifetime_sequence": {"nullable": true, "allOf": [{"$ref": "#/components/schemas/Int32Type"}]},
"suspicious_activity_flags": {"allOf": [{"$ref": "#/components/schemas/SuspiciousActivityFlags"}]},
"phone_verification_deferred": {
"type": "boolean",
"description": "Whether a stored phone requirement is deferred and not enforced"
},
"temp_banned_until": {"nullable": true, "type": "string"},
"pending_deletion_at": {"nullable": true, "type": "string"},
"pending_bulk_message_deletion_at": {"nullable": true, "type": "string"},
@@ -15920,7 +15629,7 @@
"description": "ISO 8601 timestamp when the pending deletion was scheduled",
"type": "string"
},
"acls": {"maxItems": 108, "type": "array", "items": {"type": "string"}},
"acls": {"maxItems": 104, "type": "array", "items": {"type": "string"}},
"traits": {"maxItems": 100, "type": "array", "items": {"type": "string"}},
"has_totp": {"type": "boolean"},
"authenticator_types": {"maxItems": 10, "type": "array", "items": {"$ref": "#/components/schemas/Int32Type"}},
@@ -15946,7 +15655,6 @@
"email",
"email_verified",
"email_bounced",
"has_verified_phone",
"date_of_birth",
"locale",
"premium_type",
@@ -15954,8 +15662,6 @@
"premium_until",
"premium_grace_ends_at",
"premium_lifetime_sequence",
"suspicious_activity_flags",
"phone_verification_deferred",
"temp_banned_until",
"pending_deletion_at",
"pending_bulk_message_deletion_at",
@@ -15975,44 +15681,6 @@
],
"additionalProperties": false
},
"SuspiciousActivityFlags": {
"type": "integer",
"minimum": 0,
"maximum": 2147483647,
"description": "Suspicious activity indicators",
"format": "int32",
"x-bitflagValues": [
{"name": "REQUIRE_VERIFIED_EMAIL", "value": "1", "description": "Requires verified email address"},
{"name": "REQUIRE_REVERIFIED_EMAIL", "value": "2", "description": "Requires re-verified email address"},
{"name": "REQUIRE_VERIFIED_PHONE", "value": "4", "description": "Requires verified phone number"},
{"name": "REQUIRE_REVERIFIED_PHONE", "value": "8", "description": "Requires re-verified phone number"},
{
"name": "REQUIRE_VERIFIED_EMAIL_OR_VERIFIED_PHONE",
"value": "16",
"description": "Requires verified email or verified phone"
},
{
"name": "REQUIRE_REVERIFIED_EMAIL_OR_VERIFIED_PHONE",
"value": "32",
"description": "Requires re-verified email or re-verified phone"
},
{
"name": "REQUIRE_VERIFIED_EMAIL_OR_REVERIFIED_PHONE",
"value": "64",
"description": "Requires verified email or re-verified phone"
},
{
"name": "REQUIRE_REVERIFIED_EMAIL_OR_REVERIFIED_PHONE",
"value": "128",
"description": "Requires re-verified email or re-verified phone"
},
{
"name": "REQUIRE_INBOUND_PHONE_VERIFICATION",
"value": "256",
"description": "Requires inbound SMS verification (user must text code to platform number)"
}
]
},
"PremiumFlags": {
"type": "integer",
"minimum": 0,