---
metadata:
  - name: generator
    content: Diplodoc Platform v5.47.3
alternate:
  - https://yandex.com.tr/support/tracker/en/api-ref/queues/change-trigger.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com.tr/support/tracker/en/llms.txt

# Updating a trigger using an API request

Use this request to update a [trigger](https://yandex.com.tr/support/tracker/en/user/create-trigger.md).

<div class="request_example method_patch yfm-clipboard">
    <p>PATCH</p>
    <pre><code>https://api.tracker.yandex.net/v3/queues/&lt;queue_ID>/triggers/&lt;trigger_ID>?version=&lt;trigger_current_version></code></pre>
    <button class="yfm-clipboard-button"><svg width="16" height="16" viewBox="0 0 24 24" class="yfm-clipboard-icon" data-animation="15">
    <path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path>
    <path stroke="currentColor" fill="transparent" strokewidth="1.5" d="M9.5 13l3 3l5 -5" visibility="hidden">
        <animate id="visibileAnimation-15" attributeName="visibility" from="hidden" to="visible" dur="0.2s" fill="freeze" begin=""></animate>
        <animate id="hideAnimation-15" attributeName="visibility" from="visible" to="hidden" dur="1s" begin="visibileAnimation-15.end+1" fill="freeze"></animate>
    </path>
</svg>
</button>
</div>

<!-- source: en/_assets/style/methods.md -->

<!-- endsource: en/_assets/style/methods.md -->

## Query format {#query}

Before making a request, [get permission to access the API](https://yandex.com.tr/support/tracker/en/api-ref/access.md).

To update a trigger, use an HTTP `PATCH` request. In the request body, specify the parameters in JSON format.

```json
PATCH /v3/queues/<queue_ID>/triggers/<trigger_ID>?version=<current_trigger_version>
Host: api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID or X-Cloud-Org-ID: <organization_ID>

{
    "name": "<trigger_name>",
    "actions": [<trigger_action_parameters>],
    "conditions": [<trigger-condition_parameters>]
}
```

<!-- source: en/_includes/api/headings.md -->
{% cut "Headers" %}

* `Host`: address of the node that provides the API.

* <!-- source: en/_includes/api/authorization.md -->
  `Authorization`: Authorization token about these formats:

    - `OAuth <OAuth_token>`: For authorization using the OAuth 2.0 protocol. [Learn more](https://yandex.com.tr/support/tracker/en/api-ref/access.md#about_OAuth)

    - `Bearer <IAM_token>`: For authorization using an IAM token, if a Yandex Cloud Organization organization is linked to Tracker. [Learn more](https://yandex.com.tr/support/tracker/en/api-ref/access.md#iam-token)
  <!-- endsource: en/_includes/api/authorization.md -->


* <!-- source: en/_includes/api/org-id.md -->
  `X-Org-ID` or `X-Cloud-Org-ID`: Organization ID.

  - Use the `X-Org-ID` header if a Tracker organization is linked to Yandex 360 for Business.

  - Use the `X-Cloud-Org-ID` header if a Tracker organization is linked to Yandex Cloud Organization.

  To get the organization ID, go to **Administration** → [**Organizations**](https://tracker.yandex.com/admin/orgs) and copy the value from the **ID** field. {#find-id}
  <!-- endsource: en/_includes/api/org-id.md -->


{% endcut %}
<!-- endsource: en/_includes/api/headings.md -->

{% cut "Resource" %}

| Parameter | Description | Data type |
----- | ----- | -----
| \<queue_ID\> | Queue ID or key. The queue key is case-sensitive. | String or number |
| \<trigger_ID\> | Trigger ID | Number |
| \<current_trigger_version\> | Current trigger version | Number |

{% note info "" %}

To find the current trigger version, use the [request for getting trigger parameters](https://yandex.com.tr/support/tracker/en/api-ref/queues/get-trigger.md).

{% endnote %}

{% endcut %}

{% cut "Request body parameters" %}

**Additional parameters**

| Parameter | Description | Data type |
----- | ----- | -----
| name | Trigger name | String |
| actions | Array with trigger action objects For more information, see [Trigger action objects](change-trigger-actions.md). | Array of objects |
| conditions | Array with trigger conditions. For more information, see [Trigger conditions](#conditions). | Array of objects |
| active | Trigger status Acceptable values include:<ul><li>`true`: Active</li><li>`false`: Inactive</li></ul> | Boolean |
| before | ID of the trigger before which to place this trigger | Number |

#### Trigger conditions {#conditions}

Depending on whether all or at least one condition is to be met, you can specify the **conditions** field value in one of the two formats: either () or an array of objects including both the array of elementary trigger condition objects and the type of a logical combination of conditions:

* Array of elementary trigger condition objects. For more information, see [Trigger condition objects](https://yandex.com.tr/support/tracker/en/api-ref/queues/change-trigger-conditions.md).

  In this case, the trigger will fire when all conditions are met, like when conditions are combined with the “logical AND” operator.

  ```json translate=no
  {
      "conditions": [
         {<trigger_condition_1>},
         {<trigger_condition_2>}
      ]
  }
  ```

* Object indicating the type for combining trigger conditions:

   | Parameter | Description | Data type |
   ----- | ----- | -----
   | type | Type of logical combination of trigger conditions. Acceptable values include:<ul><li>`Or`: Logical OR (`Any`)</li><li>`And`: Logical AND (`All`)</li></ul> | String |
   | conditions | Array with elementary [trigger condition objects](change-trigger-conditions.md) | Array of objects |

  ```json translate=no
  {
      "conditions": {
          "type": "Or",
          "conditions": [
              {<trigger_condition_1>},
              {<trigger_condition_2>}
          ]
      }
  }
  ```
{% endcut %}

## Examples {#examples}

1. [Trigger that fires when at least one condition is met](#or-condition).
1. [Updating a trigger action](#and-condition).
1. [Trigger that fires when a group of conditions is met](#condition-group).
1. [Disabling a trigger](#deactivation).
1. [Moving a trigger in the list and activating it](#move-before).

Example 1: Changing trigger conditions and trigger action. The trigger must fire if at least one of the conditions is met. {#or-condition}
> - The HTTP `PATCH` method is used.
> - The trigger for the DESIGN queue is being updated.
> - The trigger ID is 16 and its current version is 1.
> - The trigger condition is updated: the comment text matches the **Need info** phrase.
> - Trigger action: the issue status changes to **Need info**.
> ```json translate=no
> PATCH /v3/queues/DESIGN/triggers/16?version=1
> Host: api.tracker.yandex.net
> Authorization: OAuth <OAuth_token>
> X-Org-ID or X-Cloud-Org-ID: <organization_ID>
> {
>   "actions": [
>       { "type": "Transition",
>           "status": {
>              "key": "needInfo"
>           }
>       }
>   ],
>   "conditions": [
>       { "type": "Or",
>            "conditions": [
>                { "type": "CommentFullyMatchCondition", "word": "Need info" },
>                { "type": "CommentFullyMatchCondition", "word": "Need info" }
>            ]
>       }
>   ]
> }
> ```

Example 2: Updating a trigger action. {#and-condition}
> - The HTTP `PATCH` method is used.
> - The trigger for the DESIGN queue is being updated.
> - The trigger ID is 16 and its current version is 2.
> - Trigger action changes: a checklist is created with the item names, assignee, and deadline specified.
> ```json translate=no
> PATCH /v3/queues/DESIGN/triggers/16?version=2
> Host: api.tracker.yandex.net
> Authorization: OAuth <OAuth_token>
> X-Org-ID or X-Cloud-Org-ID: <organization_ID>
> {
>   "actions": [
>      {
>         "type": "CreateChecklist",
>         "checklistItems": [
>            {
>               "text": "Do that",
>               "assignee": "username",
>               "deadline": {"date": "2025-05-23"}
>            },
>            {
>               "text": "Do this",
>               "assignee": "username",
>               "deadline": {"date": "2025-05-23"}
>            },
>            {"text": "Report the results"}
>         ]
>      }
>   ]
> }
> ```


Example 3: Changing trigger conditions and trigger action. The trigger must fire when one of the condition groups is met. {#condition-group}
>- The HTTP `PATCH` method is used.
>- The trigger for the DESIGN queue is being updated.
>- The trigger ID is 16 and its current version is 3.
>- The trigger condition is updated: Trigger is activated if one of the condition groups is met:
>- Comment text matches the **Need info** phrase and the issue status is `In progress`.
>- Comment text matches the **No data** phrase.
>- Trigger action changes: the issue status changes to **Need info**.
>```json translate=no
> PATCH /v3/queues/DESIGN/triggers/16?version=3
> Host: api.tracker.yandex.net
> Authorization: OAuth <OAuth_token>
> X-Org-ID or X-Cloud-Org-ID: <organization_ID>
>
> {
>    "actions": [
>        {
>            "type": "Transition",
>            "status": {
>                "key": "needInfo"
>            }
>        }
>    ],
>    "conditions": [
>        {
>            "type": "Or",
>            "conditions": [
>                {
>                    "type": "And",
>                    "conditions": [
>                        {
>                            "ignoreCase": false,
>                            "noMatchBefore": false,
>                            "removeMarkup": false,
>                            "type": "CommentFullyMatchCondition",
>                            "word": "Need info"
>                        },
>                        {
>                            "type": "FieldEquals",
>                            "field": "status",
>                            "value": "inProgress"
>                        }
>                    ]
>                },
>                {
>                    "ignoreCase": false,
>                    "noMatchBefore": false,
>                    "removeMarkup": false,
>                    "type": "CommentFullyMatchCondition",
>                    "word": "No data"
>                }
>            ]
>        }
>    ]
> }
> ```

Example 4: Deactivating a trigger. {#deactivation}
> - The HTTP `PATCH` method is used.
> - The trigger for the DESIGN queue is being updated.
> - The trigger ID is 16 and its current version is 4.
> - The trigger is deactivated.
> ```json translate=no
> PATCH /v3/queues/DESIGN/triggers/16?version=4
> Host: api.tracker.yandex.net
> Authorization: OAuth <OAuth_token>
> X-Org-ID or X-Cloud-Org-ID: <organization_ID>
> {
>   "active": false
> }
> ```

Example 5: Moving a trigger in the list and activating it. {#move-before}
> - The HTTP `PATCH` method is used.
> - The trigger for the DESIGN queue is being updated.
> - The trigger ID is 16 and its current version is 4.
> - The trigger is moved and placed before the trigger with the `6` ID and then activated.
> ```json translate=no
> PATCH /v3/queues/DESIGN/triggers/16?version=4
> Host: api.tracker.yandex.net
> Authorization: OAuth <OAuth_token>
> X-Org-ID or X-Cloud-Org-ID: <organization_ID>
> { "before": 6, "active": true }
> ```

## Response format {#answer}

{% list tabs %}

- Request executed successfully

   <!-- source: en/_includes/api/answer-200.md -->
   If the request is successful, the API returns a response with code `200 OK`.
   <!-- endsource: en/_includes/api/answer-200.md -->

   The request body contains information about the created trigger in JSON format.

   ```json translate=no
   {
      "id": 16,
      "self": "https://api.tracker.yandex.net/v3/queues/DESIGN/triggers/16",
      "queue": {
         "self": "https://api.tracker.yandex.net/v3/queues/DESIGN",
         "id": "26",
         "key": "DESIGN",
         "display": "Design"
      },
      "name": "TriggerName",
      "order": "0.0002",
      "actions": [
         {
            "type": "Transition",
            "id": 2,
            "status": {
               "self": "https://api.tracker.yandex.net/v3/statuses/2",
               "id": "2",
               "key": "needInfo",
               "display": "Need info"
            }
         }
      ],
      "conditions": [
         {
            "type": "Or",
            "conditions": [
               {
                  "type": "CommentFullyMatchCondition",
                  "word": "Need info",
                  "ignoreCase": true,
                  "removeMarkup": true,
                  "noMatchBefore": false
               },
               {
                  "type": "CommentFullyMatchCondition",
                  "word": "Need info",
                  "ignoreCase": true,
                  "removeMarkup": true,
                  "noMatchBefore": false
               }
            ]
         }
         ],
         "version": 2,
         "active": true
      }

   ```

   {% cut "Response parameters" %}

   | Parameter | Description | Data type |
   ----- | ----- | -----
   | id | Trigger ID | String |
   | self | Links to trigger | String |
   | queue | Queue to create the trigger | Map item |
   | name | Trigger name | String |
   | order | Trigger weight. This parameter affects the order of trigger display in the interface. | String |
   | [actions](#actions) | Array with trigger actions | Array of objects |
   | [conditions](#conditions) | Array with trigger conditions | Array of objects |
   | version | Trigger version. Each trigger update increases the version number. | Number |
   | active | Trigger status | Boolean |

   `queue` **object fields** {#queue}

   <!-- source: en/_includes/api/queue.md -->
   | Parameter | Description | Data type |
   ----- | ----- | -----
   | self | Address of the API resource with information about the queue. | String |
   | id | Queue ID. | String |
   | key | Queue key. | String |
   | display | Queue name displayed. | String |
   <!-- endsource: en/_includes/api/queue.md -->

   {% endcut %}

- Request failed

    If the request is processed incorrectly, the API returns a message with error details:

    <!-- source: en/_includes/api/answer-error-400.md -->
    400
    :   One or more request parameters have an invalid value.
    <!-- endsource: en/_includes/api/answer-error-400.md -->

    <!-- source: en/_includes/api/answer-error-403.md -->
    403
    :   You are not authorized to perform this action. You can check what rights you have in the Tracker interface. The same rights are required to perform an action via the API and interface.
    <!-- endsource: en/_includes/api/answer-error-403.md -->

    <!-- source: en/_includes/api/answer-error-404.md -->
    404
    :   The requested object was not found. You may have specified an invalid object ID or key.
    <!-- endsource: en/_includes/api/answer-error-404.md -->

    <!-- source: en/_includes/api/answer-error-409.md -->
    409
    :   There was a conflict when editing the object. The error may be due to an invalid update version.
    <!-- endsource: en/_includes/api/answer-error-409.md -->

    <!-- source: en/_includes/api/answer-error-412.md -->
    412
    :   A conflict occurred while editing the object. The error may be due to an invalid update version.
    <!-- endsource: en/_includes/api/answer-error-412.md -->

    <!-- source: en/_includes/api/answer-error-422.md -->
    422
    :   JSON validation error, the request is rejected.
    <!-- endsource: en/_includes/api/answer-error-422.md -->

    <!-- source: en/_includes/api/answer-error-500.md -->
    500
    :   Internal service error. Try again later.
    <!-- endsource: en/_includes/api/answer-error-500.md -->

    <!-- source: en/_includes/api/answer-error-503.md -->
    503
    :   The API service is temporarily unavailable.
    <!-- endsource: en/_includes/api/answer-error-503.md -->

{% endlist %}
