curl --request POST \
--url https://api.kit.com/v4/broadcasts \
--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": null,
"thumbnail_alt": null,
"thumbnail_url": null,
"preview_text": "Pleased to meet you!",
"subject": "Hello!",
"subscriber_filter": [
{
"all": [
{
"type": "segment",
"ids": [
18
]
}
],
"any": null,
"none": null
}
]
}
'require 'uri'
require 'net/http'
url = URI("https://api.kit.com/v4/broadcasts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.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\": null,\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 18\n ]\n }\n ],\n \"any\": null,\n \"none\": null\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyconst options = {
method: 'POST',
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: null,
thumbnail_alt: null,
thumbnail_url: null,
preview_text: 'Pleased to meet you!',
subject: 'Hello!',
subscriber_filter: [{all: [{type: 'segment', ids: [18]}], any: null, none: null}]
})
};
fetch('https://api.kit.com/v4/broadcasts', 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"
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\": null,\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 18\n ]\n }\n ],\n \"any\": null,\n \"none\": null\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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' => null,
'thumbnail_alt' => null,
'thumbnail_url' => null,
'preview_text' => 'Pleased to meet you!',
'subject' => 'Hello!',
'subscriber_filter' => [
[
'all' => [
[
'type' => 'segment',
'ids' => [
18
]
]
],
'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"
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": None,
"thumbnail_alt": None,
"thumbnail_url": None,
"preview_text": "Pleased to meet you!",
"subject": "Hello!",
"subscriber_filter": [
{
"all": [
{
"type": "segment",
"ids": [18]
}
],
"any": None,
"none": None
}
]
}
headers = {
"X-Kit-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"broadcast": {
"id": 64,
"publication_id": 55,
"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": null,
"thumbnail_alt": null,
"thumbnail_url": null,
"public_url": "https://kit-greetings.kit.com/posts/",
"email_address": "greetings@kit.dev",
"email_template": {
"id": 2,
"name": "Classic"
},
"subscriber_filter": [
{
"all": [
{
"type": "segment",
"ids": [
18
]
}
]
}
],
"status": "draft"
}
}{
"errors": [
"The access token is invalid"
]
}{
"errors": [
"You do not have sufficient permissions to access this resource. Please contact support."
]
}{
"errors": [
"Email template not found",
"Only a single filter group is supported. Use one of `all`, `any`, or `none`."
]
}Create a broadcast
Draft or schedule to send a broadcast to all or a subset of your subscribers.
To save a draft, set send_at to null.
To publish to the web, set public to true.
To schedule the broadcast for sending, provide a send_at timestamp. 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 POST \
--url https://api.kit.com/v4/broadcasts \
--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": null,
"thumbnail_alt": null,
"thumbnail_url": null,
"preview_text": "Pleased to meet you!",
"subject": "Hello!",
"subscriber_filter": [
{
"all": [
{
"type": "segment",
"ids": [
18
]
}
],
"any": null,
"none": null
}
]
}
'require 'uri'
require 'net/http'
url = URI("https://api.kit.com/v4/broadcasts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.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\": null,\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 18\n ]\n }\n ],\n \"any\": null,\n \"none\": null\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyconst options = {
method: 'POST',
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: null,
thumbnail_alt: null,
thumbnail_url: null,
preview_text: 'Pleased to meet you!',
subject: 'Hello!',
subscriber_filter: [{all: [{type: 'segment', ids: [18]}], any: null, none: null}]
})
};
fetch('https://api.kit.com/v4/broadcasts', 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"
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\": null,\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 18\n ]\n }\n ],\n \"any\": null,\n \"none\": null\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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' => null,
'thumbnail_alt' => null,
'thumbnail_url' => null,
'preview_text' => 'Pleased to meet you!',
'subject' => 'Hello!',
'subscriber_filter' => [
[
'all' => [
[
'type' => 'segment',
'ids' => [
18
]
]
],
'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"
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": None,
"thumbnail_alt": None,
"thumbnail_url": None,
"preview_text": "Pleased to meet you!",
"subject": "Hello!",
"subscriber_filter": [
{
"all": [
{
"type": "segment",
"ids": [18]
}
],
"any": None,
"none": None
}
]
}
headers = {
"X-Kit-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"broadcast": {
"id": 64,
"publication_id": 55,
"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": null,
"thumbnail_alt": null,
"thumbnail_url": null,
"public_url": "https://kit-greetings.kit.com/posts/",
"email_address": "greetings@kit.dev",
"email_template": {
"id": 2,
"name": "Classic"
},
"subscriber_filter": [
{
"all": [
{
"type": "segment",
"ids": [
18
]
}
]
}
],
"status": "draft"
}
}{
"errors": [
"The access token is invalid"
]
}{
"errors": [
"You do not have sufficient permissions to access this resource. Please contact support."
]
}{
"errors": [
"Email template not found",
"Only a single filter group is supported. Use one of `all`, `any`, or `none`."
]
}Authorizations
Authenticate API requests via an API Key
Body
The HTML content of the email.
true to publish this broadcast to the web. The broadcast will appear in a newsletter feed on your Creator Profile and Landing Pages.
The published timestamp to display in ISO8601 format. If no timezone is provided, UTC is assumed.
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.
Show child attributes
Show child attributes
Id of the email template to use. Uses the account's default template if not provided. 'Starting point' template is not supported.
The sending email address to use. Uses the account's sending email address if not provided.
The scheduled send time for this broadcast in ISO8601 format. If no timezone is provided, UTC is assumed.
Response
Creates a new broadcast
Show child attributes
Show child attributes
Was this page helpful?