Creating a segment from a CSV file
Creates a segment from a file with data. There must be at least 100 entries in the file.
Sample request
POST https://api-audience.yandex.com/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> File to upload. 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 A segment created from a file with user data. Example
|
BaseSegment
The segment description by type.
|
Name |
Description |
|
name |
Type: string Segment name. Example: |
|
create_time |
Type: string<date-time> The time of segment creation. Example: |
|
id |
Type: integer ID of the segment. Specify this parameter when updating a segment. |
|
owner |
Type: string The username of the segment owner. Example: |
|
status |
Type: string Status of processing the segment. Acceptable values:
Example: |
|
type |
Type: string Segment type. Acceptable values:
Example: |
Example
{
"type": "example",
"id": 0,
"name": "example",
"status": "example",
"create_time": "2025-01-01T00:00:00Z",
"owner": "example"
}
UploadingSegment
A segment created from a file with user data.
All of 2 types
-
Type: BaseSegment
The segment description by type.
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
Type of file content. Acceptable values:
idfa_gaid: Device IDs.mac: MAC addresses.crm: CRM data.
Example:
exampledevice_matching_type
Type: string
Device search mode for the segment.
Acceptable values:
CROSS_DEVICE: The segment includes other devices associated with the uploaded ID and belonging to the same user. This is the default value if no search mode is selected.IN_DEVICE: The segment includes only the uploaded devices, without expanding to other devices. Currently, theIN_DEVICEmode is available only foridfa_gaidsegments.
Example:
examplehashed
Type: boolean
Whether every string in the uploaded file is hashed. Acceptable values:
true: Hashed.false: Unhashed.
used_hashing_alg
Type: string
The hashing algorithm used for the data is sent for
hashed: true. Acceptable value:SHA256.Starting January 2025, uploading new MD5 hashes is no longer supported. To upload new data, use 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.