Campaigns
Create Campaign
Create a new email marketing campaign with sender, template, recipient lists, and scheduling options via the AutoSend API.
POST
/
campaigns
curl --request POST \
--url 'https://api.autosend.com/v1/campaigns' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Spring Sale Newsletter",
"subject": "Don'\''t miss our Spring Sale!",
"previewText": "Up to 50% off this weekend only",
"from": {
"email": "hello@example.com",
"name": "Example Team"
},
"replyTo": "support@example.com",
"templateId": "60d5ec49f1b2c72d9c8b1234",
"toLists": ["60d5ec49f1b2c72d9c8b0001"],
"sendMode": "immediate",
"publish": true,
"sendNow": true,
"trackingClick": true,
"trackingOpen": true
}'
import requests
url = "https://api.autosend.com/v1/campaigns"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
payload = {
"name": "Spring Sale Newsletter",
"subject": "Don't miss our Spring Sale!",
"previewText": "Up to 50% off this weekend only",
"from": {
"email": "hello@example.com",
"name": "Example Team"
},
"replyTo": "support@example.com",
"templateId": "60d5ec49f1b2c72d9c8b1234",
"toLists": ["60d5ec49f1b2c72d9c8b0001"],
"sendMode": "immediate",
"publish": True,
"sendNow": True,
"trackingClick": True,
"trackingOpen": True
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch('https://api.autosend.com/v1/campaigns', {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Spring Sale Newsletter',
subject: "Don't miss our Spring Sale!",
previewText: 'Up to 50% off this weekend only',
from: {
email: 'hello@example.com',
name: 'Example Team',
},
replyTo: 'support@example.com',
templateId: '60d5ec49f1b2c72d9c8b1234',
toLists: ['60d5ec49f1b2c72d9c8b0001'],
sendMode: 'immediate',
publish: true,
sendNow: true,
trackingClick: true,
trackingOpen: true,
}),
});
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.autosend.com/v1/campaigns',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Spring Sale Newsletter',
'subject' => "Don't miss our Spring Sale!",
'previewText' => 'Up to 50% off this weekend only',
'from' => [
'email' => 'hello@example.com',
'name' => 'Example Team',
],
'replyTo' => 'support@example.com',
'templateId' => '60d5ec49f1b2c72d9c8b1234',
'toLists' => ['60d5ec49f1b2c72d9c8b0001'],
'sendMode' => 'immediate',
'publish' => true,
'sendNow' => true,
'trackingClick' => true,
'trackingOpen' => true,
]),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer <token>',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload := map[string]interface{}{
"name": "Spring Sale Newsletter",
"subject": "Don't miss our Spring Sale!",
"previewText": "Up to 50% off this weekend only",
"from": map[string]string{
"email": "hello@example.com",
"name": "Example Team",
},
"replyTo": "support@example.com",
"templateId": "60d5ec49f1b2c72d9c8b1234",
"toLists": []string{"60d5ec49f1b2c72d9c8b0001"},
"sendMode": "immediate",
"publish": true,
"sendNow": true,
"trackingClick": true,
"trackingOpen": true,
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.autosend.com/v1/campaigns", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
respBody, _ := io.ReadAll(resp.Body)
fmt.Println(string(respBody))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String body = """
{
"name": "Spring Sale Newsletter",
"subject": "Don't miss our Spring Sale!",
"previewText": "Up to 50% off this weekend only",
"from": { "email": "hello@example.com", "name": "Example Team" },
"replyTo": "support@example.com",
"templateId": "60d5ec49f1b2c72d9c8b1234",
"toLists": ["60d5ec49f1b2c72d9c8b0001"],
"sendMode": "immediate",
"publish": true,
"sendNow": true,
"trackingClick": true,
"trackingOpen": true
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.autosend.com/v1/campaigns"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://api.autosend.com/v1/campaigns')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer <token>'
request['Content-Type'] = 'application/json'
request.body = {
name: 'Spring Sale Newsletter',
subject: "Don't miss our Spring Sale!",
previewText: 'Up to 50% off this weekend only',
from: { email: 'hello@example.com', name: 'Example Team' },
replyTo: 'support@example.com',
templateId: '60d5ec49f1b2c72d9c8b1234',
toLists: ['60d5ec49f1b2c72d9c8b0001'],
sendMode: 'immediate',
publish: true,
sendNow: true,
trackingClick: true,
trackingOpen: true
}.to_json
response = http.request(request)
puts JSON.parse(response.body)
{
"success": true,
"data": {
"id": "69d348dd0351e0c32be90342",
"name": "Spring Sale Newsletter",
"subject": "Don't miss our Spring Sale!",
"previewText": "Up to 50% off this weekend only",
"status": "scheduled",
"sendMode": "immediate",
"from": {
"email": "hello@example.com",
"name": "Example Team"
},
"replyTo": "support@example.com",
"templateId": "A-280fa451a7ca5cc17513",
"toLists": [
{
"id": "696e1158fbfc515799175f02",
"name": "seg list",
"type": "list",
"contactCount": 3
}
],
"excludeLists": [],
"sendNow": true,
"sendToGlobalList": false,
"metrics": {
"sent": 0,
"delivered": 0,
"opened": 0,
"suppressed": 0,
"clicked": 0,
"bounced": 0,
"unsubscribed": 0,
"spamReported": 0,
"processedCount": 0,
"totalContacts": 0,
"failedCount": 0
},
"trackingClick": true,
"trackingOpen": true,
"source": "api",
"createdAt": "2026-04-06T05:47:09.523Z",
"updatedAt": "2026-04-06T05:52:38.949Z"
},
"message": "Campaign updated successfully"
}
curl --request POST \
--url 'https://api.autosend.com/v1/campaigns' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Spring Sale Newsletter",
"subject": "Don'\''t miss our Spring Sale!",
"previewText": "Up to 50% off this weekend only",
"from": {
"email": "hello@example.com",
"name": "Example Team"
},
"replyTo": "support@example.com",
"templateId": "60d5ec49f1b2c72d9c8b1234",
"toLists": ["60d5ec49f1b2c72d9c8b0001"],
"sendMode": "immediate",
"publish": true,
"sendNow": true,
"trackingClick": true,
"trackingOpen": true
}'
import requests
url = "https://api.autosend.com/v1/campaigns"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
payload = {
"name": "Spring Sale Newsletter",
"subject": "Don't miss our Spring Sale!",
"previewText": "Up to 50% off this weekend only",
"from": {
"email": "hello@example.com",
"name": "Example Team"
},
"replyTo": "support@example.com",
"templateId": "60d5ec49f1b2c72d9c8b1234",
"toLists": ["60d5ec49f1b2c72d9c8b0001"],
"sendMode": "immediate",
"publish": True,
"sendNow": True,
"trackingClick": True,
"trackingOpen": True
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch('https://api.autosend.com/v1/campaigns', {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Spring Sale Newsletter',
subject: "Don't miss our Spring Sale!",
previewText: 'Up to 50% off this weekend only',
from: {
email: 'hello@example.com',
name: 'Example Team',
},
replyTo: 'support@example.com',
templateId: '60d5ec49f1b2c72d9c8b1234',
toLists: ['60d5ec49f1b2c72d9c8b0001'],
sendMode: 'immediate',
publish: true,
sendNow: true,
trackingClick: true,
trackingOpen: true,
}),
});
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.autosend.com/v1/campaigns',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Spring Sale Newsletter',
'subject' => "Don't miss our Spring Sale!",
'previewText' => 'Up to 50% off this weekend only',
'from' => [
'email' => 'hello@example.com',
'name' => 'Example Team',
],
'replyTo' => 'support@example.com',
'templateId' => '60d5ec49f1b2c72d9c8b1234',
'toLists' => ['60d5ec49f1b2c72d9c8b0001'],
'sendMode' => 'immediate',
'publish' => true,
'sendNow' => true,
'trackingClick' => true,
'trackingOpen' => true,
]),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer <token>',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload := map[string]interface{}{
"name": "Spring Sale Newsletter",
"subject": "Don't miss our Spring Sale!",
"previewText": "Up to 50% off this weekend only",
"from": map[string]string{
"email": "hello@example.com",
"name": "Example Team",
},
"replyTo": "support@example.com",
"templateId": "60d5ec49f1b2c72d9c8b1234",
"toLists": []string{"60d5ec49f1b2c72d9c8b0001"},
"sendMode": "immediate",
"publish": true,
"sendNow": true,
"trackingClick": true,
"trackingOpen": true,
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.autosend.com/v1/campaigns", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
respBody, _ := io.ReadAll(resp.Body)
fmt.Println(string(respBody))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String body = """
{
"name": "Spring Sale Newsletter",
"subject": "Don't miss our Spring Sale!",
"previewText": "Up to 50% off this weekend only",
"from": { "email": "hello@example.com", "name": "Example Team" },
"replyTo": "support@example.com",
"templateId": "60d5ec49f1b2c72d9c8b1234",
"toLists": ["60d5ec49f1b2c72d9c8b0001"],
"sendMode": "immediate",
"publish": true,
"sendNow": true,
"trackingClick": true,
"trackingOpen": true
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.autosend.com/v1/campaigns"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://api.autosend.com/v1/campaigns')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer <token>'
request['Content-Type'] = 'application/json'
request.body = {
name: 'Spring Sale Newsletter',
subject: "Don't miss our Spring Sale!",
previewText: 'Up to 50% off this weekend only',
from: { email: 'hello@example.com', name: 'Example Team' },
replyTo: 'support@example.com',
templateId: '60d5ec49f1b2c72d9c8b1234',
toLists: ['60d5ec49f1b2c72d9c8b0001'],
sendMode: 'immediate',
publish: true,
sendNow: true,
trackingClick: true,
trackingOpen: true
}.to_json
response = http.request(request)
puts JSON.parse(response.body)
{
"success": true,
"data": {
"id": "69d348dd0351e0c32be90342",
"name": "Spring Sale Newsletter",
"subject": "Don't miss our Spring Sale!",
"previewText": "Up to 50% off this weekend only",
"status": "scheduled",
"sendMode": "immediate",
"from": {
"email": "hello@example.com",
"name": "Example Team"
},
"replyTo": "support@example.com",
"templateId": "A-280fa451a7ca5cc17513",
"toLists": [
{
"id": "696e1158fbfc515799175f02",
"name": "seg list",
"type": "list",
"contactCount": 3
}
],
"excludeLists": [],
"sendNow": true,
"sendToGlobalList": false,
"metrics": {
"sent": 0,
"delivered": 0,
"opened": 0,
"suppressed": 0,
"clicked": 0,
"bounced": 0,
"unsubscribed": 0,
"spamReported": 0,
"processedCount": 0,
"totalContacts": 0,
"failedCount": 0
},
"trackingClick": true,
"trackingOpen": true,
"source": "api",
"createdAt": "2026-04-06T05:47:09.523Z",
"updatedAt": "2026-04-06T05:52:38.949Z"
},
"message": "Campaign updated successfully"
}
Authorizations
Bearer authentication header of the form Bearer
<token>, where <token> is your auth token.Body
ID of the email template to use for this campaign. The template can be created via the Template API. Either
templateId or htmlTemplate is required.Raw HTML content to use as the campaign email body. Either
htmlTemplate or templateId is required. If both are provided, htmlTemplate takes precedence and the template referenced by templateId will be updated with the provided HTML content.Growth strategy for gradual sending. One of:
fixed, 1.25x, 1.5x, 1.75x, 2x. Required when sendMode is gradual.Response
Returns the newly created campaign object.The created campaign object.
Show data
Show data
Was this page helpful?
⌘I
curl --request POST \
--url 'https://api.autosend.com/v1/campaigns' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Spring Sale Newsletter",
"subject": "Don'\''t miss our Spring Sale!",
"previewText": "Up to 50% off this weekend only",
"from": {
"email": "hello@example.com",
"name": "Example Team"
},
"replyTo": "support@example.com",
"templateId": "60d5ec49f1b2c72d9c8b1234",
"toLists": ["60d5ec49f1b2c72d9c8b0001"],
"sendMode": "immediate",
"publish": true,
"sendNow": true,
"trackingClick": true,
"trackingOpen": true
}'
import requests
url = "https://api.autosend.com/v1/campaigns"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
payload = {
"name": "Spring Sale Newsletter",
"subject": "Don't miss our Spring Sale!",
"previewText": "Up to 50% off this weekend only",
"from": {
"email": "hello@example.com",
"name": "Example Team"
},
"replyTo": "support@example.com",
"templateId": "60d5ec49f1b2c72d9c8b1234",
"toLists": ["60d5ec49f1b2c72d9c8b0001"],
"sendMode": "immediate",
"publish": True,
"sendNow": True,
"trackingClick": True,
"trackingOpen": True
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch('https://api.autosend.com/v1/campaigns', {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Spring Sale Newsletter',
subject: "Don't miss our Spring Sale!",
previewText: 'Up to 50% off this weekend only',
from: {
email: 'hello@example.com',
name: 'Example Team',
},
replyTo: 'support@example.com',
templateId: '60d5ec49f1b2c72d9c8b1234',
toLists: ['60d5ec49f1b2c72d9c8b0001'],
sendMode: 'immediate',
publish: true,
sendNow: true,
trackingClick: true,
trackingOpen: true,
}),
});
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.autosend.com/v1/campaigns',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Spring Sale Newsletter',
'subject' => "Don't miss our Spring Sale!",
'previewText' => 'Up to 50% off this weekend only',
'from' => [
'email' => 'hello@example.com',
'name' => 'Example Team',
],
'replyTo' => 'support@example.com',
'templateId' => '60d5ec49f1b2c72d9c8b1234',
'toLists' => ['60d5ec49f1b2c72d9c8b0001'],
'sendMode' => 'immediate',
'publish' => true,
'sendNow' => true,
'trackingClick' => true,
'trackingOpen' => true,
]),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer <token>',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload := map[string]interface{}{
"name": "Spring Sale Newsletter",
"subject": "Don't miss our Spring Sale!",
"previewText": "Up to 50% off this weekend only",
"from": map[string]string{
"email": "hello@example.com",
"name": "Example Team",
},
"replyTo": "support@example.com",
"templateId": "60d5ec49f1b2c72d9c8b1234",
"toLists": []string{"60d5ec49f1b2c72d9c8b0001"},
"sendMode": "immediate",
"publish": true,
"sendNow": true,
"trackingClick": true,
"trackingOpen": true,
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.autosend.com/v1/campaigns", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
respBody, _ := io.ReadAll(resp.Body)
fmt.Println(string(respBody))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String body = """
{
"name": "Spring Sale Newsletter",
"subject": "Don't miss our Spring Sale!",
"previewText": "Up to 50% off this weekend only",
"from": { "email": "hello@example.com", "name": "Example Team" },
"replyTo": "support@example.com",
"templateId": "60d5ec49f1b2c72d9c8b1234",
"toLists": ["60d5ec49f1b2c72d9c8b0001"],
"sendMode": "immediate",
"publish": true,
"sendNow": true,
"trackingClick": true,
"trackingOpen": true
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.autosend.com/v1/campaigns"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://api.autosend.com/v1/campaigns')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer <token>'
request['Content-Type'] = 'application/json'
request.body = {
name: 'Spring Sale Newsletter',
subject: "Don't miss our Spring Sale!",
previewText: 'Up to 50% off this weekend only',
from: { email: 'hello@example.com', name: 'Example Team' },
replyTo: 'support@example.com',
templateId: '60d5ec49f1b2c72d9c8b1234',
toLists: ['60d5ec49f1b2c72d9c8b0001'],
sendMode: 'immediate',
publish: true,
sendNow: true,
trackingClick: true,
trackingOpen: true
}.to_json
response = http.request(request)
puts JSON.parse(response.body)
{
"success": true,
"data": {
"id": "69d348dd0351e0c32be90342",
"name": "Spring Sale Newsletter",
"subject": "Don't miss our Spring Sale!",
"previewText": "Up to 50% off this weekend only",
"status": "scheduled",
"sendMode": "immediate",
"from": {
"email": "hello@example.com",
"name": "Example Team"
},
"replyTo": "support@example.com",
"templateId": "A-280fa451a7ca5cc17513",
"toLists": [
{
"id": "696e1158fbfc515799175f02",
"name": "seg list",
"type": "list",
"contactCount": 3
}
],
"excludeLists": [],
"sendNow": true,
"sendToGlobalList": false,
"metrics": {
"sent": 0,
"delivered": 0,
"opened": 0,
"suppressed": 0,
"clicked": 0,
"bounced": 0,
"unsubscribed": 0,
"spamReported": 0,
"processedCount": 0,
"totalContacts": 0,
"failedCount": 0
},
"trackingClick": true,
"trackingOpen": true,
"source": "api",
"createdAt": "2026-04-06T05:47:09.523Z",
"updatedAt": "2026-04-06T05:52:38.949Z"
},
"message": "Campaign updated successfully"
}