Uploading customer data (CSV)

Uploads customer data.

The data is transmitted as multipart/form-data in CSV format. You must pass the column names in the first line of the request. Learn more about the format of transmitted data.

Example of an uploaded file

  1. Request syntax
  2. In the request body
  3. Response format

Request syntax

counterId: ID of the tag that you want to upload customer data for.

https://api-metrika.yandex.net/cdp/api/v1/counter/{counterId}/data/contacts
 ? merge_mode=<update_type>
 & [columns_mapping=<string>]
 & [delimiter_type=<delimiter_type>]
merge_mode *Data saving mode. For any value, pass all required fields, even ones that aren't modified.

Acceptable values:

  • SAVE: All previously transmitted data is completely replaced with new data. Learn more
  • UPDATE: Only the information that you're currently uploading is updated. Learn more
  • APPEND: New information is added to the previously uploaded information. Learn more
columns_mappingCorrespondence between column names and attribute names.
delimiter_typeType of column separator used in the file.

Default value: COMMA.

Acceptable values:

  • COMMA: Comma separator.
  • SEMICOLON: Semicolon separator.
merge_mode *Data saving mode. For any value, pass all required fields, even ones that aren't modified.

Acceptable values:

  • SAVE: All previously transmitted data is completely replaced with new data. Learn more
  • UPDATE: Only the information that you're currently uploading is updated. Learn more
  • APPEND: New information is added to the previously uploaded information. Learn more
columns_mappingCorrespondence between column names and attribute names.
delimiter_typeType of column separator used in the file.

Default value: COMMA.

Acceptable values:

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

* Required

In the request body


POST https://api-metrika.yandex.net/cdp/api/v1/counter/2215573/data/contacts?
    merge_mode=SAVE&
    columns_mapping=
        "uniq_id":"ID",
        "name":"Name",
        "emails":"Email",
        "age":"Age"&
    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

ID,Name,Email,Age
11,John D.,example@example.com,40
42,James S.,somebody@example.com,24
--------------------------7zDUQOAIAE9hEWoV--

Sample request

POST https://api-metrika.yandex.net/cdp/api/v1/counter/{counterId}/data/contacts?merge_mode=SAVE

Response format


{
    "uploading" : {
        "uploading_id" :  < string > ,
        "datetime" :  < local_date_time > ,
        "api_validation_status" :  < api_validation_status > ,
        "elements_count" :  < integer > ,
        "entity_type" :  < entity_type > ,
        "entity_subtype" :  < string > ,
        "uploading_format" :  < uploading_format > ,
        "uploading_source" :  < uploading_source > 
    }
}
Parameters Description
uploading Upload information
uploading
uploading_id Upload ID
datetime Upload time
api_validation_status Upload validation status

Possible values:

  • PASSED: Validation passed.
  • FAILED: Validation failed.
elements_count Number of elements in the upload
entity_type Entity type

Possible values:

  • SYSTEM: System entity, such as contacts or orders.
  • CUSTOM_LIST: Custom list.
  • SYSTEM_LIST: System list, such as products.
entity_subtype Entity subtype
uploading_format Upload format

Possible values:

  • JSON: JSON.
  • CSV: CSV.
uploading_source Upload source

Possible values:

  • API: API.
Parameters Description
uploading Upload information
uploading
uploading_id Upload ID
datetime Upload time
api_validation_status Upload validation status

Possible values:

  • PASSED: Validation passed.
  • FAILED: Validation failed.
elements_count Number of elements in the upload
entity_type Entity type

Possible values:

  • SYSTEM: System entity, such as contacts or orders.
  • CUSTOM_LIST: Custom list.
  • SYSTEM_LIST: System list, such as products.
entity_subtype Entity subtype
uploading_format Upload format

Possible values:

  • JSON: JSON.
  • CSV: CSV.
uploading_source Upload source

Possible values:

  • API: API.