CastBricks Docs

Email API

Endpoints for sending email, checking status, and templates

Email API

Base path: /v1/email

Send Email

  • POST /v1/email/send

Request body (JSON):

{
  "from": "no-reply@yourdomain.com",
  "to": ["recipient@example.com"],
  "cc": [],
  "bcc": [],
  "subject": "Subject",
  "html": "<p>Body</p>",
  "text": "Plain text body",
  "template_id": null,
  "template_data": {}
}

Response (201):

{
  "id": "msg_123",
  "status": "queued",
  "accepted": ["recipient@example.com"]
}

Get Message Status

  • GET /v1/email/{id}

Response:

{
  "id": "msg_123",
  "status": "delivered",
  "delivered_at": "2025-11-01T12:34:56Z",
  "recipients": [
    { "email": "recipient@example.com", "status": "delivered" }
  ]
}

Templates

  • GET /v1/email/templates — list templates
  • POST /v1/email/templates — create template
  • GET /v1/email/templates/{id} — get template
  • PUT /v1/email/templates/{id} — update template
  • DELETE /v1/email/templates/{id} — delete template

Templates support handlebars-style placeholders and must be rendered server-side or by the API using template_id + template_data.