curl --request PUT \
--url https://api.kit.com/v4/broadcasts/{id} \
--header 'Content-Type: application/json' \
--header 'X-Kit-Api-Key: <api-key>' \
--data '
{
"email_template_id": 2,
"email_address": null,
"content": "<p>Let me introduce myself</p>",
"description": "Intro email",
"public": true,
"published_at": "2023-02-17T11:43:55+00:00",
"send_at": "2023-02-17T11:43:55+00:00",
"thumbnail_alt": null,
"thumbnail_url": null,
"preview_text": "Pleased to meet you!",
"subject": "Hello!",
"subscriber_filter": [
{
"all": [
{
"type": "segment",
"ids": [
6
]
}
],
"any": null,
"none": null
}
]
}
'require 'uri'
require 'net/http'
url = URI("https://api.kit.com/v4/broadcasts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Kit-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email_template_id\": 2,\n \"email_address\": null,\n \"content\": \"<p>Let me introduce myself</p>\",\n \"description\": \"Intro email\",\n \"public\": true,\n \"published_at\": \"2023-02-17T11:43:55+00:00\",\n \"send_at\": \"2023-02-17T11:43:55+00:00\",\n \"thumbnail_alt\": null,\n \"thumbnail_url\": null,\n \"preview_text\": \"Pleased to meet you!\",\n \"subject\": \"Hello!\",\n \"subscriber_filter\": [\n {\n \"all\": [\n {\n \"type\": \"segment\",\n \"ids\": [\n 6\n ]\n }\n ],\n \"any\": null,\n \"none\": null\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyconst options = {
method: 'PUT',
headers: {'X-Kit-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email_template_id: 2,
email_address: null,
content: '<p>Let me introduce myself</p>',
description: 'Intro email',
public: true,
published_at: '2023-02-17T11:43:55+00:00',
send_at: '2023-02-17T11:43:55+00:00',
thumbnail_alt: null,
thumbnail_url: null,
preview_text: 'Pleased to meet you!',
subject: 'Hello!',
subscriber_filter: [{all: [{type: 'segment', ids: [6]}], any: null, none: null}]
})
};
fetch('https://api.kit.com/v4/broadcasts/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kit.com/v4/broadcasts/{id}"
payload := strings.NewReader("{\n \"email_template_id\": 2,\n \"email_address\": null,\n \"content\": \"<p>Let me introduce myself</p>\",\n \"description\": \"Intro email\",\n \"public\": true,\n \"published_at\": \"2023-02-17T11:43:55+00:00\",\n \"send_at\": \"2023-02-17T11:43:55+00:00\",\n \"thumbnail_alt\": null,\n \"thumbnail_url\": null,\n \"preview_text\": \"Pleased to meet you!\",\n \"subject\": \"Hello!\",\n \"subscriber_filter\": [\n {\n \"all\": [\n {\n \"type\": \"segment\",\n \"ids\": [\n 6\n ]\n }\n ],\n \"any\": null,\n \"none\": null\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Kit-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kit.com/v4/broadcasts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'email_template_id' => 2,
'email_address' => null,
'content' => '<p>Let me introduce myself</p>',
'description' => 'Intro email',
'public' => true,
'published_at' => '2023-02-17T11:43:55+00:00',
'send_at' => '2023-02-17T11:43:55+00:00',
'thumbnail_alt' => null,
'thumbnail_url' => null,
'preview_text' => 'Pleased to meet you!',
'subject' => 'Hello!',
'subscriber_filter' => [
[
'all' => [
[
'type' => 'segment',
'ids' => [
6
]
]
],
'any' => null,
'none' => null
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Kit-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://api.kit.com/v4/broadcasts/{id}"
payload = {
"email_template_id": 2,
"email_address": None,
"content": "<p>Let me introduce myself</p>",
"description": "Intro email",
"public": True,
"published_at": "2023-02-17T11:43:55+00:00",
"send_at": "2023-02-17T11:43:55+00:00",
"thumbnail_alt": None,
"thumbnail_url": None,
"preview_text": "Pleased to meet you!",
"subject": "Hello!",
"subscriber_filter": [
{
"all": [
{
"type": "segment",
"ids": [6]
}
],
"any": None,
"none": None
}
]
}
headers = {
"X-Kit-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"broadcast": {
"id": 9,
"publication_id": 9,
"created_at": "2023-02-17T11:43:55Z",
"subject": "Hello!",
"preview_text": "Pleased to meet you!",
"description": "Intro email",
"content": "<p>Let me introduce myself</p>",
"public": true,
"published_at": "2023-02-17T11:43:55Z",
"send_at": "2023-02-17T11:43:55Z",
"thumbnail_alt": null,
"thumbnail_url": null,
"public_url": null,
"email_address": "greetings@kit.dev",
"email_template": {
"id": 2,
"name": "Classic"
},
"subscriber_filter": [
{
"all": [
{
"type": "segment",
"ids": [
6
]
}
]
}
],
"status": "sending",
"ab_test": null
}
}{
"errors": [
"The access token is invalid"
]
}{
"errors": [
"You do not have sufficient permissions to access this resource. Please contact support."
]
}{
"errors": [
"Not Found"
]
}{
"errors": [
"<string>"
]
}{
"errors": [
"Email template not found",
"Only a single filter group is supported. Use one of `all`, `any`, or `none`."
]
}{
"errors": [
"Could not work out what switching to this email template would do to the broadcast's content. Nothing was changed; please retry."
]
}Update a broadcast
Update an existing broadcast. Continue to draft or schedule to send a broadcast to all or a subset of your subscribers.
To save a draft, set public to false.
To schedule the broadcast for sending, set public to true and provide send_at. Scheduled broadcasts should contain a subject and your content, at a minimum.
We currently support targeting your subscribers based on segment or tag ids.
curl --request PUT \
--url https://api.kit.com/v4/broadcasts/{id} \
--header 'Content-Type: application/json' \
--header 'X-Kit-Api-Key: <api-key>' \
--data '
{
"email_template_id": 2,
"email_address": null,
"content": "<p>Let me introduce myself</p>",
"description": "Intro email",
"public": true,
"published_at": "2023-02-17T11:43:55+00:00",
"send_at": "2023-02-17T11:43:55+00:00",
"thumbnail_alt": null,
"thumbnail_url": null,
"preview_text": "Pleased to meet you!",
"subject": "Hello!",
"subscriber_filter": [
{
"all": [
{
"type": "segment",
"ids": [
6
]
}
],
"any": null,
"none": null
}
]
}
'require 'uri'
require 'net/http'
url = URI("https://api.kit.com/v4/broadcasts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Kit-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email_template_id\": 2,\n \"email_address\": null,\n \"content\": \"<p>Let me introduce myself</p>\",\n \"description\": \"Intro email\",\n \"public\": true,\n \"published_at\": \"2023-02-17T11:43:55+00:00\",\n \"send_at\": \"2023-02-17T11:43:55+00:00\",\n \"thumbnail_alt\": null,\n \"thumbnail_url\": null,\n \"preview_text\": \"Pleased to meet you!\",\n \"subject\": \"Hello!\",\n \"subscriber_filter\": [\n {\n \"all\": [\n {\n \"type\": \"segment\",\n \"ids\": [\n 6\n ]\n }\n ],\n \"any\": null,\n \"none\": null\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyconst options = {
method: 'PUT',
headers: {'X-Kit-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email_template_id: 2,
email_address: null,
content: '<p>Let me introduce myself</p>',
description: 'Intro email',
public: true,
published_at: '2023-02-17T11:43:55+00:00',
send_at: '2023-02-17T11:43:55+00:00',
thumbnail_alt: null,
thumbnail_url: null,
preview_text: 'Pleased to meet you!',
subject: 'Hello!',
subscriber_filter: [{all: [{type: 'segment', ids: [6]}], any: null, none: null}]
})
};
fetch('https://api.kit.com/v4/broadcasts/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kit.com/v4/broadcasts/{id}"
payload := strings.NewReader("{\n \"email_template_id\": 2,\n \"email_address\": null,\n \"content\": \"<p>Let me introduce myself</p>\",\n \"description\": \"Intro email\",\n \"public\": true,\n \"published_at\": \"2023-02-17T11:43:55+00:00\",\n \"send_at\": \"2023-02-17T11:43:55+00:00\",\n \"thumbnail_alt\": null,\n \"thumbnail_url\": null,\n \"preview_text\": \"Pleased to meet you!\",\n \"subject\": \"Hello!\",\n \"subscriber_filter\": [\n {\n \"all\": [\n {\n \"type\": \"segment\",\n \"ids\": [\n 6\n ]\n }\n ],\n \"any\": null,\n \"none\": null\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Kit-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kit.com/v4/broadcasts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'email_template_id' => 2,
'email_address' => null,
'content' => '<p>Let me introduce myself</p>',
'description' => 'Intro email',
'public' => true,
'published_at' => '2023-02-17T11:43:55+00:00',
'send_at' => '2023-02-17T11:43:55+00:00',
'thumbnail_alt' => null,
'thumbnail_url' => null,
'preview_text' => 'Pleased to meet you!',
'subject' => 'Hello!',
'subscriber_filter' => [
[
'all' => [
[
'type' => 'segment',
'ids' => [
6
]
]
],
'any' => null,
'none' => null
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Kit-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://api.kit.com/v4/broadcasts/{id}"
payload = {
"email_template_id": 2,
"email_address": None,
"content": "<p>Let me introduce myself</p>",
"description": "Intro email",
"public": True,
"published_at": "2023-02-17T11:43:55+00:00",
"send_at": "2023-02-17T11:43:55+00:00",
"thumbnail_alt": None,
"thumbnail_url": None,
"preview_text": "Pleased to meet you!",
"subject": "Hello!",
"subscriber_filter": [
{
"all": [
{
"type": "segment",
"ids": [6]
}
],
"any": None,
"none": None
}
]
}
headers = {
"X-Kit-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"broadcast": {
"id": 9,
"publication_id": 9,
"created_at": "2023-02-17T11:43:55Z",
"subject": "Hello!",
"preview_text": "Pleased to meet you!",
"description": "Intro email",
"content": "<p>Let me introduce myself</p>",
"public": true,
"published_at": "2023-02-17T11:43:55Z",
"send_at": "2023-02-17T11:43:55Z",
"thumbnail_alt": null,
"thumbnail_url": null,
"public_url": null,
"email_address": "greetings@kit.dev",
"email_template": {
"id": 2,
"name": "Classic"
},
"subscriber_filter": [
{
"all": [
{
"type": "segment",
"ids": [
6
]
}
]
}
],
"status": "sending",
"ab_test": null
}
}{
"errors": [
"The access token is invalid"
]
}{
"errors": [
"You do not have sufficient permissions to access this resource. Please contact support."
]
}{
"errors": [
"Not Found"
]
}{
"errors": [
"<string>"
]
}{
"errors": [
"Email template not found",
"Only a single filter group is supported. Use one of `all`, `any`, or `none`."
]
}{
"errors": [
"Could not work out what switching to this email template would do to the broadcast's content. Nothing was changed; please retry."
]
}Authorizations
Body
Id of the email template to use for the broadcast's layout and design. Leave it out or send null to keep the current template. Changing it without sending content applies the new template's design to the broadcast. When that would discard the broadcast's existing content, or overwrite unsaved edits open in Kit's editor, the request returns a 409 unless you also send allow_content_loss: true. Send content in the same request to keep your own content instead. The template of a broadcast running a content A/B test can't be changed through the API.
The HTML content of the email. On a Classic template this is the body, and the template adds the design around it when the broadcast is sent. On a Starting point template the design lives in the body, so this is the complete email: keep the wrappers, images, inline styles and Liquid tags, including {{ unsubscribe_url }} and {{ address }}. Without an unsubscribe link the broadcast can't be sent.
A read returns the string that was written, so GET, PUT, GET round-trips, apart from Kit's own "Built with Kit" badge, which a Starting point write takes out of the body and re-applies when the email renders. A broadcast built in Kit's editor reads back as Kit's rendered HTML instead, and writing that back replaces its individually-editable blocks with one HTML block. Sending content in the same request as a Starting point email_template_id shapes that content into the template's design.
Filters your subscribers. At this time, we only support using only one filter group type via the API (e.g. all, any, or none but no combinations). If nothing is provided, will default to all of your subscribers. Each entry matches subscribers in any of its ids. To require several tags or segments under all, send one entry for each, for example [{ "all": [{ "type": "tag", "ids": [1] }, { "type": "tag", "ids": [2] }] }].
Show child attributes
Show child attributes
Was this page helpful?