Uploading customer data (JSON)

Uploads customer data. The data is submitted within the POST request body in JSON format.

Sample request body
--data '{
        "contacts": [
            {
                "uniq_id": "J3QQ4-H7H2V-2HCH4-M3HK8-6M8VW",
                "name": "John Smith",
                "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": "Jane Smith",
                "create_date_time": "2020-05-17 16:13:21",
                "update_date_time": "2020-05-17 16:14:21",
                "client_ids": [
                    "11223344556"
                ]
            }
        ]
    }'

Request

POST

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

Path parameters

Name

Description

counterId

Type: integer

ID of the counter that you want to upload contact data for.

Query parameters

Name

Description

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

Body

application/json
{
  "contacts": [
    {
      "attribute_values": [
        {}
      ],
      "uniq_id": "example",
      "name": "example",
      "birth_date": "2025-01-01",
      "create_date_time": "2025-01-01T00:00:00Z",
      "update_date_time": "2025-01-01T00:00:00Z",
      "client_ids": [
        0
      ],
      "user_ids": [
        "example"
      ],
      "emails": [
        "example"
      ],
      "phones": [
        "example"
      ],
      "emails_md5": [
        "example"
      ],
      "phones_md5": [
        "example"
      ],
      "company_uniq_id": "example",
      "user_comment": "example"
    }
  ]
}

Name

Description

contacts

Type: ContactRow[]

Min items: 1

Example
[
  {
    "attribute_values": [
      {}
    ],
    "uniq_id": "example",
    "name": "example",
    "birth_date": "2025-01-01",
    "create_date_time": "2025-01-01T00:00:00Z",
    "update_date_time": "2025-01-01T00:00:00Z",
    "client_ids": [
      0
    ],
    "user_ids": [
      "example"
    ],
    "emails": [
      "example"
    ],
    "phones": [
      "example"
    ],
    "emails_md5": [
      "example"
    ],
    "phones_md5": [
      "example"
    ],
    "company_uniq_id": "example",
    "user_comment": "example"
  }
]

ContactRow

List of customers.

Name

Description

uniq_id

Type: string

Customer ID.

Min length: 1

Example: example

attribute_values

Type: object[]

[additional]

Type: string[]

Unique items: true

Example
[
  "example"
]

Custom attributes.

Example
[
  {}
]

birth_date

Type: string<date>

Customer's date of birth.

Example: 2025-01-01

client_ids

Type: integer[]

Min items: 0

Max items: 500

Unique items: true

Example
[
  0
]

create_date_time

Type: string<date-time>

Date and time of contact creation in the counter's time zone. Learn more.

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

emails

Type: string[]

Min items: 0

Max items: 50

Unique items: true

Example
[
  "example"
]

emails_md5

Type: string[]

Min items: 0

Max items: 50

Unique items: true

Example
[
  "example"
]

name

Type: string

Customer name. When you send the full name, the string will be truncated to Doe J. format.

Example: example

phones

Type: string[]

Min items: 0

Max items: 50

Unique items: true

Example
[
  "example"
]

phones_md5

Type: string[]

Min items: 0

Max items: 50

Unique items: true

Example
[
  "example"
]

update_date_time

Type: string<date-time>

Date and time of contact update in the counter's time zone. Learn more.

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

user_comment

Type: string

Comment on the customer.

Min length: 0

Max length: 1000

Example: example

Example
{
  "attribute_values": [
    {}
  ],
  "uniq_id": "example",
  "name": "example",
  "birth_date": "2025-01-01",
  "create_date_time": "2025-01-01T00:00:00Z",
  "update_date_time": "2025-01-01T00:00:00Z",
  "client_ids": [
    0
  ],
  "emails": [
    "example"
  ],
  "phones": [
    "example"
  ],
  "emails_md5": [
    "example"
  ],
  "phones_md5": [
    "example"
  ],
  "user_comment": "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.