# Create a broadcast

`POST /v1/broadcasts`

- Authentication: required (Bearer token)
- Required scope: `api.broadcasts.manage`

Composes a broadcast in the `draft` state, in one of two
mutually-exclusive content modes:

- **Template mode** — supply `template_id` (the template slug / file name
  from `GET /v1/templates`, e.g. `welcome.html`, not a UUID) plus optional
  `template_version` (defaults to latest) and `template_data` (shared merge
  data; per-recipient contact attributes are overlaid at send). Inject a
  large rendered HTML block as a triple-stache variable (`{{{body_html}}}`)
  so it is not HTML-escaped.
- **Inline mode** — supply `html` (raw, fully-rendered content) plus
  optional `text`. Inline HTML must satisfy the same caps as templates
  (≤500 KB, valid UTF-8, at least one HTML tag).

Supplying both `template_id` and `html`, or neither, is a
`422 validation_failed`. `subject` and `preview_text` are owned by the
broadcast (overridable per send). `from_identity`, when given, must be one
of the org's verified identities (see `GET /v1/identities`); omit it to
send from the default `no-reply@<verified-domain>` address. `topic_id`,
when given, is the topic `name` from `GET /v1/topics` (not a UUID).

Does not send — call `POST /v1/broadcasts/{id}/send`. Supports the
`Idempotency-Key` header: a duplicate key within 24 h replays the original
response.

## Request body

Content type: `application/json`

```json
{
  "name": "string",
  "template_id": "string",
  "template_version": 0,
  "template_data": {},
  "html": "string",
  "text": "string",
  "audience_kind": "list",
  "audience_id": "00000000-0000-0000-0000-000000000000",
  "topic_id": "string",
  "from_identity": "string",
  "subject": "string",
  "preview_text": "string",
  "acknowledge_no_topic": true
}
```

## Example request

```bash
curl -X POST 'https://api.sendops.dev/v1/broadcasts' \
  -H "Authorization: Bearer $SENDOPS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"string","template_id":"string","template_version":0,"template_data":{},"html":"string","text":"string","audience_kind":"list","audience_id":"00000000-0000-0000-0000-000000000000","topic_id":"string","from_identity":"string","subject":"string","preview_text":"string","acknowledge_no_topic":true}'
```

## Responses

### 201 — Broadcast created (draft)

Content type: `application/json`

```json
{
  "id": "00000000-0000-0000-0000-000000000000",
  "name": "string",
  "content_mode": "template",
  "template_id": "string",
  "template_version": 0,
  "audience_kind": "list",
  "audience_id": "00000000-0000-0000-0000-000000000000",
  "subject": "string",
  "preview_text": "string",
  "from_identity": "string",
  "default_template_data": {},
  "topic_id": "string",
  "schedule_at": "2026-05-17T20:00:00Z",
  "state": "draft",
  "recipient_count": 0,
  "sent_count": 0,
  "failed_count": 0,
  "started_at": "2026-05-17T20:00:00Z",
  "completed_at": "2026-05-17T20:00:00Z",
  "created_at": "2026-05-17T20:00:00Z",
  "updated_at": "2026-05-17T20:00:00Z",
  "summary": {
    "audience_size": 0,
    "mailable": 0,
    "sent": 0,
    "failed": 0,
    "filtered": 0
  },
  "tags": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "string",
      "key": "string",
      "color": "string",
      "description": "string",
      "created_at": "2026-05-17T20:00:00Z",
      "updated_at": "2026-05-17T20:00:00Z"
    }
  ]
}
```

### 401 — Missing, malformed, or unknown API key

Content type: `application/problem+json`

```json
{
  "type": "https://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "invalid_key",
  "request_id": "string",
  "retry_after": 0,
  "retention_days": 0,
  "scope": "string",
  "resource": "string",
  "errors": [
    {
      "field": "string",
      "reason": "string"
    }
  ]
}
```

### 403 — Key lacks the required scope or plan limit violated

Content type: `application/problem+json`

```json
{
  "type": "https://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "invalid_key",
  "request_id": "string",
  "retry_after": 0,
  "retention_days": 0,
  "scope": "string",
  "resource": "string",
  "errors": [
    {
      "field": "string",
      "reason": "string"
    }
  ]
}
```

### 422 — Query parameter or path value failed validation

Content type: `application/problem+json`

```json
{
  "type": "https://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "invalid_key",
  "request_id": "string",
  "retry_after": 0,
  "retention_days": 0,
  "scope": "string",
  "resource": "string",
  "errors": [
    {
      "field": "string",
      "reason": "string"
    }
  ]
}
```

### 429 — Per-org rate limit exceeded

Content type: `application/problem+json`

```json
{
  "type": "https://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "invalid_key",
  "request_id": "string",
  "retry_after": 0,
  "retention_days": 0,
  "scope": "string",
  "resource": "string",
  "errors": [
    {
      "field": "string",
      "reason": "string"
    }
  ]
}
```

### 500 — Unexpected server-side failure. The `code` is `internal_error`. The
`request_id` field can be quoted to SendOps support to investigate.

Content type: `application/problem+json`

```json
{
  "type": "https://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "invalid_key",
  "request_id": "string",
  "retry_after": 0,
  "retention_days": 0,
  "scope": "string",
  "resource": "string",
  "errors": [
    {
      "field": "string",
      "reason": "string"
    }
  ]
}
```
