Upload orders (CSV)

Uploads orders. The data is transmitted as multipart/form-data in CSV format. In the first line of the request, pass the names of the columns. Learn more about the format of transmitted data.

Example of an uploaded file.

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

  1. You can transmit data for up to 100,000 orders per customer.
  2. File size limit: 1 GB.
Sample request
  • Transmitting goals: The goals column must contain goals in the format goal_action1[:price1],goal_action2[:price2].
  • Transmitting products: The products column must contain products in the format Laptop TGDD12:1,Laptop TGD123:2. First specify the product, then its quantity.

If you're transmitting multiple goals or products, use semicolons as delimiters (delimiter_type=SEMICOLON).

POST https://api-metrica.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--

Request

POST

https://api-metrika.yandex.net/cdp/api/v1/counter/{counterId}/data/orders/csv

Path parameters

Name

Description

counterId

Type: integer

ID of the counter for which you want to upload orders.

Query parameters

Name

Description

columns_mapping

Type: string

Correspondence between column names and attribute names.

Pattern: "([^"]+)":"([^"]+)"

Example: "uniq_id":"ИД","name":"Name","birth_date":"Date of birth"

merge_mode

Type: string

Data saving mode. For any value, pass all required fields, even ones that aren't modified.

  • SAVE: All previously transmitted data is completely replaced with new data. Details.
  • UPDATE: Only the data that you're currently uploading is updated. Details.
  • APPEND: New data is added to previously uploaded data. Details.

Example: SAVE

delimiter_type

Type: string

Type of column separator used in the file:

  • COMMA: Comma separator.
  • SEMICOLON: Semicolon separator.

Default: COMMA

Example: ``

Body

multipart/form-data
{
  "file": "example"
}

Name

Description

file

Type: string<binary>

File size limit: 1 GB.

Example: example

Responses

200 OK

OK

Body

application/json
{
  "uploading": {
    "uploading_id": "example",
    "datetime": "2025-01-01T00:00:00Z",
    "api_validation_status": "example",
    "elements_count": 0,
    "entity_type": "example",
    "entity_subtype": "example",
    "uploading_format": "example",
    "uploading_source": "example",
    "api_validation_errors": [
      "example"
    ],
    "uploading_title": "example"
  }
}

Name

Description

uploading

Type: UploadingMetaExternal

Upload information

Example
{
  "uploading_id": "example",
  "datetime": "2025-01-01T00:00:00Z",
  "api_validation_status": "example",
  "elements_count": 0,
  "entity_type": "example",
  "entity_subtype": "example",
  "uploading_format": "example",
  "uploading_source": "example",
  "api_validation_errors": [
    "example"
  ],
  "uploading_title": "example"
}

UploadingMetaExternal

Upload information

Name

Description

api_validation_status

Type: string

Upload validation status:

  • PASSED: Validation passed.
  • FAILED: Validation failed.

Example: example

datetime

Type: string<date-time>

Upload time.

Example: 2025-01-01T00:00:00Z

elements_count

Type: integer

Number of elements within the upload.

entity_type

Type: string

Entity type:

  • SYSTEM: System entity, such as contacts or orders.
  • CUSTOM_LIST: Custom list.
  • SYSTEM_LIST: System list, such as products.

Example: example

uploading_format

Type: string

Upload format. Possible values:

  • JSON
  • CSV

Example: example

uploading_id

Type: string

Upload ID.

Example: example

uploading_source

Type: string

Upload source. Possible values: API

Example: example

Example
{
  "uploading_id": "example",
  "datetime": "2025-01-01T00:00:00Z",
  "api_validation_status": "example",
  "elements_count": 0,
  "entity_type": "example",
  "uploading_format": "example",
  "uploading_source": "example"
}

No longer supported, please use an alternative and newer version.