Campaigns
Create a campaign
For platform: meta with a page_id, launches a real campaign on Meta (same path the in-app wizard uses). Every other platform/shape creates a local draft - only Meta has live launch wiring today. Requires scope ads:write.
POST
/
ads
/
campaigns
Create a campaign
curl --request POST \
--url https://api.smartlyq.com/v1/ads/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"platform": "meta",
"name": "Spring Sale - US",
"objective": "traffic",
"page_id": "1234567890",
"ad_account_id": "act_123456789",
"budget": 50,
"budget_type": "daily",
"start_date": "2026-09-01",
"end_date": "2026-09-30",
"launch": false,
"targeting": {},
"creative": {
"object_story_id": "1234567890_9876543210",
"image_url": "https://example.com/creative.jpg",
"video_url": "https://example.com/creative.mp4",
"format": "image",
"headlines": [
"20% off this week only"
],
"descriptions": [
"<string>"
],
"primary_text": "Shop the sale before it ends.",
"destination_url": "https://example.com/spring-sale",
"cta": "LEARN_MORE"
},
"settings": {
"pixel_id": "",
"pixel_tracking": true,
"conversion_event": "purchase",
"lead_form_id": "",
"placements": [
"<string>"
],
"destination_type": "",
"phone_number": ""
}
}
'import requests
url = "https://api.smartlyq.com/v1/ads/campaigns"
payload = {
"platform": "meta",
"name": "Spring Sale - US",
"objective": "traffic",
"page_id": "1234567890",
"ad_account_id": "act_123456789",
"budget": 50,
"budget_type": "daily",
"start_date": "2026-09-01",
"end_date": "2026-09-30",
"launch": False,
"targeting": {},
"creative": {
"object_story_id": "1234567890_9876543210",
"image_url": "https://example.com/creative.jpg",
"video_url": "https://example.com/creative.mp4",
"format": "image",
"headlines": ["20% off this week only"],
"descriptions": ["<string>"],
"primary_text": "Shop the sale before it ends.",
"destination_url": "https://example.com/spring-sale",
"cta": "LEARN_MORE"
},
"settings": {
"pixel_id": "",
"pixel_tracking": True,
"conversion_event": "purchase",
"lead_form_id": "",
"placements": ["<string>"],
"destination_type": "",
"phone_number": ""
}
}
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({
platform: 'meta',
name: 'Spring Sale - US',
objective: 'traffic',
page_id: '1234567890',
ad_account_id: 'act_123456789',
budget: 50,
budget_type: 'daily',
start_date: '2026-09-01',
end_date: '2026-09-30',
launch: false,
targeting: {},
creative: {
object_story_id: '1234567890_9876543210',
image_url: 'https://example.com/creative.jpg',
video_url: 'https://example.com/creative.mp4',
format: 'image',
headlines: ['20% off this week only'],
descriptions: ['<string>'],
primary_text: 'Shop the sale before it ends.',
destination_url: 'https://example.com/spring-sale',
cta: 'LEARN_MORE'
},
settings: {
pixel_id: '',
pixel_tracking: true,
conversion_event: 'purchase',
lead_form_id: '',
placements: ['<string>'],
destination_type: '',
phone_number: ''
}
})
};
fetch('https://api.smartlyq.com/v1/ads/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.smartlyq.com/v1/ads/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([
'platform' => 'meta',
'name' => 'Spring Sale - US',
'objective' => 'traffic',
'page_id' => '1234567890',
'ad_account_id' => 'act_123456789',
'budget' => 50,
'budget_type' => 'daily',
'start_date' => '2026-09-01',
'end_date' => '2026-09-30',
'launch' => false,
'targeting' => [
],
'creative' => [
'object_story_id' => '1234567890_9876543210',
'image_url' => 'https://example.com/creative.jpg',
'video_url' => 'https://example.com/creative.mp4',
'format' => 'image',
'headlines' => [
'20% off this week only'
],
'descriptions' => [
'<string>'
],
'primary_text' => 'Shop the sale before it ends.',
'destination_url' => 'https://example.com/spring-sale',
'cta' => 'LEARN_MORE'
],
'settings' => [
'pixel_id' => '',
'pixel_tracking' => true,
'conversion_event' => 'purchase',
'lead_form_id' => '',
'placements' => [
'<string>'
],
'destination_type' => '',
'phone_number' => ''
]
]),
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.smartlyq.com/v1/ads/campaigns"
payload := strings.NewReader("{\n \"platform\": \"meta\",\n \"name\": \"Spring Sale - US\",\n \"objective\": \"traffic\",\n \"page_id\": \"1234567890\",\n \"ad_account_id\": \"act_123456789\",\n \"budget\": 50,\n \"budget_type\": \"daily\",\n \"start_date\": \"2026-09-01\",\n \"end_date\": \"2026-09-30\",\n \"launch\": false,\n \"targeting\": {},\n \"creative\": {\n \"object_story_id\": \"1234567890_9876543210\",\n \"image_url\": \"https://example.com/creative.jpg\",\n \"video_url\": \"https://example.com/creative.mp4\",\n \"format\": \"image\",\n \"headlines\": [\n \"20% off this week only\"\n ],\n \"descriptions\": [\n \"<string>\"\n ],\n \"primary_text\": \"Shop the sale before it ends.\",\n \"destination_url\": \"https://example.com/spring-sale\",\n \"cta\": \"LEARN_MORE\"\n },\n \"settings\": {\n \"pixel_id\": \"\",\n \"pixel_tracking\": true,\n \"conversion_event\": \"purchase\",\n \"lead_form_id\": \"\",\n \"placements\": [\n \"<string>\"\n ],\n \"destination_type\": \"\",\n \"phone_number\": \"\"\n }\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.smartlyq.com/v1/ads/campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"platform\": \"meta\",\n \"name\": \"Spring Sale - US\",\n \"objective\": \"traffic\",\n \"page_id\": \"1234567890\",\n \"ad_account_id\": \"act_123456789\",\n \"budget\": 50,\n \"budget_type\": \"daily\",\n \"start_date\": \"2026-09-01\",\n \"end_date\": \"2026-09-30\",\n \"launch\": false,\n \"targeting\": {},\n \"creative\": {\n \"object_story_id\": \"1234567890_9876543210\",\n \"image_url\": \"https://example.com/creative.jpg\",\n \"video_url\": \"https://example.com/creative.mp4\",\n \"format\": \"image\",\n \"headlines\": [\n \"20% off this week only\"\n ],\n \"descriptions\": [\n \"<string>\"\n ],\n \"primary_text\": \"Shop the sale before it ends.\",\n \"destination_url\": \"https://example.com/spring-sale\",\n \"cta\": \"LEARN_MORE\"\n },\n \"settings\": {\n \"pixel_id\": \"\",\n \"pixel_tracking\": true,\n \"conversion_event\": \"purchase\",\n \"lead_form_id\": \"\",\n \"placements\": [\n \"<string>\"\n ],\n \"destination_type\": \"\",\n \"phone_number\": \"\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.smartlyq.com/v1/ads/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 \"platform\": \"meta\",\n \"name\": \"Spring Sale - US\",\n \"objective\": \"traffic\",\n \"page_id\": \"1234567890\",\n \"ad_account_id\": \"act_123456789\",\n \"budget\": 50,\n \"budget_type\": \"daily\",\n \"start_date\": \"2026-09-01\",\n \"end_date\": \"2026-09-30\",\n \"launch\": false,\n \"targeting\": {},\n \"creative\": {\n \"object_story_id\": \"1234567890_9876543210\",\n \"image_url\": \"https://example.com/creative.jpg\",\n \"video_url\": \"https://example.com/creative.mp4\",\n \"format\": \"image\",\n \"headlines\": [\n \"20% off this week only\"\n ],\n \"descriptions\": [\n \"<string>\"\n ],\n \"primary_text\": \"Shop the sale before it ends.\",\n \"destination_url\": \"https://example.com/spring-sale\",\n \"cta\": \"LEARN_MORE\"\n },\n \"settings\": {\n \"pixel_id\": \"\",\n \"pixel_tracking\": true,\n \"conversion_event\": \"purchase\",\n \"lead_form_id\": \"\",\n \"placements\": [\n \"<string>\"\n ],\n \"destination_type\": \"\",\n \"phone_number\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": 5001,
"status": "paused",
"warnings": [
"<string>"
]
},
"meta": {
"request_id": "req_9f3a2b1c-7d4e-4a08-b2c6-5e1f8a9d0c34",
"timestamp": "2026-07-26T09:41:22Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Missing required fields: content, platforms.",
"details": {
"fields": [
"content",
"platforms"
]
}
},
"meta": {
"request_id": "req_9f3a2b1c-7d4e-4a08-b2c6-5e1f8a9d0c34",
"timestamp": "2026-07-26T09:41:22Z"
}
}Authorizations
API key from Developer dashboard (Bearer token).
Body
application/json
Available options:
meta, google, tiktok, linkedin Example:
"meta"
Example:
"Spring Sale - US"
Example:
"traffic"
Meta only - required to launch live, otherwise a draft is created.
Example:
"1234567890"
Example:
"act_123456789"
Example:
50
Available options:
daily, lifetime Example:
"daily"
Example:
"2026-09-01"
Example:
"2026-09-30"
Non-Meta only - true creates an active local draft instead of a draft.
Example:
false
Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I
Create a campaign
curl --request POST \
--url https://api.smartlyq.com/v1/ads/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"platform": "meta",
"name": "Spring Sale - US",
"objective": "traffic",
"page_id": "1234567890",
"ad_account_id": "act_123456789",
"budget": 50,
"budget_type": "daily",
"start_date": "2026-09-01",
"end_date": "2026-09-30",
"launch": false,
"targeting": {},
"creative": {
"object_story_id": "1234567890_9876543210",
"image_url": "https://example.com/creative.jpg",
"video_url": "https://example.com/creative.mp4",
"format": "image",
"headlines": [
"20% off this week only"
],
"descriptions": [
"<string>"
],
"primary_text": "Shop the sale before it ends.",
"destination_url": "https://example.com/spring-sale",
"cta": "LEARN_MORE"
},
"settings": {
"pixel_id": "",
"pixel_tracking": true,
"conversion_event": "purchase",
"lead_form_id": "",
"placements": [
"<string>"
],
"destination_type": "",
"phone_number": ""
}
}
'import requests
url = "https://api.smartlyq.com/v1/ads/campaigns"
payload = {
"platform": "meta",
"name": "Spring Sale - US",
"objective": "traffic",
"page_id": "1234567890",
"ad_account_id": "act_123456789",
"budget": 50,
"budget_type": "daily",
"start_date": "2026-09-01",
"end_date": "2026-09-30",
"launch": False,
"targeting": {},
"creative": {
"object_story_id": "1234567890_9876543210",
"image_url": "https://example.com/creative.jpg",
"video_url": "https://example.com/creative.mp4",
"format": "image",
"headlines": ["20% off this week only"],
"descriptions": ["<string>"],
"primary_text": "Shop the sale before it ends.",
"destination_url": "https://example.com/spring-sale",
"cta": "LEARN_MORE"
},
"settings": {
"pixel_id": "",
"pixel_tracking": True,
"conversion_event": "purchase",
"lead_form_id": "",
"placements": ["<string>"],
"destination_type": "",
"phone_number": ""
}
}
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({
platform: 'meta',
name: 'Spring Sale - US',
objective: 'traffic',
page_id: '1234567890',
ad_account_id: 'act_123456789',
budget: 50,
budget_type: 'daily',
start_date: '2026-09-01',
end_date: '2026-09-30',
launch: false,
targeting: {},
creative: {
object_story_id: '1234567890_9876543210',
image_url: 'https://example.com/creative.jpg',
video_url: 'https://example.com/creative.mp4',
format: 'image',
headlines: ['20% off this week only'],
descriptions: ['<string>'],
primary_text: 'Shop the sale before it ends.',
destination_url: 'https://example.com/spring-sale',
cta: 'LEARN_MORE'
},
settings: {
pixel_id: '',
pixel_tracking: true,
conversion_event: 'purchase',
lead_form_id: '',
placements: ['<string>'],
destination_type: '',
phone_number: ''
}
})
};
fetch('https://api.smartlyq.com/v1/ads/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.smartlyq.com/v1/ads/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([
'platform' => 'meta',
'name' => 'Spring Sale - US',
'objective' => 'traffic',
'page_id' => '1234567890',
'ad_account_id' => 'act_123456789',
'budget' => 50,
'budget_type' => 'daily',
'start_date' => '2026-09-01',
'end_date' => '2026-09-30',
'launch' => false,
'targeting' => [
],
'creative' => [
'object_story_id' => '1234567890_9876543210',
'image_url' => 'https://example.com/creative.jpg',
'video_url' => 'https://example.com/creative.mp4',
'format' => 'image',
'headlines' => [
'20% off this week only'
],
'descriptions' => [
'<string>'
],
'primary_text' => 'Shop the sale before it ends.',
'destination_url' => 'https://example.com/spring-sale',
'cta' => 'LEARN_MORE'
],
'settings' => [
'pixel_id' => '',
'pixel_tracking' => true,
'conversion_event' => 'purchase',
'lead_form_id' => '',
'placements' => [
'<string>'
],
'destination_type' => '',
'phone_number' => ''
]
]),
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.smartlyq.com/v1/ads/campaigns"
payload := strings.NewReader("{\n \"platform\": \"meta\",\n \"name\": \"Spring Sale - US\",\n \"objective\": \"traffic\",\n \"page_id\": \"1234567890\",\n \"ad_account_id\": \"act_123456789\",\n \"budget\": 50,\n \"budget_type\": \"daily\",\n \"start_date\": \"2026-09-01\",\n \"end_date\": \"2026-09-30\",\n \"launch\": false,\n \"targeting\": {},\n \"creative\": {\n \"object_story_id\": \"1234567890_9876543210\",\n \"image_url\": \"https://example.com/creative.jpg\",\n \"video_url\": \"https://example.com/creative.mp4\",\n \"format\": \"image\",\n \"headlines\": [\n \"20% off this week only\"\n ],\n \"descriptions\": [\n \"<string>\"\n ],\n \"primary_text\": \"Shop the sale before it ends.\",\n \"destination_url\": \"https://example.com/spring-sale\",\n \"cta\": \"LEARN_MORE\"\n },\n \"settings\": {\n \"pixel_id\": \"\",\n \"pixel_tracking\": true,\n \"conversion_event\": \"purchase\",\n \"lead_form_id\": \"\",\n \"placements\": [\n \"<string>\"\n ],\n \"destination_type\": \"\",\n \"phone_number\": \"\"\n }\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.smartlyq.com/v1/ads/campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"platform\": \"meta\",\n \"name\": \"Spring Sale - US\",\n \"objective\": \"traffic\",\n \"page_id\": \"1234567890\",\n \"ad_account_id\": \"act_123456789\",\n \"budget\": 50,\n \"budget_type\": \"daily\",\n \"start_date\": \"2026-09-01\",\n \"end_date\": \"2026-09-30\",\n \"launch\": false,\n \"targeting\": {},\n \"creative\": {\n \"object_story_id\": \"1234567890_9876543210\",\n \"image_url\": \"https://example.com/creative.jpg\",\n \"video_url\": \"https://example.com/creative.mp4\",\n \"format\": \"image\",\n \"headlines\": [\n \"20% off this week only\"\n ],\n \"descriptions\": [\n \"<string>\"\n ],\n \"primary_text\": \"Shop the sale before it ends.\",\n \"destination_url\": \"https://example.com/spring-sale\",\n \"cta\": \"LEARN_MORE\"\n },\n \"settings\": {\n \"pixel_id\": \"\",\n \"pixel_tracking\": true,\n \"conversion_event\": \"purchase\",\n \"lead_form_id\": \"\",\n \"placements\": [\n \"<string>\"\n ],\n \"destination_type\": \"\",\n \"phone_number\": \"\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.smartlyq.com/v1/ads/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 \"platform\": \"meta\",\n \"name\": \"Spring Sale - US\",\n \"objective\": \"traffic\",\n \"page_id\": \"1234567890\",\n \"ad_account_id\": \"act_123456789\",\n \"budget\": 50,\n \"budget_type\": \"daily\",\n \"start_date\": \"2026-09-01\",\n \"end_date\": \"2026-09-30\",\n \"launch\": false,\n \"targeting\": {},\n \"creative\": {\n \"object_story_id\": \"1234567890_9876543210\",\n \"image_url\": \"https://example.com/creative.jpg\",\n \"video_url\": \"https://example.com/creative.mp4\",\n \"format\": \"image\",\n \"headlines\": [\n \"20% off this week only\"\n ],\n \"descriptions\": [\n \"<string>\"\n ],\n \"primary_text\": \"Shop the sale before it ends.\",\n \"destination_url\": \"https://example.com/spring-sale\",\n \"cta\": \"LEARN_MORE\"\n },\n \"settings\": {\n \"pixel_id\": \"\",\n \"pixel_tracking\": true,\n \"conversion_event\": \"purchase\",\n \"lead_form_id\": \"\",\n \"placements\": [\n \"<string>\"\n ],\n \"destination_type\": \"\",\n \"phone_number\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": 5001,
"status": "paused",
"warnings": [
"<string>"
]
},
"meta": {
"request_id": "req_9f3a2b1c-7d4e-4a08-b2c6-5e1f8a9d0c34",
"timestamp": "2026-07-26T09:41:22Z"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Missing required fields: content, platforms.",
"details": {
"fields": [
"content",
"platforms"
]
}
},
"meta": {
"request_id": "req_9f3a2b1c-7d4e-4a08-b2c6-5e1f8a9d0c34",
"timestamp": "2026-07-26T09:41:22Z"
}
}
