Creating a segment with the "geo-polygon" type

Creates a segment based on location data with the polygon type.

Request

POST

https://api-audience.yandex.ru/v1/management/segments/create_geo_polygon

Body

application/json
{
  "segment": {
    "name": "example",
    "polygons": [
      {
        "points": [
          {},
          {},
          {},
          {}
        ],
        "description": "example"
      }
    ],
    "period_length": 0,
    "times_quantity": 0,
    "geo_segment_type": "example",
    "device_matching_type": "example"
  }
}

Name

Description

segment

Type: SegmentRequestGeoPolygon

The segment with the specified parameters.

Example
{
  "name": "example",
  "polygons": [
    {
      "points": [
        {
          "latitude": 0.5,
          "longitude": 0.5,
          "description": "example"
        },
        {
          "latitude": 0.5,
          "longitude": 0.5,
          "description": "example"
        },
        {
          "latitude": 0.5,
          "longitude": 0.5,
          "description": "example"
        },
        {
          "latitude": 0.5,
          "longitude": 0.5,
          "description": "example"
        }
      ],
      "description": "example"
    }
  ],
  "period_length": 0,
  "times_quantity": 0,
  "geo_segment_type": "example",
  "device_matching_type": "example"
}

GeoPoint

The coordinates of the points.

Name

Description

description

Type: string

Any comment up to 200 characters.

Min length: 0

Max length: 200

Example: example

latitude

Type: number

Latitude.

longitude

Type: number

Longitude.

Example
{
  "latitude": 0.5,
  "longitude": 0.5,
  "description": "example"
}

GeoPolygon

List of polygons. You cannot add more than 10 polygons to a segment.

Name

Description

points

Type: GeoPoint[]

Min items: 4

Max items: 2147483647

Example
[
  {
    "latitude": 0.5,
    "longitude": 0.5,
    "description": "example"
  },
  {
    "latitude": 0.5,
    "longitude": 0.5,
    "description": "example"
  },
  {
    "latitude": 0.5,
    "longitude": 0.5,
    "description": "example"
  },
  {
    "latitude": 0.5,
    "longitude": 0.5,
    "description": "example"
  }
]
Example
{
  "points": [
    {
      "latitude": 0.5,
      "longitude": 0.5,
      "description": "example"
    },
    {
      "latitude": 0.5,
      "longitude": 0.5,
      "description": "example"
    },
    {
      "latitude": 0.5,
      "longitude": 0.5,
      "description": "example"
    },
    {
      "latitude": 0.5,
      "longitude": 0.5,
      "description": "example"
    }
  ]
}

SegmentRequestGeoPolygon

The segment with the specified parameters.

Name

Description

name

Type: string

Segment name.

Example: example

polygons

Type: GeoPolygon[]

Min items: 1

Max items: 10

Example
[
  {
    "points": [
      {
        "latitude": 0.5,
        "longitude": 0.5,
        "description": "example"
      },
      {
        "latitude": 0.5,
        "longitude": 0.5,
        "description": "example"
      },
      {
        "latitude": 0.5,
        "longitude": 0.5,
        "description": "example"
      },
      {
        "latitude": 0.5,
        "longitude": 0.5,
        "description": "example"
      }
    ],
    "description": "example"
  }
]

geo_segment_type

Type: string

Coordinate type. Acceptable values:

  • last: Current location. The segment includes users who are currently in the selected area or who were in the area less than an hour ago.
  • regular: Frequent location. The segment includes users who frequently visit the selected area. For example, they may be people who live or work nearby. Targeting is based on the data from the past 45 days.
  • home: Home location. The segment includes users who live in the selected area.
  • work: Work location. The segment includes users who work in the selected area.
  • condition: The condition "The user visited the specified places X times during the period". The segment includes users who meet this criteria.

Example: example

period_length

Type: integer

The period for visits to the specified places. This parameter is required if you are creating the condition "User visited the specified places N time(s) during the period". Acceptable values for the time period (in days): from 1 to 90 (inclusive).

