Campaigns
Create campaign
POST
/
v1
/
campaigns
cURL
curl --request POST \
--url https://app.usesend.com/api/v1/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"from": "<string>",
"subject": "<string>",
"contactBookId": "<string>",
"previewText": "<string>",
"content": "<string>",
"html": "<string>",
"replyTo": "<string>",
"cc": "<string>",
"bcc": "<string>",
"sendNow": true,
"scheduledAt": "<string>",
"batchSize": 50000
}
'import requests
url = "https://app.usesend.com/api/v1/campaigns"
payload = {
"name": "<string>",
"from": "<string>",
"subject": "<string>",
"contactBookId": "<string>",
"previewText": "<string>",
"content": "<string>",
"html": "<string>",
"replyTo": "<string>",
"cc": "<string>",
"bcc": "<string>",
"sendNow": True,
"scheduledAt": "<string>",
"batchSize": 50000
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
from: '<string>',
subject: '<string>',
contactBookId: '<string>',
previewText: '<string>',
content: '<string>',
html: '<string>',
replyTo: '<string>',
cc: '<string>',
bcc: '<string>',
sendNow: true,
scheduledAt: '<string>',
batchSize: 50000
})
};
fetch('https://app.usesend.com/api/v1/campaigns', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.usesend.com/api/v1/campaigns",
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([
'name' => '<string>',
'from' => '<string>',
'subject' => '<string>',
'contactBookId' => '<string>',
'previewText' => '<string>',
'content' => '<string>',
'html' => '<string>',
'replyTo' => '<string>',
'cc' => '<string>',
'bcc' => '<string>',
'sendNow' => true,
'scheduledAt' => '<string>',
'batchSize' => 50000
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.usesend.com/api/v1/campaigns"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"from\": \"<string>\",\n \"subject\": \"<string>\",\n \"contactBookId\": \"<string>\",\n \"previewText\": \"<string>\",\n \"content\": \"<string>\",\n \"html\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"cc\": \"<string>\",\n \"bcc\": \"<string>\",\n \"sendNow\": true,\n \"scheduledAt\": \"<string>\",\n \"batchSize\": 50000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.post("https://app.usesend.com/api/v1/campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"from\": \"<string>\",\n \"subject\": \"<string>\",\n \"contactBookId\": \"<string>\",\n \"previewText\": \"<string>\",\n \"content\": \"<string>\",\n \"html\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"cc\": \"<string>\",\n \"bcc\": \"<string>\",\n \"sendNow\": true,\n \"scheduledAt\": \"<string>\",\n \"batchSize\": 50000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.usesend.com/api/v1/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"from\": \"<string>\",\n \"subject\": \"<string>\",\n \"contactBookId\": \"<string>\",\n \"previewText\": \"<string>\",\n \"content\": \"<string>\",\n \"html\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"cc\": \"<string>\",\n \"bcc\": \"<string>\",\n \"sendNow\": true,\n \"scheduledAt\": \"<string>\",\n \"batchSize\": 50000\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"from": "<string>",
"subject": "<string>",
"previewText": "<string>",
"contactBookId": "<string>",
"html": "<string>",
"content": "<string>",
"status": "<string>",
"scheduledAt": "2023-11-07T05:31:56Z",
"batchSize": 123,
"batchWindowMinutes": 123,
"total": 123,
"sent": 123,
"delivered": 123,
"opened": 123,
"clicked": 123,
"unsubscribed": 123,
"bounced": 123,
"hardBounced": 123,
"complained": 123,
"replyTo": [
"<string>"
],
"cc": [
"<string>"
],
"bcc": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Minimum string length:
1Minimum string length:
1Minimum string length:
1Minimum string length:
1Minimum string length:
1Minimum string length:
1Minimum string length:
1Minimum string length:
1Minimum string length:
1Timestamp in ISO 8601 format or natural language (e.g., 'tomorrow 9am', 'next monday 10:30')
Required range:
1 <= x <= 100000Response
200 - application/json
Create a campaign
⌘I
cURL
curl --request POST \
--url https://app.usesend.com/api/v1/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"from": "<string>",
"subject": "<string>",
"contactBookId": "<string>",
"previewText": "<string>",
"content": "<string>",
"html": "<string>",
"replyTo": "<string>",
"cc": "<string>",
"bcc": "<string>",
"sendNow": true,
"scheduledAt": "<string>",
"batchSize": 50000
}
'import requests
url = "https://app.usesend.com/api/v1/campaigns"
payload = {
"name": "<string>",
"from": "<string>",
"subject": "<string>",
"contactBookId": "<string>",
"previewText": "<string>",
"content": "<string>",
"html": "<string>",
"replyTo": "<string>",
"cc": "<string>",
"bcc": "<string>",
"sendNow": True,
"scheduledAt": "<string>",
"batchSize": 50000
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
from: '<string>',
subject: '<string>',
contactBookId: '<string>',
previewText: '<string>',
content: '<string>',
html: '<string>',
replyTo: '<string>',
cc: '<string>',
bcc: '<string>',
sendNow: true,
scheduledAt: '<string>',
batchSize: 50000
})
};
fetch('https://app.usesend.com/api/v1/campaigns', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.usesend.com/api/v1/campaigns",
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([
'name' => '<string>',
'from' => '<string>',
'subject' => '<string>',
'contactBookId' => '<string>',
'previewText' => '<string>',
'content' => '<string>',
'html' => '<string>',
'replyTo' => '<string>',
'cc' => '<string>',
'bcc' => '<string>',
'sendNow' => true,
'scheduledAt' => '<string>',
'batchSize' => 50000
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.usesend.com/api/v1/campaigns"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"from\": \"<string>\",\n \"subject\": \"<string>\",\n \"contactBookId\": \"<string>\",\n \"previewText\": \"<string>\",\n \"content\": \"<string>\",\n \"html\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"cc\": \"<string>\",\n \"bcc\": \"<string>\",\n \"sendNow\": true,\n \"scheduledAt\": \"<string>\",\n \"batchSize\": 50000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.post("https://app.usesend.com/api/v1/campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"from\": \"<string>\",\n \"subject\": \"<string>\",\n \"contactBookId\": \"<string>\",\n \"previewText\": \"<string>\",\n \"content\": \"<string>\",\n \"html\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"cc\": \"<string>\",\n \"bcc\": \"<string>\",\n \"sendNow\": true,\n \"scheduledAt\": \"<string>\",\n \"batchSize\": 50000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.usesend.com/api/v1/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"from\": \"<string>\",\n \"subject\": \"<string>\",\n \"contactBookId\": \"<string>\",\n \"previewText\": \"<string>\",\n \"content\": \"<string>\",\n \"html\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"cc\": \"<string>\",\n \"bcc\": \"<string>\",\n \"sendNow\": true,\n \"scheduledAt\": \"<string>\",\n \"batchSize\": 50000\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"from": "<string>",
"subject": "<string>",
"previewText": "<string>",
"contactBookId": "<string>",
"html": "<string>",
"content": "<string>",
"status": "<string>",
"scheduledAt": "2023-11-07T05:31:56Z",
"batchSize": 123,
"batchWindowMinutes": 123,
"total": 123,
"sent": 123,
"delivered": 123,
"opened": 123,
"clicked": 123,
"unsubscribed": 123,
"bounced": 123,
"hardBounced": 123,
"complained": 123,
"replyTo": [
"<string>"
],
"cc": [
"<string>"
],
"bcc": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}