---
metadata:
  - name: generator
    content: Diplodoc Platform v5.70.0
alternate:
  - https://yandex.ru/dev/metrika/en/management/openapi/segment/updateSegment.md
  - https://yandex.ru/dev/metrika/ru/management/openapi/segment/updateSegment.md
  - href: https://yandex.ru/dev/metrika/en/management/openapi/segment/updateSegment.md
    type: text/markdown
    title: Markdown version
  - href: https://yandex.ru/dev/metrika/en/llms.txt?revision=r22093398
    rel: describedby
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.ru/dev/metrika/en/llms.txt?revision=r22093398

<!-- source: en/management-src/Managing-segments/updateSegment.md -->
<div class="openapi">

# Changing a segment

<!-- markdownlint-disable-file -->

Changes the specified segment. The segment updated via the API won't appear in the Yandex Metrica web interface

## Request

<div class="openapi__requests">

<div class="openapi__request__wrapper" style="--method: var(--dc-openapi-methods-put);margin-bottom: 12px">

<div class="openapi__request">

PUT {.openapi__method}
```text translate=no
https://api-metrika.yandex.net/management/v1/counter/{counterId}/apisegment/segment/{segmentId}
```

</div>

</div>

</div>

### Path parameters

#|
|| **Name** | **Description** ||
||

_counterId_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: integer

Tag ID.
{.table-cell}
||
||

_segmentId_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: integer

ID of the segment that you want to update.
{.table-cell}
||
|#{.json-schema-properties}

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "segment": {
    "segment_id": 0,
    "counter_id": 0,
    "name": "example",
    "expression": "example",
    "status": "example",
    "segment_source": "example",
    "create_time": "2025-01-01T00:00:00Z"
  }
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_segment_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: [Segment](#entity-Segment)

Segment.

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "segment_id": 0,
  "counter_id": 0,
  "name": "example",
  "expression": "example",
  "status": "example",
  "segment_source": "example",
  "create_time": "2025-01-01T00:00:00Z"
}
```

{% endcut %}
{.table-cell}
||
|#{.json-schema-properties}

</div>

<div class="openapi-entity">

### Segment {#entity-Segment}

Segment.

#|
|| **Name** | **Description** ||
||

_counter_id_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: integer

Tag ID.
{.table-cell}
||
||

_create_time_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string&lt;date-time&gt;

Segment creation time.

_Example:_{.json-schema-reset .json-schema-example} `2025-01-01T00:00:00Z`
{.table-cell}
||
||

_expression_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

An expression that matches the [value of the `filters` parameter](https://yandex.ru/dev/metrika/en/stat/segmentation.md).

_Min length:_{.json-schema-reset .json-schema-assertion} `1`

_Max length:_{.json-schema-reset .json-schema-assertion} `65535`

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_name_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Segment name.

_Min length:_{.json-schema-reset .json-schema-assertion} `1`

_Max length:_{.json-schema-reset .json-schema-assertion} `255`

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_segment_id_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: integer

Segment ID.
{.table-cell}
||
||

_segment_source_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Segment source. Shows how this segment was created. Accepts the value `api`. API-created segments are used.

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_status_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Segment status. Possible values:
- `active`: Active segment.
- `deleted`: Deleted segment.


_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "segment_id": 0,
  "counter_id": 0,
  "name": "example",
  "expression": "example",
  "status": "example",
  "segment_source": "example",
  "create_time": "2025-01-01T00:00:00Z"
}
```

{% endcut %}

</div>

## Responses

<div class="openapi__response__code__200">

## 200 OK

OK

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "segment": {
    "segment_id": 0,
    "counter_id": 0,
    "name": "example",
    "expression": "example",
    "status": "example",
    "segment_source": "example",
    "create_time": "2025-01-01T00:00:00Z"
  }
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_segment_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: [Segment](#entity-Segment)

Segment.

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "segment_id": 0,
  "counter_id": 0,
  "name": "example",
  "expression": "example",
  "status": "example",
  "segment_source": "example",
  "create_time": "2025-01-01T00:00:00Z"
}
```

{% endcut %}
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

</div>
<!-- endsource: en/management-src/Managing-segments/updateSegment.md -->

[*Deprecated]: No longer supported, please use an alternative and newer version.