Request to export segment

Create a request to export segment to CSV files.

Export is only available for the Account Owner. For details, see the section Access Rights

Input data

End-point

https://tracker.my.com/api/segment/v1/export/create.json

Method

POST

Parameters

Name Value Description Note
idSegment * ID of one of the segments available to you

Example: 1 или
idSegment=1
ID of the segment to be exported
requestFields Some values of exported fields, separated by commas or array-based

Example: requestFields=gaid,idfa
The list of identifiers that will be present in the exporting. If the list is empty or not transmitted, all available fields will be exported The list of available fields depends on the audience type of the segment.
Segment by users:
  • idProject
  • idProjectUser
  • customUserId
Segment by devices:
  • idApp
  • idProfile
  • gaid
  • idfa
  • oaid
includeHeaderLine One of the values:
0 - off
1 - on (by default)

Example: includeHeaderLine=1
Adding the first line with column names to each file

* - required parameters

Example query

/api/segment/v1/export/create.json?idSegment=1&requestFields=gaid,idfa

Responses

Success

A 200 response (OK) indicates success. It will include an identifier of a new request in the idSegmentExport field:

{
  "code": 200,
  "message": "Ok",
  "data": {
    "idSegmentExport": "1"
  }
}

Errors

A 400 response indicates an error in parameters given. For example:

  • The requested segment (idSegment) cannot be export:
    {
      "code": 400,
      "message": "Bad Request",
      "data": {
        "error": {
          "detail": "Field \"idSegment\" is invalid"
        }
      }
    }

Restrictions

  • A 403 response indicates that the method needs authorization. Maybe you made mistakes or forgot to send authorization data.
    {
      "code": 403,
      "message": "Access denied",
      "data": null
    }
  • A 400 response is returned when you sent a new request, and the previous export did not finish yet:
    {
      "code": 400,
      "message": "Bad Request",
      "data": {
        "error": {
          "detail": "There are previously requested segment export, wait for them to complete",
          "info": {
            "exports": [
              {
                "idSegmentExport": "1"
              }
            ]
          }
        }
      }
    }
  • Request for a new export for a segment that is in the process of exporting.
    {
      "code": 400,
      "message": "Bad Request",
      "data": {
        "error": {
          "detail": "This segment is already being exported"
        }
      }
    }