Skip to content

Update a broadcast

Edit a draft broadcast before it goes out.

http
PATCH /v1/broadcasts/{id}

Requires a Full access API key — a broadcast reaches your audience, so a sending key embedded in an app cannot edit one.

Path parameters

ParameterTypeRequiredDescription
idstringYesThe broadcast id.

Body parameters

Every field is optional — send only what you want to change.

ParameterTypeDescription
fromstringThe sender address. Max 320 characters.
subjectstringThe subject line. Max 998 characters.
segment_idstring | nullReplaces the target segment. Pass null to target your whole audience.
topic_idstring | nullThe topic to scope the send to, or null to clear it.
htmlstring | nullThe HTML body. Contact properties render here — e.g. {{{contact.first_name}}}.
textstring | nullA plain-text part. If omitted, plain text is derived from the html at send time.
preview_textstring | nullInbox preview text. Max 255 characters.
reply_tostring | nullA reply-to address. Max 320 characters.
namestring | nullA friendly name. Max 160 characters.

Example

bash
curl -X PATCH "https://api.sendgrail.com/v1/broadcasts/$BROADCAST_ID" \
  -H "Authorization: Bearer $SENDGRAIL_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "subject": "What shipped this month (updated)",
    "segment_id": "0a7d3c14-9b52-4e88-8f61-2d5a6c9b1e07"
  }'
js
const res = await fetch(
  `https://api.sendgrail.com/v1/broadcasts/${id}`,
  {
    method: 'PATCH',
    headers: {
      Authorization: `Bearer ${process.env.SENDGRAIL_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      subject: 'What shipped this month (updated)',
      segment_id: '0a7d3c14-9b52-4e88-8f61-2d5a6c9b1e07',
    }),
  },
);

const broadcast = await res.json();

Passing segment_id replaces the target — the broadcast now goes to that segment, and only that segment.

Response

json
{
  "id": "e4f9a2c1-7b83-4d6e-9a1f-2c5b8e0d3a47"
}

Only a draft can be edited

Update applies only to a broadcast still in draft. One that has been sent or scheduled answers 409 broadcast_not_editable:

json
{
  "message": "Only a draft broadcast can be edited.",
  "code": "broadcast_not_editable",
  "request_id": "8f2c1e64-1b17-4f8c-9f0e-3b6c1e0f5c31"
}

To edit a broadcast that is already scheduled, cancel the send first — deleting a scheduled broadcast cancels it in the dashboard — then recreate or re-edit the draft.

Unknown segment or topic

A segment_id or topic_id that doesn't belong to your team answers 404. See Errors for the full list of codes.

Transactional email on your own domain.