Fileoverview

Check Email Exists Edge Function

Checks if an email address is already registered in the system. Used during invitation flow to determine if invitee needs to register.

Endpoint

POST /check-email-exists

Auth

None - Public endpoint (verify_jwt = false in config)

Remarks

  • Uses Admin API to search auth.users table
  • Performs case-insensitive email matching
  • Paginates through users to find exact match
  • Has safety limit of 50 pages (2500 users) to prevent excessive API calls

Tables touched:

  • auth.users (read via Admin API)

Example: Request body

{ "email": "user@example.com" }

Returns

200 - { exists: boolean }

Returns

400 - Missing email

Returns

500 - Internal server error