Skip to main content
POST
/
api
/
v1
/
campaigns
/
Create Campaign
curl --request POST \
  --url https://api.example.com/api/v1/campaigns/ \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "dataset_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "steps": [
    {
      "step": 2,
      "delay_days": 1,
      "channel": "email",
      "variants": [
        {
          "label": "<string>",
          "weight": 50,
          "template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "sender_profile_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
        }
      ],
      "ai_personalization_enabled": true,
      "track_clicks": false,
      "message_template": "<string>"
    }
  ],
  "description": "<string>",
  "type": "email",
  "alias_ids": [
    "<string>"
  ],
  "connected_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "launch_type": "immediate",
  "start_date": "2023-11-07T05:31:56Z",
  "daily_limit": 500,
  "sending_window_start": "09:00:00",
  "sending_window_end": "17:00:00",
  "min_interval_seconds": 300,
  "timezone": "UTC",
  "send_days": [
    "<string>"
  ],
  "system_prompt": "<string>",
  "unreviewed_launch_policy": "launch_default"
}
'
import requests

url = "https://api.example.com/api/v1/campaigns/"

payload = {
"name": "<string>",
"dataset_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"steps": [
{
"step": 2,
"delay_days": 1,
"channel": "email",
"variants": [
{
"label": "<string>",
"weight": 50,
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sender_profile_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"ai_personalization_enabled": True,
"track_clicks": False,
"message_template": "<string>"
}
],
"description": "<string>",
"type": "email",
"alias_ids": ["<string>"],
"connected_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"launch_type": "immediate",
"start_date": "2023-11-07T05:31:56Z",
"daily_limit": 500,
"sending_window_start": "09:00:00",
"sending_window_end": "17:00:00",
"min_interval_seconds": 300,
"timezone": "UTC",
"send_days": ["<string>"],
"system_prompt": "<string>",
"unreviewed_launch_policy": "launch_default"
}
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>',
dataset_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
steps: [
{
step: 2,
delay_days: 1,
channel: 'email',
variants: [
{
label: '<string>',
weight: 50,
template_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
sender_profile_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
],
ai_personalization_enabled: true,
track_clicks: false,
message_template: '<string>'
}
],
description: '<string>',
type: 'email',
alias_ids: ['<string>'],
connected_account_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
launch_type: 'immediate',
start_date: '2023-11-07T05:31:56Z',
daily_limit: 500,
sending_window_start: '09:00:00',
sending_window_end: '17:00:00',
min_interval_seconds: 300,
timezone: 'UTC',
send_days: ['<string>'],
system_prompt: '<string>',
unreviewed_launch_policy: 'launch_default'
})
};

