Create an ad set (audience, budget, schedule)
curl --request POST \
--url https://api.example.com/v1/ads/{accountId}/adsets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"campaignId": "<string>",
"dailyBudget": 123,
"lifetimeBudget": 123,
"billingEvent": "IMPRESSIONS",
"optimizationGoal": "REACH",
"bidAmount": 123,
"targeting": {
"geo_locations": {
"countries": [
"FR"
]
},
"age_min": 25
},
"startTime": "2026-08-10T09:00:00+0200",
"endTime": "2026-08-20T09:00:00+0200",
"promotedObject": {}
}
'import requests
url = "https://api.example.com/v1/ads/{accountId}/adsets"
payload = {
"name": "<string>",
"campaignId": "<string>",
"dailyBudget": 123,
"lifetimeBudget": 123,
"billingEvent": "IMPRESSIONS",
"optimizationGoal": "REACH",
"bidAmount": 123,
"targeting": {
"geo_locations": { "countries": ["FR"] },
"age_min": 25
},
"startTime": "2026-08-10T09:00:00+0200",
"endTime": "2026-08-20T09:00:00+0200",
"promotedObject": {}
}
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>',
campaignId: '<string>',
dailyBudget: 123,
lifetimeBudget: 123,
billingEvent: 'IMPRESSIONS',
optimizationGoal: 'REACH',
bidAmount: 123,
targeting: {geo_locations: {countries: ['FR']}, age_min: 25},
startTime: '2026-08-10T09:00:00+0200',
endTime: '2026-08-20T09:00:00+0200',
promotedObject: {}
})
};
fetch('https://api.example.com/v1/ads/{accountId}/adsets', 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/v1/ads/{accountId}/adsets",
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>',
'campaignId' => '<string>',
'dailyBudget' => 123,
'lifetimeBudget' => 123,
'billingEvent' => 'IMPRESSIONS',
'optimizationGoal' => 'REACH',
'bidAmount' => 123,
'targeting' => [
'geo_locations' => [
'countries' => [
'FR'
]
],
'age_min' => 25
],
'startTime' => '2026-08-10T09:00:00+0200',
'endTime' => '2026-08-20T09:00:00+0200',
'promotedObject' => [
]
]),
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/v1/ads/{accountId}/adsets"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"campaignId\": \"<string>\",\n \"dailyBudget\": 123,\n \"lifetimeBudget\": 123,\n \"billingEvent\": \"IMPRESSIONS\",\n \"optimizationGoal\": \"REACH\",\n \"bidAmount\": 123,\n \"targeting\": {\n \"geo_locations\": {\n \"countries\": [\n \"FR\"\n ]\n },\n \"age_min\": 25\n },\n \"startTime\": \"2026-08-10T09:00:00+0200\",\n \"endTime\": \"2026-08-20T09:00:00+0200\",\n \"promotedObject\": {}\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/v1/ads/{accountId}/adsets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"campaignId\": \"<string>\",\n \"dailyBudget\": 123,\n \"lifetimeBudget\": 123,\n \"billingEvent\": \"IMPRESSIONS\",\n \"optimizationGoal\": \"REACH\",\n \"bidAmount\": 123,\n \"targeting\": {\n \"geo_locations\": {\n \"countries\": [\n \"FR\"\n ]\n },\n \"age_min\": 25\n },\n \"startTime\": \"2026-08-10T09:00:00+0200\",\n \"endTime\": \"2026-08-20T09:00:00+0200\",\n \"promotedObject\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/ads/{accountId}/adsets")
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 \"campaignId\": \"<string>\",\n \"dailyBudget\": 123,\n \"lifetimeBudget\": 123,\n \"billingEvent\": \"IMPRESSIONS\",\n \"optimizationGoal\": \"REACH\",\n \"bidAmount\": 123,\n \"targeting\": {\n \"geo_locations\": {\n \"countries\": [\n \"FR\"\n ]\n },\n \"age_min\": 25\n },\n \"startTime\": \"2026-08-10T09:00:00+0200\",\n \"endTime\": \"2026-08-20T09:00:00+0200\",\n \"promotedObject\": {}\n}"
response = http.request(request)
puts response.read_bodyads
Create an ad set (audience, budget, schedule)
POST
/
v1
/
ads
/
{accountId}
/
adsets
Create an ad set (audience, budget, schedule)
curl --request POST \
--url https://api.example.com/v1/ads/{accountId}/adsets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"campaignId": "<string>",
"dailyBudget": 123,
"lifetimeBudget": 123,
"billingEvent": "IMPRESSIONS",
"optimizationGoal": "REACH",
"bidAmount": 123,
"targeting": {
"geo_locations": {
"countries": [
"FR"
]
},
"age_min": 25
},
"startTime": "2026-08-10T09:00:00+0200",
"endTime": "2026-08-20T09:00:00+0200",
"promotedObject": {}
}
'import requests
url = "https://api.example.com/v1/ads/{accountId}/adsets"
payload = {
"name": "<string>",
"campaignId": "<string>",
"dailyBudget": 123,
"lifetimeBudget": 123,
"billingEvent": "IMPRESSIONS",
"optimizationGoal": "REACH",
"bidAmount": 123,
"targeting": {
"geo_locations": { "countries": ["FR"] },
"age_min": 25
},
"startTime": "2026-08-10T09:00:00+0200",
"endTime": "2026-08-20T09:00:00+0200",
"promotedObject": {}
}
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>',
campaignId: '<string>',
dailyBudget: 123,
lifetimeBudget: 123,
billingEvent: 'IMPRESSIONS',
optimizationGoal: 'REACH',
bidAmount: 123,
targeting: {geo_locations: {countries: ['FR']}, age_min: 25},
startTime: '2026-08-10T09:00:00+0200',
endTime: '2026-08-20T09:00:00+0200',
promotedObject: {}
})
};
fetch('https://api.example.com/v1/ads/{accountId}/adsets', 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/v1/ads/{accountId}/adsets",
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>',
'campaignId' => '<string>',
'dailyBudget' => 123,
'lifetimeBudget' => 123,
'billingEvent' => 'IMPRESSIONS',
'optimizationGoal' => 'REACH',
'bidAmount' => 123,
'targeting' => [
'geo_locations' => [
'countries' => [
'FR'
]
],
'age_min' => 25
],
'startTime' => '2026-08-10T09:00:00+0200',
'endTime' => '2026-08-20T09:00:00+0200',
'promotedObject' => [
]
]),
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/v1/ads/{accountId}/adsets"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"campaignId\": \"<string>\",\n \"dailyBudget\": 123,\n \"lifetimeBudget\": 123,\n \"billingEvent\": \"IMPRESSIONS\",\n \"optimizationGoal\": \"REACH\",\n \"bidAmount\": 123,\n \"targeting\": {\n \"geo_locations\": {\n \"countries\": [\n \"FR\"\n ]\n },\n \"age_min\": 25\n },\n \"startTime\": \"2026-08-10T09:00:00+0200\",\n \"endTime\": \"2026-08-20T09:00:00+0200\",\n \"promotedObject\": {}\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/v1/ads/{accountId}/adsets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"campaignId\": \"<string>\",\n \"dailyBudget\": 123,\n \"lifetimeBudget\": 123,\n \"billingEvent\": \"IMPRESSIONS\",\n \"optimizationGoal\": \"REACH\",\n \"bidAmount\": 123,\n \"targeting\": {\n \"geo_locations\": {\n \"countries\": [\n \"FR\"\n ]\n },\n \"age_min\": 25\n },\n \"startTime\": \"2026-08-10T09:00:00+0200\",\n \"endTime\": \"2026-08-20T09:00:00+0200\",\n \"promotedObject\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/ads/{accountId}/adsets")
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 \"campaignId\": \"<string>\",\n \"dailyBudget\": 123,\n \"lifetimeBudget\": 123,\n \"billingEvent\": \"IMPRESSIONS\",\n \"optimizationGoal\": \"REACH\",\n \"bidAmount\": 123,\n \"targeting\": {\n \"geo_locations\": {\n \"countries\": [\n \"FR\"\n ]\n },\n \"age_min\": 25\n },\n \"startTime\": \"2026-08-10T09:00:00+0200\",\n \"endTime\": \"2026-08-20T09:00:00+0200\",\n \"promotedObject\": {}\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/json
Campaign the ad set belongs to.
Available options:
ACTIVE, PAUSED Minor units of the account currency.
Minor units of the account currency.
Example:
"IMPRESSIONS"
Example:
"REACH"
Bid cap in minor units of the account currency.
Meta targeting spec, passed through as-is. Defaults to France if omitted.
Example:
{
"geo_locations": { "countries": ["FR"] },
"age_min": 25
}
Example:
"2026-08-10T09:00:00+0200"
Example:
"2026-08-20T09:00:00+0200"
What the ad set optimizes towards (page, pixel, application…), passed through as-is.
Response
201 - undefined