Skip to main content
POST
/
newsletter
/
subscribe
curl -X POST https://api.example.com/newsletter/subscribe \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]"
  }'
{
  "id": 42,
  "email": "[email protected]",
  "isActive": true,
  "createdAt": "2026-03-10T14:30:00.000Z"
}
Subscribe a new email address to receive newsletter updates. This is a public endpoint that does not require authentication.

Request Body

email
string
required
The email address to subscribe to the newsletter. Must be a valid email format.Validation:
  • Must be a valid email address
  • Cannot be empty

Response

id
integer
The unique identifier of the newsletter subscriber
email
string
The subscribed email address
isActive
boolean
Whether the subscription is active (defaults to true)
createdAt
string
ISO 8601 timestamp of when the subscription was created

Examples

curl -X POST https://api.example.com/newsletter/subscribe \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]"
  }'
{
  "id": 42,
  "email": "[email protected]",
  "isActive": true,
  "createdAt": "2026-03-10T14:30:00.000Z"
}

Error Codes

Status CodeDescription
201Successfully subscribed to newsletter
400Invalid request body or email format
409Email address is already subscribed
500Internal server error

Notes

  • Email addresses are unique - attempting to subscribe the same email twice will result in a 409 Conflict error
  • Email validation follows standard RFC 5322 format
  • New subscriptions are automatically set to active status
  • This endpoint is public and does not require authentication

Build docs developers (and LLMs) love