Create campaign from draft
curl --request POST \
--url http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/create \
--header 'Authorization: Bearer <token>'import requests
url = "http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/create"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/create"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/create")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/create")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"campaign": {
"id": 123,
"google_ads_campaign_id": "<string>",
"resource_name": "<string>",
"name": "<string>",
"status": "ENABLED",
"created_at": "2023-11-07T05:31:56Z",
"ad_groups": [
{
"id": 123,
"google_ads_ad_group_id": "<string>",
"name": "<string>",
"keywords_count": 123,
"ads_count": 123
}
],
"market_analysis_id": 123
},
"warnings": [
"<string>"
],
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Campaigns
Create campaign from draft
Create a Google Ads campaign from a saved draft.
Requirements:
- All background tasks must be completed (ad groups, RSAs)
- Draft must pass validation (use /drafts//validate first)
On success:
- Campaign is created in Google Ads (PAUSED status)
- Draft is marked as published (is_published=True)
- published_campaign_id is set
Returns 409 Conflict if background tasks are still running. Returns 400 with validation errors if the draft is incomplete.
POST
/
api
/
v1
/
campaigns
/
drafts
/
{draft_id}
/
create
Create campaign from draft
curl --request POST \
--url http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/create \
--header 'Authorization: Bearer <token>'import requests
url = "http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/create"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/create"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/create")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/api/v1/campaigns/drafts/{draft_id}/create")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"campaign": {
"id": 123,
"google_ads_campaign_id": "<string>",
"resource_name": "<string>",
"name": "<string>",
"status": "ENABLED",
"created_at": "2023-11-07T05:31:56Z",
"ad_groups": [
{
"id": 123,
"google_ads_ad_group_id": "<string>",
"name": "<string>",
"keywords_count": 123,
"ads_count": 123
}
],
"market_analysis_id": 123
},
"warnings": [
"<string>"
],
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Path Parameters
Query Parameters
Optional specific Token ID