Skip to main content

POST /api/lead

Store lead email addresses submitted through the landing page. This endpoint is triggered by the ButtonLead component.

Request

string
required
Email address of the lead. Must be a valid email format.

Response

object
Empty object returned on successful lead storage.
string
Error message returned when request fails.

Code Examples

Request Validation

The endpoint validates the following:
  • Email presence: The email field must be provided in the request body
  • Email format: Must be a valid email address format
packages/landing/app/api/lead/route.ts

Error Handling

error
Validation ErrorReturned when:
  • Email field is missing from request body
error
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