Broadcasts API
API reference for creating, sending and tracking broadcasts and A/B variants in Taifa Mail.
Base URL: https://govconnect.ke/v1
All endpoints require authentication via API Key or JWT cookie. API keys use the tfm_k_ prefix.
See the Broadcasts overview for concepts.
List broadcasts
Returns the broadcasts in your workspace, newest first.
Query parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
status | string | -- | Filter by status: draft, scheduled, sending, sent, cancelled. |
limit | integer | 50 | Results to return (1-200). |
Create a broadcast
Creates a broadcast in draft status, or scheduled when scheduled_at is set.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Internal name for the broadcast. |
subject | string | Yes | Subject line. |
from_address | string | Yes | Sender address used in the From header. |
html_body | string | No | HTML body. |
text_body | string | No | Plain-text body. |
reply_to | string | No | Reply-To address. |
contact_list_id | string (UUID) | No | The contact list to send to. Required before sending. |
sender_address_id | string (UUID) | No | A sender address in your workspace. |
scheduled_at | string (ISO 8601) | No | If set, the broadcast is created scheduled and sends automatically at this time. |
Response (201 Created):
Get a broadcast
Returns the broadcast with its aggregate counters (recipient_count,
queued_count, delivered_count, bounced_count, failed_count,
opened_count, clicked_count).
Update a broadcast
Updates a draft or scheduled broadcast. Editing a broadcast in any
other status returns 409. Accepts the same fields as create, all
optional. Setting or clearing scheduled_at moves the status between
scheduled and draft.
Delete a broadcast
Deletes a broadcast. A sending broadcast must be cancelled first.
Returns 204 No Content.
Send a broadcast
Hands a draft or scheduled broadcast off for delivery and moves it to
sending. Recipients come from the broadcast's contact_list_id, which
must be set and non-empty. The sender address, if set, must be active and
visible to your workspace.
Returns the updated BroadcastResponse.
Cancel a broadcast
Stops a scheduled or sending broadcast and sets its status to
cancelled. Returns the updated BroadcastResponse.
Top links
Returns the most-clicked links in a broadcast, ranked by click count.
Query parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | integer | 10 | Number of links to return (1-50). |
Response:
Variants (A/B testing)
Variants can only be created, edited, or deleted while the broadcast is
draft or scheduled. See A/B testing.
Create variant request body:
| Field | Type | Required | Description |
|---|---|---|---|
label | string | Yes | Variant label. Must be unique within the broadcast. |
subject | string | Yes | Subject line for this variant. |
html_body | string | No | HTML body override. |
text_body | string | No | Plain-text body override. |
weight | integer | No | Relative send weight (1 or higher). Defaults to 1. |
Variant response:
PATCH accepts the same fields, all optional. DELETE returns 204 No Content.
Errors
| Status | Cause |
|---|---|
401 Unauthorized | Missing or invalid authentication. |
404 Not Found | Broadcast or variant ID does not exist. |
409 Conflict | Invalid status transition, or a variant label already exists. |
422 Unprocessable Entity | Validation failed, e.g. no contact list, empty list, inactive sender address, or invalid status filter. |