---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.5
  - property: og:type
    content: article
  - property: article:section
    content: Справочник API
  - property: og:title
    content: Изменить метрики сущности
  - property: article:tag
    content: Техническая инструкция
alternate:
  - https://yandex.com.tr/support/tracker/en/api-ref/entities/metric.md
  - href: en/api-ref/entities/metric.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.tr/support/tracker/en/llms.txt


# Editing entity metrics

To manage metrics in projects, portfolios, and goals, use the `metricItems` entity parameter.

See For more information, see:

* [Additional entity parameters](https://yandex.com.tr/support/tracker/en/api-ref/entities/about-entities.md#query-params)
* [Metrics in the project](https://yandex.com.tr/support/tracker/en/manager/create-project.md#add-metrics):

## Adding or editing metrics {#patch-metrics}

To add or update the list of metrics in a project, portfolio, or goal, send a [Updating an entity](https://yandex.com.tr/support/tracker/en/api-ref/entities/update-entity.md) request. In the request body, include a `fields` object with a nested `metricItems` array. See [Additional entity parameters](https://yandex.com.tr/support/tracker/en/api-ref/entities/about-entities.md#query-params) for details.

**Parameters of objects** in the `metricItems` array {#metric-items}

#|
|| **Parameter** | **Description** | **Data type** ||
|| text | Metric name. Required parameter | String ||
|| url | Widget URL for an iframe||
|#

> Example 1: Add two metrics to a goal. If the goal already has metrics, they’ll be replaced with the new ones.
>
> ```json translate=no
> PATCH /v3/entities/goal/655f328********?fields=metricItems
> Host: api.tracker.yandex.net
> Authorization: OAuth <OAuth_token>
> X-Org-ID or X-Cloud-Org-ID: <organization_ID>
>
> {
>  "fields": {
>    "metricItems": [
>      {
>        "text": "First metric",
>        "url": "https://tracker.yandex.com/dashboard/12/widget/34?_embedded=1&_no_controls=1"
>      },
>      {
>        "text": "Second metric",
>        "url": "https://tracker.yandex.com/dashboard/23/widget/45?_embedded=1&_no_controls=1"
>      }
>    ]
>  }
> }
> ```

> Example 2: Add a new metric to the list of project metrics.
>
> ```json translate=no
> PATCH /v3/entities/project/655f8cc52*****?fields=metricItems
> Host: api.tracker.yandex.net
> Authorization: OAuth <OAuth_token>
> X-Org-ID or X-Cloud-Org-ID: <organization_ID>
>
> {
>  "fields": {
>    "metricItems": {
>      "add": {
>        "text": "My metric",
>        "url": "https://tracker.yandex.com/dashboard/12/widget/34?_embedded=1&_no_controls=1"
>      }
>    }
>  }
> }
> ```

## Getting entity metrics {#get-metrics}

To get metrics for a project, portfolio, or goal, send a [Getting entity parameters](https://yandex.com.tr/support/tracker/en/api-ref/entities/get-entity.md) request with the `fields=metricItems` parameter.

```
GET https://api.tracker.yandex.net/v3/entities/<entity_type>/<entity_id>?fields=metricItems
```

For descriptions of parameters in the `metricItems` array, see [Additional entity parameters](https://yandex.com.tr/support/tracker/en/api-ref/entities/about-entities.md#query-params).

## Deleting metrics {#delete-metrics}

To delete metrics from a project, portfolio, or goal, use the [Updating an entity](https://yandex.com.tr/support/tracker/en/api-ref/entities/update-entity.md) request.
* To delete all metrics, set `"metricItems": null`.
* To delete one or more metrics, update the list (see [Adding or editing metrics](#patch-metrics)) or use the `remove` operator.

> Example 1. Deleting all metrics from a goal.
>
> ```json translate=no
> PATCH /v3/entities/goal/655f328********?fields=metricItems
> Host: api.tracker.yandex.net
> Authorization: OAuth <OAuth_token>
> X-Org-ID or X-Cloud-Org-ID: <organization_ID>
>
> {
>  "fields": {
>        "metricItems": null
>    }
> }
> ```

> Example 2. Deleting a specific metric from the list.
>
> ```json translate=no
> PATCH /v3/entities/project/655f8cc52*****?fields=metricItems
> Host: api.tracker.yandex.net
> Authorization: OAuth <OAuth_token>
> X-Org-ID or X-Cloud-Org-ID: <organization_ID>
>
> {
>   "fields": {
>      "metricItems": {
>          "remove": {
>              "id": "6789*******",
>              "text": "My metric",
>              "url": "https://tracker.yandex.com/dashboard/12/widget/34?_embedded=1&_no_controls=1"
>          }
>      }
>   }
> }
> ```

{% note warning "" %}

To delete a specific metric from the list, pass an object with the metric's parameters in the same format as returned by the [Getting entity parameters](https://yandex.com.tr/support/tracker/en/api-ref/entities/get-entity.md) request.

{% endnote %}

