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

<!-- source: en/management-src/Managing-customer-and-order-data-from-the-CRM/uploadOrdersJson.md -->
<div class="openapi">

# Uploading orders (JSON)

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

Uploads orders.

The data is submitted within the POST request body in JSON format. [Learn more about the format of transmitted data](https://yandex.com/dev/metrika/en/data-import/orders-data.md#contacts).

For Yandex Metrica to process information about orders, you need to transmit customer data. Yandex Metrica links customer information to sessions, and order data to sessions and customers. This is required to calculate and display statistics.

{% note info %}

You can transmit data for up to 100,000 orders per customer.

{% endnote %}

{% cut "Sample request body" %}

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

ID of the tag for which you want to upload orders.
{.table-cell}
||
|#{.json-schema-properties}

### Query parameters

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

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

Data saving mode. For any value, pass all [required fields](https://yandex.com/dev/metrika/en/data-import/orders-data.md), even ones that aren't modified.

- `SAVE`: All previously transmitted data is completely replaced with new data. [Details](https://yandex.com/dev/metrika/en/data-import/modes.md).
- `UPDATE`: Only the data that you're currently uploading is updated. [Details](https://yandex.com/dev/metrika/en/data-import/modes.md).
- `APPEND`: New data is added to previously uploaded data. [Details](https://yandex.com/dev/metrika/en/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-21T11:59:21.000Z",
      "id": "example",
      "client_uniq_id": "example",
      "client_type": "example",
      "update_date_time": "2020-04-21T11:59:21.000Z",
      "finish_date_time": "2020-04-21T11:59:21.000Z",
      "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)[]

List of orders.

_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-21T11:59:21.000Z",
    "id": "example",
    "client_uniq_id": "example",
    "client_type": "example",
    "update_date_time": "2020-04-21T11:59:21.000Z",
    "finish_date_time": "2020-04-21T11:59:21.000Z",
    "order_status": "example",
    "products": {},
    "user_comment": "example"
  }
]
```

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

</div>

<div class="openapi-entity">

### CdpGoalExternal {#entity-CdpGoalExternal}

Goals and their costs in the order.

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

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

ID of the JS goal.

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

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

Goal cost in the order.
{.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}

List of orders.

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

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

Type of customer who placed this order.

Possible values:
- `CONTACT`
- `COMPANY`


_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

ID of the customer (`uniq_id`) who placed this order.

_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

Date and time of order creation in the tag's time zone. You can't change this value.

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

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

Order ID.

_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

Order status ID. An arbitrary string. You can change the status. Specify the value that you passed when [mapping statuses in the id field](https://yandex.com/dev/metrika/en/management-src/Managing-customer-and-order-data-from-the-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}|
{% cut "**Type**: object[]" %}

#|
||

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

_Unique items:_{.json-schema-reset .json-schema-assertion} `true`

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

```json translate=no
[
  "example"
]
```

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

{% endcut %}

Custom attributes.

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

```json translate=no
[
  {}
]
```

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

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

Expenses.

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

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

Order currency in ISO 4217 format.

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

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

Date and time of order completion in the tag's time zone.

_Example:_{.json-schema-reset .json-schema-example} `2020-04-21T11:59:21.000Z`
{.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

Products in the order.
{.table-cell}
||
|#{.json-schema-properties}

{% endcut %}

Products in the order.

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

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

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

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

Revenue. Total value of the order.

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

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

Date and time of order update in the tag's time zone. If the parameter is not passed, the value is inserted automatically.

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

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

Comment on the order.

_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-21T11:59:21.000Z",
  "id": "example",
  "client_uniq_id": "example",
  "client_type": "example",
  "update_date_time": "2020-04-21T11:59:21.000Z",
  "finish_date_time": "2020-04-21T11:59:21.000Z",
  "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-21T11:59:21.000Z",
    "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)

Upload information

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

```json translate=no
{
  "uploading_id": "example",
  "datetime": "2020-04-21T11:59:21.000Z",
  "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}

Upload information

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

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

Upload validation status:
- `PASSED`: Validation passed.
- `FAILED`: Validation failed.


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

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

Upload time.

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

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

Number of elements within the upload.
{.table-cell}
||
||

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

Entity type:
- `SYSTEM`: System entity, such as contacts or orders.
- `CUSTOM_LIST`: Custom list.
- `SYSTEM_LIST`: System list, such as products.


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

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

Upload format. Possible values:
- `JSON`
- `CSV`


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

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

Upload ID.

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

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

Upload source. Possible values: `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-21T11:59:21.000Z",
  "api_validation_status": "example",
  "elements_count": 0,
  "entity_type": "example",
  "uploading_format": "example",
  "uploading_source": "example"
}
```

{% endcut %}

</div>

</div>

</div>
<!-- endsource: en/management-src/Managing-customer-and-order-data-from-the-CRM/uploadOrdersJson.md -->

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