Создание сегмента из CSV-файла
Создает сегмент из файла с данными. В файле должно быть не менее 100 записей.
Пример запроса
POST https://api-audience.yandex.ru/v1/management/segments/upload_csv_file
Content-Type: multipart/form-data; boundary=--------------------------5b2a52c5c90f668a
Context-Length: 331
--------------------------5b2a52c5c90f668a
Content-Disposition: form-data; name="file"; filename="data.csv"
Content-Type: application/octet-stream
"email","phone","ext_id","key1","key2"
"abc@inbox.ru","111","1","q","w"
"abc@mail.ru","222","2","q","w"
"bcd@mail.ru","333","3","q","w"
"abc@yandex.ru","444","4","q","w"
"bcd@yandex.ru","555","5","q","w"
"cde@mail.ru","666","6","q","w"
"cde@yandex.ru","777","7","q","w"
"def@mail.ru","888","8","q","w"
"def@yandex.ru","999","9","q","w"
--------------------------5b2a52c5c90f668a--
Request
POST
https://api-audience.yandex.ru/v1/management/segments/upload_csv_file
Body
multipart/form-data
{
"file": "example"
}
|
Name |
Description |
|
file |
Type: string<binary> Загружаемый файл. Example: |
Responses
200 OK
OK
Body
application/json
{
"segment": {
"type": "example",
"id": 0,
"name": "example",
"status": "example",
"create_time": "2025-01-01T00:00:00Z",
"owner": "example",
"has_guests": true,
"guest_quantity": 0,
"can_create_dependent": true,
"has_derivatives": true,
"derivatives": [
0
],
"cookies_matched_quantity": 0,
"hashed": true,
"used_hashing_alg": "example",
"content_type": "example",
"source_id": 0,
"source_name": "example",
"item_quantity": 0,
"valid_unique_quantity": 0,
"valid_unique_percentage": "example",
"matched_quantity": 0,
"matched_percentage": "example",
"counter_id": 0,
"uploading_last_modify_time": "2025-01-01T00:00:00Z",
"device_matching_type": "example"
}
}
|
Name |
Description |
|
segment |
Type: UploadingSegment Сегмент, созданный из файла с пользовательскими данными. Example
|
BaseSegment
Тип для описания сегмента.
|
Name |
Description |
|
name |
Type: string Название сегмента. Example: |
|
create_time |
Type: string<date-time> Время создания сегмента. Example: |
|
id |
Type: integer Идентификатор сегмента. Укажите данный параметр при обновлении сегмента. |
|
owner |
Type: string Логин владельца сегмента. Example: |
|
status |
Type: string Статус обработки сегмента. Допустимые значения:
Example: |
|
type |
Type: string Тип сегмента. Допустимые значения:
Example: |
Example
{
"type": "example",
"id": 0,
"name": "example",
"status": "example",
"create_time": "2025-01-01T00:00:00Z",
"owner": "example"
}
UploadingSegment
Сегмент, созданный из файла с пользовательскими данными.
All of 2 types
-
Type: BaseSegment
Тип для описания сегмента.
Example
{ "type": "example", "id": 0, "name": "example", "status": "example", "create_time": "2025-01-01T00:00:00Z", "owner": "example", "has_guests": true, "guest_quantity": 0, "can_create_dependent": true, "has_derivatives": true, "derivatives": [ 0 ], "cookies_matched_quantity": 0 } -
Type: object
content_type
Type: string
Вид содержимого файла. Допустимые значения:
idfa_gaid— идентификаторы устройств.mac— MAC-адреса.crm— CRM-данные.
Example:
exampledevice_matching_type
Type: string
Режим поиска устройств для сегмента.
Допустимые значения:
CROSS_DEVICE— включает в сегмент другие устройства того же пользователя, связанные с загруженным ID. Значение по-умолчанию, если режим поиска не выбран.IN_DEVICE— сегмент строится только по загруженным устройствам, без расширения на другие устройства. На данный момент режимIN_DEVICEдоступен только дляidfa_gaidсегментов.
Example:
examplehashed
Type: boolean
Является ли захешированной каждая строка загруженного файла. Допустимые значения:
true— строка захеширована.false— строка не захеширована.
used_hashing_alg
Type: string
Алгоритм хеширования примененный для данных, отправляется для
hashed: true. Допустимое значение:SHA256.С 1 января 2025 года загрузка новых хешей MD5 не поддерживается. Для загрузки данных используйте SHA‑256.
Example:
exampleExample
{ "hashed": true, "used_hashing_alg": "example", "content_type": "example", "device_matching_type": "example" }
Example
{
"type": "example",
"id": 0,
"name": "example",
"status": "example",
"create_time": "2025-01-01T00:00:00Z",
"owner": "example",
"has_guests": true,
"guest_quantity": 0,
"can_create_dependent": true,
"has_derivatives": true,
"derivatives": [
0
],
"cookies_matched_quantity": 0,
"hashed": true,
"used_hashing_alg": "example",
"content_type": "example",
"device_matching_type": "example"
}
No longer supported, please use an alternative and newer version.