fetch('https://api.example.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://api.example.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>',
'dataset_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'steps' => [
[
'step' => 2,
'delay_days' => 1,
'channel' => 'email',
'variants' => [
[
'label' => '<string>',
'weight' => 50,
'template_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'sender_profile_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
],
'ai_personalization_enabled' => true,
'track_clicks' => false,
'message_template' => '<string>'
]
],
'description' => '<string>',
'type' => 'email',
'alias_ids' => [
'<string>'
],
'connected_account_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'launch_type' => 'immediate',
'start_date' => '2023-11-07T05:31:56Z',
'daily_limit' => 500,
'sending_window_start' => '09:00:00',
'sending_window_end' => '17:00:00',
'min_interval_seconds' => 300,
'timezone' => 'UTC',
'send_days' => [
'<string>'
],
'system_prompt' => '<string>',
'unreviewed_launch_policy' => 'launch_default'
]),
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://api.example.com/api/v1/campaigns/"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"dataset_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"steps\": [\n {\n \"step\": 2,\n \"delay_days\": 1,\n \"channel\": \"email\",\n \"variants\": [\n {\n \"label\": \"<string>\",\n \"weight\": 50,\n \"template_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"sender_profile_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"ai_personalization_enabled\": true,\n \"track_clicks\": false,\n \"message_template\": \"<string>\"\n }\n ],\n \"description\": \"<string>\",\n \"type\": \"email\",\n \"alias_ids\": [\n \"<string>\"\n ],\n \"connected_account_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"launch_type\": \"immediate\",\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"daily_limit\": 500,\n \"sending_window_start\": \"09:00:00\",\n \"sending_window_end\": \"17:00:00\",\n \"min_interval_seconds\": 300,\n \"timezone\": \"UTC\",\n \"send_days\": [\n \"<string>\"\n ],\n \"system_prompt\": \"<string>\",\n \"unreviewed_launch_policy\": \"launch_default\"\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://api.example.com/api/v1/campaigns/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"dataset_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"steps\": [\n {\n \"step\": 2,\n \"delay_days\": 1,\n \"channel\": \"email\",\n \"variants\": [\n {\n \"label\": \"<string>\",\n \"weight\": 50,\n \"template_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"sender_profile_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"ai_personalization_enabled\": true,\n \"track_clicks\": false,\n \"message_template\": \"<string>\"\n }\n ],\n \"description\": \"<string>\",\n \"type\": \"email\",\n \"alias_ids\": [\n \"<string>\"\n ],\n \"connected_account_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"launch_type\": \"immediate\",\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"daily_limit\": 500,\n \"sending_window_start\": \"09:00:00\",\n \"sending_window_end\": \"17:00:00\",\n \"min_interval_seconds\": 300,\n \"timezone\": \"UTC\",\n \"send_days\": [\n \"<string>\"\n ],\n \"system_prompt\": \"<string>\",\n \"unreviewed_launch_policy\": \"launch_default\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.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 \"dataset_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"steps\": [\n {\n \"step\": 2,\n \"delay_days\": 1,\n \"channel\": \"email\",\n \"variants\": [\n {\n \"label\": \"<string>\",\n \"weight\": 50,\n \"template_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"sender_profile_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"ai_personalization_enabled\": true,\n \"track_clicks\": false,\n \"message_template\": \"<string>\"\n }\n ],\n \"description\": \"<string>\",\n \"type\": \"email\",\n \"alias_ids\": [\n \"<string>\"\n ],\n \"connected_account_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"launch_type\": \"immediate\",\n \"start_date\": \"2023-11-07T05:31:56Z\",\n \"daily_limit\": 500,\n \"sending_window_start\": \"09:00:00\",\n \"sending_window_end\": \"17:00:00\",\n \"min_interval_seconds\": 300,\n \"timezone\": \"UTC\",\n \"send_days\": [\n \"<string>\"\n ],\n \"system_prompt\": \"<string>\",\n \"unreviewed_launch_policy\": \"launch_default\"\n}"

