Uploading customer data (JSON)

Uploads customer data.

The data is transmitted in the POST request body in JSON format.

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

Request syntax

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

https://api-metrika.yandex.net/cdp/api/v1/counter/{counterId}/data/contacts
 ? merge_mode=<update_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
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

* Required

In the request body


--data '{
        "contacts": [
            {
                "uniq_id": "J3QQ4-H7H2V-2HCH4-M3HK8-6M8VW",
                "name": "Doe J..",
                "create_date_time": "2020-04-17 16:12:21",
                "update_date_time": "2020-04-17 16:12:21",
                "client_ids": [
                    "12345678910",
                    "10987654321"
                ],
                "emails": [
                    "exampl1@example.com",
                    "example2@example.com"
                ],
                "phones": [
                    "78005553535",
                    "73449932378"
                ]
            },
            {
                "uniq_id": "ZYX4-H7H2V-2HCH4-M3HK8-6M8VW",
                "name": "Smith M.",
                "create_date_time": "2020-05-17 16:13:21",
                "update_date_time": "2020-05-17 16:14:21",
                "client_ids": [
                    "11223344556"
                ]
            }
        ]
    }'

Parameters Description
contacts List of customers
contacts
uniq_id Customer ID
name Customer name. If you're passing the full name, the string is shortened to Doe J. format.
birth_date Customer's date of birth
create_date_time Date and time of contact creation in the tag's time zone. Learn more
update_date_time Date and time of contact update in the tag's time zone. Learn more
client_ids List of ClientIDs for the customer
user_ids List of UserIDs for the customer.
emails List of the customer's email addresses.
phones List of the customer's phone numbers.
emails_md5 List of the customer's MD5-hashed email addresses
phones_md5 List of the customer's MD5-hashed phone numbers.
Parameters Description
contacts List of customers
contacts
uniq_id Customer ID
name Customer name. If you're passing the full name, the string is shortened to Doe J. format.
birth_date Customer's date of birth
create_date_time Date and time of contact creation in the tag's time zone. Learn more
update_date_time Date and time of contact update in the tag's time zone. Learn more
client_ids List of ClientIDs for the customer
user_ids List of UserIDs for the customer.
emails List of the customer's email addresses.
phones List of the customer's phone numbers.
emails_md5 List of the customer's MD5-hashed email addresses
phones_md5 List of the customer's MD5-hashed phone numbers.

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.