Contact Form API

Public endpoint for submitting the contact form on the landing page. No authentication required.

Endpoint

POST
https://eggisatria.dev/api/contact

Request body

FieldTypeRequiredConstraints
namestringyes2–100 chars
emailstringyesValid email, ≤ 200 chars
messagestringyes10–2000 chars
sourcestringnoAttribution tag, e.g. "landing", "blog". Defaults to "landing".

Example request

Terminal
curl -X POST https://eggisatria.dev/api/contact \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Ada Lovelace",
    "email": "ada@example.com",
    "message": "Hi! I'd love to chat about a project.",
    "source": "docs"
  }'

Example response

JSON · 201 Created
{
  "success": true,
  "data": {
    "id": "ckxxx...",
    "message": "Thanks! Your message has been received — I'll get back to you soon."
  },
  "error": null
}

Side effects

  • The submission is persisted to the contact_submissions table and visible in the Manager dashboard at /dashboard/contact.
  • If RESEND_API_KEY is set, a notification email is sent to the site owner. Otherwise the email is logged to the server console.
  • Rate-limited per IP: 5 submissions per 10 minutes.

Error responses

StatusCause
400Invalid JSON, missing fields, or fields outside the allowed ranges.
429Rate limit exceeded.
500Database failure. Retry the request.