Emails

Update email blocks

Replaces an email body or mutates an existing block type.

patch/emails/{emailId}/blocks

Path parameters

emailIdstring required

Email ID

Request body

htmlstring

Raw HTML body. Provide either html or blocks, not both.

blockIdstring

Existing block ID to mutate.

type'text' | 'html'

New block type. Type mutation supports text and html.

contentstring

Optional replacement content for the mutated block.

Example request

{
  "html": "<h1>Hello</h1>",
  "blocks": [
    {
      "id": "block_123",
      "type": "html",
      "content": "<h1>Hello</h1>",
      "styles": {
        "backgroundColor": "#f8fafc",
        "backgroundOpacity": 80,
        "textColor": "#111827",
        "borderRadius": 12,
        "borderColor": "#cbd5e1",
        "borderWidth": 1
      }
    }
  ]
}

Response

Email blocks updated

successboolean

Example response

{
  "success": true,
  "email": {
    "id": "email_123",
    "companyId": "company_123",
    "name": "Welcome email",
    "subject": "Welcome",
    "previewText": "Here's what to do next",
    "blocks": [
      {
        "id": "block_123",
        "type": "html",
        "content": "<h1>Hello</h1>",
        "styles": {
          "backgroundColor": "#f8fafc",
          "backgroundOpacity": 80,
          "textColor": "#111827",
          "borderRadius": 12,
          "borderColor": "#cbd5e1",
          "borderWidth": 1
        }
      }
    ]
  }
}

Changes