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
| Parameter | Type | Description |
|---|---|---|
userId | string | Path parameter |
Error Responses
| Status Code | Error Code | Description |
|---|---|---|
| 401 | HTTP_401 | Unauthorized |
| 404 | HTTP_404 | Not Found |
| 404 | HTTP_404 | Not Found |
| 404 | HTTP_404 | Not Found |
| 404 | HTTP_404 | Not Found |
| 401 | HTTP_401 | Unauthorized |
| 404 | HTTP_404 | Not Found |
| 500 | HTTP_500 | Internal Server Error |
| 401 | HTTP_401 | Unauthorized |
| 403 | HTTP_403 | Forbidden |
| 422 | HTTP_422 | Error |
| 500 | HTTP_500 | Internal Server Error |
| 500 | HTTP_500 | Internal Server Error |
| 401 | HTTP_401 | Unauthorized |
| 403 | HTTP_403 | Forbidden |
| 500 | HTTP_500 | Internal Server Error |
| 500 | HTTP_500 | Internal Server Error |
Example Request
curl -X DELETE "https://api.allurelms.com/users/userId-value" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json"