Preview a broadcast (variable coverage + sample)

Search Documentation

Search across all developer documentation

broadcasts

Preview a broadcast (variable coverage + sample)

POST /v1/broadcasts/{id}/preview
Auth required api.broadcasts.view

Pre-send validation for a broadcast: the parallel to segment preview. For the broadcast's pinned template version and resolved audience it classifies every declared template variable (attribute, reserved, or unbound) and computes per-variable coverage over the current audience population — what fraction is resolved by a contact attribute, falls back to default_template_data, or renders blank — plus a small rendered sample.

Read-only: it never mutates the broadcast. Runs under the same ClickHouse query governors segment preview uses. Returns 422 validation_failed when the template version has no renderable content or the audience cannot be resolved (e.g. an invalid segment predicate); unresolved variables are surfaced in the body, not raised.

PII: the sample is rendered from a real audience member, so sample.email is that contact's actual address (and the rendered sample.html may carry their attribute values). Only the coverage counts are aggregate.

Path parameters

id string<uuid> required

Resource UUID. An unparseable id reads as a clean 404 not_found.

Responses

Errors follow the RFC 7807 problem format — see the error reference.

200 The computed preview application/json
broadcast_id string<uuid> required
audience object required

The resolved audience and its current population size.

Fields of audience:

kind string enum required

One of: list, segment

id string<uuid> required
total integer<int64> required

Current member count of the resolved audience.

variables array<object> required

Every declared variable, classified with per-bucket coverage.

Each entry in variables:

variable string required
class string enum required

attribute — name matches a registry attribute (filled per recipient); reserved — a system variable injected by a deploy transform (e.g. the unsubscribe token), filled by the send path; unbound — neither, so it renders blank unless a default supplies it.

One of: attribute, reserved, unbound

attribute_name string optional

The bound registry attribute (present only for attribute).

resolved_by_attribute integer<int64> required

Members whose contact attribute supplies a non-empty value.

resolved_by_default integer<int64> required

Members with no attribute value who fall back to default_template_data.

unresolved integer<int64> required

Members with neither an attribute value nor a default — renders blank.

coverage_percent number<double> required

Share of the population resolved by attribute, in [0,100].

sample object required

A rendered sample. When the audience is empty available is false and the sample is rendered from defaults only, so the template shape is still shown.

Fields of sample:

available boolean required

True when a real audience member backed the sample render.

contact_id string<uuid> | null optional

The sampled contact, or null when the audience is empty.

email string optional

The sampled contact's real email address (empty when the audience is empty). Personal data — the sample is a live audience member, not a placeholder.

subject string required

Rendered subject line.

html string required

Rendered HTML body.

warnings array<string> required

Non-blocking render/validation warnings.

401 Missing, malformed, or unknown API key application/problem+json
403 Key lacks the required scope or plan limit violated application/problem+json
404 Resource not found application/problem+json
422 Query parameter or path value failed validation application/problem+json
429 Per-org rate limit exceeded application/problem+json
500 Unexpected server-side failure. The code is internal_error. The request_id field can be quoted to SendOps support to investigate. application/problem+json