Skip to content

Contacts API overview

Token, contact import, consent export and rate limits of the Segmentify Contacts API.

View as Markdown llms.txt

Base URL: https://trapi.segmentify.com. Every contacts request needs the access token as a Bearer token: Authorization: Bearer <accessToken>.

POST /oauth2/token

Get a token with the account credentials you use to log in to the Segmentify panel.

Access token: valid for 2 hours.

Refresh token: valid for 4 hours.

Request

{
"username": "accountUser",
"password": "accountPassword"
}

Response (200)

{
"accessToken": "ACCESS_TOKEN",
"refreshToken": "REFRESH_TOKEN",
"accessExpiresInTime": 7200,
"refreshExpiresInTime": 14400
}

POST /oauth2/token

When the 2-hour access token has expired, get a new token with the refresh token, without sending your credentials again.

Request

{
"grantType": "REFRESH_TOKEN",
"refreshToken": "REFRESH_TOKEN"
}

Response (200)

{
"accessToken": "ACCESS_TOKEN",
"refreshToken": "REFRESH_TOKEN",
"accessExpiresInTime": 7200,
"refreshExpiresInTime": 14400
}

POST /contacts/import

successRecord: the number of records that were saved.

errors: the fields that were rejected, with the format each one is expected in.

  • userId is optional. When it is empty, the email address is used as the user ID.
  • iysEnabled: when true, the user data is sent to the İYS integration. To keep it from being sent, leave the field out or send "iysEnabled": false.

Request

[
{
"userId": "test.test@segmentify.com",
"fullName": "Test",
"email": "test.testç@segmentify.com",
"isEmailOpt": true,
"iysEnabled": true,
"mobilePhone": "05551234567",
"gender": "E",
"location": "Ankara",
"customSegments": [
"Futbol",
"Basketbol"
],
"paramsMap": {
"takim": "besiktas"
}
},
{
"fullName": "Test test2",
"email": "test.test2@segmentify.com",
"isEmailOpt": true,
"iysEnabled": true,
"mobilePhone": "05551234567",
"gender": "E",
"birthDate": "1985.10.03",
"memberShipDate": "2023.01.01",
"location": "Ankara",
"customSegments": [
"Futbol",
"Basketbol"
],
"paramsMap": {
"takim": "fenerbahce"
}
}
]

Response (400)

{
"errors": [
{
"index": 0,
"value": "test.testç@segmentify.com",
"message": "Please check the email address format, it seems to be invalid"
},
{
"index": 1,
"value": "1985.10.03",
"message": "The birthDate should be sent in DD.MM.YYYY format. Please check it"
},
{
"index": 1,
"value": "2023.01.01",
"message": "The memberShipDate should be sent in DD.MM.YYYY format. Please check it"
}
],
"successRecord": 0
}

POST /contacts/import

successRecord: the number of records that were saved.

errors: the fields that were rejected, with the format each one is expected in.

  • userId is optional. When it is empty, the email address is used as the user ID.
  • iysEnabled: when true, the user data is sent to the İYS integration. To keep it from being sent, leave the field out or send "iysEnabled": false.

Request

[
{
"fullName": "test sgm",
"email": "test-sgm@segmentify.com",
"isEmailOpt": true,
"iysEnabled": true,
"mobilePhone": "05551234567",
"gender": "E",
"location": "Ankara",
"customSegments": [
"Futbol",
"Basketbol"
],
"paramsMap": {
"takim": "besiktas"
}
}
]

Response (200)

{
"errors": [],
"successRecord": 1
}

POST /contacts/v2/export

  • unsubscribed: when true, the result includes contacts whose consent is rejected.
  • subscribed: when true, the result includes contacts whose consent is approved.
  • startDate and endDate: return the consent data of that date range. Without them, the result covers the consent changes of the last day.
  • includeUserDetails: when true, each contact comes with its user details.

Request

{
"unsubscribed": true,
"subscribed": true
}

Response (200)

{
"totalCount": 3,
"totalPages": 1,
"currentPage": 1,
"list": [
{
"email": "test.test08@segmentify.com",
"isEmailOpt": "false",
"allowDate": "2024-03-27 11:25:21.448"
},
{
"userId": "test-sgm@segmentify.com",
"email": "test-sgm@segmentify.com",
"isEmailOpt": "true",
"allowDate": "2024-03-27 11:10:00.0"
},
{
"userId": "test.test@segmentify.com",
"email": "test.test@segmentify.com",
"isEmailOpt": "true",
"allowDate": "2024-03-27 11:50:00.0"
}
]
}

POST /contacts/v2/export

  • unsubscribed: when true, the result includes contacts whose consent is rejected.
  • subscribed: when true, the result includes contacts whose consent is approved.
  • startDate and endDate: return the consent data of that date range. Without them, the result covers the consent changes of the last day.
  • includeUserDetails: when true, each contact comes with its user details.

Request

{
"unsubscribed": true,
"subscribed": true,
"includeUserDetails": true
}

Response (200)

