# Segmentify API Docs
> Guides, debugging help and an interactive reference for the Segmentify Events, Customer and Contacts APIs.
import { Card, CardGrid, LinkCard } from '@astrojs/starlight/components';
## APIs
Track page views, basket and checkout steps, search, widget, email, SMS,
push and CDP user events. [Guide](/events/overview/) ·
[Reference](/reference/events/)
Create customers one at a time or in bulk, with OAuth2 Bearer tokens.
[Guide](/customer-api/overview/) · [Reference](/reference/customer-api/)
Import contacts and export their consent data.
[Guide](/contacts-api/overview/) · [Reference](/reference/contacts-api/)
Error codes, rate limits and the checks to run when a request fails.
[Debugging guide](/debugging/)
## SDK documentation
---
# Introduction
> Which Segmentify API to use, where each one is served, how each one authenticates and how to send requests from this site.
Segmentify has three REST APIs. Each has a guide section on this site and an interactive reference where you can send requests.
| API | Use it to | Base URL | Authentication |
| --- | --- | --- | --- |
| [Events API](/events/overview/) | Send user interactions from a website, app or backend | `https://{dataCenter}.segmentify.com` | `apiKey` query parameter, plus an `Origin` header that matches your account's domain |
| [Customer API](/customer-api/overview/) | Create customers, one at a time or in bulk | `https://api-eq.segmentify.com` (Türkiye), `https://api-gcp.segmentify.com` (Global) | Bearer access token from `POST /auth/token` |
| [Contacts API](/contacts-api/overview/) | Import contacts and export consent data | `https://trapi.segmentify.com` | Bearer access token from `POST /oauth2/token` |
Your API key and data center are under **Settings > Integrations** in the Segmentify panel.
If you integrate through an SDK, the SDK sends the Events API requests for you. See the SDK documentation linked in the sidebar.
## Send a request from this site
1. Open a reference: [Events](/reference/events/), [Customer](/reference/customer-api/) or [Contacts](/reference/contacts-api/).
2. Choose the server. For the Events API, type your data center into the server variable.
3. Enter your credentials under **Authentication**: the API key for the Events API, or an access token for the Customer and Contacts APIs. To get a token, send the login request of that API first and copy `accessToken` from the response.
4. Open an operation and select **Test Request**. Where an operation has several examples, pick one in the request body to load its payload.
5. Send the request. The response, its status and headers are shown next to it, and the reference also shows the same request as code (cURL and other languages) to copy into your integration.
Requests are sent through this site's own proxy, which forwards only to `https://*.segmentify.com`. Credentials are kept in the page only and are cleared when you reload it.
### The Origin header of the Events API
The Events API checks the `Origin` header against the domain of your account. A browser always sets `Origin` itself, so a value typed into the reference is ignored. Fill in the `X-Forward-Origin` header instead: the proxy sends its value as `Origin`. This header exists only for the reference on this site; do not send it from your integration.
---
# Contacts API overview
> Token, contact import, consent export and rate limits of the Segmentify Contacts API.
Base URL: `https://trapi.segmentify.com`. Every contacts request needs the access token as a Bearer token: `Authorization: Bearer `.
## Authorization Token
`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**
```json
{
"username": "accountUser",
"password": "accountPassword"
}
```
**Response** (200)
```json
{
"accessToken": "ACCESS_TOKEN",
"refreshToken": "REFRESH_TOKEN",
"accessExpiresInTime": 7200,
"refreshExpiresInTime": 14400
}
```
## Authorization Refresh Token
`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**
```json
{
"grantType": "REFRESH_TOKEN",
"refreshToken": "REFRESH_TOKEN"
}
```
**Response** (200)
```json
{
"accessToken": "ACCESS_TOKEN",
"refreshToken": "REFRESH_TOKEN",
"accessExpiresInTime": 7200,
"refreshExpiresInTime": 14400
}
```
## Contacts-Import-Failed
`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**
```json
[
{
"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)
```json
{
"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
}
```
## Contacts-Import-Successfully
`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**
```json
[
{
"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)
```json
{
"errors": [],
"successRecord": 1
}
```
## Contacts-Api-V2-Export-Api Successfully
`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**
```json
{
"unsubscribed": true,
"subscribed": true
}
```
**Response** (200)
```json
{
"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"
}
]
}
```
## Contacts-Api-V2-Export-Api Include-User
`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**
```json
{
"unsubscribed": true,
"subscribed": true,
"includeUserDetails": true
}
```
**Response** (200)
```json
{
"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"
]
}
}
]
}
```
## Contacts-Api-v2-Export-Api-Include-Iys
`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**
```json
{
"unsubscribed": true,
"subscribed": true,
"includeIysField": true,
"includeUserDetails": true
}
```
**Response** (200)
```json
{
"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"
]
}
}
]
}
```
## Contacts-v2-Export-Pagination
`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**
```json
{
"unsubscribed": true,
"subscribed": true,
"startDate": "2023-06-01",
"endDate": "2024-03-27"
}
```
**Response** (200)
```json
{
"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"
}
]
}
```
## Contacts-v2-Export-Pagination-Error
`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**
```json
{
"unsubscribed": true,
"subscribed": true
}
```
**Response** (400)
```text
Please check the page parameter, currentPage not be greater than totalPage it seems to be invalid
```
## Contacts-Api-Too-Many-Request
`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**
```json
[
{
"fullName": "Test",
"email": "test.test@segmentify.com",
"isEmailOpt": true,
"mobilePhone": "05551234567",
"gender": "E",
"location": "Istanbul",
"customSegments": [
"Futbol",
"Basketbol"
],
"paramsMap": {
"takim": "trabzon"
}
}
]
```
**Response** (429)
```text
Your request has been blocked. You have too many requests, try again later.
```
## Contacts-Api-Too-Many-Bad-Request
`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**
```json
{
"unsubscribed": true,
"subscribed": true
}
```
**Response** (429)
```text
Your request has been blocked. You have too many bad requests, try again later.
```
## Contacts-Api-v2-Get-User-Data
`POST /contacts/v2/get/user-data?userId=test-sgm@segmentify.com`
Look up a user by user ID or email address.
**Response** (200)
```json
{
"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"
]
}
}
```
## API reference
Send these requests from the [Contacts API reference](/reference/contacts-api/).
---
# Customer API overview
> Base URLs, versioning, authentication and the customer creation endpoints of the Segmentify Customer API.
| Item | Value |
| --- | --- |
| API title | Segmentify Customer API |
| API version | `1.0` |
| Protocol | HTTPS / REST, JSON payloads |
| Auth scheme | OAuth2 Bearer token (`Authorization: Bearer` ) |
## Base URL
The service is deployed per environment.
```
Türkiye -> https://api-eq.segmentify.com
Global -> https://api-gcp.segmentify.com
```
## API version header
Every endpoint is versioned. Send the API version as a request header:
```
X-Api-Version: 1.0
```
## Content type
All request and response bodies are JSON:
```
Content-Type: application/json
Accept: application/json
```
## Authentication model
- The **authentication endpoints** under `/auth` are public — they do **not** require a Bearer token (they are how you obtain one).
- All **customer endpoints** under `/customer` require a valid Bearer access token.
## Authentication flow
Obtain an access token with your credentials, then send it as a Bearer token on every customer request. Access tokens are short-lived; use the refresh endpoint to get a new pair without re-sending credentials.
## Login
`POST /auth/token`
Exchanges a username and password for an access token and a refresh token.
**Request**
```json
{
"username": "acme-integration",
"password": "s3cr3t-p@ssw0rd"
}
```
**Response** (200)
```json
{
"accessToken": "ACCESS_TOKEN",
"refreshToken": "REFRESH_TOKEN",
"accessExpiresInTime": 900,
"refreshExpiresInTime": 2592000
}
```
## Refresh Token
`POST /auth/token/refresh`
Exchanges a valid refresh token for a **new** access/refresh token pair. Call this before the access token expires (or after receiving a `401`) to avoid re-sending credentials.
**Request**
```json
{
"refreshToken": "REFRESH_TOKEN"
}
```
**Response** (200)
```json
{
"accessToken": "ACCESS_TOKEN",
"refreshToken": "REFRESH_TOKEN",
"accessExpiresInTime": 900,
"refreshExpiresInTime": 2592000
}
```
## Single Customer
`POST /customer/`
Creates (or resolves and updates) a single customer and returns the resulting customer profile.
**Request**
```json
{
"firstName": "Jane",
"lastName": "Doe",
"email": "jane.doe@example.com",
"phone": "+905055554433",
"gender": "FEMALE",
"birthDate": "1990-05-14",
"maritalStatus": "SINGLE",
"country": "Turkey",
"city": "Istanbul",
"district": "Kadikoy",
"postalCode": "34000",
"language": "tr",
"currency": "TRY",
"region": "TR-34",
"timeZone": "Europe/Istanbul",
"creationSource": "API",
"membershipDate": "2026-01-15T10:30:00+03:00",
"loginMethods": [
"email",
"google"
],
"custom": {
"loyaltyId": "LYT-99123",
"segment": "vip"
},
"channelConsents": {
"EMAIL": {
"marketing": {
"state": "SUBSCRIBED"
},
"transactional": {
"state": "SUBSCRIBED"
}
}
}
}
```
**Response** (200)
```json
{
"id": "9b2e6c1a-3f4d-4a2b-8c7e-1f2a3b4c5d6e",
"firstName": "Jane",
"lastName": "Doe",
"email": "jane.doe@example.com",
"customAttributes": {},
"customIdentifiers": {},
"createdAt": 1767181800000,
"changeType": "CREATED"
}
```
## Batch Customers
`POST /customer/batch`
Creates customers in bulk. Supports **partial success**: the request is validated per record, then valid records are processed and reported as succeeded/failed. Invalid records are reported separately and never processed.
**Request**
```json
[
{
"firstName": "Jane",
"lastName": "Doe",
"email": "jane.doe@example.com",
"phone": "+905055554433",
"gender": "FEMALE",
"birthDate": "1990-05-14",
"maritalStatus": "SINGLE",
"country": "Turkey",
"city": "Istanbul",
"district": "Kadikoy",
"postalCode": "34000",
"language": "tr",
"currency": "TRY",
"region": "TR-34",
"timeZone": "Europe/Istanbul",
"creationSource": "API",
"membershipDate": "2026-01-15T10:30:00+03:00",
"loginMethods": [
"email",
"google"
],
"custom": {
"loyaltyId": "LYT-99123",
"segment": "vip"
},
"channelConsents": {
"EMAIL": {
"marketing": {
"state": "SUBSCRIBED"
},
"transactional": {
"state": "SUBSCRIBED"
}
}
}
}
]
```
**Response** (200)
```json
{
"validCount": 2,
"invalids": [],
"successCount": 1,
"fails": [
{
"phone": "+905055554433",
"firstName": "John"
}
]
}
```
## API reference
Send these requests from the [Customer API reference](/reference/customer-api/).
---
# Debugging
> Error codes, rate limits and the checks to run when a Segmentify API request fails.
Start by sending the failing request from the API reference with the same values. The reference shows the raw response, which usually names the problem.
## Events API
The Events API reports errors in the response body. If the body contains a `statusCode` field, the request failed.
| `statusCode` | Meaning | What to check |
| --- | --- | --- |
| `NO_API_KEY` | The `apiKey` parameter is missing. | Send your API key as the `apiKey` query parameter. |
| `NO_ACCOUNT` | The API key belongs to no Segmentify account. | Compare the key with the one under Settings > Integrations. |
| `FAILED_ACCOUNT` | The account of the API key is inactive. | Contact the Segmentify support team to re-activate the account. |
| `NO_DOMAIN_APIKEY_MATCH` | The `Origin` header does not match the domain of the account. | Send the registered domain as `Origin`. In the reference on this site, use `X-Forward-Origin`. |
| `NO_EVENT` | The request body holds no events. | Send at least one event. |
| `INVALID_EVENT` | The event format is not acceptable. | Compare the event with the example of its category. |
| `NO_USERID` | An event has no `userId`. | Add `userId` to every event. See [Session Management](/events/session-management/). |
| `NO_SESSIONID` | An event has no `sessionId`. | Add `sessionId` to every event. |
| `BAD_INPUT` | The body is not valid JSON. | Validate the JSON: look for missing or trailing commas and comments. |
Other checks:
- **Data center**: the host must be the data center of your account. A key sent to another data center is not found.
- **Test mode**: an event with `testMode: "true"` does not affect live data, so it does not show up in live reports.
- **Campaign events** (email, SMS, push): the values come from the UTM parameters of the landing page URL. Check that the URL carries them before sending the event. See [Email](/events/email/), [SMS](/events/sms/) and [Push](/events/push/).
- **Push endpoints** are served from the push data center, not the events data center.
## Customer API
- **`401`**: the access token is missing, invalid or expired. Access tokens are short-lived; get a new pair from `POST /auth/token/refresh`, or log in again if the refresh token has expired too.
- **Missing version header**: every endpoint needs `X-Api-Version: 1.0`.
- **Wrong region**: use the base URL of your region, `api-eq` for Türkiye or `api-gcp` for Global.
- **Batch requests succeed partially**: a `200` response does not mean every record was created. Read `invalids` (records that failed validation and were not processed) and `fails` (valid records that could not be processed) in the response.
## Contacts API
- **`400` on import**: the response lists each rejected field in `errors`, with the `index` of the record in your array, the rejected `value` and a `message`. `successRecord` is the number of records that were saved. Dates (`birthDate`, `memberShipDate`) must be in `DD.MM.YYYY` format.
- **`400` on export**: the `page` parameter is greater than `totalPages`. Read `totalPages` and `currentPage` from the previous response.
- **`429` Too Many Requests**: one request can carry 1000 records, and 100 successful requests are allowed per hour. More than 100 failed requests in an hour block the account for one hour.
- **Expired token**: the access token is valid for 2 hours and the refresh token for 4 hours. Send the refresh token to `POST /oauth2/token` with `grantType: "REFRESH_TOKEN"`.
## Still stuck
Send the Segmentify support team the request (method, URL without the API key or token, body) and the full response, with the time of the request.
---
# Basket Operations
> Tracks changes to the user's shopping cart using the BASKET_OPERATIONS event.
Tracks changes to the user's shopping cart using the `BASKET_OPERATIONS` event. All three requests share the same event name and differ only in the `step` field.
**Requests:**
- **Basket Add** — fires when a product is added to the cart (`step: "add"`). Requires `productId`, `price`, `quantity`, and `basketId`.
- **Basket Remove** — fires when a product is removed from the cart (`step: "remove"`). Requires `productId`, `price`, `quantity`, and `basketId`.
- **Basket Clear** — fires when the entire cart is emptied (`step: "clear"`). No product-level fields are needed.
All requests use the `{dataCenterUrl}` endpoint and require `userId`, `sessionId`, `lang`, `currency`, and `basketId`.
## Basket Add
**Example body**
```json
{
"name": "BASKET_OPERATIONS",
"userId": "1234567890123456789",
"sessionId": "323232",
"testMode": "false",
"device": "PC",
"nextPage": false,
"params": {},
"os": "ANDROID",
"lang": "EN",
"currency": "EUR",
"productId": "T59008765Y0",
"basketId": "basket_1234567890123456789",
"step": "add",
"price": "1999",
"quantity": 1
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Basket Operations / Basket Add** in the request body examples of *Send events*.
:::
## Basket Remove
**Example body**
```json
{
"name": "BASKET_OPERATIONS",
"basketId": "basket_1234567890123456789",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"params": {},
"recommendIds": [],
"pageUrl": "",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"productId": "PRODUCT_ID",
"price": "1000",
"quantity": "1",
"email": "user@example.com",
"step": "remove"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Basket Operations / Basket Remove** in the request body examples of *Send events*.
:::
## Basket Clear
**Example body**
```json
{
"name": "BASKET_OPERATIONS",
"basketId": "basket_1234567890123456789",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"params": {},
"recommendIds": [],
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"email": "user@example.com",
"step": "clear"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Basket Operations / Basket Clear** in the request body examples of *Send events*.
:::
---
# CDP User Events
> Customer Data Platform user events: identify, register, login, logout, subscribe and unsubscribe.
CDP (Customer Data Platform) user events, aligned with the Segmentify Integration SDK (`@segmentify/integration`).
### Endpoint
```
POST {baseUrl}/add/events/v1.json?apiKey={apiKey}
```
### Base URL per region
| Region | baseUrl |
| --- | --- |
| QA | `https://gandalf-qa.segmentify.com` |
| TR | `https://per2.segmentify.com` |
| EU | `https://gandalf-eu.segmentify.com` |
| LATAM | `https://gandalf-br.segmentify.com` |
### General notes
- Every event has the shape `name` + `properties`.
- The SDK adds the context fields automatically on `sendEvent` (`device`, `userId`, `sessionId`, `currency`, `lang`, `sdkVersion` and so on). The example bodies on this page include them.
- Profile events (`IdentifyUser`, `RegisterUser`, `LoginUser`, `LogoutUser`) are not sent with empty `properties`.
- If at least one consent field is present, the SDK fills the missing consent fields with `NOT_SET`.
### SDK method → event name
| SDK method | Event `name` |
| --- | --- |
| `IdentifyUser` | `USER_IDENTIFY` |
| `RegisterUser` | `USER_REGISTER` |
| `LoginUser` | `USER_LOGIN` |
| `LogoutUser` | `USER_LOGOUT` |
| `SubscribeUser` | `USER_SUBSCRIBE` |
| `UnsubscribeUser` | `USER_UNSUBSCRIBE` |
## Profile Events
Profile events, which share the `CdpEventsPayload` type.
#### CdpEventsPayload fields
| Field | Type | Required | Description |
|---|---|---|---|
| `phone` | string | No | Phone number |
| `email` | string | No | Email address |
| `username` | string | No | Username |
| `source` | string | No | Source (for example `email-collection`) |
| `gender` | string | No | Gender |
| `fullName` | string | No | Full name |
| `callConsent` | enum | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` |
| `emailConsent` | enum | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` |
| `whatsappConsent` | enum | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` |
| `smsConsent` | enum | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` |
| *(extra key)* | string \| number \| boolean | No | Custom trait (for example `loyalty_level`) |
#### Consent behavior
1. If `properties` is empty, the event is **not sent**.
2. If **at least one** consent field is present, the missing consent fields are set to `NOT_SET`.
3. If no consent field is present, the payload is sent as it is.
### Identify User
#### IdentifyUser → `USER_IDENTIFY`
Sends a snapshot of the user's identity and traits when the profile changes. If the profile has not changed, the SDK **skips** the event (deduplication).
##### SDK method
```ts
await segmentify.Events.IdentifyUser(params: CdpEventsPayload)
```
##### Behavior notes
- Consent defaults are applied (`withConsentDefaults`).
- An empty payload is not sent.
- A profile identical to the last one sent successfully is not sent again (deduplication).
- After a successful send the profile snapshot is stored; on an error the in-flight reservation is cleared.
##### `properties` parameters
| Parameter | Type | Required | Enum / Example | Description |
| --- | --- | --- | --- | --- |
| `email` | string | No | `user@example.com` | Email |
| `phone` | string | No | `905551234567` | Phone (`phone`, not `phoneNumber`) |
| `username` | string | No | `johndoe` | Username |
| `fullName` | string | No | `John Doe` | Full name |
| `gender` | string | No | `male` | Gender |
| `source` | string | No | `email-collection` | Data source |
| `callConsent` | string | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` | Call consent |
| `emailConsent` | string | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` | Email consent |
| `whatsappConsent` | string | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` | WhatsApp consent |
| `smsConsent` | string | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` | SMS consent |
| _(extra)_ | string/number/boolean | No | `loyalty_level: "gold"` | Free-form trait fields |
##### Context fields (added automatically by the SDK)
| Field | Type | Description |
| --- | --- | --- |
| `device` | string | `PC` \| `mobile` \| `tablet` |
| `userId` | string | Segmentify user ID |
| `sessionId` | string | Session ID |
| `referrer` | string | Referrer URL |
| `pageUrl` | string | Page URL |
| `userAgent` | string | User-Agent |
| `currency` | string | Currency |
| `lang` | string | Language |
| `sdkVersion` | string | SDK version |
| `os` / `osversion` | string | Operating system |
| `browser` | string | Browser |
| `dnp` | string | Do-not-personalize |
| `testMode` | string | Test mode |
| `region` | string | Optional region |
**Example body**
```json
{
"name": "USER_IDENTIFY",
"properties": {
"email": "user@example.com",
"username": "johndoe",
"phone": "905551234567",
"gender": "male",
"callConsent": "SUBSCRIBED",
"emailConsent": "UNSUBSCRIBED",
"whatsappConsent": "NOT_SET",
"smsConsent": "SUBSCRIBED",
"source": "email-collection",
"fullName": "John Doe",
"loyalty_level": "gold"
},
"device": "mobile",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"referrer": "",
"pageUrl": "https://www.example.com/account",
"userAgent": "Mozilla/5.0",
"currency": "EUR",
"lang": "EN",
"sdkVersion": "1.0.0",
"os": "Android",
"osversion": "14",
"browser": "Chrome",
"dnp": "false",
"testMode": "false"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **CDP User Events / Profile Events / Identify User** in the request body examples of *Send events*.
:::
### Traits User
Sends the `USER_TRAITS` event with the user's profile `properties` and `segments`. The `properties` object takes the same fields as [Identify User](#identify-user).
**Example body**
```json
{
"name": "USER_TRAITS",
"properties": {
"email": "user@example.com",
"username": "johndoe",
"phone": "905551234567",
"gender": "male",
"callConsent": "SUBSCRIBED",
"emailConsent": "UNSUBSCRIBED",
"whatsappConsent": "NOT_SET",
"smsConsent": "SUBSCRIBED",
"source": "email-collection",
"fullName": "John Doe",
"loyalty_level": "gold",
"segments": [
"vip-customers"
]
},
"segments": [
"vip-customers"
],
"device": "mobile",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"referrer": "",
"pageUrl": "https://www.example.com/account",
"userAgent": "Mozilla/5.0",
"currency": "EUR",
"lang": "EN",
"sdkVersion": "1.0.0",
"os": "Android",
"osversion": "14",
"browser": "Chrome",
"dnp": "false",
"testMode": "false"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **CDP User Events / Profile Events / Traits User** in the request body examples of *Send events*.
:::
### Register User
#### RegisterUser → `USER_REGISTER`
Sent when a user completes registration (signup). It creates the CDP profile and is separate from the older `USER_OPERATIONS` / `signup` event.
##### SDK method
```ts
await segmentify.Events.RegisterUser(params: CdpEventsPayload)
```
##### Behavior notes
- Consent defaults are applied.
- An empty payload is not sent.
- No deduplication: it is sent on every call (unlike IdentifyUser).
##### `properties` parameters
| Parameter | Type | Required | Enum / Example | Description |
|---|---|---|---|---|
| `email` | string | No | `user@example.com` | Email |
| `phone` | string | No | `905551234567` | Phone |
| `username` | string | No | `johndoe` | Username |
| `fullName` | string | No | `John Doe` | Full name |
| `gender` | string | No | `male` | Gender |
| `source` | string | No | `email-collection` | Data source |
| `callConsent` | string | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` | Call consent |
| `emailConsent` | string | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` | Email consent |
| `whatsappConsent` | string | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` | WhatsApp consent |
| `smsConsent` | string | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` | SMS consent |
| *(extra)* | string/number/boolean | No | `loyalty_level: "gold"` | Free-form trait fields |
**Example body**
```json
{
"name": "USER_REGISTER",
"properties": {
"email": "user@example.com",
"username": "johndoe",
"phone": "905551234567",
"gender": "male",
"callConsent": "SUBSCRIBED",
"emailConsent": "UNSUBSCRIBED",
"whatsappConsent": "NOT_SET",
"smsConsent": "SUBSCRIBED",
"source": "email-collection",
"fullName": "John Doe",
"loyalty_level": "gold"
},
"device": "mobile",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"referrer": "",
"pageUrl": "https://www.example.com/register",
"userAgent": "Mozilla/5.0",
"currency": "EUR",
"lang": "EN",
"sdkVersion": "1.0.0",
"os": "Android",
"osversion": "14",
"browser": "Chrome",
"dnp": "false",
"testMode": "false"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **CDP User Events / Profile Events / Register User** in the request body examples of *Send events*.
:::
### Login User
#### LoginUser → `USER_LOGIN`
Sent when a user logs in. Typically `email` (or another identifying field) is enough.
##### SDK method
```ts
await segmentify.Events.LoginUser(params: CdpEventsPayload)
```
##### Behavior notes
- Consent defaults are applied.
- An empty payload is not sent.
- No deduplication.
##### `properties` parameters
| Parameter | Type | Required | Enum / Example | Description |
|---|---|---|---|---|
| `email` | string | No* | `user@example.com` | Email (*recommended in practice) |
| `phone` | string | No | `905551234567` | Phone |
| `username` | string | No | `johndoe` | Username |
| `fullName` | string | No | `John Doe` | Full name |
| `gender` | string | No | `male` | Gender |
| `source` | string | No | `login-form` | Data source |
| `callConsent` | string | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` | Call consent |
| `emailConsent` | string | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` | Email consent |
| `whatsappConsent` | string | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` | WhatsApp consent |
| `smsConsent` | string | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` | SMS consent |
| *(extra)* | string/number/boolean | No | — | Free-form trait fields |
**Example body**
```json
{
"name": "USER_LOGIN",
"properties": {
"email": "user@example.com"
},
"device": "mobile",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"referrer": "",
"pageUrl": "https://www.example.com/login",
"userAgent": "Mozilla/5.0",
"currency": "EUR",
"lang": "EN",
"sdkVersion": "1.0.0",
"os": "Android",
"osversion": "14",
"browser": "Chrome",
"dnp": "false",
"testMode": "false"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **CDP User Events / Profile Events / Login User** in the request body examples of *Send events*.
:::
### Logout User
#### LogoutUser → `USER_LOGOUT`
Sent when a user logs out.
##### SDK method
```ts
await segmentify.Events.LogoutUser(params: CdpEventsPayload)
```
##### Behavior notes
- Consent defaults are applied.
- An empty payload is not sent.
- No deduplication.
##### `properties` parameters
| Parameter | Type | Required | Enum / Example | Description |
|---|---|---|---|---|
| `email` | string | No* | `user@example.com` | Email (*recommended in practice) |
| `phone` | string | No | `905551234567` | Phone |
| `username` | string | No | `johndoe` | Username |
| `fullName` | string | No | `John Doe` | Full name |
| `gender` | string | No | `male` | Gender |
| `source` | string | No | `logout` | Data source |
| `callConsent` | string | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` | Call consent |
| `emailConsent` | string | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` | Email consent |
| `whatsappConsent` | string | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` | WhatsApp consent |
| `smsConsent` | string | No | `SUBSCRIBED` \| `UNSUBSCRIBED` \| `NOT_SET` | SMS consent |
| *(extra)* | string/number/boolean | No | — | Free-form trait fields |
**Example body**
```json
{
"name": "USER_LOGOUT",
"properties": {
"email": "user@example.com"
},
"device": "mobile",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"referrer": "",
"pageUrl": "https://www.example.com/logout",
"userAgent": "Mozilla/5.0",
"currency": "EUR",
"lang": "EN",
"sdkVersion": "1.0.0",
"os": "Android",
"osversion": "14",
"browser": "Chrome",
"dnp": "false",
"testMode": "false"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **CDP User Events / Profile Events / Logout User** in the request body examples of *Send events*.
:::
## Channel Subscription
Channel subscribe and unsubscribe events.
The `channel` field is the discriminator: the required fields depend on the channel.
#### Channel enum
| Value | Description |
|---|---|
| `web_push` | Web Push / FCM |
| `email` | Email |
| `whatsapp` | WhatsApp |
| `sms` | SMS |
| `call` | Call |
#### Purpose enum (email only)
`MARKETING` | `TRANSACTIONAL` | `PERSONALISATION` | `ALL`
#### Required fields for subscribe
| channel | Required fields |
|---|---|
| `web_push` | `pushSubscriptionId`, `auth`, `p256dh`, `fcmToken`, `endPoint` |
| `email` | `email`, `purpose[]` |
| `whatsapp` / `sms` / `call` | `phone` |
#### Required fields for unsubscribe
| channel | Required fields |
|---|---|
| `web_push` | `channel` only |
| `email` | `channel`, `email` (+ optional `purpose[]`) |
| `whatsapp` / `sms` / `call` | `channel`, `phone` |
**Field name:** the phone field must be `phone` (not `phoneNumber`).
### Subscribe — Web Push
#### SubscribeUser → `USER_SUBSCRIBE` (channel: `web_push`)
Sent when a user subscribes to the Web Push / FCM channel.
##### SDK method
```ts
await segmentify.Events.SubscribeUser({
channel: 'web_push',
pushSubscriptionId: '...',
auth: '...',
p256dh: '...',
fcmToken: '...',
endPoint: '...'
})
```
##### `properties` parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| `channel` | string | Yes | Fixed: `web_push` |
| `pushSubscriptionId` | string | Yes | Push subscription ID |
| `auth` | string | Yes | Push auth key |
| `p256dh` | string | Yes | Push p256dh key |
| `fcmToken` | string | Yes | FCM token |
| `endPoint` | string | Yes | Push endpoint URL |
**Example body**
```json
{
"name": "USER_SUBSCRIBE",
"properties": {
"channel": "web_push",
"pushSubscriptionId": "fcm_token_abc123_xyz",
"auth": "auth_token_example",
"p256dh": "p256dh_key_example",
"fcmToken": "fcm_token_example",
"endPoint": "https://fcm.googleapis.com/fcm/send/example"
},
"device": "mobile",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"currency": "EUR",
"lang": "EN",
"sdkVersion": "1.0.0"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **CDP User Events / Channel Subscription / Subscribe — Web Push** in the request body examples of *Send events*.
:::
### Subscribe — Email
#### SubscribeUser → `USER_SUBSCRIBE` (channel: `email`)
Sent when a user subscribes to the email channel.
##### SDK method
```ts
await segmentify.Events.SubscribeUser({
channel: 'email',
email: 'test@email.com',
purpose: ['MARKETING']
})
```
##### `properties` parameters
| Parameter | Type | Required | Enum / Example | Description |
|---|---|---|---|---|
| `channel` | string | Yes | `email` | Channel |
| `email` | string | Yes | `test@email.com` | Subscriber email |
| `purpose` | string[] | Yes | `MARKETING` \| `TRANSACTIONAL` \| `PERSONALISATION` \| `ALL` | List of purposes (JSON array) |
**Note:** `purpose` must be an **array**, not a single string.
**Example body**
```json
{
"name": "USER_SUBSCRIBE",
"properties": {
"channel": "email",
"email": "user@example.com",
"purpose": [
"MARKETING"
],
"doNotSendWelcomeEmail": false
},
"device": "mobile",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"currency": "EUR",
"lang": "EN",
"sdkVersion": "1.0.0"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **CDP User Events / Channel Subscription / Subscribe — Email** in the request body examples of *Send events*.
:::
### Subscribe — WhatsApp
#### SubscribeUser → `USER_SUBSCRIBE` (channel: `whatsapp`)
Sent when a user subscribes to the WhatsApp channel.
##### SDK method
```ts
await segmentify.Events.SubscribeUser({
channel: 'whatsapp',
phone: '905551234567'
})
```
##### `properties` parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| `channel` | string | Yes | Fixed: `whatsapp` |
| `phone` | string | Yes | Phone number (`phone`, not `phoneNumber`) |
**Example body**
```json
{
"name": "USER_SUBSCRIBE",
"properties": {
"channel": "whatsapp",
"phone": "905551234567"
},
"device": "mobile",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"currency": "EUR",
"lang": "EN",
"sdkVersion": "1.0.0"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **CDP User Events / Channel Subscription / Subscribe — WhatsApp** in the request body examples of *Send events*.
:::
### Subscribe — SMS
#### SubscribeUser → `USER_SUBSCRIBE` (channel: `sms`)
Sent when a user subscribes to the SMS channel.
##### SDK method
```ts
await segmentify.Events.SubscribeUser({
channel: 'sms',
phone: '905551234567'
})
```
##### `properties` parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| `channel` | string | Yes | Fixed: `sms` |
| `phone` | string | Yes | Phone number |
**Example body**
```json
{
"name": "USER_SUBSCRIBE",
"properties": {
"channel": "sms",
"phone": "905551234567"
},
"device": "mobile",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"currency": "EUR",
"lang": "EN",
"sdkVersion": "1.0.0"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **CDP User Events / Channel Subscription / Subscribe — SMS** in the request body examples of *Send events*.
:::
### Subscribe — Call
#### SubscribeUser → `USER_SUBSCRIBE` (channel: `call`)
Sent when a user subscribes to the call channel.
##### SDK method
```ts
await segmentify.Events.SubscribeUser({
channel: 'call',
phone: '905551234567'
})
```
##### `properties` parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| `channel` | string | Yes | Fixed: `call` |
| `phone` | string | Yes | Phone number |
**Example body**
```json
{
"name": "USER_SUBSCRIBE",
"properties": {
"channel": "call",
"phone": "905551234567"
},
"device": "mobile",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"currency": "EUR",
"lang": "EN",
"sdkVersion": "1.0.0"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **CDP User Events / Channel Subscription / Subscribe — Call** in the request body examples of *Send events*.
:::
### Unsubscribe — Web Push
#### UnsubscribeUser → `USER_UNSUBSCRIBE` (channel: `web_push`)
Sent when a user cancels the Web Push subscription. Only `channel` is needed.
##### SDK method
```ts
await segmentify.Events.UnsubscribeUser({ channel: 'web_push' })
```
##### `properties` parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| `channel` | string | Yes | Fixed: `web_push` |
| `email` | string | No | Not used for this channel |
| `phone` | string | No | Not used for this channel |
| `purpose` | string[] | No | Not used for this channel |
**Example body**
```json
{
"name": "USER_UNSUBSCRIBE",
"properties": {
"channel": "web_push"
},
"device": "mobile",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"currency": "EUR",
"lang": "EN",
"sdkVersion": "1.0.0"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **CDP User Events / Channel Subscription / Unsubscribe — Web Push** in the request body examples of *Send events*.
:::
### Unsubscribe — Email
#### UnsubscribeUser → `USER_UNSUBSCRIBE` (channel: `email`)
Sent when a user cancels the email subscription.
##### SDK method
```ts
await segmentify.Events.UnsubscribeUser({
channel: 'email',
email: 'test@email.com',
purpose: ['MARKETING'] // optional
})
```
##### `properties` parameters
| Parameter | Type | Required | Enum / Example | Description |
|---|---|---|---|---|
| `channel` | string | Yes | `email` | Channel |
| `email` | string | Yes | Email address being unsubscribed |
| `purpose` | string[] | No | `MARKETING` \| `TRANSACTIONAL` \| `PERSONALISATION` \| `ALL` | Purpose(s) being cancelled |
| `phone` | string | No | — | Not used for this channel |
**Example body**
```json
{
"name": "USER_UNSUBSCRIBE",
"properties": {
"channel": "email",
"email": "user@example.com",
"purpose": [
"MARKETING"
]
},
"device": "mobile",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"currency": "EUR",
"lang": "EN",
"sdkVersion": "1.0.0"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **CDP User Events / Channel Subscription / Unsubscribe — Email** in the request body examples of *Send events*.
:::
### Unsubscribe — WhatsApp
#### UnsubscribeUser → `USER_UNSUBSCRIBE` (channel: `whatsapp`)
Sent when a user cancels the WhatsApp subscription.
##### SDK method
```ts
await segmentify.Events.UnsubscribeUser({
channel: 'whatsapp',
phone: '905551234567'
})
```
##### `properties` parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| `channel` | string | Yes | Fixed: `whatsapp` |
| `phone` | string | Yes | Phone number |
**Example body**
```json
{
"name": "USER_UNSUBSCRIBE",
"properties": {
"channel": "whatsapp",
"phone": "905551234567"
},
"device": "mobile",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"currency": "EUR",
"lang": "EN",
"sdkVersion": "1.0.0"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **CDP User Events / Channel Subscription / Unsubscribe — WhatsApp** in the request body examples of *Send events*.
:::
### Unsubscribe — SMS
#### UnsubscribeUser → `USER_UNSUBSCRIBE` (channel: `sms`)
Sent when a user cancels the SMS subscription.
##### SDK method
```ts
await segmentify.Events.UnsubscribeUser({
channel: 'sms',
phone: '905551234567'
})
```
##### `properties` parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| `channel` | string | Yes | Fixed: `sms` |
| `phone` | string | Yes | Phone number |
**Example body**
```json
{
"name": "USER_UNSUBSCRIBE",
"properties": {
"channel": "sms",
"phone": "905551234567"
},
"device": "mobile",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"currency": "EUR",
"lang": "EN",
"sdkVersion": "1.0.0"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **CDP User Events / Channel Subscription / Unsubscribe — SMS** in the request body examples of *Send events*.
:::
### Unsubscribe — Call
#### UnsubscribeUser → `USER_UNSUBSCRIBE` (channel: `call`)
Sent when a user cancels the call subscription.
##### SDK method
```ts
await segmentify.Events.UnsubscribeUser({
channel: 'call',
phone: '905551234567'
})
```
##### `properties` parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| `channel` | string | Yes | Fixed: `call` |
| `phone` | string | Yes | Phone number |
**Example body**
```json
{
"name": "USER_UNSUBSCRIBE",
"properties": {
"channel": "call",
"phone": "905551234567"
},
"device": "mobile",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"currency": "EUR",
"lang": "EN",
"sdkVersion": "1.0.0"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **CDP User Events / Channel Subscription / Unsubscribe — Call** in the request body examples of *Send events*.
:::
---
# Checkout
> Tracks the two key steps of the checkout funnel using the CHECKOUT event.
Tracks the two key steps of the checkout funnel using the `CHECKOUT` event. Both requests share the same event name and differ in the `step` field.
**Requests:**
- **View Basket** — fires when a user views their cart before proceeding to checkout (`step: "view-basket"`). Includes the full `productList` array with `productId`, `price`, and `quantity`, plus `totalPrice`.
- **Purchase** — fires when an order is successfully completed (`step: "purchase"`). Includes `productList`, `totalPrice`, and a merchant `orderNo` for deduplication.
These events are critical for conversion tracking and revenue attribution in the Segmentify dashboard.
## View Basket
**Example body**
```json
{
"name": "CHECKOUT",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "true",
"device": "PC",
"params": {},
"recommendIds": [],
"pageUrl": "",
"referrer": "",
"lang": "EN",
"productList": [
{
"productId": "PRODUCT_ID",
"price": "1222",
"quantity": 1
}
],
"currency": "EUR",
"step": "view-basket",
"email": "user@example.com",
"totalPrice": "1222",
"basketId": "basket_1234567890123456789"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Checkout / View Basket** in the request body examples of *Send events*.
:::
## Purchase
### Purpose
Sends a **Purchase** event (`name: "CHECKOUT"`, `step: "purchase"`) to Segmentify Events API. Use this event to report a completed checkout (order) together with customer/session context and purchased items.
---
### Endpoint
**POST** `https://{dataCenterUrl}.segmentify.com/add/events/v1.json?apiKey={apikey}`
> This request uses query param authentication via `apiKey`.
---
### Required variables
These variables are referenced in the request URL / headers / body. Make sure they are defined in your active environment (or at collection/global level):
- `dataCenterUrl` (string) – datacenter subdomain/prefix (e.g., `eu`, `us`, etc.)
- `apikey` (string) – Segmentify API key
- `domain` (string) – value for the `origin` header (your site domain)
- `userId` (string) – your user identifier
- `sessionId` (string) – session identifier
- `deviceType` (string) – device type (e.g., `desktop`, `mobile`, `tablet`)
- `lang` (string) – language code (e.g., `en`, `tr`)
- `productId` (string) – product identifier used inside `productList[]`
- `currency` (string) – currency code (e.g., `USD`, `EUR`, `TRY`)
- `region` (string) – region/country code (e.g., `TR`)
- `email` (string) – customer email
---
### Headers
- `origin: {domain}`
---
### Body (JSON)
Content type is **raw JSON**.
#### Top-level schema
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | Event name. For this request it is `CHECKOUT`. |
| `userId` | string | yes | User identifier. |
| `sessionId` | string | yes | Session identifier. |
| `testMode` | string/boolean | recommended | When enabled, the event may be treated as test traffic. **Note:** this request currently sends it as a string (`"false"`). |
| `device` | string | recommended | Device type (from `{deviceType}`). |
| `params` | object | optional | Additional custom parameters. |
| `recommendIds` | array | optional | Recommendation IDs associated with the conversion (if any). |
| `pageUrl` | string | optional | Page URL where purchase occurred. |
| `referrer` | string | optional | Referrer URL. |
| `lang` | string | recommended | Language code. |
| `productList` | array | yes | Purchased items list. See schema below. |
| `currency` | string | yes | Currency code for the order. |
| `region` | string | recommended | Region/country. |
| `step` | string | yes | Checkout step. For purchase it is `purchase`. |
| `orderNo` | string | yes | Merchant order number. |
| `email` | string | recommended | Customer email. |
| `totalPrice` | string/number | yes | Total order price. **Note:** this request currently sends it as a string. |
#### `productList[]` item schema
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `productId` | string | yes | Purchased product identifier. |
| `price` | string/number | yes | Unit price. **Note:** this request currently sends it as a string. |
| `quantity` | number | yes | Quantity purchased. |
---
### Example payload
```json
{
"name": "CHECKOUT",
"userId": "{userId}",
"sessionId": "{sessionId}",
"testMode": "false",
"device": "{deviceType}",
"params": {},
"recommendIds": [],
"pageUrl": "",
"referrer": "",
"lang": "{lang}",
"productList": [
{
"productId": "{productId}",
"price": "1222",
"quantity": 1
}
],
"currency": "{currency}",
"region": "{region}",
"step": "purchase",
"orderNo": "TS232323",
"email": "{email}",
"totalPrice": "1222"
}
```
---
### Success / error expectations
Because implementations may vary by account/setup, validate based on your Segmentify Events API behavior:
#### Success
- HTTP status commonly **200** or **2xx**
- Response body typically includes an acknowledgement that the event is accepted/processed
#### Error
- **4xx**: invalid/missing `apiKey`, invalid payload, missing required fields
- **5xx**: server-side error
Recommended validation:
- Ensure the response is JSON (if applicable)
- Confirm the event appears in your dashboard/logs according to your tracking setup
---
### Notes
- **Idempotency:** If you might retry requests, consider keeping `orderNo` stable per order to avoid duplicate purchases (behavior depends on backend deduplication rules).
- **`testMode`****:** This request sends `testMode` as a string. If your backend expects a boolean, you may want to align types in your implementation.
- **Money fields:** `price` and `totalPrice` are currently strings. If numeric values are required, ensure type consistency.
- **Currency/region:** Use standard ISO codes where possible (e.g., `TRY`, `USD`; `TR`, `US`).
- **Optional URLs:** Set `pageUrl` and `referrer` when available to improve analytics attribution.
**Example body**
```json
{
"name": "CHECKOUT",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"params": {},
"recommendIds": [],
"lang": "EN",
"productList": [
{
"productId": "PRODUCT_ID",
"price": "1222",
"quantity": 1
}
],
"currency": "EUR",
"step": "purchase",
"orderNo": "TS232323",
"email": "user@example.com",
"totalPrice": "1222"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Checkout / Purchase** in the request body examples of *Send events*.
:::
---
# Custom Event
> Contains requests for sending custom, non-standard events to Segmentify using the CUSTOM_EVENT event name.
Contains requests for sending custom, non-standard events to Segmentify using the `CUSTOM_EVENT` event name. Use these when none of the built-in event types fit your use case.
**Requests:**
- **Trigger Event** — a generic custom event template. The `type` field is fully configurable via `{type}`, allowing you to define any custom interaction or trigger.
- **Mail Trigger Example** — a concrete example of a custom event used to trigger a transactional or behavioral email. Sets `type: "test-mail"` and passes `email` and `emailNtf` inside `params` to identify the recipient and opt-in status.
Custom events are useful for triggering Segmentify automations, A/B tests, or personalization rules that depend on business-specific signals.
## Trigger Event
**Example body**
```json
{
"name": "CUSTOM_EVENT",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "true",
"device": "PC",
"lang": "EN",
"currency": "EUR",
"params": {},
"region": "",
"type": "my-custom-event",
"email": "user@example.com"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Custom Event / Trigger Event** in the request body examples of *Send events*.
:::
## Mail Trigger Example
**Example body**
```json
[
{
"name": "CUSTOM_EVENT",
"userId": "test-user-id-3",
"sessionId": "test-session-id-3",
"testMode": "false",
"device": "PC",
"noProcess": false,
"nextPage": false,
"params": {
"email": "test3@segmentify.com",
"emailNtf": "true"
},
"recommendIds": [],
"pageUrl": "https://www.example.com",
"referrer": "",
"lang": "PL",
"currency": "PLN",
"region": "",
"email": "test3@segmentify.com",
"type": "test-mail"
}
]
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Custom Event / Mail Trigger Example** in the request body examples of *Send events*.
:::
---
# Email
> Handles attribution and interaction tracking for Segmentify email campaigns.
Handles attribution and interaction tracking for Segmentify email campaigns. These events must be sent when a user arrives on your site via an email campaign link where `utm_medium=email`.
Before sending any of these events, verify that the campaign URL contains the required UTM parameters: `utm_source=segmentify`, `utm_medium=email`, `utm_campaign=eml_xxxx`, and `utm_code=xxxxxxxx`.
**Requests:**
- **Email View** — fires when the user lands on the site from an email link. Uses `type: "email"` and sets both `instanceId` and `interactionId` to `{emailCampaignId}` (the `utm_campaign` value).
- **Email Click** — fires when the user clicks a product or recommendation shown as a result of the email campaign. Uses `type: "click"` with `instanceId` set to the campaign ID and `interactionId` set to the clicked `{productId}`.
- **Email User Op** — identifies the arriving user by linking their session to a known email identity. Uses `name: "USER_OPERATIONS"`, `step: "identify"`, `channel: "email"`, and `identity: {utm_code}` (the hash from the campaign URL).
## Email View
### Email View Event
Send this event when a user **opens or views an email** sent by a Segmentify email campaign. This event must be fired as soon as the user lands on your website via an email campaign link where `utm_medium=email`.
> ⚠️ **Important:** Before sending this event, make sure the email campaign URL contains the following UTM parameters:
---
#### Endpoint
`POST https://{dataCenterUrl}.segmentify.com/add/events/v1.json?apiKey={apikey}`
---
#### Request Body Fields
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | ✅ | Event name. Must be `INTERACTION`. |
| `userId` | string | ✅ | Unique identifier for the user. |
| `sessionId` | string | ✅ | Unique identifier for the current session. |
| `testMode` | string | ✅ | Set to `"false"` for production events. |
| `device` | string | ✅ | Device type of the user (e.g., `DESKTOP`, `MOBILE`, `TABLET`). |
| `lang` | string | ✅ | Language code (e.g., `en`, `tr`). |
| `currency` | string | ✅ | Currency code (e.g., `USD`, `EUR`, `TRY`). |
| `region` | string | ❌ | Region or country code of the user. |
| `email` | string | ✅ | Email address of the user who received the campaign. |
| `type` | string | ✅ | Interaction type. Fixed value: `"email"`. |
| `interactionId` | string | ✅ | The email campaign ID. Use the `utm_campaign` value from the email link. Maps to `{emailCampaignId}`. |
| `instanceId` | string | ✅ | The email campaign instance ID. Same as `interactionId`. Maps to `{emailCampaignId}`. |
**Example body**
```json
{
"name": "INTERACTION",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"lang": "EN",
"currency": "EUR",
"region": "",
"email": "user@example.com",
"type": "email",
"interactionId": "eml_xxxx",
"instanceId": "eml_xxxx"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Email / Email View** in the request body examples of *Send events*.
:::
## Email Click
### Email Click Event
Send this event when a user **clicks on a product or recommendation** within a Segmentify email campaign. This event tracks which products the user interacted with after arriving from an email link where `utm_medium=email`.
> ⚠️ **Important:** Before sending this event, make sure the email campaign URL contains the following UTM parameters:
> - `utm_source=segmentify`
> - `utm_medium=email`
> - `utm_campaign=eml_xxxx`
> - `utm_code=xxxxxxxx`
---
#### Endpoint
`POST https://{dataCenterUrl}.segmentify.com/add/events/v1.json?apiKey={apikey}`
---
#### Request Body Fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | string | ✅ | Event name. Must be `INTERACTION`. |
| `userId` | string | ✅ | Unique identifier for the user. |
| `sessionId` | string | ✅ | Unique identifier for the current session. |
| `testMode` | string | ✅ | Set to `"false"` for production events. |
| `device` | string | ✅ | Device type (e.g., `DESKTOP`, `MOBILE`, `TABLET`). |
| `params` | object | ❌ | Additional custom parameters. Can be left empty `{}`. |
| `recommendIds` | array | ❌ | IDs of recommendations shown in the email. |
| `pageUrl` | string | ❌ | Full URL of the page the user landed on after clicking. |
| `referrer` | string | ❌ | URL of the referring page. |
| `lang` | string | ✅ | Language code (e.g., `en`, `tr`). |
| `currency` | string | ✅ | Currency code (e.g., `USD`, `EUR`, `TRY`). |
| `region` | string | ❌ | Region or country code of the user. |
| `type` | string | ✅ | Interaction type. Fixed value: `"click"`. |
| `instanceId` | string | ✅ | The email campaign ID. Maps to `{emailCampaignId}`. |
| `interactionId` | string | ✅ | The ID of the product that was clicked in the email. Maps to `{productId}`. |
| `email` | string | ✅ | Email address of the user who received the campaign. |
**Example body**
```json
{
"name": "INTERACTION",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"params": {},
"recommendIds": [],
"pageUrl": "",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"type": "click",
"instanceId": "eml_xxxx",
"interactionId": "PRODUCT_ID",
"email": "user@example.com"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Email / Email Click** in the request body examples of *Send events*.
:::
## Email User Op
### Email User Op Event
Send this event to **identify the user** who arrived via a Segmentify email campaign link. This event links the anonymous user session to a known email identity using the `utm_code` hash from the campaign URL. It must be fired when `utm_medium=email` is detected in the URL.
> ⚠️ **Important:** The `identity` field must be populated with the `utm_code` value from the email campaign URL. This is a unique hash that Segmentify uses to identify the recipient.
>
> Example URL parameter: `utm_code=UTM_CODE_HASH`
---
#### Endpoint
`POST https://{dataCenterUrl}.segmentify.com/add/events/v1.json?apiKey={apikey}`
---
#### Request Body Fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | string | ✅ | Event name. Must be `USER_OPERATIONS`. |
| `userId` | string | ✅ | Unique identifier for the user. |
| `sessionId` | string | ✅ | Unique identifier for the current session. |
| `device` | string | ✅ | Device type (e.g., `DESKTOP`, `MOBILE`, `TABLET`). |
| `lang` | string | ✅ | Language code (e.g., `en`, `tr`). |
| `currency` | string | ✅ | Currency code (e.g., `USD`, `EUR`, `TRY`). |
| `region` | string | ❌ | Region or country code of the user. |
| `email` | string | ❌ | Email address of the user (if known at this point). |
| `step` | string | ✅ | Operation step. Fixed value: `"identify"`. |
| `channel` | string | ✅ | The channel through which the user arrived. Fixed value: `"email"`. |
| `type` | string | ✅ | Identity type. Fixed value: `"sgm-hash"`. |
| `identity` | string | ✅ | The `utm_code` hash value extracted from the email campaign URL. Maps to `{utm_code}`. |
**Example body**
```json
{
"name": "USER_OPERATIONS",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"device": "PC",
"domain": "https://www.example.com",
"lang": "EN",
"email": "",
"step": "identify",
"channel": "email",
"type": "sgm-hash",
"identity": "UTM_CODE_HASH"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Email / Email User Op** in the request body examples of *Send events*.
:::
---
# Events API overview
> Endpoint, authentication, headers, event categories and ID management of the Segmentify Events API.
This section covers the requests needed to integrate with the **Segmentify RESTful API**. It covers the full range of trackable user interactions on your website or app, enabling Segmentify to personalize recommendations, power search, and attribute campaign conversions.
---
## Authentication & Configuration
All requests require two account-specific variables, which you can find under **Settings > Integrations** in the Segmentify Panel:
| Variable | Description |
|---|---|
| `{apikey}` | Your unique Segmentify API key |
| `{dataCenterUrl}` | Your account's data center subdomain (e.g. `xxx` in `https://xxx.segmentify.com`) |
**Endpoint format:**
```
https://{dataCenterUrl}.segmentify.com/add/events/v1.json?apiKey={apikey}
```
**Required headers for all requests:**
| Header | Value |
|---|---|
| `Content-Type` | `application/json` |
| `Accept` | `application/json` |
| `Origin` | Your domain |
Request bodies must be valid **JSON arrays**, and multiple events can be batched in a single request.
---
## Event Categories
### 📄 Page View
Tracks user visits across key pages of your site: **Home**, **Category**, **Product Detail**, **Basket**, **Checkout Success**, and other custom pages. These events drive page-level personalization and behavioral analytics.
### 🛒 Basket Operations
Covers add-to-basket, remove-from-basket, and basket view actions, allowing Segmentify to track cart activity and trigger relevant recommendations.
### 🏁 Checkout
Tracks the **View Basket** and **Checkout Success** steps to measure conversions and attribute revenue.
### 🔍 Search
A comprehensive set of events covering the full search lifecycle — queries, results, impressions (including after-search), clicks, and Searchandising interactions — enabling Segmentify's intelligent search and merchandising features.
### 👁️ Product View
Captures product detail page views to feed product-level recommendation engines.
### ❤️ Wishlist Events
Tracks when users add, remove, or view items in their wishlist/favorites.
### 🖱️ Widget Interaction
Records user interactions with Segmentify recommendation widgets (impressions, clicks, and conversions).
### 📲 Push
Handles push notification campaign attribution, including subscription, unsubscription, and interaction tracking for notifications triggered by Segmentify.
### 📧 Email
Tracks email campaign attribution — open, click, and conversion events for emails sent through Segmentify.
### ⚙️ Custom Event
Allows sending fully custom events for any interaction not covered by the standard event types.
---
> **Tip:** You can send multiple events in a single request by including them as elements in the JSON array body.
---
## API Errors
If the response body contains a `statusCode` field, your request encountered an error. The table below describes all possible error codes:
| Error Code | Description |
|---|---|
| `NO_API_KEY` | Your request is missing the `apiKey` parameter. Provide your account's unique API key as a query parameter. |
| `NO_ACCOUNT` | The given API key is not associated with any Segmentify account. Check that your `{apikey}` value is correct. |
| `FAILED_ACCOUNT` | The account associated with the API key is inactive. Contact the Segmentify support team to re-activate your account. |
| `NO_DOMAIN_APIKEY_MATCH` | Each Segmentify account is tied to a specific domain. Ensure you are sending the correct `Origin` header matching your registered domain. |
| `NO_EVENT` | The request body contains no events. At least one event must be included in the JSON array. |
| `INVALID_EVENT` | The event format is not acceptable. Check the structure of your event objects against the expected schema. |
| `NO_USERID` | Every event must include a `userId` parameter. At least one event in the request is missing this field. |
| `NO_SESSIONID` | Every event must include a `sessionId` parameter. At least one event in the request is missing this field. |
| `BAD_INPUT` | The request body is not a valid JSON array of Segmentify events. Validate your JSON for syntax errors. |
---
## User & Session Management
Every Segmentify event must include a `userId` and a `sessionId` to uniquely identify the user and their current visit session.
### Generating IDs via Segmentify
You can generate IDs by making a `GET` request to the following endpoint:
```
GET https://{dataCenterUrl}.segmentify.com/get/key?count=
```
| `count` value | Use case |
|---|---|
| `1` | Generate a `sessionId` only |
| `2` | Generate both `userId` and `sessionId` |
**Example requests:**
```
GET https://{dataCenterUrl}.segmentify.com/get/key?count=1
GET https://{dataCenterUrl}.segmentify.com/get/key?count=2
```
**Example response** (for `count=2`):
```json
["XXXXXXXXXXXXXXXXXXXXXXX", "YYYYYYYYYYYYYYYYYYYY"]
```
The response is a plain JSON array. The first element can be used as the `userId` and the second as the `sessionId`.
### Using Your Own IDs
Alternatively, you can generate and manage your own unique IDs. These can be any string value, as long as they are:
- **Unique per user** for `userId`
- **Unique per visit/session** for `sessionId`
> **Tip:** A common approach is to persist `userId` in a long-lived cookie and generate a fresh `sessionId` at the start of each browser session.
## API reference
Every request on these pages can be sent from the [Events API reference](/reference/events/).
---
# Page View
> Tracks user visits across all page types using the PAGE_VIEW event.
Tracks user visits across all page types using the `PAGE_VIEW` event. The `category` field distinguishes each page type and is the only required difference between requests.
**Requests:**
- **Home Page** — tracks visits to the home page (`category: "Home Page"`).
- **Category Page** — tracks visits to category/listing pages (`category: "Category Page"`). Supports passing category hierarchy via `params`.
- **Product Page** — tracks visits to product detail pages (`category: "Product Page"`).
- **Search Page** — tracks visits to the search results page (`category: "Search Page"`). Passes the search query via `params.squery`.
- **404 Page** — tracks visits to error pages (`category: "404 Page"`), enabling recovery recommendations.
- **Basket Page** — tracks visits to the shopping cart page (`category: "Basket Page"`).
- **Checkout Success Page** — tracks the order confirmation page (`category: "Checkout Success Page"`), signaling a completed conversion.
- **Other Pages** — tracks custom or miscellaneous pages not covered by standard categories. Use `{customPage}` to set a dynamic category name.
- **Unknown Page** — a fallback event for pages that cannot be categorized (`category: "Unknown Page"`).
All requests require `userId`, `sessionId`, `lang`, `currency`, and `device`. Optional fields include `pageUrl`, `referrer`, `recommendIds`, and `email`.
## Home Page
### Home Page View Event
Send this event when a user lands on the **Home Page** of your website. This allows Segmentify to track home page visits and personalize recommendations accordingly.
---
#### Endpoint
`POST https://{dataCenterUrl}.segmentify.com/add/events/v1.json?apiKey={apikey}`
---
#### Request Body Fields
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | ✅ | Event name. Must be `PAGE_VIEW`. |
| `userId` | string | ✅ | Unique identifier for the user. |
| `sessionId` | string | ✅ | Unique identifier for the current session. |
| `testMode` | string | ✅ | Set to `"true"` to send test events (won't affect live data). Set to `"false"` for production. |
| `device` | string | ✅ | Device type of the user (e.g., `DESKTOP`, `MOBILE`, `TABLET`). |
| `lang` | string | ✅ | Language code of the user's browser/session (e.g., `en`, `tr`). |
| `currency` | string | ✅ | Currency code used on the site (e.g., `USD`, `EUR`, `TRY`). |
| `category` | string | ✅ | Page category. Fixed value: `"Home Page"`. |
**Example body**
```json
{
"name": "PAGE_VIEW",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"lang": "EN",
"currency": "EUR",
"category": "Home Page"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Page View / Home Page** in the request body examples of *Send events*.
:::
## Category Page
### Category Page View Event
Send this event when a user visits a **Category Page** (e.g., Men's Shoes, Electronics). This helps Segmentify understand browsing behavior and deliver category-specific recommendations.
---
#### Endpoint
`POST https://{dataCenterUrl}.segmentify.com/add/events/v1.json?apiKey={apikey}`
---
#### Request Body Fields
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | ✅ | Event name. Must be `PAGE_VIEW`. |
| `userId` | string | ✅ | Unique identifier for the user. |
| `sessionId` | string | ✅ | Unique identifier for the current session. |
| `testMode` | string | ✅ | Set to `"false"` for production events. |
| `device` | string | ✅ | Device type (e.g., `DESKTOP`, `MOBILE`, `TABLET`). |
| `params` | object | ❌ | Additional custom parameters. Can be left empty `{}`. |
| `recommendIds` | array | ❌ | IDs of recommendations shown on this page. |
| `pageUrl` | string | ❌ | Full URL of the current page. |
| `referrer` | string | ❌ | URL of the referring page. |
| `lang` | string | ✅ | Language code (e.g., `en`, `tr`). |
| `currency` | string | ✅ | Currency code (e.g., `USD`, `EUR`, `TRY`). |
| `region` | string | ❌ | Region or country code of the user. |
| `category` | string | ✅ | Page category. Fixed value: `"Category Page"`. |
| `subCategory` | string | ❌ | The specific sub-category being viewed (e.g., `"Sneakers"`). Use `{subCategory}` variable. |
| `email` | string | ❌ | Email address of the logged-in user (if available). |
**Example body**
```json
{
"name": "PAGE_VIEW",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"params": {},
"recommendIds": [],
"pageUrl": "",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"category": "Category Page",
"subCategory": "Sneakers",
"email": "user@example.com"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Page View / Category Page** in the request body examples of *Send events*.
:::
## Product Page
### Product Page View Event
Send this event when a user views a **Product Detail Page (PDP)**. This is one of the most important events for Segmentify to build accurate recommendation models and track product interest.
---
#### Endpoint
`POST https://{dataCenterUrl}.segmentify.com/add/events/v1.json?apiKey={apikey}`
---
#### Request Body Fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | string | ✅ | Event name. Must be `PAGE_VIEW`. |
| `userId` | string | ✅ | Unique identifier for the user. |
| `sessionId` | string | ✅ | Unique identifier for the current session. |
| `testMode` | string | ✅ | Set to `"false"` for production events. |
| `device` | string | ✅ | Device type (e.g., `DESKTOP`, `MOBILE`, `TABLET`). |
| `params` | object | ❌ | Additional custom parameters. Can be left empty `{}`. |
| `recommendIds` | array | ❌ | IDs of recommendations shown on this page. |
| `pageUrl` | string | ❌ | Full URL of the current product page. |
| `referrer` | string | ❌ | URL of the referring page. |
| `lang` | string | ✅ | Language code (e.g., `en`, `tr`). |
| `currency` | string | ✅ | Currency code (e.g., `USD`, `EUR`, `TRY`). |
| `region` | string | ❌ | Region or country code of the user. |
| `category` | string | ✅ | Page category. Fixed value: `"Product Page"`. |
| `email` | string | ❌ | Email address of the logged-in user (if available). |
**Example body**
```json
{
"name": "PAGE_VIEW",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"params": {},
"recommendIds": [],
"pageUrl": "",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"category": "Product Page",
"email": "user@example.com"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Page View / Product Page** in the request body examples of *Send events*.
:::
## Search Page
### Search Page View Event
Send this event when a user performs a **search** and lands on the Search Results Page. The search query (`squery`) is a key field that helps Segmentify understand user intent and improve search-based recommendations.
---
#### Endpoint
`POST https://{dataCenterUrl}.segmentify.com/add/events/v1.json?apiKey={apikey}`
---
#### Request Body Fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | string | ✅ | Event name. Must be `PAGE_VIEW`. |
| `userId` | string | ✅ | Unique identifier for the user. |
| `sessionId` | string | ✅ | Unique identifier for the current session. |
| `testMode` | string | ✅ | Set to `"false"` for production events. |
| `device` | string | ✅ | Device type (e.g., `DESKTOP`, `MOBILE`, `TABLET`). |
| `params.squery` | string | ✅ | The search query term entered by the user (e.g., `"red sneakers"`). |
| `recommendIds` | array | ❌ | IDs of recommendations shown on this page. |
| `pageUrl` | string | ❌ | Full URL of the search results page. |
| `referrer` | string | ❌ | URL of the referring page. |
| `lang` | string | ✅ | Language code (e.g., `en`, `tr`). |
| `currency` | string | ✅ | Currency code (e.g., `USD`, `EUR`, `TRY`). |
| `region` | string | ❌ | Region or country code of the user. |
| `category` | string | ✅ | Page category. Fixed value: `"Search Page"`. |
| `email` | string | ❌ | Email address of the logged-in user (if available). |
**Example body**
```json
{
"name": "PAGE_VIEW",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"params": {
"squery": "red sneakers"
},
"recommendIds": [],
"pageUrl": "",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"category": "Search Page",
"email": "user@example.com"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Page View / Search Page** in the request body examples of *Send events*.
:::
## 404 Page
### 404 Page View Event
Send this event when a user lands on a **404 Not Found** page. Tracking 404 errors helps Segmentify identify broken links and serve relevant recovery recommendations to keep users engaged.
---
#### Endpoint
`POST https://{dataCenterUrl}.segmentify.com/add/events/v1.json?apiKey={apikey}`
---
#### Request Body Fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | string | ✅ | Event name. Must be `PAGE_VIEW`. |
| `userId` | string | ✅ | Unique identifier for the user. |
| `sessionId` | string | ✅ | Unique identifier for the current session. |
| `testMode` | string | ✅ | Set to `"false"` for production events. |
| `device` | string | ✅ | Device type (e.g., `DESKTOP`, `MOBILE`, `TABLET`). |
| `params` | object | ❌ | Additional custom parameters. Can be left empty `{}`. |
| `recommendIds` | array | ❌ | IDs of recommendations shown on this page. |
| `pageUrl` | string | ❌ | Full URL of the 404 page. |
| `referrer` | string | ❌ | URL of the referring page. |
| `lang` | string | ✅ | Language code (e.g., `en`, `tr`). |
| `currency` | string | ✅ | Currency code (e.g., `USD`, `EUR`, `TRY`). |
| `region` | string | ❌ | Region or country code of the user. |
| `category` | string | ✅ | Page category. Fixed value: `"404 Page"`. |
| `email` | string | ❌ | Email address of the logged-in user (if available). |
**Example body**
```json
{
"name": "PAGE_VIEW",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"params": {},
"recommendIds": [],
"pageUrl": "",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"category": "404 Page",
"email": "user@example.com"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Page View / 404 Page** in the request body examples of *Send events*.
:::
## Basket Page
### Basket Page View Event
Send this event when a user visits the **Shopping Cart / Basket Page**. This event helps Segmentify track cart activity and trigger cart abandonment or upsell recommendation strategies.
---
#### Endpoint
`POST https://{dataCenterUrl}.segmentify.com/add/events/v1.json?apiKey={apikey}`
---
#### Request Body Fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | string | ✅ | Event name. Must be `PAGE_VIEW`. |
| `userId` | string | ✅ | Unique identifier for the user. |
| `sessionId` | string | ✅ | Unique identifier for the current session. |
| `testMode` | string | ✅ | Set to `"false"` for production events. |
| `device` | string | ✅ | Device type (e.g., `DESKTOP`, `MOBILE`, `TABLET`). |
| `params` | object | ❌ | Additional custom parameters. Can be left empty `{}`. |
| `recommendIds` | array | ❌ | IDs of recommendations shown on this page. |
| `pageUrl` | string | ❌ | Full URL of the basket page. |
| `referrer` | string | ❌ | URL of the referring page. |
| `lang` | string | ✅ | Language code (e.g., `en`, `tr`). |
| `currency` | string | ✅ | Currency code (e.g., `USD`, `EUR`, `TRY`). |
| `region` | string | ❌ | Region or country code of the user. |
| `category` | string | ✅ | Page category. Fixed value: `"Basket Page"`. |
| `email` | string | ❌ | Email address of the logged-in user (if available). |
**Example body**
```json
{
"name": "PAGE_VIEW",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"params": {},
"recommendIds": [],
"pageUrl": "",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"category": "Basket Page",
"email": "user@example.com"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Page View / Basket Page** in the request body examples of *Send events*.
:::
## Checkout Success Page
### Checkout Success Page View Event
Send this event when a user reaches the **Order Confirmation / Checkout Success Page** after completing a purchase. This event signals a successful conversion and helps Segmentify optimize post-purchase recommendation flows.
---
#### Endpoint
`POST https://{dataCenterUrl}.segmentify.com/add/events/v1.json?apiKey={apikey}`
---
#### Request Body Fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | string | ✅ | Event name. Must be `PAGE_VIEW`. |
| `userId` | string | ✅ | Unique identifier for the user. |
| `sessionId` | string | ✅ | Unique identifier for the current session. |
| `testMode` | string | ✅ | Set to `"false"` for production events. |
| `device` | string | ✅ | Device type (e.g., `DESKTOP`, `MOBILE`, `TABLET`). |
| `params` | object | ❌ | Additional custom parameters. Can be left empty `{}`. |
| `recommendIds` | array | ❌ | IDs of recommendations shown on this page. |
| `pageUrl` | string | ❌ | Full URL of the checkout success page. |
| `referrer` | string | ❌ | URL of the referring page. |
| `lang` | string | ✅ | Language code (e.g., `en`, `tr`). |
| `currency` | string | ✅ | Currency code (e.g., `USD`, `EUR`, `TRY`). |
| `region` | string | ❌ | Region or country code of the user. |
| `category` | string | ✅ | Page category. Fixed value: `"Checkout Success Page"`. |
| `email` | string | ❌ | Email address of the logged-in user (if available). |
**Example body**
```json
{
"name": "PAGE_VIEW",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"params": {},
"recommendIds": [],
"pageUrl": "",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"category": "Checkout Success Page",
"email": "user@example.com"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Page View / Checkout Success Page** in the request body examples of *Send events*.
:::
## Other Pages
### Other Pages View Event
Send this event for any **custom or miscellaneous page** that doesn't fall into a standard category (e.g., About Us, Blog, Contact). Use the `{customPage}` variable to dynamically pass the page name.
---
#### Endpoint
`POST https://{dataCenterUrl}.segmentify.com/add/events/v1.json?apiKey={apikey}`
---
#### Request Body Fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | string | ✅ | Event name. Must be `PAGE_VIEW`. |
| `userId` | string | ✅ | Unique identifier for the user. |
| `sessionId` | string | ✅ | Unique identifier for the current session. |
| `testMode` | string | ✅ | Set to `"false"` for production events. |
| `device` | string | ✅ | Device type (e.g., `DESKTOP`, `MOBILE`, `TABLET`). |
| `params` | object | ❌ | Additional custom parameters. Can be left empty `{}`. |
| `recommendIds` | array | ❌ | IDs of recommendations shown on this page. |
| `pageUrl` | string | ❌ | Full URL of the current page. |
| `referrer` | string | ❌ | URL of the referring page. |
| `lang` | string | ✅ | Language code (e.g., `en`, `tr`). |
| `currency` | string | ✅ | Currency code (e.g., `USD`, `EUR`, `TRY`). |
| `region` | string | ❌ | Region or country code of the user. |
| `category` | string | ✅ | The custom page name. Pass the page identifier dynamically using `{customPage}` (e.g., `"About Us"`, `"Blog"`). |
| `email` | string | ❌ | Email address of the logged-in user (if available). |
**Example body**
```json
{
"name": "PAGE_VIEW",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"params": {},
"recommendIds": [],
"pageUrl": "",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"category": "About Us",
"email": "user@example.com"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Page View / Other Pages** in the request body examples of *Send events*.
:::
## Unknown Page
### Unknown Page View Event
Send this event when a user visits a page that **cannot be categorized** by your integration. This acts as a fallback event to ensure all page views are tracked, even when the page type is undetermined.
---
#### Endpoint
`POST https://{dataCenterUrl}.segmentify.com/add/events/v1.json?apiKey={apikey}`
---
#### Request Body Fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | string | ✅ | Event name. Must be `PAGE_VIEW`. |
| `userId` | string | ✅ | Unique identifier for the user. |
| `sessionId` | string | ✅ | Unique identifier for the current session. |
| `testMode` | string | ✅ | Set to `"false"` for production events. |
| `device` | string | ✅ | Device type (e.g., `DESKTOP`, `MOBILE`, `TABLET`). |
| `params` | object | ❌ | Additional custom parameters. Can be left empty `{}`. |
| `recommendIds` | array | ❌ | IDs of recommendations shown on this page. |
| `pageUrl` | string | ❌ | Full URL of the current page. |
| `referrer` | string | ❌ | URL of the referring page. |
| `lang` | string | ✅ | Language code (e.g., `en`, `tr`). |
| `currency` | string | ✅ | Currency code (e.g., `USD`, `EUR`, `TRY`). |
| `region` | string | ❌ | Region or country code of the user. |
| `category` | string | ✅ | Page category. Fixed value: `"Unknown Page"`. |
| `email` | string | ❌ | Email address of the logged-in user (if available). |
**Example body**
```json
{
"name": "PAGE_VIEW",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"params": {},
"recommendIds": [],
"pageUrl": "",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"category": "Unknown Page",
"email": "user@example.com"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Page View / Unknown Page** in the request body examples of *Send events*.
:::
---
# Product View
> Tracks detailed product views using the dedicated PRODUCT_VIEW event.
Tracks detailed product views using the dedicated `PRODUCT_VIEW` event. This is distinct from the `PAGE_VIEW` Product Page event and is used specifically to feed Segmentify's recommendation and personalization engines with product-level signals.
**Requests:**
- **Product View** — fires when a user views a product detail page. Key fields include `productId`, `price`, `oldPrice`, and `inStock`. Optional fields `recommendIds` and `pageUrl` help attribute the view to a specific recommendation campaign.
This event is one of the most important signals for building accurate recommendation models. It should be sent on every product detail page load alongside the `PAGE_VIEW` Product Page event.
## Product View
**Example body**
```json
{
"name": "PRODUCT_VIEW",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"params": {},
"recommendIds": [],
"pageUrl": "",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"inStock": "true",
"price": "2323",
"oldPrice": "3333",
"productId": "PRODUCT_ID",
"email": "user@example.com"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Product View / Product View** in the request body examples of *Send events*.
:::
---
# Push
> Handles push notification permission and interaction tracking for Segmentify push campaigns.
Handles push notification permission and interaction tracking for Segmentify push campaigns. These events must be sent when a user arrives on your site via a push campaign link where `utm_medium=push`.
Before sending these events, verify that the campaign URL contains the required UTM parameters: `utm_source=segmentify`, `utm_medium=push`, and `utm_campaign=pushCampaignName`.
**Requests:**
- **Accept Notifications** — registers the user's push subscription with Segmentify's push service (`psh2.segmentify.com`). Sends the browser `instanceId` to associate the subscription with the user.
- **Deny Notifications** — records the user's decision to deny push notifications. Sent to `gimli-eu.segmentify.com` as a GET request with `userId`, `instanceId`, `browser`, and `device` as query parameters.
- **Native Push Permission** — registers a native push permission event via `psh2.segmentify.com/native/subscription/push`. Used for native app or browser-level push opt-in flows.
- **Native View Interaction** — fires when a user views content after arriving from a push notification (`type: "view"`). Sent to `psh2.segmentify.com/native/interaction/notification`.
- **Native Click Interaction** — fires when a user clicks on a push notification (`type: "click"`). Sent to `psh2.segmentify.com/native/interaction/notification`.
## Push Permission
`POST /native/subscription/push`
**Example body**
```json
{
"deviceToken": "FCM_DEVICE_TOKEN",
"type": "PERMISSION_INFO",
"providerType": "FIREBASE",
"userId": "1234567890123456789",
"device": "PC",
"os": "ANDROID",
"email": "user@example.com"
}
```
See this endpoint in the [Events API reference](/reference/events/).
## Native View Interaction
`POST /native/interaction/notification`
**Example body**
```json
{
"os": "IOS",
"device": "PC",
"type": "VIEW",
"instanceId": "psh_xxxx",
"userId": "1234567890123456789",
"providerType": "FIREBASE"
}
```
See this endpoint in the [Events API reference](/reference/events/).
## Native Click Interaction
`POST /native/interaction/notification`
**Example body**
```json
{
"os": "PC",
"device": "PC",
"type": "CLICK",
"instanceId": "psh_xxxx",
"userId": "1234567890123456789",
"providerType": "FIREBASE"
}
```
See this endpoint in the [Events API reference](/reference/events/).
## Accept Notifications
`POST /subscription/push`
**Example body**
```json
{
"subscriptionId": "PUSH_SUBSCRIPTION_ID",
"auth": "PUSH_AUTH_SECRET",
"key": "PUSH_P256DH_KEY",
"userId": "1234567890123456789",
"agent": "ANDROID",
"endpoint": "https://fcm.googleapis.com/fcm/send",
"deviceType": "ANDROID",
"isVapid": false,
"fcmToken": "FCM_DEVICE_TOKEN"
}
```
See this endpoint in the [Events API reference](/reference/events/).
## Deny Notifications
`GET /subscription/deny`
See this endpoint in the [Events API reference](/reference/events/).
---
# Search
> Covers the full lifecycle of a user's search interaction, from the initial query through results, impressions, widget views, and product clicks.
Covers the full lifecycle of a user's search interaction, from the initial query through results, impressions, widget views, and product clicks. Events are split into **Before Search** (pre-results) and **After Search** (post-results) phases, plus **Searchandising** for merchandised search results.
**Requests:**
- **Before Search** — fires when the user types a query into the search box before results are shown (`name: "SEARCH"`, `type: "instant"`, empty `query`).
- **Before Search Impression** — fires when the Before Search widget becomes visible (`name: "INTERACTION"`, `type: "impression"`, `instanceId: "BEFORE_SEARCH"`).
- **Before Search Widget View** — fires when the Before Search widget is rendered in the viewport (`type: "widget-view"`, `instanceId: "BEFORE_SEARCH"`).
- **Before Search Product Click** — fires when a user clicks a product in the Before Search results (`type: "search"`, `instanceId: "bs_product"`, `interactionId: {productId}`).
- **After Search** — fires when the user submits a search query and results are returned (`name: "SEARCH"`, `type: "instant"`, `query: "exampleQuery"`).
- **After Search Impression** — fires when an After Search widget becomes visible in the viewport (`type: "impression"`).
- **After Search Widget View** — fires when the After Search widget is rendered (`type: "widget-view"`, `instanceId: "SEARCH"`).
- **After Search Product Click** — fires when a user clicks a product in the After Search results (`type: "search"`, `instanceId: "product"`, `interactionId: {productId}`, includes `params.term`).
- **Basket Add** *(search context)* — a Basket Add event sent in the context of a search interaction.
- **Searchandising** — fires a faceted search event for Searchandising campaigns (`name: "SEARCH"`, `type: "faceted"`). Supports `ordering`, `filters`, and `trigger` fields for sorting, filtering, and trigger type (`keyword`, `page`, or `filter`).
- **Searchandising Click** — fires when a user clicks a product within a Searchandising result set (`type: "search"`, `instanceId: "searchandisingInstanceId"`, includes `params.term`).
## Before Search
### Add Events API
This endpoint allows you to track various user events within your application. By sending a POST request to the specified URL, you can log events such as searches performed by users, which can be useful for analytics and improving user experience.
#### Request
**URL:**
`https://{dataCenterUrl}.segmentify.com/add/events/v1.json?apiKey={apikey}`
**Method:**
`POST`
**Request Body:**
The request body should be a JSON object with the following parameters:
- **name** (string): The name of the event being tracked (e.g., "SEARCH").
- **userId** (string): A unique identifier for the user performing the event.
- **sessionId** (string): A unique identifier for the user's session.
- **testMode** (string): Indicates whether the event is being logged in test mode (e.g., "false").
- **device** (string): The type of device being used (e.g., mobile, desktop).
- **os** (string): The operating system of the device (e.g., "ANDROID").
- **lang** (string): The language preference of the user.
- **currency** (string): The currency used in the transaction or event.
- **region** (string): The geographical region of the user (can be empty).
- **query** (string): The search query entered by the user (can be empty).
- **type** (string): The type of event (e.g., "instant").
#### Response
The response from this endpoint will typically include a confirmation of the event logging status, along with any relevant metadata. The exact structure of the response may vary, but it generally indicates whether the event was successfully recorded or if there were any errors.
Ensure that all required parameters are included in the request body to avoid errors and ensure successful event tracking.
**Example body**
```json
{
"name": "SEARCH",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"os": "ANDROID",
"lang": "EN",
"currency": "EUR",
"region": "",
"query": "",
"type": "instant"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Search / Before Search** in the request body examples of *Send events*.
:::
## Before Search Impression
**Example body**
```json
{
"name": "INTERACTION",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"os": "ANDROID",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"instanceId": "BEFORE_SEARCH",
"interactionId": "static",
"type": "impression"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Search / Before Search Impression** in the request body examples of *Send events*.
:::
## Before Search Widget View
**Example body**
```json
{
"name": "INTERACTION",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"os": "ANDROID",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"instanceId": "BEFORE_SEARCH",
"interactionId": "static",
"type": "widget-view"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Search / Before Search Widget View** in the request body examples of *Send events*.
:::
## Before Search Product Click
**Example body**
```json
{
"name": "INTERACTION",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"os": "ANDROID",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"instanceId": "bs_product",
"interactionId": "PRODUCT_ID",
"type": "search"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Search / Before Search Product Click** in the request body examples of *Send events*.
:::
## After Search
**Example body**
```json
{
"name": "SEARCH",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"os": "ANDROID",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"query": "exampleQuery",
"type": "instant"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Search / After Search** in the request body examples of *Send events*.
:::
## After Search Impression
**Example body**
```json
{
"name": "INTERACTION",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"os": "ANDROID",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"instanceId": "SEARCH",
"interactionId": "static",
"type": "impression"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Search / After Search Impression** in the request body examples of *Send events*.
:::
## After Search Widget View
**Example body**
```json
{
"name": "INTERACTION",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"os": "ANDROID",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"instanceId": "SEARCH",
"interactionId": "static",
"type": "widget-view"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Search / After Search Widget View** in the request body examples of *Send events*.
:::
## After Search Product Click
**Example body**
```json
{
"name": "INTERACTION",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"os": "ANDROID",
"params": {
"term": "exampleQuery"
},
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"instanceId": "product",
"interactionId": "PRODUCT_ID",
"type": "search"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Search / After Search Product Click** in the request body examples of *Send events*.
:::
## Basket Add
**Example body**
```json
{
"name": "BASKET_OPERATIONS",
"userId": "1234567890123456789",
"sessionId": "323232",
"testMode": "false",
"device": "ANDROID",
"nextPage": false,
"params": {},
"os": "ANDROID",
"lang": "TR",
"currency": "TRY",
"productId": "T59008765Y0",
"basketId": "basket_1234567890123456789",
"step": "add",
"price": "1999.95",
"quantity": 1
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Search / Basket Add** in the request body examples of *Send events*.
:::
## Searchandising
**Example body**
```json
{
"name": "SEARCH",
"query": "red sneakers",
"sessionId": "9876543210987654321",
"device": "PC",
"userId": "1234567890123456789",
"lang": "EN",
"testMode": "true",
"email": "user@example.com",
"ordering": {
"page": "1",
"sort": "PRICE_ASC"
},
"trigger": "keyword",
"type": "faceted",
"filters": [
{
"facet": "brand",
"values": [
"Acme"
]
}
]
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Search / Searchandising** in the request body examples of *Send events*.
:::
## Searchandising Click
**Example body**
```json
{
"name": "INTERACTION",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"os": "ANDROID",
"params": {
"term": "exampleQuery"
},
"lang": "EN",
"currency": "EUR",
"region": "",
"instanceId": "searchandisingInstanceId",
"interactionId": "PRODUCT_ID",
"type": "search"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Search / Searchandising Click** in the request body examples of *Send events*.
:::
---
# Session Management
> Generate the userId and sessionId that every event must carry.
Every event must include both `userId` and `sessionId`.
These two fields are used together to uniquely identify:
- the user in your store
- the user’s current session during their visit
### Generating IDs with Segmentify
You can generate these IDs by sending a `GET` request to your account-specific data center URL using this endpoint:
```text
/get/key?count=
```
You can find your data center URL in `Account Settings -> Integrations`.
Example data center URL:
```text
https://xxx.segmentify.com
```
Use the `count` parameter based on what you need:
- `count=1` returns one key for `sessionId`
- `count=2` returns two keys for both `userId` and `sessionId`
### Example requests
```http
GET https://xxx.segmentify.com/get/key?count=1
```
Returns one key to use as `sessionId`.
```http
GET https://xxx.segmentify.com/get/key?count=2
```
Returns two keys to use as `userId` and `sessionId`.
### Example response
If you request two keys, the response will look like this:
```text
["XXXXXXXXXXXXXXXXXXXXXXX","YYYYYYYYYYYYYYYYYYYY"]
```
Recommended mapping:
- first value -> `userId`
- second value -> `sessionId`
### Alternative approach
You can also generate your own IDs instead of requesting them from Segmentify.
If you use your own IDs:
- they can be any string
- each `userId` must uniquely identify a user
- each `sessionId` must uniquely identify a session
### Recommended flow
1. Check whether the visitor already has a `userId`.
2. If not, request 2 keys and store them as `userId` and `sessionId`.
3. If the visitor already has a `userId` but starts a new visit, request 1 key for a new `sessionId`.
4. Include both `userId` and `sessionId` in every event.
## Request SessionId
`GET /get/key`
See this endpoint in the [Events API reference](/reference/events/).
## Request UserId and SessionId
`GET /get/key`
See this endpoint in the [Events API reference](/reference/events/).
---
# SMS
> Report a visit that came from an SMS campaign link.
## Click
Send this `INTERACTION` event when a visitor lands on your site from an SMS campaign link. The fields are derived from the UTM parameters of the landing page URL.
Given a landing page URL like:
`https://example.com/?utm_source=segmentify&utm_campaign=sms_0000000000000000&utm_content=static&utm_medium=sms`
| UTM parameter | Event field | Example |
| --- | --- | --- |
| `utm_medium` | `type` | `sms` |
| `utm_campaign` | `instanceId` | `sms_0000000000000000` |
| `utm_content` | `interactionId` | `static` |
The API key is sent as the `apiKey` query parameter and as the `x-sfy-api-key` header.
**Example body**
```json
{
"name": "INTERACTION",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"device": "PC",
"lang": "EN",
"currency": "EUR",
"nextPage": false,
"dnp": false,
"params": {},
"os": "macOS",
"region": "",
"email": "",
"type": "sms",
"interactionId": "static",
"instanceId": "sms_0000000000000000"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **SMS / Click** in the request body examples of *Send events*.
:::
---
# Widget Interaction
> Tracks user interactions with Segmentify recommendation widgets using the INTERACTION event.
Tracks user interactions with Segmentify recommendation widgets using the `INTERACTION` event. These events are essential for measuring widget performance and feeding the recommendation engine with behavioral signals.
The `instanceId` field identifies which campaign or widget instance the user interacted with (use `{campaignInstance}`), and the `type` field specifies the nature of the interaction.
**Requests:**
- **Impression** — fires when a recommendation widget enters the user's viewport (`type: "impression"`). Should be sent as soon as the widget becomes visible, even if the user does not click.
- **Widget View** — fires when a recommendation widget is fully rendered and displayed (`type: "widget-view"`). Distinct from an impression — use this to confirm the widget was actually shown.
- **Click** — fires when a user clicks on a product within a recommendation widget (`type: "click"`, `interactionId: {productId}`). This is the primary signal for measuring recommendation effectiveness.
All three requests require `userId`, `sessionId`, `instanceId`, `lang`, `currency`, and `device`. Optional fields include `recommendIds`, `pageUrl`, `referrer`, and `email`.
## Impression
**Example body**
```json
{
"name": "INTERACTION",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"params": {},
"recommendIds": [],
"pageUrl": "",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"type": "impression",
"instanceId": "scn_xxxx",
"email": "user@example.com"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Widget Interaction / Impression** in the request body examples of *Send events*.
:::
## Widget View
**Example body**
```json
{
"name": "INTERACTION",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"params": {},
"recommendIds": [],
"pageUrl": "",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"type": "widget-view",
"instanceId": "scn_xxxx",
"email": "user@example.com"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Widget Interaction / Widget View** in the request body examples of *Send events*.
:::
## Click
**Example body**
```json
{
"name": "INTERACTION",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"params": {},
"recommendIds": [],
"pageUrl": "",
"referrer": "",
"lang": "EN",
"currency": "EUR",
"region": "",
"type": "click",
"instanceId": "scn_xxxx",
"interactionId": "PRODUCT_ID",
"email": "user@example.com"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Widget Interaction / Click** in the request body examples of *Send events*.
:::
---
# Wishlist Events
> Tracks all wishlist-related user actions using the WISHLIST event.
Tracks all wishlist-related user actions using the `WISHLIST` event. The `step` field distinguishes each action type, and `productId` identifies the product being acted upon.
**Requests:**
- **Favorite Add** — fires when a user adds a product to their wishlist (`step: "add"`).
- **Favorite Remove** — fires when a user removes a product from their wishlist (`step: "remove"`).
- **Favorite View** — fires when a user views their wishlist page (`step: "view"` implied by context). Allows Segmentify to track wishlist engagement and trigger relevant recommendations.
- **Favorite Detail** — fires when a user views the detail of a specific wishlisted product (`step: "detail"`). Used to signal deeper interest in a saved item.
All requests require `userId`, `sessionId`, `productId`, `lang`, `currency`, and `device`. The optional `email` field can be included to associate the action with a known user identity.
## Favorite Add
**Example body**
```json
{
"name": "WISHLIST",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"lang": "EN",
"currency": "EUR",
"region": "",
"email": "",
"step": "add",
"productId": "232"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Wishlist Events / Favorite Add** in the request body examples of *Send events*.
:::
## Favorite Remove
**Example body**
```json
{
"name": "WISHLIST",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"lang": "EN",
"currency": "EUR",
"region": "",
"email": "",
"step": "remove",
"productId": "232"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Wishlist Events / Favorite Remove** in the request body examples of *Send events*.
:::
## Favorite View
**Example body**
```json
{
"name": "WISHLIST",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"lang": "EN",
"currency": "EUR",
"region": "",
"email": "",
"step": "view-favorites",
"favoritesList": [
"7618"
]
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Wishlist Events / Favorite View** in the request body examples of *Send events*.
:::
## Favorite Detail
**Example body**
```json
{
"name": "WISHLIST",
"userId": "1234567890123456789",
"sessionId": "9876543210987654321",
"testMode": "false",
"device": "PC",
"lang": "EN",
"currency": "EUR",
"region": "",
"email": "",
"step": "detail",
"productId": "7618"
}
```
:::tip[Try it]
Send this request from the [Events API reference](/reference/events/): pick **Wishlist Events / Favorite Detail** in the request body examples of *Send events*.
:::
---
# Copy for LLMs
> Give this documentation, or a Google Doc, to an LLM as clean Markdown
LLMs such as Claude or ChatGPT read Markdown far better than a copied web page or a Word-style document: headings, lists, tables and code blocks keep their structure, and no navigation, styling or long URLs waste the context window. This site, and the Google Docs we write alongside it, can both be handed to an LLM as Markdown.
## Copy a page of this site
- **Copy for LLMs**: the button under the title of every page copies the page as Markdown (title, description and content). Paste it into the LLM.
- **View as Markdown**: every page is also served as a Markdown file: replace the trailing slash of the page address with `.md`, so `…/some-page/` becomes `…/some-page.md`.
- **llms.txt**: [`llms.txt`](../llms.txt) lists every page of the site with a link to its Markdown file, following the [llms.txt](https://llmstxt.org/) convention. Give its address to an LLM or agent that can browse.
- **llms-full.txt**: [`llms-full.txt`](../llms-full.txt) is the whole site in one Markdown file, for a tool that should read all of it at once.
- **OpenAPI documents**: the API reference is generated from three OpenAPI files, which an LLM or agent can read directly: [`events.json`](/openapi/events.json), [`customer-api.json`](/openapi/customer-api.json) and [`contacts-api.json`](/openapi/contacts-api.json).
## Export a Google Doc as Markdown (Google Docs Copy for LLMs)
Specs, analyses and meeting notes often start in Google Docs. To give one to an LLM, or to move it into this documentation, export it as Markdown with the **Better Google Docs Copy** Chrome extension (its project is called "Google Docs Copy for LLMs"):
1. Install it from the [Chrome Web Store](https://chromewebstore.google.com/detail/better-google-docs-copy/faciokbjemdddkjokcajndenapikgcml).
2. Open the Google Doc and click **Copy for LLM**.
3. The first time, sign in with your Google account and allow access. The extension reads the document through the Google Docs API and its comments through the Google Drive API.
4. Choose whether to copy the selected text or the whole document, then paste the Markdown where you need it.
What it adds over a plain copy:
- **Comments**: comment threads come along with the passage they were left on, so the LLM sees the review discussion too.
- **Images**: Google's very long image URLs are replaced with short references, so they do not fill the context window.
- **Options** (right-click the extension icon, then Options): heading style (ATX `# Heading` or Setext), comment format (XML tags, blockquote or quoted context) and whether resolved comments are included.
The extension runs in the browser and only talks to Google's APIs. Before pasting a document into an external LLM, check that it holds no customer data, credentials or other information that must not leave the company.
### Without the extension
Google Docs can export Markdown itself, without comments:
- **Whole document**: File → Download → Markdown (.md).
- **A selection**: turn on Tools → Preferences → Enable Markdown, then use Edit → Copy as Markdown.
## Move a Google Doc into this documentation
1. Export the doc as Markdown as described above (leave comments out, or resolve them first).
2. Save it as a new `.md` file under `src/content/docs/`, with `title` and `description` front matter.
3. Add the page to the `sidebar` in `astro.config.mjs`, and open a pull request.