> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sequenzy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Email

> Update email metadata or replace the email body.

# Update Email

You can update an email's metadata and replace its body with either raw HTML or structured blocks.

## Request

<ParamField path="emailId" type="string" required>
  Email ID.
</ParamField>

<ParamField body="name" type="string">
  Email name.
</ParamField>

<ParamField body="subject" type="string">
  Email subject line.
</ParamField>

<ParamField body="previewText" type="string">
  Inbox preview text. Use `null` to clear it.
</ParamField>

<ParamField body="html" type="string">
  Raw HTML body. Provide either `html` or `blocks`, not both.
</ParamField>

<ParamField body="blocks" type="array">
  Structured email blocks. Provide either `blocks` or `html`, not both. Put
  block styling under `styles`; top-level style keys like `backgroundColor`,
  `backgroundOpacity`, `borderColor`, `borderWidth`, and `borderRadius` are
  normalized into `styles`.
</ParamField>

```bash theme={null}
curl -X PATCH "https://api.sequenzy.com/api/v1/emails/email_123" \
  -H "Authorization: Bearer API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"subject":"Updated welcome","html":"<p>Updated body</p>"}'
```

## Responses

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "email": {
      "id": "email_123",
      "companyId": "company_123",
      "name": "Welcome",
      "subject": "Updated welcome",
      "previewText": null,
      "blocks": [{ "id": "block_123", "type": "text", "variant": "html", "content": "<p>Updated body</p>" }],
      "createdAt": "2026-04-19T12:00:00.000Z",
      "updatedAt": "2026-04-19T12:05:00.000Z"
    }
  }
  ```

  ```json 400 theme={null}
  { "success": false, "error": "No supported fields provided" }
  ```

  ```json 401 theme={null}
  {
    "success": false,
    "error": "Missing API key. Provide via x-api-key header or Authorization: Bearer <key>"
  }
  ```

  ```json 403 theme={null}
  { "success": false, "error": "No company selected" }
  ```

  ```json 404 theme={null}
  { "success": false, "error": "Email not found" }
  ```

  ```json 500 theme={null}
  { "success": false, "error": "Internal server error" }
  ```
</ResponseExample>
