---
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/en/management/openapi/filter/addFilter.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-filters/addFilter.md -->
<div class="openapi">

# Creating a filter

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

Creates a tag filter.

## 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

ID of the tag that you want to create a filter for.
{.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)

List of structures with information on tag filters.

{% 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}

List of structures with information on tag filters.

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

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

Filter type:
- `exclude`: Exclude traffic.
- `include`: Leave only traffic.


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

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

Data type the filter is applied to:
- `title`: Page title.
- `client_ip`: IP address.
- `url`: Page URL.
- `referer`: Referrer.
- `uniq_id`: Special attribute for the **Don't count my sessions** filter.


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

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

Filter status:
- `active`: Filter is used.
- `disabled`: Filter disabled (but not deleted).


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

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

Filter type or action for filter:
- `equal`: Equal to.
- `start`: Starts with.
- `contain`: Contains.
- `interval`: In the interval, only used with the "IP address" data type (`attr = client_ip`).
- `me`: My visits, only used with the `attr = uniq_id` data type.
- `only_mirrors`: Only the site and its mirrors, used only for the Page URL data type (`attr = url`) and the **Leave only traffic** filter type (`action = include`), and provided that mirrors are specified for the tag.
- `regexp`: Regular expression.


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

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

The last IP address in the range.

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

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

Filter ID. Specify this parameter when changing a tag filter.
{.table-cell}
||
||

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

The first IP address in the range.

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

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

Filter value.

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

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

Filter by subdomain.
{.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)

List of structures with information on tag filters.

{% 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: en/management-src/Managing-filters/addFilter.md -->

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