Skip to main content

Delete Current User Information

DELETE 

/auth/v1/user/me

API Description

Delete current user information, requires obtaining a temporary administrator privileges sudo_token to execute. This operation will permanently delete the user account and related data, please use with caution.

Features

  • Permanently delete current user account
  • Requires sudo_token for secondary verification to ensure security
  • Cannot be recovered after deletion, use with caution
  • Supports both soft delete and hard delete modes

Input Requirements

Required Parameters

  • Authorization: Current logged-in user's access_token (required, Bearer format)
  • sudo_token: Temporary administrator privileges token (required, obtained through sudo API)
  • client_id: Client ID corresponding to the application (optional, defaults to environment ID)
  • x-device-id: Device ID (optional, current logged-in device ID)

Request Body Parameters

  • No request body parameters

Prerequisites

  • User must be logged in and hold valid access_token
  • Must obtain valid sudo_token through sudo API
  • sudo_token must be within validity period (15 minutes)
  • User confirms to delete their own account

Output Description

Successful Response

  • Returns empty object, indicating successful deletion

Request Example

Delete User Request Example

DELETE /auth/v1/user/me?sudo_token=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxODQ5NzU1MTE5ODQwNDk3NjY0IiwiZXhwIjoxNzM0Njg5NTU3LCJpYXQiOjE3MzQ2ODIzNTcsInNjb3BlIjoic3VkbyJ9
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2FwaS5leGFtcGxlLmNvbSIsInN1YiI6Ijk4NzY1NDMyMTAxMjM0NTY3ODkiLCJhdWQiOiJkZW1vLWFwcC0yZjhhOWMzZTFiNGQiLCJleHAiOjE3MzQ2NzU4ODksImlhdCI6MTczNDY2ODY4OSwic2NvcGUiOiJ1c2VyIn0.dGhpc19pc19hX2Zha2Vfc2lnbmF0dXJlX2Zvcl9leGFtcGxlX3B1cnBvc2VzX29ubHlfZG9fbm90X3VzZV9pbl9wcm9kdWN0aW9uX2Vudmlyb25tZW50X3RoaXNfaXNfbm90X3JlYWxfdG9rZW5fZGF0YQ
Content-Type: application/json

Response Examples

Delete Success Response

{}

sudo_token Invalid Response

{
"error": "permission_denied",
"error_code": 7,
"error_description": "bad sudo token"
}

User Not Found Response

{
"error": "user_not_found",
"error_code": 4004,
"error_description": "User does not exist or has been deleted"
}

Usage Flow

1. Get sudo_token

  • Call Get sudo_token API
  • Obtain sudo_token through password or verification code verification

2. Confirm Deletion

  • Frontend should display confirmation dialog
  • User confirms deletion operation

3. Execute Deletion

  • Call this API to delete user
  • Pass sudo_token for secondary verification

4. Clean Client Data

  • Clean local storage after successful deletion
  • Redirect to login page

Key Characteristics

Security

  • Requires sudo_token secondary verification
  • Prevents accidental account deletion
  • Operation logs recorded for audit

Data Cleanup

  • Delete user basic information
  • Clean user associated data
  • Retain operation log records

Error Handling

Common Error Scenarios

  • sudo_token expired: Prompt user to re-verify
  • Insufficient permissions: Check if sudo_token is correct
  • Network exception: Retry mechanism
  • Server error: Display friendly error message

Request

Query Parameters

    client_id string

    Client ID corresponding to the application, can be obtained from Cloud Development Platform -> Identity Authentication -> Development Settings. Defaults to environment ID, can be omitted

    sudo_token stringrequired

    Temporary administrator token, used to delete users

Header Parameters

    x-device-id string

    Device ID, the ID of the current logged-in device. The client should generate it randomly and cache it on the client. This parameter is related to the number of logged-in accounts.

    Authorization stringrequired

    The access_token of the current logged-in user, format is Bearer xxx

    Example: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2FwaS5leGFtcGxlLmNvbSIsInN1YiI6Ijk4NzY1NDMyMTAxMjM0NTY3ODkiLCJhdWQiOiJkZW1vLWFwcC0yZjhhOWMzZTFiNGQiLCJleHAiOjE3MzQ2NzU4ODksImlhdCI6MTczNDY2ODY4OSwic2NvcGUiOiJ1c2VyIn0.dGhpc19pc19hX2Zha2Vfc2lnbmF0dXJlX2Zvcl9leGFtcGxlX3B1cnBvc2VzX29ubHlfZG9fbm90X3VzZV9pbl9wcm9kdWN0aW9uX2Vudmlyb25tZW50X3RoaXNfaXNfbm90X3JlYWxfdG9rZW5fZGF0YQ

Body

    any

Responses

A successful response.

Response Headers
    Schema
      any
    Loading...