---
title: "Create a reusable email content block"
description: "Creates a workspace-scoped reusable HTML block for Email Builder V2."
---

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

Path: Channel Automation API › Email

`POST /api/email/content-blocks`

Creates a workspace-scoped reusable HTML block for Email Builder V2.

## Authentication

Requires one of the following:

- `BearerAuth`, http, header `Authorization`, format `JWT` **and** `WorkspaceAuth`, apiKey, in header, header `X-Workspace-Id`
- `ApiKeyAuth`, apiKey, in header, header `X-API-Key`, format `API_KEY` **and** `WorkspaceAuth`, apiKey, in header, header `X-Workspace-Id`

## Header parameters

- `X-Workspace-Id` (`post/api/email/content-blocks.header.X-Workspace-Id`; string, required) — Workspace ID for data isolation

## Request body

_Required._

- `name` (`post/api/email/content-blocks.name`; string, required)
- `slug` (`post/api/email/content-blocks.slug`; string, optional)
- `block_type` (`post/api/email/content-blocks.block_type`; string, optional)
  - one of `"header"`, `"footer"`, `"offer"`, `"promo"`, `"legal"`, `"custom"`
- `design_json` (`post/api/email/content-blocks.design_json`; object, optional)
- `rendered_html` (`post/api/email/content-blocks.rendered_html`; string, optional)
- `status` (`post/api/email/content-blocks.status`; string, optional)
  - one of `"active"`, `"archived"`

## Example request

```json
{
  "name": "string",
  "slug": "string",
  "block_type": "header",
  "design_json": {},
  "rendered_html": "string",
  "status": "active"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.channelautomation.com/api/email/content-blocks \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-Workspace-Id: <X-Workspace-Id>' \
  --data '
{
  "name": "string",
  "slug": "string",
  "block_type": "header",
  "design_json": {},
  "rendered_html": "string",
  "status": "active"
}
'
```

### TypeScript

```typescript
const url = 'https://api.channelautomation.com/api/email/content-blocks';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Workspace-Id': '<X-Workspace-Id>',
    Authorization: 'Bearer <token>'
  },
  body: JSON.stringify({
    name: 'string',
    slug: 'string',
    block_type: 'header',
    design_json: {},
    rendered_html: 'string',
    status: 'active'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.channelautomation.com/api/email/content-blocks"

payload = {
    "name": "string",
    "slug": "string",
    "block_type": "header",
    "design_json": {},
    "rendered_html": "string",
    "status": "active"
}
headers = {
    "Content-Type": "application/json",
    "X-Workspace-Id": "<X-Workspace-Id>",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 201

Content block created.

### 400

Invalid request.

### 409

Slug already exists.

### 500

Internal server error

#### Example

```json
{
  "error": "Internal server error",
  "details": "string",
  "success": false
}
```

- `error` (`post/api/email/content-blocks.response.500.error`; string, optional)
  - example `"Internal server error"`
- `details` (`post/api/email/content-blocks.response.500.details`; string, optional)
- `success` (`post/api/email/content-blocks.response.500.success`; boolean, optional)
  - example `false`


Source: https://developer.channelautomations.com/api/post-api-email-content-blocks/index.md
