---
title: "Track an embedded message session and related impressions"
method: POST
path: "/api/embedded-messaging/events/session"
tags: ["events"]
---

# Track an embedded message session and related impressions

`POST /api/embedded-messaging/events/session`

This endpoint tracks a single <code>embeddedSession</code> event, and one <code>embeddedImpression</code> event for each of the session's impressions. <br/><br/>An <code>embeddedSession</code> event represents a period of time when a user is viewing a page or a screen where embedded messages can be displayed (in one or many placements).<br/><br/>An <code>embeddedImpression</code> event represents the number of times a given embedded message was visible during the session, and the total amount of time the message was visible (in seconds) across all those appearances.<br/><br/>This endpoint does not create events for test messages (proofs).<br/><br/>Learn about <a href="https://support.iterable.com/hc/articles/29156459027348">identifying users by <code>userId</code> and <code>email</code></a>.

## Request body

- EmbeddedSessionRequest
  - `createdAt` integer — The time of the event's occurrence (Unix timestamp). If unspecified, gets set to the time Iterable received the event.
  - `deviceInfo` DeviceInfo
    - `appPackageName` string, required — Package name of the app.
    - `deviceId` string, required — Device unique identifier.
    - `platform` 'iOS' | 'Android' | 'Web', required — Device platform (case-sensitive).
  - `email` string — An email address that identifies a user profile in Iterable. Provide an <code>email</code> or a <code>userId</code> (but not both), depending on <a href="https://support.iterable.com/hc/articles/29156459027348">how your project identifies users</a>.
  - `impressions` Impression[] — Impressions associated with the session.
    - `displayCount` integer — Total number of times the message identified by <code>messageId</code> was visible during the session.
    - `displayDuration` number, double — Total amount of time (in seconds) the message identified by <code>messageId</code> was visible during the session, across all its appearances.
    - `messageId` string — ID of a message that appeared during the session.
    - `placementId` integer — ID of the placement where the impression took place.
  - `session` EmbeddedSession
    - `end` integer — Session end time (Unix timestamp).
    - `id` string — Unique identifier (such as a UUID) to associate with the session.
    - `start` integer — Session start time (Unix timestamp).
  - `userId` string — A user ID that identifies a user profile in Iterable. Provide an <code>email</code> or a <code>userId</code> (but not both), depending on <a href="https://support.iterable.com/hc/articles/29156459027348">how your project identifies users</a>.

## Other responses

- `400` — Invalid parameters
- `401` — Invalid API key

---

[API](https://skmtc.net/iterable/apis/iterable-api.md) · [All operations](https://skmtc.net/iterable/apis/iterable-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/iterable/iterable-api/revisions/afaab604b58c/schema)
