DELETE /users/:userId

DELETE /users/:userId

WORKAROUND: Handle "me" case explicitly since Turbopack may route it here instead of static route Use the same logic as /api/users/me route If profile doesn't exist, try to create it automatically Get full user info from Clerk Extract email from Clerk user Generate UUID for the user_profile Check for pending invitations for this email Extract tenant_id from public_metadata if provided Create the profile Mark invitation as used if found Verify authentication with Clerk Fetch user Verify authentication and admin role Parse and validate body Update user (RLS will enforce tenant isolation) Verify authentication and admin role Soft delete (set is_active to false)

Endpoint

DELETE /users/:userId

Authentication

This endpoint requires authentication. Include your authentication token in the request headers.

Path Parameters

ParameterTypeDescription
userIdstringPath parameter

Error Responses

Status CodeError CodeDescription
401HTTP_401Unauthorized
404HTTP_404Not Found
404HTTP_404Not Found
404HTTP_404Not Found
404HTTP_404Not Found
401HTTP_401Unauthorized
404HTTP_404Not Found
500HTTP_500Internal Server Error
401HTTP_401Unauthorized
403HTTP_403Forbidden
422HTTP_422Error
500HTTP_500Internal Server Error
500HTTP_500Internal Server Error
401HTTP_401Unauthorized
403HTTP_403Forbidden
500HTTP_500Internal Server Error
500HTTP_500Internal Server Error

Example Request

curl -X DELETE "https://api.allurelms.com/users/userId-value" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json"