# Event fields and types

> The type, allowed values, defaults and validation rules of every field of the main Segmentify events.

This page lists the fields of the main events with their types and rules. The same information is available as schemas in the [Events API reference](/reference/events/) (see **Models**) and in the [OpenAPI document](/openapi/events.json).

## Reading the tables

- **Type** is the JSON type. Where a number or boolean is expected, its string form is accepted too: `"1999.95"` for a number, `"true"` for a boolean. Several examples on this site use strings for this reason. Prefer the real type in new code.
- **Required** marks the fields an event needs to be useful. *Yes* means always, *Recommended* means Segmentify works better with it. The API itself rejects a request only for the rules listed in [Responses and errors](/events/responses-and-errors/#what-makes-an-event-invalid); a missing field outside those rules is stored as empty.
- **Unknown fields are ignored without an error.** A misspelled field name does not fail the request; the value is simply lost.
- **Enum values are exact.** A `step` or `type` outside the listed values rejects the whole request.

## Fields of every event

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | string | Yes | | Event name. Decides which other fields apply. |
| `userId` | string | Yes | | Unique identifier of the user. Not empty, and not the text `"undefined"`. |
| `sessionId` | string | Yes | | Unique identifier of the visit. Not empty, and not the text `"undefined"`. |
| `lang` | string | Recommended | `EN` | Language of the page. Must be a language configured for your account. |
| `currency` | string | Recommended | | Currency of the prices. If sent, must be a currency configured for your account. |
| `region` | string | No | | Region of the user. If sent, must be a region configured for your account. |
| `device` | string | No | `PC` | Device of the user, for example `PC`, `MOBILE`, `TABLET`, `ANDROID`, `IOS`. Campaigns can target devices. |
| `testMode` | boolean | No | `false` | `true` marks a test event. |
| `pageUrl` | string | No | | Full URL of the page. |
| `referrer` | string | No | | URL of the referring page. |
| `userAgent` | string | No | | User-Agent of the visitor. Bot user agents are rejected. |
| `os`, `osversion`, `browser` | string | No | | Platform details. |
| `params` | object | No | | Custom key-value pairs. Values are strings. |
| `recommendIds` | string[] | No | | IDs of the recommendation campaigns shown on the page. |
| `instanceId` | string | No | | ID of a campaign. Required on `INTERACTION`. |
| `dnp` | boolean | No | `false` | Do not personalise: the user opted out of personalisation. |
| `noProcess` | boolean | No | `false` | `true` records the event without running live campaigns. |
| `async` | boolean | No | `true` | `false` records the event without running any campaign. |

## PAGE_VIEW

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `category` | string | Yes | Page type: `Home Page`, `Category Page`, `Product Page`, `Search Page`, `Basket Page`, `Checkout Success Page`, `404 Page`, or your own name for other pages. |
| `subCategory` | string | No | On a category page, the category being viewed. |

Guide: [Page View](/events/page-view/)

## PRODUCT_VIEW

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `productId` | string | Yes | Your ID of the product. |
| `title` | string | Recommended | Product name. |
| `url` | string | Recommended | Product page URL. |
| `image` | string | Recommended | Main image URL. |
| `price` | number | Recommended | Current price. At most 9,000,000,000. |
| `oldPrice` | number | No | Price before discount. Ignored unless greater than `price`. |
| `specialPrice` | number | No | A special price, for example for members. |
| `inStock` | boolean | Recommended | Whether the product can be bought. |
| `stockCount` | integer | No | Units in stock. Not negative. |
| `stockRatio`, `stockStatus` | number | No | Between 0 and 100. |
| `category` | string | Recommended | Category of the product. |
| `categories` | string[] | No | All categories of the product. |
| `mainCategory` | string | No | Top-level category. |
| `brand` | string | No | Brand name. |
| `gender` | string | No | Target gender. |
| `labels`, `sizes`, `allSizes`, `colors`, `badges` | string[] | No | Product attributes. |
| `additionalImages` | string[] | No | More image URLs. |
| `mUrl` | string | No | Mobile product page URL. |
| `groupId` | string | No | ID shared by the variants of one product. |
| `scoreCount`, `reviewCount` | integer | No | Rating and review counts. |
| `iosDeepLink`, `androidDeepLink` | string | No | App deep links. |

Rules:

- `oldPrice` and `specialPrice` are used only when `price` is sent.
- If your account restricts product URLs or image URLs to certain domains, `url` and `image` must be on them.

Guide: [Product View](/events/product-view/)

## BASKET_OPERATIONS

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `step` | string | Yes | `add`, `remove` or `clear`. |
| `basketId` | string | Recommended | Your ID of the basket. |
| `productId` | string | For `add`, `remove` | The product. |
| `quantity` | number | For `add`, `remove` | At most 1,000,000. |
| `price` | number | For `add`, `remove` | Unit price. At most 9,000,000,000. |
| `size` | string | No | Selected size or variant. |

Guide: [Basket Operations](/events/basket-operations/)

## CHECKOUT

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `step` | string | Yes | `view-basket`, `customer-info`, `payment-info` or `purchase`. |
| `productList` | object[] | Yes | The products in the basket or order. See below. |
| `totalPrice` | number | Yes | Total of the basket or order. At most 90,000,000,000. |
| `orderNo` | string | For `purchase` | Your order number. Keep it the same if you resend. |
| `basketId` | string | Recommended | Your ID of the basket. |
| `paymentType` | string | No | Payment method. |
| `cartUrl` | string | No | URL of the basket page. |
| `coupon` | string | No | Coupon code used. |
| `totalDiscount`, `shipment`, `tax` | number | No | Order amounts. |
| `discounts` | object[] | No | Each with `type` (`FIXED_AMOUNT`, `PERCENTAGE`, `FREE_SHIPMENT`), `code`, `amount`, `target` (`CART`, `SHIPMENT`, `PRODUCT`). |

Each item of `productList`:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `productId` | string | Yes | The product. |
| `quantity` | number | Yes | At most 1,000,000. |
| `price` | number | Yes | Unit price. At most 9,000,000,000. |
| `size` | string | No | Selected size or variant. |
| `title`, `category`, `brand`, `image`, `url` | string | No | Product details. When left out, they are filled from your product catalogue. |
| `labels` | string[] | No | Product labels. |

Guide: [Checkout](/events/checkout/)

## WISHLIST

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `step` | string | Yes | `add`, `remove`, `detail` or `view-favorites`. |
| `productId` | string | For `add`, `remove`, `detail` | The product. |
| `favoritesList` | string[] | For `view-favorites` | Product IDs in the wishlist. |

Guide: [Wishlist](/events/wishlist/)

## INTERACTION

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | string | Yes | Kind of interaction. Not case-sensitive. See the values below. |
| `instanceId` | string | Yes | ID of the campaign or widget. |
| `interactionId` | string | No | What was interacted with, for example the product ID of a click. |

Common `type` values:

| Value | Meaning |
| --- | --- |
| `impression` | The campaign was returned to the page. |
| `widget-view` | The widget became visible to the user. |
| `click` | A product of a recommendation widget was clicked. |
| `search` | A product of a search result was clicked. |
| `close` | The user closed a popup or banner. |
| `email`, `sms`, `push`, `whatsapp` | The user arrived from a message of that channel. |

A `type` outside the accepted values, or a missing `instanceId`, is rejected with `INVALID_EVENT`.

Guides: [Widget Interaction](/events/widget-interaction/), [Email](/events/email/), [SMS](/events/sms/), [Search](/events/search/)

## SEARCH

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `query` | string | No | | The text searched. Empty before the user types. |
| `type` | string | No | `instant` | `instant`, `faceted` or `suggest`. |
| `trigger` | string | No | | What caused a faceted search: `keyword`, `filter`, `order` or `page`. |
| `ordering` | object | For `faceted` | | `page` (integer, from 1), `sort` (string), `size` (integer). |
| `filters` | object[] | No | | Each with `facet` (string) and `values` (string[]). |

Guide: [Search](/events/search/)

## CUSTOM_EVENT

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | string | Yes | Your name for the event. Campaigns are triggered by it. |

Extra data goes in `params`. Guide: [Custom Event](/events/custom-event/)

## USER_OPERATIONS

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `step` | string | Yes | `signin`, `signup`, `signout`, `update`, `subscribe`, `unsubscribe` or `identify`. |
| `email` | string | Recommended | Email address of the user. |
| `username`, `phone`, `fullName`, `gender`, `location` | string | No | Profile fields. |
| `birthDate` | string | No | `DD.MM.YYYY`, for example `14.05.1990`. |
| `segments` | string[] | No | Your own segments of the user. |
| `isLogin`, `isRegistered` | boolean | No | State of the user. |
| `emailNtf`, `smsNtf`, `callNtf`, `whatsappNtf` | boolean | No | Consent per channel. |
| `type`, `identity` | string | For `identify` | The identity type and value, for example `sgm-hash` and the hash from an email link. |

For new integrations, prefer the [CDP User Events](/events/cdp-user-events/) (`USER_IDENTIFY`, `USER_REGISTER`, `USER_LOGIN`, `USER_LOGOUT`), which carry the profile in a `properties` object.

## CDP user profile (`properties`)

The `properties` object of `USER_IDENTIFY`, `USER_TRAITS`, `USER_REGISTER`, `USER_LOGIN` and `USER_LOGOUT`:

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `email`, `phone`, `username` | string | | Identifiers of the user. |
| `fullName`, `firstName`, `lastName`, `gender` | string | | Profile fields. |
| `source` | string | | Where the data came from, for example `email-collection`. |
| `emailConsent`, `smsConsent`, `whatsappConsent`, `callConsent` | string | `NOT_SET` | `SUBSCRIBED`, `UNSUBSCRIBED` or `NOT_SET`. |
| `loginMethods` | string[] | | How the user signs in, for example `email`, `google`. A single string is accepted. |
| `custom` | object | | Your own attributes. |

Guide: [CDP User Events](/events/cdp-user-events/)
