digital-identity-platform-docs
digital-identity-platform-docs / supabase/functions/check-email-exists
supabase/functions/check-email-exists
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.
Cloudflare Architecture Context
| Attribute | Value |
|---|---|
| Classification | 🔵 BACKEND-ONLY |
| Position | App Backend (invitation flow) |
| Receives Public Traffic | Yes (unauthenticated check) |
| Latency Sensitive | No |
| Safe to Retry | Yes (read-only) |
| Failure Behavior | Fail-closed (returns error) |
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
json
{ "email": "user@example.com" }