Modifying the data for a segment created from a file

Changes the data for the specified segment. When updating segments, you need to use the file structure that was used when the segment was loaded the first time.

Sample request
POST https://api-audience.yandex.com/v1/management/segment/111/modify_data?modification_type=addition
Content-Type: multipart/form-data; boundary=--------------------------5b2a52c5c90f668a
Context-Length: 331
--------------------------5b2a52c5c90f668a
Content-Disposition: form-data; name="file"; filename="data.tsv"
Content-Type: application/octet-stream

aaaaaaaa-bbbb-cccc-1111-222222222200
aaaaaaaa-bbbb-cccc-1111-222222222201
--------------------------5b2a52c5c90f668a--

Request

POST

https://api-audience.yandex.com/v1/management/segment/{segmentId}/modify_data

Path parameters

Name

Description

segmentId*

Type: integer<int32>

ID of the segment that you want to change.

Query parameters

Name

Description

modification_type*

Type: string

Type of data change: add or delete data, overwrite the entire file. The added data must match the original format (hashed or unhashed information).
Type of data change. Acceptable values:

  • subtraction — Removing data from the file.
  • addition — Adding data to the file.
  • replace — Overwriting the entire file.
    Example: addition, subtraction, replace

check_size

Type: boolean

You can create segments with less than 100 records using this parameter. However, you can't use these segments for advertising in Yandex Direct until their size exceeds 100 records.

Default: true

Body

multipart/form-data
{
    "file": null
}

Name

Description

file*

Type: string<binary>

Uploaded file with the updated data.

Responses

200 OK

OK

Body

application/json
{
    "segment": {
        "id": 0,
        "name": "string",
        "type": "string",
        "status": "string",
        "create_time": "2022-12-29T18:02:01Z",
        "owner": "string",
        "hashed": false,
        "used_hashing_alg": "string",
        "content_type": "string"
    }
}

Name

Description

segment

Type: UploadingSegment

A segment created from a file with user data.
The segment description by type.

UploadingSegment

A segment created from a file with user data.

Name

Description

name*

Type: string

Segment name.

used_hashing_alg*

Type: string

The hashing algorithm used for the data is sent for hashed: true. Acceptable values:

  • MD5.
  • SHA256.

Note

Starting January 2025, uploading new MD5 hashes will no longer be supported. Please use SHA256 to upload data.

content_type

Type: string

Type of file content. Acceptable values:

  • idfa_gaid – Device IDs.
  • mac — MAC addresses.
  • crm — CRM data.

create_time

Type: string<date-time>

The time of segment creation.

hashed

Type: boolean

Whether every string in the uploaded file is hashed. Acceptable values:

  • true: Hashed.
  • false: Unhashed.

id

Type: integer<int32>

ID of the segment. Specify this parameter when updating a segment.

owner

Type: string

The username of the segment owner.

status

Type: string

Status of processing the segment. Acceptable values:

  • uploaded – The segment with the user's data has been uploaded.
  • is_processed – The segment with the specified parameters is being processed.
  • processed – Uploading and processing the segment is complete. The segment is ready to use.
  • processing_failed – Processing the segment failed with an error.
  • is_updated — The segment is updated.
  • few_data – The segment doesn't have enough data.

type

Type: string

Segment type. Acceptable values:

  • uploading: A segment created from a file with user data.
  • metrika: A segment imported from Yandex Metrica.
  • appmetrica: A segment imported from AppMetrica.
  • lookalike: A segment of users who "look like" one of the client's other segments (uses the "lookalike" technology).
  • geo: A segment based on location data for polygons and circles.
  • pixel: A segment created using a tracking pixel.

No longer supported, please use an alternative and newer version.