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

<!-- source: ru/management-src/Upravlenie-filtrami/addFilter.md -->
<div class="openapi">

# Создание фильтра

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

Создает фильтр счетчика.

## Request

<div class="openapi__requests">

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

<div class="openapi__request">

POST {.openapi__method}
```text translate=no
https://api-metrika.yandex.net/management/v1/counter/{counterId}/filters
```

</div>

</div>

</div>

### Path parameters

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

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

Идентификатор счетчика, для которого вы хотите создать фильтр.
{.table-cell}
||
|#{.json-schema-properties}

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "filter": {
    "id": 0,
    "attr": "example",
    "type": "example",
    "value": "example",
    "action": "example",
    "status": "example",
    "start_ip": "example",
    "end_ip": "example",
    "with_subdomains": true
  }
}
```

{% endcut %}

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

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

Фильтр.

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

```json translate=no
{
  "id": 0,
  "attr": "example",
  "type": "example",
  "value": "example",
  "action": "example",
  "status": "example",
  "start_ip": "example",
  "end_ip": "example",
  "with_subdomains": true
}
```

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

</div>

<div class="openapi-entity">

### FilterE {#entity-FilterE}

Фильтр.

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

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

Тип фильтра:
- `exclude` — исключить трафик.
- `include` — оставить только трафик.


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

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

Тип данных, к которым применяется фильтр:
- `title` — заголовок страницы.
- `client_ip` — IP-адрес.
- `url` — URL страницы.
- `referer` — реферер.
- `uniq_id` — специальный атрибут для фильтра **не учитывать мои визиты**.


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

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

Статус фильтра:
- `active` — фильтр используется.
- `disabled` — фильтр отключен (без удаления).


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

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

Отношение или действие для фильтра:
- `equal` — равно.
- `start` — начинается с.
- `contain` — содержит.
- `interval` — в интервале, используется только с типом данных «IP-адрес» (`attr = client_ip`).
- `me` — мои посещения, используется только с типом данных `attr = uniq_id`.
- `only_mirrors` — только сайт и зеркала, используется только для типа данных «URL страницы» (`attr = url`) и типа фильтра **оставить только трафик** (`action = include`), а также при условии, что для счетчика заданы зеркала.
- `regexp` — регулярное выражение.


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

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

Последний IP-адрес диапазона.

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

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

Идентификатор фильтра. Укажите данный параметр при изменении фильтра счетчика.
{.table-cell}
||
||

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

Первый IP-адрес диапазона.

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

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

Значение фильтра.

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

_with_subdomains_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: boolean

Фильтровать по поддоменам:
- 0 — не фильтровать по поддоменам (по умолчанию);
- 1 — фильтровать по поддоменам.

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

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

```json translate=no
{
  "id": 0,
  "attr": "example",
  "type": "example",
  "value": "example",
  "action": "example",
  "status": "example",
  "start_ip": "example",
  "end_ip": "example",
  "with_subdomains": true
}
```

{% endcut %}

</div>

## Responses

<div class="openapi__response__code__200">

## 200 OK

OK

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "filter": {
    "id": 0,
    "attr": "example",
    "type": "example",
    "value": "example",
    "action": "example",
    "status": "example",
    "start_ip": "example",
    "end_ip": "example",
    "with_subdomains": true
  }
}
```

{% endcut %}

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

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

Фильтр.

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

```json translate=no
{
  "id": 0,
  "attr": "example",
  "type": "example",
  "value": "example",
  "action": "example",
  "status": "example",
  "start_ip": "example",
  "end_ip": "example",
  "with_subdomains": true
}
```

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

</div>

</div>

</div>
<!-- endsource: ru/management-src/Upravlenie-filtrami/addFilter.md -->

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