Skip to main content
DELETE
/
api
/
members
/
[email]
Delete Member
curl --request DELETE \
  --url 'https://api.example.com/api/members/[email]'
{
  "ok": true,
  "error": {}
}

Authentication

This endpoint requires admin authentication. Include your session cookie in the request.

Path Parameters

email
string
required
Email address of the member to delete. Will be URL-decoded and normalized (trimmed, lowercased).Example: /api/members/user%40company.com or /api/members/[email protected]

Response

Returns a success confirmation object.
ok
boolean
required
Always true when the deletion succeeds. The operation is idempotent - returns success even if the member didn’t exist.

Error Responses

error
object

Examples

curl -X DELETE https://your-domain.com/api/members/user%40company.com \
  -H "Cookie: your-session-cookie"

Example Response

{
  "ok": true
}

Implementation Details

  • Email addresses are automatically normalized (URL-decoded, trimmed, lowercased)
  • Environment-based admins (from ADMIN_EMAILS) cannot be deleted
  • The operation is idempotent - deleting a non-existent member still returns success
  • Email in URL path should be URL-encoded to handle special characters
  • Deleting a member does not delete their user account if they’ve logged in
  • Source: src/app/api/members/[email]/route.ts:43

Protected Members

Members whose email appears in the ADMIN_EMAILS environment variable cannot be deleted. These are configured through environment variables and represent permanent workspace administrators. If you attempt to delete a protected member, you’ll receive:
{
  "error": "default admin cannot be removed"
}

Side Effects

  • Removes the member from the workspace_members table
  • Does NOT delete the user’s account from the users table if they’ve logged in
  • Does NOT revoke any active sessions
  • The user can still access the workspace if they’re in the ADMIN_EMAILS environment variable

Best Practices

  1. URL Encode Emails: Always URL-encode email addresses in the path parameter
  2. Check Environment Admins: Before attempting deletion, check if isAdminByEnv is true
  3. Handle Idempotency: Don’t treat success as confirmation that a member existed
  4. Confirmation UI: Show a confirmation dialog before deletion in user interfaces

Build docs developers (and LLMs) love