POST /api/lead
Store lead email addresses submitted through the landing page. This endpoint is triggered by theButtonLead component.
Request
Email address of the lead. Must be a valid email format.
Response
Empty object returned on successful lead storage.
Error message returned when request fails.
Code Examples
Request Validation
The endpoint validates the following:- Email presence: The
emailfield must be provided in the request body - Email format: Must be a valid email address format
Validation Code
Validation Code
packages/landing/app/api/lead/route.ts
Error Handling
Validation ErrorReturned when:
- Email field is missing from request body
Internal Server ErrorReturned when:
- Database operation fails
- Unexpected server error occurs
Success Response
Status Code:200 OK
Implementation Notes
- The current implementation includes a TODO for adding custom lead storage logic
- Consider integrating with Supabase for lead storage or sending welcome emails
- All errors are logged to the console for debugging