---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://yandex.com.tr/dev/metrika/en/management/openapi/schema/uploadOrders.md
  - https://yandex.com.tr/dev/metrika/ru/management/openapi/schema/uploadOrders.md
  - href: ru/management/openapi/schema/uploadOrders.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/dev/metrika/ru/llms.txt

<!-- source: ru/management-src/Upravlenie-dannymi-o-klientah-i-zakazah-iz-CRM/uploadOrders.md -->
<div class="openapi">

# Загрузка заказов (CSV)

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

Выполняет загрузку заказов. Данные передаются как multipart/form-data в формате CSV. В первой строке запроса необходимо передать названия колонок. [Подробно о формате передаваемых данных](https://yandex.com.tr/dev/metrika/ru/data-import/orders-data.md).

[Пример загружаемого файла](https://download.cdn.yandex.net/from/yandex.ru/support/ru/metrica/files/crm-orders.csv).

Чтобы Метрика обработала информацию о заказах, обязательно передайте данные о клиентах. Метрика привязывает информацию о клиентах к визитам, а данные о заказах — к визитам и клиентам. Это необходимо для расчета и отображения статистики.

{% note info %}

1. Для одного клиента можно передать не более 100 000 заказов.
2. Ограничение на размер файла — 1 Гб.

{% endnote %}

{% cut "Пример запроса" %}

- Передача целей: в колонке `goals` цели должны быть в формате `goal_action1[:price1],goal_action2[:price2]`.
- Передача товаров: в колонке `products` товары должны быть в формате `Ноутбук TGDD12:1,Ноутбук TGD123:2`. Сначала укажите товар, после — его количество.

Если передаете несколько целей/товаров, в качестве разделителя используйте точку с запятой (`delimiter_type=SEMICOLON`).

```json translate=no
POST https://api-metrika.yandex.net/cdp/api/v1/counter/2215573/data/orders/csv?
    merge_mode=SAVE&
    columns_mapping=
        "id":"ИД",
        "client_uniq_id":"ИД клиента",
        "client_type":"Тип клиента",
        "order_status":"Статус",
        "create_date_time":"Дата создания",
        "revenue":"Сумма",
        "goals":"Цели"&
    delimiter_type=COMMA
    Content-Type: multipart/form-data; boundary=------------------------7zDUQOAIAE9hEWoV
    Context-Length: TBD

    --------------------------7zDUQOAIAE9hEWoV
    Content-Disposition: form-data; name="file"; filename="data.csv"
    Content-Type: text/csv

    ИД,ИД клиента,Тип клиента,Статус,Дата создания,Сумма,Цели
    100,11,CONTACT,paid,2020-06-11 12:30:00,43089.54,goal_action_id_1:1000
    101,42,CONTACT,paid,2019-10-11 09:10:00,109999,goal_action_id_2
    102,42,CONTACT,created,2020-12-24 12:30:00,1004.17,goal_action_id_3:500
    --------------------------7zDUQOAIAE9hEWoV--
```

{% endcut %}


## 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/cdp/api/v1/counter/{counterId}/data/orders/csv
```

</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}

### Query parameters

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

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

Соответствие названий столбцов названиям атрибутов.

_Pattern:_{.json-schema-reset .json-schema-assertion} `"([^"]+)":"([^"]+)"`

_Example:_{.json-schema-reset .json-schema-example} `"uniq_id":"ИД","name":"Имя","birth_date":"Дата рождения"`
{.table-cell}
||
||

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

Режим сохранения данных. При любом из значений передавайте все [обязательные поля](https://yandex.com.tr/dev/metrika/ru/data-import/orders-data.md) — даже те, которые не меняются.

- `SAVE` — вся ранее переданная информация полностью заменяется новой. [Подробно](https://yandex.com.tr/dev/metrika/ru/data-import/modes.md).
- `UPDATE` – обновляется только та информация, которую вы загружаете в данный момент. [Подробно](https://yandex.com.tr/dev/metrika/ru/data-import/modes.md).
- `APPEND` — новая информация добавляется к ранее загруженной. [Подробно](https://yandex.com.tr/dev/metrika/ru/data-import/modes.md).


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

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

Вид разделителя столбцов в файле:
- `COMMA` — разделитель "запятая".
- `SEMICOLON` — разделитель "точка с запятой".


_Default:_{.json-schema-reset .json-schema-value} `COMMA`

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

<div class="openapi-entity">

### Body

{% cut "multipart/form-data" %}

```json translate=no
{
  "file": "example"
}
```

{% endcut %}

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

_file_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string&lt;binary&gt;

Ограничение на размер файла — 1 Гб.

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

</div>

## Responses

<div class="openapi__response__code__200">

## 200 OK

OK

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "uploading": {
    "uploading_id": "example",
    "datetime": "2020-04-21 11:59:21",
    "api_validation_status": "example",
    "elements_count": 0,
    "entity_type": "example",
    "uploading_format": "example",
    "uploading_source": "example"
  }
}
```

{% endcut %}

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

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

Информация о загрузке

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

```json translate=no
{
  "uploading_id": "example",
  "datetime": "2020-04-21 11:59:21",
  "api_validation_status": "example",
  "elements_count": 0,
  "entity_type": "example",
  "uploading_format": "example",
  "uploading_source": "example"
}
```

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

</div>

<div class="openapi-entity">

### UploadingMetaExternal {#entity-UploadingMetaExternal}

Информация о загрузке

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

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

Статус валидации загрузки:
- `PASSED` — валидация прошла успешно.
- `FAILED` — валидация прошла не успешно.


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

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

Время загрузки.

_Example:_{.json-schema-reset .json-schema-example} `2020-04-21 11:59:21`
{.table-cell}
||
||

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

Количество элементов в загрузке.
{.table-cell}
||
||

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

Тип сущности:
- `SYSTEM` — системная сущность, например, контакты или заказы.
- `CUSTOM_LIST` — пользовательский список.
- `SYSTEM_LIST` — системный список, например товары.


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

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

Формат загрузки. Возможные значения:
- `JSON`.
- `CSV`.


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

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

Идентификатор загрузки.

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

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

Источник загрузки. Возможные значения: `API`.

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

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

```json translate=no
{
  "uploading_id": "example",
  "datetime": "2020-04-21 11:59:21",
  "api_validation_status": "example",
  "elements_count": 0,
  "entity_type": "example",
  "uploading_format": "example",
  "uploading_source": "example"
}
```

{% endcut %}

</div>

</div>

</div>
<!-- endsource: ru/management-src/Upravlenie-dannymi-o-klientah-i-zakazah-iz-CRM/uploadOrders.md -->

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