Saving a segment created from a file

Saves a segment created from a file with data.

Request

POST

https://api-audience.yandex.ru/v1/management/segment/{segmentId}/confirm

Path parameters

Name

Description

segmentId

Type: integer

ID of the segment that you want to save.

Query parameters

Name

Description

check_size

Type: boolean

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

Default: true

Body

application/json
{
  "segment": {
    "id": 0,
    "name": "example",
    "hashed": true,
    "hashing_alg": "example",
    "content_type": "example",
    "device_matching_type": "example"
  }
}

Name

Description

segment

Type: SegmentRequestUploading

The segment with the specified parameters.

Example
{
  "id": 0,
  "name": "example",
  "hashed": true,
  "hashing_alg": "example",
  "content_type": "example",
  "device_matching_type": "example"
}

SegmentRequestUploading

The segment with the specified parameters.

Name

Description

content_type

Type: string

Type of file content. Acceptable values:

  • idfa_gaid: Device IDs.
  • mac: MAC addresses.
  • crm: CRM data.

Example: example

name

Type: string

Segment name

Example: example

hashed

Type: boolean

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

  • true: Hashed.
  • false: Unhashed.

hashing_alg

Type: string

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

  • MD5.
  • SHA256.

Note

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

Example: example

id

Type: integer

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

Example
{
  "id": 0,
  "name": "example",
  "hashed": true,
  "hashing_alg": "example",
  "content_type": "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
{
  "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"
}

BaseSegment

The segment description by type.

Name

Description

name

Type: string

Segment name.

Example: example

create_time

Type: string<date-time>

The time of segment creation.

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

id

Type: integer

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

owner

Type: string

The username of the segment owner.

Example: example

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: The segment has been uploaded and processed. The segment is ready to use.
  • processing_failed: Segment processing has failed.
  • is_updated: The segment is updating.
  • few_data: The segment has insufficient data.

Example: example

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.

Example: 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: example

    device_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, the IN_DEVICE mode is available only for idfa_gaid segments.

    Example: example

    hashed

    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: example

    Example
    {
      "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.