times_quantity

Type: integer

Frequency of visits to the specified places. This parameter is required if you are creating the condition "User visited the specified places N time(s) during the period".

Note

Only one visit per day is counted.

Example
{
  "name": "example",
  "polygons": [
    {
      "points": [
        {
          "latitude": 0.5,
          "longitude": 0.5,
          "description": "example"
        },
        {
          "latitude": 0.5,
          "longitude": 0.5,
          "description": "example"
        },
        {
          "latitude": 0.5,
          "longitude": 0.5,
          "description": "example"
        },
        {
          "latitude": 0.5,
          "longitude": 0.5,
          "description": "example"
        }
      ],
      "description": "example"
    }
  ],
  "period_length": 0,
  "times_quantity": 0,
  "geo_segment_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,
    "geo_segment_type": "example",
    "times_quantity": 0,
    "period_length": 0,
    "form": "example",
    "polygons": [
      {
        "points": [
          null,
          null,
          null,
          null
        ],
        "description": "example"
      }
    ],
    "pattern": "example",
    "too_much_data": true
  }
}

Name

Description

segment

Type: PolygonGeoSegment

Segment based on location data for polygons.

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,
  "geo_segment_type": "example",
  "times_quantity": 0,
  "period_length": 0,
  "form": "example",
  "polygons": [
    {
      "points": [
        {},
        {},
        {},
        {}
      ],
      "description": "example"
    }
  ],
  "pattern": "example",
  "too_much_data": true
}

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"
}

PolygonGeoSegment

Segment based on location data for polygons.

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

    geo_segment_type

    Type: string

    Coordinate type. Acceptable values:

    • last: Current location. The segment includes users who are currently in the selected area or who were in the area less than an hour ago.
    • regular: Frequent location. The segment includes users who frequently visit the selected area. For example, they may be people who live or work nearby. Targeting is based on the data from the past 45 days.
    • home: Home location. The segment includes users who live in the selected area.
    • work: Work location. The segment includes users who work in the selected area.
    • condition: The condition "The user visited the specified places X times during the period". The segment will include users who meet this criteria.

    Example: example

    period_length

    Type: integer

    The period for visits to the specified places. This parameter is required if you are creating the condition "User visited the specified places N time(s) during the period". Acceptable values for the time period (in days): from 1 to 90 (inclusive).

    polygons

    Type: GeoPolygon[]

    Example
    [
      {
        "points": [
          {
            "latitude": 0.5,
            "longitude": 0.5,
            "description": "example"
          },
          {
            "latitude": 0.5,
            "longitude": 0.5,
            "description": "example"
          },
          {
            "latitude": 0.5,
            "longitude": 0.5,
            "description": "example"
          },
          {
            "latitude": 0.5,
            "longitude": 0.5,
            "description": "example"
          }
        ],
        "description": "example"
      }
    ]
    

    times_quantity

    Type: integer

    Frequency of visits to the specified places. This parameter is required if you are creating the condition "User visited the specified places N time(s) during the period".

    Note

    Only one visit per day is counted.

    Example
    {
      "geo_segment_type": "example",
      "times_quantity": 0,
      "period_length": 0,
      "polygons": [
        {
          "points": [
            {
              "latitude": 0.5,
              "longitude": 0.5,
              "description": "example"
            },
            {
              "latitude": 0.5,
              "longitude": 0.5,
              "description": "example"
            },
            {
              "latitude": 0.5,
              "longitude": 0.5,
              "description": "example"
            },
            {
              "latitude": 0.5,
              "longitude": 0.5,
              "description": "example"
            }
          ],
          "description": "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,
  "geo_segment_type": "example",
  "times_quantity": 0,
  "period_length": 0,
  "polygons": [
    {
      "points": [
        {},
        {},
        {},
        {}
      ],
      "description": "example"
    }
  ]
}

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