---
metadata:
  - name: generator
    content: Diplodoc Platform v5.48.2
alternate:
  - https://yandex.com.tr/dev/metrika/en/management/openapi/schema/uploadOrdersJson_1.md
  - https://yandex.com.tr/dev/metrika/ru/management/openapi/schema/uploadOrdersJson_1.md
---
> **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/uploadOrdersJson.md -->
<div class="openapi">

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

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

Выполняет загрузку заказов.

Данные передаются как JSON в теле POST-запроса. [Подробно о формате передаваемых данных](https://yandex.com.tr/dev/metrika/ru/data-import/orders-data.md#contacts).

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

{% note info %}

Для одного клиента можно передать не более 100 000 заказов.

{% endnote %}

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

```json translate=no
--data '{
        "orders": [
            {
                "id": "704",
                "client_uniq_id": "J3QQ4-H7H2V-2HCH4-M3HK8-6M8VW",
                "client_type": "CONTACT",
                "order_status": "IN_PROGRESS",
                "create_date_time": "2022-09-21 09:48:23",
                "update_date_time": "2022-10-15 10:48:34",
                "cost": 4000,
                "revenue": 5000,
                "goals": [
                        {
                            "goal_action_id": "goal_id1",
                            "price": 123.5
                        }
                ],
                "products": {
                    "pear": 10,
                    "apple": 30
                }
            },
            {
                "id": "706",
                "client_uniq_id": "ZYX4-H7H2V-2HCH4-M3HK8-6M8VW",
                "client_type": "CONTACT",
                "order_status": "PAID",
                "create_date_time": "2022-09-30 10:48:23",
                "cost": 10000,
                "revenue": 13000,
                "goals": [
                        {
                            "goal_action_id": "goal_id2",
                            "price": 123.5
                        }
                ],
                "products": {
                    "apple": 30,
                    "cherry": 20
                }
            }
        ]
}'
```

{% 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/json
```

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

_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}
||
|#{.json-schema-properties}

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "orders": [
    {
      "attribute_values": {},
      "revenue": 9223372036854,
      "cost": 9223372036854,
      "currency": "example",
      "goals": [
        {
          "goal_action_id": "example",
          "price": 0.5
        }
      ],
      "create_date_time": "2020-04-21 11:59:21",
      "id": "example",
      "client_uniq_id": "example",
      "client_type": "example",
      "update_date_time": "2020-04-21 11:59:21",
      "finish_date_time": "2020-04-21 11:59:21",
      "order_status": "example",
      "products": {},
      "user_comment": "example"
    }
  ]
}
```

{% endcut %}

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

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

Список заказов.

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

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

```json translate=no
[
  {
    "attribute_values": {},
    "revenue": 9223372036854,
    "cost": 9223372036854,
    "currency": "example",
    "goals": [
      {
        "goal_action_id": "example",
        "price": 0.5
      }
    ],
    "create_date_time": "2020-04-21 11:59:21",
    "id": "example",
    "client_uniq_id": "example",
    "client_type": "example",
    "update_date_time": "2020-04-21 11:59:21",
    "finish_date_time": "2020-04-21 11:59:21",
    "order_status": "example",
    "products": {},
    "user_comment": "example"
  }
]
```

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

</div>

<div class="openapi-entity">

### CdpGoalExternal {#entity-CdpGoalExternal}

Цели и их стоимости в заказе.

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

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

Идентификатор JS-цели.

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

_price_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: number

Стоимость цели в заказе.
{.table-cell}
||
|#{.json-schema-properties}

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

```json translate=no
{
  "goal_action_id": "example",
  "price": 0.5
}
```

{% endcut %}

</div>

<div class="openapi-entity">

### OrderRow {#entity-OrderRow}

Список заказов.

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

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

Тип клиента, к которому относится данный заказ.
Возможные значения:
- `CONTACT` — контакт.


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

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

Идентификатор клиента (`uniq_id`), к которому относится данный заказ.

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

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

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

Дата и время создания заказа в часовом поясе счетчика. Значение нельзя менять.

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

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

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

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

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

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

Идентификатор статуса заказа. Произвольная строка. Статус можно менять. Укажите значение, которое вы передавали при [сопоставлении статусов в поле id](https://yandex.com.tr/dev/metrika/ru/management-src/Upravlenie-dannymi-o-klientah-i-zakazah-iz-CRM/mapOrderStatuses.md).

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

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

_attribute_values_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: object

Пользовательские атрибуты.

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

```json translate=no
{}
```

{% endcut %}
{.table-cell}
||
||

_cost_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: number

Расходы.

_Max value:_{.json-schema-reset .json-schema-assertion} `9223372036854`
{.table-cell}
||
||

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

Валюта заказа в стандарте ISO 4217.

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

_finish_date_time_{.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}
||
||

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

_Min items:_{.json-schema-reset .json-schema-assertion} `0`

_Max items:_{.json-schema-reset .json-schema-assertion} `100`

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

```json translate=no
[
  {
    "goal_action_id": "example",
    "price": 0.5
  }
]
```

{% endcut %}
{.table-cell}
||
||

_products_{.json-schema-reset .json-schema-property}
{.table-cell}|
{% cut "**Type**: object" %}

#|
||

_[additional]_{.json-schema-reset .json-schema-additional-property}
{.table-cell}|
**Type**: integer

Товары в заказе.
{.table-cell}
||
|#{.json-schema-properties}

{% endcut %}

Товары в заказе.

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

```json translate=no
{}
```

{% endcut %}
{.table-cell}
||
||

_revenue_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: number

Доход. Суммарная стоимость заказа.

_Max value:_{.json-schema-reset .json-schema-assertion} `9223372036854`
{.table-cell}
||
||

_update_date_time_{.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}
||
||

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

Комментарий к заказу.

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

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

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

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

```json translate=no
{
  "attribute_values": {},
  "revenue": 9223372036854,
  "cost": 9223372036854,
  "currency": "example",
  "goals": [
    {
      "goal_action_id": "example",
      "price": 0.5
    }
  ],
  "create_date_time": "2020-04-21 11:59:21",
  "id": "example",
  "client_uniq_id": "example",
  "client_type": "example",
  "update_date_time": "2020-04-21 11:59:21",
  "finish_date_time": "2020-04-21 11:59:21",
  "order_status": "example",
  "products": {},
  "user_comment": "example"
}
```

{% endcut %}

</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/uploadOrdersJson.md -->


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