---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://yandex.com/dev/direct/doc/dg-v4/en/live/RetargetingCondition_Update.md
  - https://yandex.com/dev/direct/doc/dg-v4/ru/live/RetargetingCondition_Update.md
  - href: en/live/RetargetingCondition_Update.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/direct/doc/dg-v4/en/llms.txt

# Update
Changes a retargeting condition.

{% note alert %}

Disabled method. Use version 5 of the API.

For information about the compatibility of methods between versions Live 4 and 5, see the [Migration guide](https://yandex.com/dev/direct/doc/migration/concepts/methods.md).

{% endnote %}


## Restrictions

If a retargeting condition contains at least one "all" or "or" type of group, after editing, it still must contain at least one "all" or "or" group.

If a retargeting condition contains only "not" groups, it still must contain only "not" groups after editing.

## Input data

The input data structure in JSON is shown below.

```javascript
{
   "method": "RetargetingCondition",
   "param": {
      /* RetargetingConditionRequest */
      "Action": (string),
      "RetargetingConditions": [
         {  /* RetargetingCondition */
            "Fields": [
               (string)
               ...
            ],
            "RetargetingConditionName": (string),
            "RetargetingConditionDescription": (string),
            "RetargetingConditionID": (int),
            "RetargetingCondition": [
               {  /* RetargetingConditionItem */
                  "Type": (string),
                  "Goals": [
                     {  /* RetargetingConditionGoalItem */
                        "Time": (int),
                        "GoalID": (long)
                     }
                     ...
                  ] 
               } 
               ...
            ]
         }
         ...
      ]
   }
}
```

Parameters are described below.


#|
||
**<sup >Parameter</sup>**
|
**<sup >Description</sup>**
|
**<sup >Required</sup>**
||

||
**<sub >RetargetingConditionRequest object</sub>**
||
||
`Action`
|
Action: Update.
|
Yes
||
||
`RetargetingConditions`
|
Array of `RetargetingCondition` objects containing information about retargeting conditions.
|
Yes
||

||
**<sub >RetargetingCondition object</sub>**
||
||
`Fields`
|
Names of parameters to be updated. If omitted, all parameters will be updated (and if the value is not set, they will be reset).
|
No
||
||
`RetargetingConditionName`
|
Name of the retargeting condition (maximum 250 characters).
|
No
||
||
`RetargetingConditionDescription`
|
Text description of the retargeting condition (maximum 4096 characters).
|
No
||
||
`RetargetingConditionID`
|
ID of the retargeting condition.
|
Yes
||
||
`RetargetingCondition`
|
Array of `RetargetingConditionItem` objects. Each object contains a group that describes the desired user behavior. If the retargeting condition has several groups, they are united with the logical AND operator (the condition is satisified if all the groups of goals are achieved).
|
Yes
||

||
**<sub >RetargetingConditionItem object</sub>**
||
||
`Type`
|
Type of group:

- all — The group is satisfied if all the goals and segments are met.
- or — The group is satisfied if at least one of the goals or segments is met.
- not — The group is satisfied if none of the goals or segments is met.

A retargeting condition that uses Yandex Metrica segments or Yandex Audience segments must contain at least one "all" or "or" type of group. A retargeting condition that consists solely of "not" groups can only use Yandex Metrica goals.
|
Yes
||
||
`Goals`
|
Array of goals and segments (`RetargetingConditionGoalItem` objects).
|
Yes
||

||
**<sub >RetargetingConditionGoalItem object</sub>**
||
||
`Time`
|
Number of days (from 1 to 90) for checking whether goals are completed or segments are matched.
|
For Yandex Metrica goals and segments
||
||
`GoalID`
|
ID of the goal or segment.
|
Yes
||
|#

## Output data


{% note alert %}

An error when changing one of the retargeting conditions does not cause the entire operation to be canceled, and does not affect the success of changing other retargeting conditions.

{% endnote %}


The output data structure in JSON is shown below.

```javascript
{
   "data": {
      /* RetargetingConditionResponse */
      "ActionsResult": [
         {  /* RetargetingConditionActionResult */
            "Warnings": [
               {  /* Warning */
                  "WarningCode": (int),
                  "WarningString": (string),
                  "Description": (string)
               }
               ...
            ],
            "Errors": [
               {  /* Error */
                  "FaultCode": (int),
                  "FaultString": (string),
                  "FaultDetail": (string)
               }
               ...
            ],
            "RetargetingConditionID": (int)
         }
         ...
      ]
   }
}
```

Parameters are described below.


#|
||
**<sup >Parameter</sup>**
|
**<sup >Description</sup>**
||

||
**<sub >RetargetingConditionResponse object</sub>**
||
||
`ActionsResult`
|
Array of `RetargetingConditionActionResult` objects. Each object corresponds to an item in the `RetargetingConditions` input array.

- If the operation was completed successfully, the object contains the ID of the added/updated retargeting condition.
- If the operation was completed but issues occurred during the operation, the object contains the ID of the added/updated retargeting condition and a `Warnings` array containing a description of those issues.
- The `Errors` array, if an error occurred.

The items in the array are in the same order as the objects in the `RetargetingConditions` input array.
||

||
**<sub >RetargetingConditionActionResult object</sub>**
||
||
`Warnings`
|
Array of `Warning` objects describing issues that occurred while performing the operation.
||
||
`Errors`
|
Array of `Error` objects with errors that occurred while performing the operation.
||
||
`RetargetingConditionID`
|
ID of the retargeting condition.
||

||
**<sub >Warning object</sub>**
||
||
`WarningCode`
|
Warning code.
||
||
`WarningString`
|
Warning text.
||
||
`Description`
|
Warning description in JSON format.
||

||
**<sub >Error object</sub>**
||
||
`FaultCode`
|
Error code.
||
||
`FaultString`
|
Textual message about the error.
||
||
`FaultDetail`
|
Detailed description of the reason for the error.
||
|#

## Examples of input data

# Python

```python
{
   'Action': 'Update',
   'RetargetingConditions': [
      {
         'Fields': ['RetargetingCondition'],
         'RetargetingConditionID': 123789,
         'RetargetingCondition': [
            {
               'Type': 'or',
               'Goals': [
                  {  
                     'Time': 14,
                     'GoalID': 1557799
                  },
                  {  
                     'Time': 14,
                     'GoalID': 1558005
                  }
               ]
            }
         ]
      }
   ]
}
```

# PHP

```php
array(
   'Action' => 'Update',
   'RetargetingConditions' => array(
      array(
         'Fields' => array('RetargetingCondition'),
         'RetargetingConditionID' => 123789,
         'RetargetingCondition' => array(
            array(
               'Type' => 'or',
               'Goals' => array(
                  array(
                     'Time' => 14,
                     'GoalID' =1557799
                  ),
                  array(
                     'Time' => 14,
                     'GoalID' =1558005
                  )
               )
            )
         )
      )
   )
)
```

# Perl

```perl
{
   'Action' => 'Update',
   'RetargetingConditions' => [
      {
         'Fields' => ['RetargetingCondition'],
         'RetargetingConditionID' => 123789,
         'RetargetingCondition' => [
            {
               'Type' => 'or',
               'Goals' => [
                  {  
                     'Time' => 14,
                     'GoalID' =1557799
                  },
                  {  
                     'Time' => 14,
                     'GoalID' =1558005
                  }
               ]
            }
         ]
      }
   ]
}
```

## Related information

- [Retargeting](https://yandex.com/dev/direct/doc/dg-v4/en/concepts/retargeting.md)

