# Remove user Remove a user from an organization, cleaning up all role and department assignments. Removes the user from the organization. All role assignments and department memberships are deleted, and the organization membership is soft-deleted. Optionally, you can transfer the user's resources to a target department. The request body requires `confirm: true` to proceed. #### Path Parameters **`organization_id`** string required The unique identifier of the organization (format: `org_*`). **`user_id`** string required The unique identifier of the user to remove (format: `usr_*`). #### Request Body **`confirm`** boolean optional ยท Defaults to `false` Set to `true` to confirm the removal. If `false` or omitted, the request will be rejected. **`transfer_resources_to_department_id`** string optional The ID of the department to transfer the user's resources to (format: `dept_*`). ## Returns An empty response with a `204 No Content` status code. Request ```bash cURL curl -X DELETE https://api.aitronos.com/v1/organizations/org_xyz789/users/usr_abc123 \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "confirm": true, "transfer_resources_to_department_id": "dept_eng001" }' ``` ```python Python SDK from aitronos import Aitronos client = Aitronos(api_key="your-api-key") # Users V2 endpoints coming to SDK soon # client.users.remove( # organization_id="org_xyz789", # user_id="usr_abc123", # confirm=True, # transfer_resources_to_department_id="dept_eng001", # ) ``` ```python Python import requests org_id = "org_xyz789" user_id = "usr_abc123" url = f"https://api.aitronos.com/v1/organizations/{org_id}/users/{user_id}" headers = { "Authorization": "Bearer YOUR_ACCESS_TOKEN", "Content-Type": "application/json", } data = { "confirm": True, "transfer_resources_to_department_id": "dept_eng001", } response = requests.delete(url, headers=headers, json=data) print(response.status_code) # 204 ``` ```javascript JavaScript const orgId = "org_xyz789"; const userId = "usr_abc123"; const response = await fetch( `https://api.aitronos.com/v1/organizations/${orgId}/users/${userId}`, { method: "DELETE", headers: { Authorization: "Bearer YOUR_ACCESS_TOKEN", "Content-Type": "application/json", }, body: JSON.stringify({ confirm: true, transfer_resources_to_department_id: "dept_eng001", }), } ); console.log(response.status); // 204 ``` Response ```json 204 No Content // Empty response body ``` ```json 422 Validation Error { "success": false, "error": { "code": "CONFIRMATION_REQUIRED", "message": "Please confirm this action by setting confirm to true.", "system_message": "please confirm this action by setting confirm to true.", "type": "client_error", "status": 422, "details": { "user_id": "usr_abc123" }, "trace_id": "abc-123-def", "timestamp": "2025-12-22T15:30:00Z" } } ``` ## Related Resources - [Invite user (v2)](/docs/api-reference/users/invite-v2) - [Update memberships](/docs/api-reference/users/update-memberships) - [Deactivate user](/docs/api-reference/users/deactivate) - [Reactivate user](/docs/api-reference/users/reactivate)