Skip to main content

Campaigns API

Bulk campaign creation, scheduling, and analytics Base path: /api/v1/campaigns Endpoint count: 2

List campaigns

GET /api/v1/campaigns/
Retrieve campaigns with cursor-based pagination. Returns draft, scheduled, running, completed, paused, and archived campaigns for the tenant.
cURL
curl -X GET "https://api.orbit.devotel.io/api/v1/campaigns/" \
  -H "X-API-Key: dv_live_sk_your_key_here" 
Node.js
import { Orbit } from '@devotel/orbit-sdk'

const orbit = new Orbit({
  apiKey: process.env.ORBIT_API_KEY!,
})

const res = await fetch('https://api.orbit.devotel.io/api/v1/campaigns/', {
  method: 'GET',
  headers: {
    'X-API-Key': process.env.ORBIT_API_KEY!,
  },
})
console.log(await res.json())


Python
import os, requests

headers = {"X-API-Key": os.environ["ORBIT_API_KEY"]}
r = requests.get("https://api.orbit.devotel.io/api/v1/campaigns/", headers=headers)
print(r.json())
Go
package main

import (
	"bytes"
	"net/http"
	"os"
)

func main() {
	req, _ := http.NewRequest("GET", "https://api.orbit.devotel.io/api/v1/campaigns/", nil)
	req.Header.Set("X-API-Key", os.Getenv("ORBIT_API_KEY"))

	http.DefaultClient.Do(req)
}
Ruby
require 'net/http'
require 'json'

uri = URI('https://api.orbit.devotel.io/api/v1/campaigns/')
req = Net::HTTP::Get.new(uri)
req['X-API-Key'] = ENV['ORBIT_API_KEY']


res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }
puts res.body
PHP
<?php
$ch = curl_init('https://api.orbit.devotel.io/api/v1/campaigns/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'X-API-Key: ' . getenv('ORBIT_API_KEY'),

]);

echo curl_exec($ch);

Create a campaign

POST /api/v1/campaigns/
Create a marketing campaign (blast, drip, or journey) targeting a list/segment/CSV/all-contacts audience. The campaign is created as a draft until POST /campaigns//send. message_template is optional at creation but mandatory at send-time. For drip campaigns, the steps array defines the sequence; smart_send spreads delivery across 24h using best-time-to-send predictions.
name
string
required
description
string
type
string (enum: blast|drip|journey)
channel
string (enum: sms|mms|whatsapp|email|rcs|viber|…)
required
audience_type
string (enum: all|list|segment|csv)
audience_id
string
message_template
string
variables
object
scheduled_at
string
throttle_rate
integer
recurrence
object
Recurrence config. Accepts either canonical keys (type, end_type, end_date, end_count, days, date, cron) or UI-prefixed keys (recurrence_type, recurrence_end_type, recurrence_end_date, etc.). When end_type === ‘on_date’ the end_date MUST be in the future; past dates are rejected with HTTP 400.
business_hours_only
boolean
steps
object[]
smart_send
boolean
cURL
curl -X POST "https://api.orbit.devotel.io/api/v1/campaigns/" \
  -H "X-API-Key: dv_live_sk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string",
  "channel": "sms"
}'
Node.js
import { Orbit } from '@devotel/orbit-sdk'

const orbit = new Orbit({
  apiKey: process.env.ORBIT_API_KEY!,
})

const res = await fetch('https://api.orbit.devotel.io/api/v1/campaigns/', {
  method: 'POST',
  headers: {
    'X-API-Key': process.env.ORBIT_API_KEY!,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "name": "string",
  "channel": "sms"
}),
})
console.log(await res.json())
Python
import os, requests

headers = {"X-API-Key": os.environ["ORBIT_API_KEY"]}
headers["Content-Type"] = "application/json"
r = requests.post("https://api.orbit.devotel.io/api/v1/campaigns/", headers=headers, json={
  "name": "string",
  "channel": "sms"
})
print(r.json())
Go
package main

import (
	"bytes"
	"net/http"
	"os"
)

func main() {
	req, _ := http.NewRequest("POST", "https://api.orbit.devotel.io/api/v1/campaigns/", bytes.NewBuffer([]byte(`{
  "name": "string",
  "channel": "sms"
}`)))
	req.Header.Set("X-API-Key", os.Getenv("ORBIT_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	http.DefaultClient.Do(req)
}
Ruby
require 'net/http'
require 'json'

uri = URI('https://api.orbit.devotel.io/api/v1/campaigns/')
req = Net::HTTP::Post.new(uri)
req['X-API-Key'] = ENV['ORBIT_API_KEY']
req['Content-Type'] = 'application/json'
req.body = {
  "name": "string",
  "channel": "sms"
}.to_json
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }
puts res.body
PHP
<?php
$ch = curl_init('https://api.orbit.devotel.io/api/v1/campaigns/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'X-API-Key: ' . getenv('ORBIT_API_KEY'),
  'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, <<<JSON
{
  "name": "string",
  "channel": "sms"
}
JSON);
echo curl_exec($ch);