Skip to main content
DELETE
/
api
/
users
/
:id
Delete User
curl --request DELETE \
  --url https://api.example.com/api/users/:id
{
  "message": "<string>",
  "deletedAt": "<string>"
}
Soft delete a user account. This deactivates the user without removing their data.

Authentication

Required. Only Admin role can delete users.

Path Parameters

id
string
required
User ID to delete

Response

message
string
Success message
deletedAt
string
ISO timestamp of deletion

Example Request

cURL
curl -X DELETE "https://api.millenium-potters.com/api/users/clx789ghi" \
  -H "Authorization: Bearer YOUR_TOKEN"
JavaScript
const response = await fetch('/api/users/clx789ghi', {
  method: 'DELETE',
  headers: {
    'Authorization': `Bearer ${token}`
  }
});
const data = await response.json();

Example Response

{
  "message": "User deleted successfully",
  "deletedAt": "2026-03-11T12:00:00Z"
}

Dependency Checking

Before deleting a user, check their dependencies using:
GET /api/users/:id/dependencies
This returns information about:
  • Unions managed by the user
  • Union members assigned to the user
  • Loans assigned to the user
  • Active sessions

Error Responses

Missing or invalid authentication token.
User does not have Admin permissions.
User with specified ID does not exist.
User has active dependencies (unions, loans, etc.) that prevent deletion.
Deleting a user with active unions or loans will fail. Reassign their responsibilities first using the dependency check endpoint.
This is a soft delete operation. The user record is marked as deleted but not removed from the database. This preserves audit trails and historical data.

See Also

Build docs developers (and LLMs) love