# Delete user

**Endpoint**

`DELETE/v2/user/{id}`

**Link**

{% embed url="<https://stagep.tst-apidmndelss.com/openapi/v2.html#/operations/Users_Delete>" %}

### **Request**

#### **Authentication**

An API key is required for authentication. Include it in the `Authorization` header.

* **Header:** `Authorization`
* **Value:** Your API key token

#### **HTTP Method & URL**

* **Method:** `DELETE`
* **URL:** `https://stagep.tst-apidmndelss.com/v2/user/{id}`

#### **Path Parameters**

| Parameter | Type     | Description                                  | Required | Example          |
| --------- | -------- | -------------------------------------------- | -------- | ---------------- |
| **`id`**  | `string` | **Unique identifier of the user to delete**. | Yes      | `user_abc123def` |

#### **Query Parameters**

| Parameter        | Type     | Description                                         | Required | Example       |
| ---------------- | -------- | --------------------------------------------------- | -------- | ------------- |
| **`customerId`** | `string` | **Customer identifier** (for verification/context). | No       | `cust_789xyz` |

#### **Headers**

| Key             | Value              | Required |
| --------------- | ------------------ | -------- |
| `Authorization` | `Bearer <JWT>`     | Yes      |
| `Accept`        | `application/json` | Yes      |

***

### **Response (200 OK)**

Returns a confirmation object indicating the success or failure of the deletion operation.

#### **Response Fields**

| Field         | Type      | Description                  | Example                     |
| ------------- | --------- | ---------------------------- | --------------------------- |
| **`success`** | `boolean` | **Operation status**.        | `true`                      |
| **`message`** | `string`  | **Detailed result message**. | `User deleted successfully` |

**Example Response:**

```json
{
  "success": true,
  "message": "User user_abc123def deleted successfully"
}
```

***

### **Examples**

#### **Basic User Deletion Request (cURL)**

```bash
curl --request DELETE \
  --url 'https://stagep.tst-apidmndelss.com/v2/user/user_abc123def' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer eyJhbGci...wNLGA'
```

#### **User Deletion with Customer Context**

```bash
curl --request DELETE \
  --url 'https://stagep.tst-apidmndelss.com/v2/user/user_456ghi?customerId=cust_789xyz' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer eyJhbGci...wNLGA'
```

***

### **Error Responses**

1. **User Not Found**:

   ```json
   {
     "success": false,
     "message": "User not found: user_invalid_id"
   }
   ```
2. **Unauthorized**:

   ```json
   {
     "success": false,
     "message": "Unauthorized"
   }
   ```
3. **Customer Context Mismatch**:

   ```json
   {
     "success": false,
     "message": "User does not belong to specified customer"
   }
   ```
4. **User Cannot Be Deleted** (e.g., active sessions):

   ```json
   {
     "success": false,
     "message": "User cannot be deleted: user has active sessions"
   }
   ```

***

### **Notes**

#### **Deletion Behavior**

* **Permanent operation** - cannot be undone
* Removes user account and associated data
* May preserve audit trails for compliance purposes
* Some systems may implement soft delete (archiving) instead of permanent deletion

#### **Security Considerations**

* Requires appropriate administrative privileges
* Customer ID parameter may be used for additional verification
* Some users (e.g., system administrators) may be protected from deletion

#### **Best Practices**

* Always verify the user ID before deletion
* Use the `customerId` parameter for additional context/verification
* Consider deactivating users instead of deleting when possible
* Maintain backup of critical user data before deletion

**Common Use Cases**:

* Removing inactive or duplicate accounts
* GDPR compliance and right-to-be-forgotten requests
* Cleaning up test or temporary accounts
* Terminating employee access in enterprise systems

**Alternative to Deletion**:

* Consider updating user status to `BANNED` or `REJECTED` instead of deletion
* Deactivation may be preferable for historical reporting purposes

**Pre-deletion Checks**:

* Ensure no pending transactions or activities
* Verify user is not associated with critical business processes
* Confirm proper authorization for deletion operation

Real response:


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.delos.financial/users/delete-user.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
