Update a campaign (campaigns/update)
Using this method, you can update an existing campaign. Only the
partnerCampaignId
parameter is mandatory. Others are optional: you can only specify the parameters that need changes in values.- After changing the data, the campaign is sent for verification and its status changes to
moderation
. - After the verification, the campaign status changes to one of the following (reported by the moderator):
verified
— everything is in order, you can start the campaign (campaigns/start) or it will start on schedule (ifcampaignStart
is set).declined
— you need to make changes: send the campaigns/update request with new data and the samepartnerCampaignId
.
- Campaign starts: status changes to
started
.
Request
Address for sending the request
POST https://yoomoney.ru/api/offerwall/v1/campaigns/update
Parameters
Parameter | Type | Description |
---|---|---|
partnerCampaignId | int | Campaign ID. Unique for the aggregator or store system. Required parameter |
categoryId | int | ID of the category of your products for this campaign according to the YooMoney reference guide. You can get the guide by calling categories/get. Required parameter |
campaignType | enum | Campaign type (method of obtaining the bonus). Possible values:
Required parameter |
campaignStart | datetime | Start date of the campaign. If not specified:
Optional parameter |
campaignEnd | datetime | Date when the campaign stops being shown to users. If not specified, you can stop the campaign by calling the campaigns/stop method. Optional parameter |
offerDuration | int | Period (in hours) during which the user can redeem the saved offer. By default, it’s 2 weeks (366 hours). You can set a different period in the offerEnd parameter.After the campaign ends (if you set a deadline in campaignEnd ), the issued offers will be valid for another two weeks or within the period specified in offerDuration . The store needs to take this into account and give bonuses to users.Optional parameter |
pinType | enum | Type of promo code. Possible values:
Required if campaignType=codeOnline or campaignType=codeOffline |
pinDisplayType | string | Ways to display the promo code. Possible values:
Required if campaignType=codeOnline or campaignType=codeOffline |
couponCode | string | Promo code value. It will provide the user with a store discount. Specified for campaigns with promo codes. Specified for products with reusable promo codes. Required if:
|
acceptUrl | string | Tracking link that the user can follow to get a bonus (used instead of the promo code or with it). By default, the YooMoney service adds the click ID ( clickId ) you need to analyze to the link. You can add template parameters to the link. How to form a linkRequired if campaignType=promo or campaignType=codeOnline |
merchantDomain | string | The address of the store’s website without http , www , and / .Example: example.com Required parameter |
merchantLogoSvg | varchar (300) | Link to the store’s logo:
Used for displaying on web pages. Required parameter |
merchantLogoPng | varchar (300) | Link to the store’s logo on transparent background:
Used for displaying on web pages. Required parameter |
merchantName | varchar (300) | Store name. Required parameter |
backgroundColor | varchar (30) | Background color in #HEX format (not white nor light). Required parameter |
backgroundImage | string | Background image:
If the field is empty, the background image will be selected to match the category of this offer. Optional parameter |
fontColor | varchar (30) | Font color in #HEX format (contrast to the background). Required parameter |
description | varchar (90) | Campaign description in Russian. Example: Скидка на товары для детей в магазине «Солнышко» Required parameter |
conditions | varchar (512) | Conditions for getting the bonus in Russian. Example: Промокод действует 10 дней при заказе от 4000 рублей на сайте example.com. Его можно использовать один раз. Required parameter |
discountType | varchar (30) | Type of discount or bonus. Possible values:
Required parameter |
discountAmount | varchar (30) | Size of the discount or the bonus description. If discountType=text , the copy must be in Russian.Required parameter |
discountCurrency | CurrencyCode | Currency code of the discount. Default value: 643 (Russian ruble).For a discount of a certain amount ( discountType=fix ), you can set a different value: 840 (US dollar).Optional parameter |
campaignFee | varchar (30) | Amount of YooMoney’s remuneration for this campaign. Amount in rubles or dollars. You must specify either of the parameters: amount of remuneration ( campaignFee ), or its minimum and maximum (campaignFeeMin and campaignFeeMax ). |
campaignFeeMin | varchar (30) | Minimum amount of YooMoney’s remuneration. Optional parameter |
campaignFeeMax | varchar (30) | Maximum amount of YooMoney’s remuneration. Optional parameter |
feeType | varchar (30) | Amount of YooMoney’s remuneration for this campaign. Possible values:
Required parameter |
feeCurrency | CurrencyCode | Currency code of YooMoney’s remuneration.
Optional parameter |
supportedPlatforms | varchar (300) | Your offers will be displayed only on certain platforms. Possible values:
Optional parameter |
cashbackType | enum | For companies offering cashback: the type of cashback sent to the user’s wallet. Possible values:
Optional parameter |
cashbackConfirmTime | long | For companies offering cashback: the timeframe for redeeming the offer and crediting cashback (campaigns/redeem method). Number of days, integer. Optional parameter |
The discount amount is described by three variables:
discountType
, discountAmount
, and discountCurrency
. For instance:- 10% off:
discount_type=percent, discount_amount=10
; - 500 ruble discount:
discount_type=fix, discount_amount=500; currency=643
; - a gift for a purchase:
discount_type=text, discount_amount="Подарок"
.
Example of a request body
JSON
{ "backgroundColor": "#C85040", "discountAmount": "500", "fontColor": "#FAF4E9", "partnerCampaignId": 228 }
Request example
cURL
curl -X POST \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'Authorization: Bearer <access token>' -d '{ "backgroundColor": "#C85040", "discountAmount": "500", "fontColor": "#FAF4E9", "partnerCampaignId": 228, }' 'https://yoomoney.ru/api/offerwall/v1/campaigns/update'
Response
Parameters
Parameter | Type | Description |
---|---|---|
ymCampaignId | int | Unique ID of the campaign in the YooMoney service. |
campaignStatus | enum | Campaign status. Possible values:
|
Errors
Error code | Value | Description |
---|---|---|
campaignNotFound | Not found | Campaign with this partnerCampaignId does not exist. |
Example of a response body
JSON
{ "status": "success", "result": { "ymCampaignId": 2248, "campaignStatus": "moderation" } }