Skip to content

Forms

The forms endpoint emails form submissions — contact forms, lead captures, waitlists — to the project’s admin email, so your app can collect messages without a backend or an email provider.

POST https://cloud.frontend.co/api/v1/contact

Authenticate with the project’s API key. Submissions are sent to the project’s admin email: the email of the member who created the project, or the team owner’s.

Send JSON with the form’s fields, a message, or both:

FieldTypeDescription
fieldsobjectThe form’s fields as name–value pairs, such as { "Name": "Ada", "Email": "ada@example.com" }. Up to 50 fields.
messagestringA free-text message.

Submissions can be up to 10,000 characters in total.

Terminal window
curl -X POST "https://cloud.frontend.co/api/v1/contact" \
-H "x-api-key: $FRONTEND_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"fields": { "Name": "Ada Lovelace", "Email": "ada@example.com", "Company": "Analytical" },
"message": "I would like a demo."
}'

Post the form from server code so the API key stays private:

export async function POST(request: Request) {
const form = await request.formData()
const res = await fetch('https://cloud.frontend.co/api/v1/contact', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': process.env.FRONTEND_API_KEY!,
},
body: JSON.stringify({
fields: { Name: form.get('name'), Email: form.get('email') },
message: form.get('message'),
}),
})
return Response.json(await res.json(), { status: res.status })
}
StatusMeaning
400The submission has no fields or message, or is too long
401Missing or invalid API key
404The project wasn’t found
409The project has no admin email
500, 502The email couldn’t be sent

A successful submission returns { "success": true }.