{
"totalCount": 2,
"totalPages": 1,
"currentPage": 1,
"list": [
{
"userId": "test-sgm@segmentify.com",
"email": "test-sgm@segmentify.com",
"isEmailOpt": "true",
"allowDate": "2024-03-27 11:10:00.0",
"userDetail": {
"email": "test-sgm@segmentify.com",
"fullName": "test sgm",
"mobilePhone": "05551234567",
"gender": "E",
"location": "Ankara",
"customSegments": [
"Futbol",
"Basketbol"
]
}
},
{
"userId": "test.test@segmentify.com",
"email": "test.test@segmentify.com",
"isEmailOpt": "true",
"allowDate": "2024-03-27 11:50:00.0",
"userDetail": {
"email": "test.test@segmentify.com",
"fullName": "Test",
"mobilePhone": "05551234567",
"gender": "E",
"location": "Istanbul",
"customSegments": [
"Futbol",
"Basketbol"
]
}
}
]
}

POST /contacts/v2/export

  • unsubscribed: when true, the result includes contacts whose consent is rejected.
  • subscribed: when true, the result includes contacts whose consent is approved.
  • startDate and endDate: return the consent data of that date range. Without them, the result covers the consent changes of the last day.
  • includeUserDetails: when true, each contact comes with its user details.
  • includeIysField: when true, the response is returned in İYS format.

Request

{
"unsubscribed": true,
"subscribed": true,
"includeIysField": true,
"includeUserDetails": true
}

Response (200)

{
"totalCount": 2,
"totalPages": 1,
"currentPage": 1,
"list": [
{
"userId": "test-sgm@segmentify.com",
"email": "test-sgm@segmentify.com",
"iysType": "EPOSTA",
"iysSource": "HS_WEB",
"iysStatus": "ONAY",
"iysConsentDate": "2024-03-27 11:10:00.0",
"iysReceiptType": "BIREYSEL",
"userDetail": {
"email": "test-sgm@segmentify.com",
"fullName": "test sgm",
"mobilePhone": "05551234567",
"gender": "E",
"location": "Ankara",
"customSegments": [
"Futbol",
"Basketbol"
]
}
},
{
"userId": "test.test@segmentify.com",
"email": "test.test@segmentify.com",
"iysType": "EPOSTA",
"iysSource": "HS_WEB",
"iysStatus": "ONAY",
"iysConsentDate": "2024-03-27 11:50:00.0",
"iysReceiptType": "BIREYSEL",
"userDetail": {
"email": "test.test@segmentify.com",
"fullName": "Test",
"mobilePhone": "05551234567",
"gender": "E",
"location": "Istanbul",
"customSegments": [
"Futbol",
"Basketbol"
]
}
}
]
}

POST /contacts/v2/export?page=2

Use the page parameter to get the next page. Each page holds 1000 records.

Request pages according to totalPages and currentPage in the response.

Request

{
"unsubscribed": true,
"subscribed": true,
"startDate": "2023-06-01",
"endDate": "2024-03-27"
}

Response (200)

{
"totalCount": 1003,
"totalPages": 2,
"currentPage": 2,
"list": [
{
"email": "test.sgm2@segmentify.com",
"isEmailOpt": "false",
"allowDate": "2024-02-22 12:47:13.484"
},
{
"userId": "test-sgm5@segmentify.com",
"email": "test-sgm5@segmentify.com",
"isEmailOpt": "true",
"allowDate": "2024-02-29 16:05:00.0"
},
{
"userId": "test-sgm2@segmentify.com",
"email": "test-sgm2@segmentify.com",
"isEmailOpt": "true",
"allowDate": "2024-02-21 13:41:16.0"
}
]
}

POST /contacts/v2/export?page=5

The error returned when the requested page does not exist.

Request pages according to totalPages and currentPage in the response.

Request

{
"unsubscribed": true,
"subscribed": true
}

Response (400)

Please check the page parameter, currentPage not be greater than totalPage it seems to be invalid

POST /contacts/import

Requests are rate limited. One request can carry 1000 records, and 100 successful requests are allowed per hour. Requests beyond the limit return an error.

Request

[
{
"fullName": "Test",
"email": "test.test@segmentify.com",
"isEmailOpt": true,
"mobilePhone": "05551234567",
"gender": "E",
"location": "Istanbul",
"customSegments": [
"Futbol",
"Basketbol"
],
"paramsMap": {
"takim": "trabzon"
}
}
]

Response (429)

Your request has been blocked. You have too many requests, try again later.

POST /contacts/export?page=10

More than 100 failed requests in one hour block you for one hour. You can send requests again when the block is lifted.

Request

{
"unsubscribed": true,
"subscribed": true
}

Response (429)

Your request has been blocked. You have too many bad requests, try again later.

POST /contacts/v2/get/user-data?userId=test-sgm@segmentify.com

Look up a user by user ID or email address.

Response (200)

{
"userId": "test-sgm@segmentify.com",
"email": "test-sgm@segmentify.com",
"isEmailOpt": "true",
"allowDate": "2024-03-27 11:10:00.0",
"userDetail": {
"email": "test-sgm@segmentify.com",
"fullName": "test sgm",
"mobilePhone": "05551234567",
"gender": "E",
"location": "Ankara",
"customSegments": [
"Futbol",
"Basketbol"
]
}
}

Send these requests from the Contacts API reference.