CreateOrUpdateBanners (Live)
Creates or modifies ad groups, ads and keywords.
If the campaign is active, added and modified ads are automatically submitted for moderation. For campaigns with "Draft" status, ads can be submitted for moderation using the ModerateBanners method.
Restrictions
Alert
The method only supports “Text & Image Ads”. To work with ads of all types, use the Ads service in API version 5. Learn more about ad types...
No more than 1000 ads can be passed in a single method call.
The method can be called no more than 1000 times per day for one campaign. Calling the method consumes points. If there are not enough points, error message 152 is returned.
To update only click prices, it is recommended to use the UpdatePrices (Live) method, which does not consume points when called.
A campaign can contain no more than 1000 ad groups. The number of ads in a group — no more than 50. The number of keywords in a group — no more than 200.
What's new in Live version 4
The AutoMinusWords input parameter has been added.
The AgeLabel input parameter has been added.
The Currency input parameter has been added.
The AdGroupID and AdGroupName input parameters have been added.
The AdGroupMobileBidAdjustment input parameter has been added.
The Type input parameter has been added.
Input data
The structure of input data in JSON format is shown below.
{
"method": "CreateOrUpdateBanners",
"param": [
{ /* BannerInfo */
"BannerID": (long),
"CampaignID": (int),
"AdGroupID": (long),
"AdGroupName": (string),
"Type": (string),
"Title": (string),
"Text": (string),
"Href": (string),
"Geo": (string),
"ContactInfo": {
/* ContactInfo */
"ContactPerson": (string),
"Country": (string),
"CountryCode": (string),
"City": (string),
"Street": (string),
"House": (string),
"Build": (string),
"Apart": (string),
"CityCode": (string),
"Phone": (string),
"PhoneExt": (string),
"CompanyName": (string),
"IMClient": (string),
"IMLogin": (string),
"ExtraMessage": (string),
"ContactEmail": (string),
"WorkTime": (string),
"OGRN": (string),
"PointOnMap": {
/* MapPoint */
"x": (float),
"y": (float),
"x1": (float),
"y1": (float),
"x2": (float),
"y2": (float)
}
},
"Phrases": [
{ /* BannerPhraseInfo */
"PhraseID": (long),
"Phrase": (string),
"IsRubric": (string),
"Price": (float),
"ContextPrice": (float),
"AutoBroker": (string),
"AutoBudgetPriority": (string),
"UserParams": {
/* PhraseUserParams */
"Param1": (string),
"Param2": (string)
},
"Currency": (string)
}
...
],
"Sitelinks": [
{ /* Sitelink */
"Title": (string),
"Href": (string)
}
...
],
"MinusKeywords": [
(string)
...
],
"AutoMinusWords": (string),
"AgeLabel": (string),
"AdGroupMobileBidAdjustment": (int)
}
...
]
}
The parameters are described below.
|
Parameter |
Description |
Required |
|
BannerInfo object |
||
|
|
Ad ID. To create an ad, set to 0; to change ad parameters, specify its ID. |
Yes |
|
|
Campaign ID. |
Yes |
|
|
Ad group ID. To create an ad group, do not specify the parameter or set the value to 0. To add an ad to an existing group, specify the ID of that group. To change ad or group parameters, specifying the parameter is optional. |
No |
|
|
Ad group name (up to 255 characters). If not specified, the group is automatically assigned a name like "AdGroup № If the string length exceeds 255 characters, extra characters will be discarded. |
No |
|
|
Ad type: Desktop or Mobile. The parameter is specified only when creating an ad. If the value is not specified, Desktop is assumed. Attempting to change the parameter value for an existing ad returns an error with code 71. |
No |
|
|
Ad title (up to 33 characters, including spaces and punctuation). |
Yes |
|
|
Ad text (up to 75 characters, including spaces and punctuation). |
Yes |
|
|
Link to the advertiser's website. May contain substitution variables. |
One of the parameters — |
|
|
|
|
|
|
IDs of regions for which display is enabled or disabled. ID 0 or empty string — display in all regions. To disable display in a region, put a minus sign before the region ID, for example "1,-219" — display for Moscow and Moscow Oblast, except Chernogolovka. Regions with a minus cannot be used if region zero is specified. Also, the parameter must not consist only of minus-regions. The complete list of regions can be obtained using the GetRegions method. Specifying the parameter is optional if the |
No |
|
|
Array of Specifying keywords is optional if the |
No |
|
|
Array of |
No |
|
|
Array of negative keywords common to all keywords in the ad group. A negative keyword should be specified without a minus before the first word. No more than 7 words in a negative keyword. Length of each word — no more than 35 characters. Total length of negative keywords in the array — no more than 4096 characters. The "!" or "+" operator before a word is not counted in the total length. Note Negative keywords common to all groups in a campaign should preferably be specified in the campaign's parameter of the same name. |
No |
|
|
Automatically make keywords in the ad group non-overlapping — Yes/No. Default value — No. |
No |
|
|
Age category. For ads belonging to the baby_food group (corresponding value returned in the For other ads — age for which the information product is intended. Possible values: '0+', '6+', '12+', '16+', '18+'. If the ad does not have an age category, the parameter is not returned in responses and is ignored when attempting to set it. Alert Through the API, you can only change the age category value if the ad has one. To change the presence/absence of an age category, please contact . |
No |
|
|
Bid adjustment coefficient for mobile devices. Used for ad groups and specified as a percentage of the desktop bid. Value range from 50 to 1300. Learn more about the coefficient in the section of Direct help. Note If the coefficient is not specified for the group, then the campaign coefficient (MobileBidAdjustment parameter) is used in calculations for setting mobile device bid prices, if available. |
No |
|
ContactInfo object |
||
|
|
Organization name. No more than 255 characters. |
Yes |
|
|
Contact person. No more than 155 characters. |
No |
|
|
Country. No more than 50 characters. |
Yes |
|
|
Country phone code. |
Yes |
|
|
City. No more than 50 characters. |
Yes |
|
|
Street. No more than 55 characters. |
No |
|
|
House number. No more than 30 characters. |
No |
|
|
Building or block number. No more than 10 characters. |
No |
|
|
Apartment or office number. No more than 255 characters. |
No |
|
|
City phone code. |
Yes |
|
|
Contact phone number. |
Yes |
|
|
Extension phone number for connection through office PBX. |
No |
|
|
Type of instant messaging network — icq, jabber, skype, mail_agent. |
No |
|
|
Login in instant messaging network. |
No |
|
|
Additional information about the advertised product or service. No more than 200 characters. |
No |
|
|
Email address. No more than 255 characters. |
No |
|
|
Organization's working hours or customer service hours. Specified as a string indicating the range of weekdays, working hours, and minutes. Weekdays are designated by numbers from 0 to 6, where 0 is Monday, 6 is Sunday. Minutes are specified in multiples of 15: 0, 15, 30, or 45. String format:
For example, the string
The schedule can consist of several strings of the specified format, for example: "
24-hour operation is specified by the string |
Yes |
|
|
OGRN code for legal entities. |
No |
|
|
|
No |
|
MapPoint object |
||
|
|
Longitude of the point. From -180 to 180. |
Yes |
|
|
Latitude of the point. From -90 to 90. |
Yes |
|
|
Longitude of the lower left corner of the map area. From -180 to 180. |
Yes |
|
|
Latitude of the lower left corner of the map area. From -90 to 90. |
Yes |
|
|
Longitude of the upper right corner of the map area. From -180 to 180. |
Yes |
|
|
Latitude of the upper right corner of the map area. From -90 to 90. |
Yes |
|
BannerPhraseInfo object |
||
|
|
Keyword ID. To add a keyword, set to 0; to change keyword parameters, specify its ID. |
No |
|
|
Keyword. May contain negative words, which are specified with a minus sign before the word, for example [lightning -thunder -rain]. Negative words common to several keywords should preferably be specified in the ad group's Keyword length — no more than 4096 characters. The "!" operator before a negative word is not counted in the keyword length (the sequence "-!" is counted as one character). No more than 7 words in a keyword, excluding stop words and negative words. Each word and negative word — no more than 35 characters, excluding the minus before the negative word. |
Yes |
|
|
Indicator that the keyword is a Yandex Catalog category — Yes/No. Default value — No. With the value Yes, the passed keyword is ignored. |
No |
|
|
Bid on Yandex search (in the currency specified in the The maximum and minimum values are provided in the table. If the value is converted from Yandex units to the campaign currency before saving, it is rounded up to the nearest bid increment in this currency. If converting the value to the campaign's currency results in a value that is less than the minimum bid or more than the maximum bid for this currency, it is set to equal the minimum or maximum bid, respectively. |
For manual strategies |
|
|
Bid in the Yandex Advertising Network (in the currency specified in the The parameter is available for modification in the following cases:
The maximum and minimum values are provided in the table. If the value is converted from Yandex units to the campaign currency before saving, it is rounded up to the nearest bid increment in this currency. If converting the value to the campaign's currency results in a value that is less than the minimum bid or more than the maximum bid for this currency, it is set to equal the minimum or maximum bid, respectively. |
For MaximumCoverage strategy |
|
|
Enable/disable auto-broker. The parameter is not used, the passed value is ignored. |
No |
|
|
Keyword priority when using automatic strategies. Possible values:
|
For WeeklyBudget strategy |
|
|
|
No |
|
|
Currency in which bids are specified. Possible values: RUB, CHF, EUR, KZT, TRY, UAH, USD, BYN. The value must match the campaign currency. If the parameter is absent or equal to NULL, Yandex units are assumed. In this case, if the campaign is conducted in real currency, the bids passed by the application are converted to real currency before saving. If the value is not NULL and does not match the campaign currency (one of the campaigns), an error with code 245 is returned. |
No |
|
PhraseUserParams object |
||
|
|
Value of the |
When using substitution variables in |
|
|
Value of the |
|
|
Sitelink object |
||
|
|
Sitelink text (no more than 30 characters). |
Yes |
|
|
Sitelink address. May contain substitution variables. |
Yes |
Output data
Upon successful execution, the method returns an array containing the IDs of created/updated banners, as shown in the following example.
{
"data": [33823946,33823947]
}
Input data examples
Python
[
# Editing ad and group parameters
{
'BannerID': 2571700,
'CampaignID': 1327837,
'AdGroupName': u'Название группы 1',
'Title': u'Заголовок объявления 1',
'Text': u'Текст объявления 1',
'Href': 'http://www.site.ru/page{param1}?ad={param2}',
'Geo': '2,183,3',
'ContactInfo': {
'ContactPerson': u'Александр Громов',
'Country': u'Россия',
'CountryCode': '+7',
'City': 'Moscow',
'Street': 'Leo Tolstoy',
'House': '16',
'Build': '',
'Apart': '',
'CityCode': '495',
'Phone': '739-70-00',
'PhoneExt': '',
'CompanyName': 'MyCompany',
'IMClient': 'jabber',
'IMLogin': 'email@ya.ru',
'ExtraMessage': u'все товары сертифицированы',
'ContactEmail': 'direct@yandex.ru',
'WorkTime': '0;4;10;00;18;00;5;6;13;00;16;00',
'OGRN': '1077746365113',
'PointOnMap': {
'x': 37.587942,
'y': 55.733783,
'x1': 37.573500,
'y1': 55.729389,
'x2': 37.600772,
'y2': 55.740249
}
},
'Phrases': [
{
'PhraseID': 37512102,
'Phrase': 'refrigerator',
'ContextPrice': 1.6,
'Price': 2.1,
'AutoBudgetPriority': 'Medium',
'UserParams': {
'Param1': '17',
'Param2': '177'
}
}
],
'Sitelinks': [
{
'Title': u'Доп. ссылка 1',
'Href': 'http://www.site.ru/?q=qu&action=1'
},
{
'Title': u'Доп. ссылка 2',
'Href': 'http://www.site.ru/?q=qu&action=2'
},
{
'Title': u'Доп. ссылка 3',
'Href': 'http://www.site.ru/?q=qu&action=3'
}
],
'MinusKeywords': ['ice','cream'],
'AutoMinusWords': 'Yes'
},
# Editing ad parameters without editing group parameters
{
'BannerID': 2571707,
'CampaignID': 1327837,
'AdGroupID': 7542138,
'Title': 'Заголовок объявления 2',
'Text': 'Текст объявления 2',
'Href': 'http://www.site.ru/page{param1}?utm_content={phrase_id}'
},
# Adding an ad to a group
{
'BannerID': 0,
'CampaignID': 1327837,
'AdGroupID': 4571251,
'Title': 'Заголовок объявления 3',
'Text': 'Текст объявления 3',
'Href': 'http://www.site.ru/page{param2}?utm_content={phrase_id}'
}
]
PHP
array(
# Editing ad and group parameters
array(
'BannerID' => 2571700,
'CampaignID' => 1327837,
'Title' => 'Заголовок объявления 1',
'Text' => 'Текст объявления 1',
'Href' => 'http://www.site.ru/page{param1}?ad={param2}',
'Geo' => '2,183,3',
'ContactInfo' => array(
'ContactPerson' => 'Александр Громов',
'Country' => 'Россия',
'CountryCode' => '+7',
'City' => 'Moscow',
'Street' => 'Leo Tolstoy',
'House' => '16',
'Build' => '',
'Apart' => '',
'CityCode' => '495',
'Phone' => '739-70-00',
'PhoneExt' => '',
'CompanyName' => 'MyCompany',
'IMClient' => 'jabber',
'IMLogin' => 'email@ya.ru',
'ExtraMessage' => 'все товары сертифицированы',
'ContactEmail' => 'direct@yandex.ru',
'WorkTime' => '0;4;10;00;18;00;5;6;13;00;16;00',
'OGRN' => '1077746365113',
'PointOnMap' => array(
'x' => 37.587942,
'y' => 55.733783,
'x1' => 37.573500,
'y1' => 55.729389,
'x2' => 37.600772,
'y2' =>55.740249
)
),
'Phrases' => array(
array(
'PhraseID' => 37512102,
'Phrase' => 'refrigerator',
'ContextPrice' => 1.6,
'Price' => 2.1,
'AutoBudgetPriority' => 'Medium',
'UserParams' => array(
'Param1' => '17',
'Param2' =>'177'
)
)
),
'Sitelinks' => array(
array(
'Title' => 'Доп. ссылка 1',
'Href' =>'http://www.site.ru/?q=qu&action=1'
),
array(
'Title' => 'Доп. ссылка 2',
'Href' =>'http://www.site.ru/?q=qu&action=2'
),
array(
'Title' => 'Доп. ссылка 3',
'Href' =>'http://www.site.ru/?q=qu&action=3'
)
),
'MinusKeywords' => array('ice','cream'),
'AutoMinusWords' =>'Yes'
),
# Editing ad parameters without editing group parameters
array(
'BannerID' => 2571707,
'CampaignID' => 1327837,
'AdGroupID' => 7542138,
'Title' => 'Заголовок объявления 2',
'Text' => 'Текст объявления 2',
'Href' =>'http://www.site.ru/page{param1}?utm_content={phrase_id}'
),
# Adding an ad to a group
array(
'BannerID' => 0,
'CampaignID' => 1327837,
'AdGroupID' => 4571251,
'Title' => 'Заголовок объявления 3',
'Text' => 'Текст объявления 3',
'Href' =>'http://www.site.ru/page{param2}?utm_content={phrase_id}'
)
)
Perl
[
# Editing ad and group parameters
{
'BannerID' => 2571700,
'CampaignID' => 1327837,
'Title' => 'Заголовок объявления 1',
'Text' => 'Текст объявления 1',
'Href' => 'http://www.site.ru/page{param1}?ad={param2}',
'Geo' => '2,183,3',
'ContactInfo' =>{
'ContactPerson' => 'Александр Громов',
'Country' => 'Россия',
'CountryCode' => '+7',
'City' => 'Moscow',
'Street' => 'Leo Tolstoy',
'House' => '16',
'Build' => '',
'Apart' => '',
'CityCode' => '495',
'Phone' => '739-70-00',
'PhoneExt' => '',
'CompanyName' => 'MyCompany',
'IMClient' => 'jabber',
'IMLogin' => 'email@ya.ru',
'ExtraMessage' => 'все товары сертифицированы',
'ContactEmail' => 'direct@yandex.ru',
'WorkTime' => '0;4;10;00;18;00;5;6;13;00;16;00',
'OGRN' => '1077746365113',
'PointOnMap' =>{
'x' => 37.587942,
'y' => 55.733783,
'x1' => 37.573500,
'y1' => 55.729389,
'x2' => 37.600772,
'y2' =>55.740249
}
},
'Phrases' => [
{
'PhraseID' => 37512102,
'Phrase' => 'refrigerator',
'ContextPrice' => 1.6,
'Price' => 2.1,
'AutoBudgetPriority' => 'Medium',
'UserParams' =>{
'Param1' => '17',
'Param2' =>'177'
}
}
],
'Sitelinks' => [
{
'Title' => 'Доп. ссылка 1',
'Href' =>'http://www.site.ru/?q=qu&action=1'
},
{
'Title' => 'Доп. ссылка 2',
'Href' =>'http://www.site.ru/?q=qu&action=2'
},
{
'Title' => 'Доп. ссылка 3',
'Href' =>'http://www.site.ru/?q=qu&action=3'
}
],
'MinusKeywords' => ['ice','cream'],
'AutoMinusWords' =>'Yes'
},
# Editing ad parameters without editing group parameters
{
'BannerID' => 2571707,
'CampaignID' => 1327837,
'AdGroupID' => 7542138,
'Title' => 'Заголовок объявления 2',
'Text' => 'Текст объявления 2',
'Href' =>'http://www.site.ru/page{param1}?utm_content={phrase_id}'
},
# Adding an ad to a group
{
'BannerID' => 0,
'CampaignID' => 1327837,
'AdGroupID' => 4571251,
'Title' => 'Заголовок объявления 3',
'Text' => 'Текст объявления 3',
'Href' =>'http://www.site.ru/page{param2}?utm_content={phrase_id}'
}
]