Create or update a full Google Ads campaign structure
PUT https://services.leadconnectorhq.com/ad-publishing/google/adsAuthorization
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
Authorization | string | Yes | Bearer token generated from the Leadway portal. See Authentication. | |
Version | string | Yes | 2021-07-28 | API version. |
Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
id | string | No | Campaign identifier | |
name | string | Yes | My Campaign | Campaign name |
locationId | string | Yes | loc_abc123 | Account identifier |
advertisingChannelType | string | Yes | Advertising channel Possible values: 'SEARCH', 'DISCOVERY', 'DISPLAY', 'HOTEL', 'LOCAL', 'MULTI_CHANNEL', 'PERFORMANCE_MAX', 'DEMAND_GEN' | |
advertisingChannelSubType | string | No | Channel sub type Possible values: 'DEMAND_GEN' | |
goalType | string | No | Goal type Possible values: 'WEBSITE_TRAFFIC', 'LEAD' | |
budget | object | No | Campaign budget | |
audience | object | No | Campaign audience targeting | |
networkSettings | object | No | Network settings | |
biddingStrategy | object | No | Bidding strategy config | |
assets | object | No | Campaign assets | |
isEuPoliticalAds | boolean | No | False | EU political ads flag |
adGroups(object[]): Campaign ad groupsid(string): Ad group identifieradGroupId(string): Google ad group identifiername(string): Ad group name Example:Ad Group 1adCampaignId(string): Ad campaign identifieradContent(object[]): Ad content itemsid(string): Ad identifiername(string): Ad namemediaType(string): Media type Possible values: 'IMAGE', 'VIDEO', 'CAROUSEL'headlines(string[]): Ad headlineslongHeadlines(string[]): Long headlinesdescriptions(string[]): Ad descriptionsfinalUrl(string): Final URL Example:https://example.compath1(string): Display path 1 Example:productspath2(string): Display path 2 Example:dealsisDeleted(boolean): Whether the ad is soft-deletedadError(string): Ad-level error message from GooglepublishingStatus(string): Ad publishing status Possible values: 'DRAFT', 'SCHEDULED', 'PUBLISHED', 'PUBLISHING', 'FAILED', 'IN_REVIEW', 'PAUSED', 'ARCHIVED', 'WITH_ISSUES', 'REJECTED'adId(string): Internal ad identifieradCampaignId(string): Ad campaign identifieradGroupId(string): Ad group identifiergoogleAdId(string): Google Ads ad resource IDmedia(object[]): Ad media itemstype(string): Media type Possible values: 'IMAGE'src(string): Media source URL Example:https://example.com/image.jpgisLogo(boolean): Is logo flag Example:Falseerror(string): Error message if media failedurl(string): Public URL of the mediaimageType(string): Image type classification
callToActionLabel(string): Call to action label Possible values: 'AUTOMATED', 'LEARN_MORE', 'GET_QUOTE', 'APPLY_NOW', 'SIGN_UP', 'CONTACT_US', 'SUBSCRIBE', 'DOWNLOAD', 'BOOK_NOW', 'SHOP_NOW', 'BUY_NOW', 'DONATE_NOW', 'ORDER_NOW', 'PLAY_NOW', 'SEE_MORE'businessName(string): Business name Example:Acme CorpyoutubeVideoLinks(object[]): YouTube video linksyoutubeVideoId(string, required): YouTube video ID
carouselCards(object[]): Carousel cardsheadline(string): Card headline Example:Shop NowfinalUrl(string): Card final URL Example:https://example.comcallToActionLabel(string): Call to action labelmedia(object[]): Card media itemstype(string): Media type Possible values: 'IMAGE'src(string): Media source URL Example:https://example.com/image.jpgisLogo(boolean): Is logo flag Example:Falseerror(string): Error message if media failedurl(string): Public URL of the mediaimageType(string): Image type classification
placements(string[]): Channel placementscustomChannels(boolean): Custom channels flag
keywords(object): Keyword targetingpublishingStatus(string): Ad group publishing status Possible values: 'DRAFT', 'SCHEDULED', 'PUBLISHED', 'PUBLISHING', 'FAILED', 'IN_REVIEW', 'PAUSED', 'ARCHIVED', 'WITH_ISSUES', 'REJECTED'adGroupError(string): Ad group-level error from GooglegoogleAdGroupId(string): Google Ads ad group resource IDcustomChannels(boolean): Custom channels flagselectedChannels(string[]): Selected channel placementsgoogleAudienceId(string): Google audience resource IDaudience(object): Ad group audience targeting
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
campaignGoal | object | No | Campaign goal config |
adSchedule(object[]): Ad schedule rulesdayOfWeek(string, required): Day of week Possible values: 'FRIDAY', 'MONDAY', 'SATURDAY', 'SUNDAY', 'THURSDAY', 'TUESDAY', 'UNKNOWN', 'UNSPECIFIED', 'WEDNESDAY', 'ALL_DAYS', 'MONDAY_TO_FRIDAY', 'SATURDAY_AND_SUNDAY'from(string, required): Start time (HH:MM) Example:09:00to(string, required): End time (HH:MM) Example:17:00
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
publishingStatus | string | No | Publishing status Possible values: 'DRAFT', 'SCHEDULED', 'PUBLISHED', 'PUBLISHING', 'FAILED', 'IN_REVIEW', 'PAUSED', 'ARCHIVED', 'WITH_ISSUES', 'REJECTED' | |
googleAdAccountId | string | No | Google Ad account identifier | |
unpublishedChanges | boolean | No | Whether the campaign has unpublished changes | |
maximumCpc | number | No | Maximum CPC bid in micros | |
googleCampaignId | string | No | Google Ads campaign resource ID | |
source | string | No | WEBSITE | Traffic source |
advancedOptions | object | No | Advanced options |
Responses
200 - Response
400 - Bad Request
{}422 - Unprocessable Entity
{}Example
curl -X PUT 'https://services.leadconnectorhq.com/ad-publishing/google/ads' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"id": "string",
"name": "My Campaign",
"locationId": "loc_abc123",
"advertisingChannelType": "SEARCH",
"advertisingChannelSubType": "DEMAND_GEN",
"goalType": "WEBSITE_TRAFFIC",
"isEuPoliticalAds": false,
"adGroups": [
{
"id": "string",
"adGroupId": "string",
"name": "Ad Group 1",
"adCampaignId": "string",
"adContent": [
{}
],
"publishingStatus": "DRAFT",
"adGroupError": "string",
"googleAdGroupId": "string",
"customChannels": true,
"selectedChannels": [
"GMAIL"
],
"googleAudienceId": "string"
}
],
"adSchedule": [
{
"dayOfWeek": "FRIDAY",
"from": "09:00",
"to": "17:00"
}
],
"publishingStatus": "DRAFT",
"googleAdAccountId": "string",
"unpublishedChanges": true,
"maximumCpc": 0,
"googleCampaignId": "string",
"source": "WEBSITE",
"advancedOptions": {}
}'const response = await fetch('https://services.leadconnectorhq.com/ad-publishing/google/ads', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"id": "string", "name": "My Campaign", "locationId": "loc_abc123", "advertisingChannelType": "SEARCH", "advertisingChannelSubType": "DEMAND_GEN", "goalType": "WEBSITE_TRAFFIC", "isEuPoliticalAds": false, "adGroups": [{"id": "string", "adGroupId": "string", "name": "Ad Group 1", "adCampaignId": "string", "adContent": [{}], "publishingStatus": "DRAFT", "adGroupError": "string", "googleAdGroupId": "string", "customChannels": true, "selectedChannels": ["GMAIL"], "googleAudienceId": "string"}], "adSchedule": [{"dayOfWeek": "FRIDAY", "from": "09:00", "to": "17:00"}], "publishingStatus": "DRAFT", "googleAdAccountId": "string", "unpublishedChanges": true, "maximumCpc": 0, "googleCampaignId": "string", "source": "WEBSITE", "advancedOptions": {}}),
});
const data = await response.json();import os, requests
response = requests.request(
'PUT',
'https://services.leadconnectorhq.com/ad-publishing/google/ads',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"id": "string", "name": "My Campaign", "locationId": "loc_abc123", "advertisingChannelType": "SEARCH", "advertisingChannelSubType": "DEMAND_GEN", "goalType": "WEBSITE_TRAFFIC", "isEuPoliticalAds": false, "adGroups": [{"id": "string", "adGroupId": "string", "name": "Ad Group 1", "adCampaignId": "string", "adContent": [{}], "publishingStatus": "DRAFT", "adGroupError": "string", "googleAdGroupId": "string", "customChannels": true, "selectedChannels": ["GMAIL"], "googleAudienceId": "string"}], "adSchedule": [{"dayOfWeek": "FRIDAY", "from": "09:00", "to": "17:00"}], "publishingStatus": "DRAFT", "googleAdAccountId": "string", "unpublishedChanges": true, "maximumCpc": 0, "googleCampaignId": "string", "source": "WEBSITE", "advancedOptions": {}},
)
data = response.json()<?php
$ch = curl_init('https://services.leadconnectorhq.com/ad-publishing/google/ads');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
'Version: 2021-07-28',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({'id': 'string', 'name': 'My Campaign', 'locationId': 'loc_abc123', 'advertisingChannelType': 'SEARCH', 'advertisingChannelSubType': 'DEMAND_GEN', 'goalType': 'WEBSITE_TRAFFIC', 'isEuPoliticalAds': false, 'adGroups': [{'id': 'string', 'adGroupId': 'string', 'name': 'Ad Group 1', 'adCampaignId': 'string', 'adContent': [{}], 'publishingStatus': 'DRAFT', 'adGroupError': 'string', 'googleAdGroupId': 'string', 'customChannels': true, 'selectedChannels': ['GMAIL'], 'googleAudienceId': 'string'}], 'adSchedule': [{'dayOfWeek': 'FRIDAY', 'from': '09:00', 'to': '17:00'}], 'publishingStatus': 'DRAFT', 'googleAdAccountId': 'string', 'unpublishedChanges': true, 'maximumCpc': 0, 'googleCampaignId': 'string', 'source': 'WEBSITE', 'advancedOptions': {}}),
]);
$data = json_decode(curl_exec($ch), true);