Shared

Sign up for Gaplessly product updates (public)

post/api/newsletter

The marketing footer's newsletter sign-up, double opt-in with all state in Resend (lib/marketing/newsletter.ts): a new address becomes a Resend contact with unsubscribed: true and is mailed a confirmation link carrying the contact id; nothing is subscribed until POST /api/newsletter/confirm. A still-pending address gets the link again (Resend's own idempotency key limits that to once per 24h); a confirmed subscriber is sent nothing. Rate-limited (newsletter: bucket, 5/min-window/IP) and bot-checked (guestBotCheck(), registered in bot-paths.ts), since it mails whatever address it is given. Answers {ok:true} for new, pending and confirmed addresses alike, so it cannot be used to learn who is on the list. A form-encoded body (the footer form before hydration) gets a 303 to /newsletter/confirm?status=sent instead of JSON.

Request Body

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/newsletter" \  -H "Content-Type: application/json" \  -d '{    "email": "user@example.com"  }'
{  "ok": true}