Segments API

Segments can be created, edited, deleted and viewed using the following REST api instructions.  When you have created a segment, you can attach that list to a demand or supply tag for targeting. 

Creating a Segment

SDK

Use tab completion with SDK to auto-complete function names or show field options!

REST API

POST /api/v0/segments

Headers

Body (example)


Device ID Segment

{
  "name": "My Device Segment",
    "description": "My Device description",
    "segment_type”: "list",
    "segment_list_type”: "device_id"
}


Cookie ID Segment

{
  "name": "My Cookie ID Segment",
    "description": "My Cookie ID description"
    "segment_type”: "list",
    "segment_list_type”: "cookie"
}

Required parameters: name. If not given a segment_type it will default to 'cookie'

Full options:

segment_type (list or pixel)
segment_list_type (cookie or device_id) – only applies when segment_type is list
segment_pixel_type (cookie or ip) – only applies when segment_type is pixel


Response

Status code 200


Get a segment

SDK

Use tab completion with SDK to auto-complete function names or show field options!

REST API

GET /api/v0/segments/<id>

Headers

Response

Status code 200

Add elements to a Segment

SDK

REST API

POST /api/v0/segments/<id>/items/bulk_create

Headers

Body (example)

Response

Status code 200

Add Items to a Segment using a File

SDK

REST API

POST /api/v0/segments/<id>/items/file_bulk_create

Response

Status code 201

Replace Entire Segment

SDK

REST API

POST /api/v0/app_name_lists/<id>/app_names/bulk_replace

Headers


Body (example)

Response

Status code 201

Replace Entire Segment with a File

Replaces segment with the items in the csv file

SDK

REST API

POST /api/v0/segments/<id>/items/file_bulk_replace

Response

Status code 201

Get Device IDs or Cookies in a Segment 

SDK

REST API

GET /api/v0/segments/<id>/items

Headers


Response (note you need to paginate)

Status code 200

Remove specific Device Ids or Cookies

SDK

REST API

DELETE /api/v0/segments/<id>/items/bulk_delete

Headers

Body (example) where "1" and "2" are the numeric 


Response (note you need to pagenate)

Status code 200

Remove specific items using a File

Removes items in the csv file from the segment

SDK

REST API

DELETE /api/v0/segments/<id>/items/file_bulk_delete

Response

Status code 200

Remove all items in a segment

SDK

Attach to a Demand or Supply Tag

See documentation on the Supply and Demand Tag APIs