response = http.request(request)
puts response.read_body
{
  "campaign_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "dataset_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "name": "<string>",
  "type": "<string>",
  "daily_limit": 123,
  "sending_window_start": "<string>",
  "sending_window_end": "<string>",
  "min_interval_seconds": 123,
  "timezone": "<string>",
  "steps_config": [
    {
      "step": 2,
      "delay_days": 1,
      "channel": "email",
      "variants": [
        {
          "label": "<string>",
          "weight": 50,
          "template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "sender_profile_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
        }
      ],
      "ai_personalization_enabled": true,
      "track_clicks": false,
      "message_template": "<string>"
    }
  ],
  "send_days": [
    "<string>"
  ],
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "description": "<string>",
  "start_date": "2023-11-07T05:31:56Z",
  "alias_ids": [
    "<string>"
  ],
  "connected_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "total_leads": 123,
  "processed_leads": 0,
  "launch_job_id": "<string>",
  "launch_requested_at": "2023-11-07T05:31:56Z",
  "launch_error": "<string>",
  "system_prompt": "<string>",
  "unreviewed_launch_policy": "launch_default",
  "paused_reason": "<string>",
  "playground_discovery_dismissed_at": "2023-11-07T05:31:56Z"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Request model for creating a campaign.

name
string
required

Campaign name

Required string length: 1 - 255
dataset_id
string<uuid>
required

Dataset containing leads

steps
CampaignStepConfig · object[]
required

Campaign steps configuration

Required array length: 1 - 10 elements
description
string | null

Campaign description

Maximum string length: 1000
type
enum<string>
default:email

Campaign type (email, linkedin, or mixed)

Available options:
email,
linkedin,
mixed
alias_ids
string[] | null

Bavimail alias IDs for sending (required for email campaigns)

connected_account_id
string<uuid> | null

Connected account ID (required for linkedin campaigns)

launch_type
enum<string>
default:immediate

Launch type (immediate or scheduled)

Available options:
immediate,
scheduled
start_date
string<date-time> | null

Scheduled start date (required if launch_type=scheduled)

daily_limit
integer
default:500

Max actions per day

Required range: 1 <= x <= 10000
sending_window_start
string<time>
default:09:00:00

Daily sending window start (UTC)

sending_window_end
string<time>
default:17:00:00

Daily sending window end (UTC)

min_interval_seconds
integer
default:300

Minimum seconds between actions

Required range: 60 <= x <= 3600
timezone
string
default:UTC

Timezone for sending window interpretation

send_days
string[]

Days of week to send (3-letter lowercase abbreviations)

system_prompt
string | null

Campaign-level personalization prompt override. When set, the email pipeline resolver uses this in preference to sender_data.custom_prompt. NULL = fall through to sender-level custom_prompt or DEFAULT.

Required string length: 100 - 5000
unreviewed_launch_policy
enum<string>
default:launch_default

Policy applied at scheduled launch time when the campaign uses AI personalization and the user never reviewed drafts in the playground. launch_default = regenerate at send; hold = pause + notify; cancel = revert to draft + notify.

Available options:
launch_default,
hold,
cancel

Response

Successful Response

Response model for campaign.

campaign_id
string<uuid>
required

Unique campaign identifier

user_id
string<uuid>
required

Owner user ID

dataset_id
string<uuid>
required

Associated dataset ID

name
string
required

Campaign name

type
string
required

Campaign type (email, linkedin, mixed)

status
enum<string>
required

Current campaign status

Available options:
draft,
launching,
scheduled,
active,
draining,
paused,
completed,
failed
launch_type
enum<string>
required

Launch type

Available options:
immediate,
scheduled
daily_limit
integer
required

Max actions per day

sending_window_start
string<time>
required

Daily sending window start

sending_window_end
string<time>
required

Daily sending window end

min_interval_seconds
integer
required

Min seconds between actions

timezone
string
required

Timezone for sending window

steps_config
CampaignStepConfig · object[]
required

Steps configuration

send_days
string[]
required

Days of week to send

created_at
string<date-time>
required

Creation timestamp

updated_at
string<date-time>
required

Last update timestamp

description
string | null

Campaign description

start_date
string<date-time> | null

Scheduled start date

alias_ids
string[] | null

Bavimail alias IDs

connected_account_id
string<uuid> | null

Connected account for LinkedIn

total_leads
integer | null

Total leads in campaign

processed_leads
integer
default:0

Leads not in pending/active status

launch_job_id
string | null

ARQ job ID for background launch

launch_requested_at
string<date-time> | null

When launch was requested

launch_error
string | null

Error message if launch failed

system_prompt
string | null

Campaign-level personalization prompt override (migration 108).

unreviewed_launch_policy
enum<string>
default:launch_default

Policy for scheduled launch without playground review (migration 108).

Available options:
launch_default,
hold,
cancel
paused_reason
string | null

Reason the campaign is paused, e.g. 'pending_personalization_review' (migration 108).

playground_discovery_dismissed_at
string<date-time> | null

When the owner dismissed the playground discovery banner (migration 108).