Skip to main content

Session Events API specification (S2S)

This document outlines the endpoint necessary to submit Events to Rokt using the Session API (v2).

Work with your Rokt account team to obtain the necessary credentials. For an end-to-end integration walkthrough, see Session API integration (S2S).

EndpointDirect link to Endpoint

EnvironmentActionURL
ProductionPOSThttps://api.rokt.com/v2/sessions/events
note

There is no separate sandbox URL. To validate before going live, send the rokt-test-session: true header on the same endpoint. Test sessions are tagged and filtered out of production metrics. The header marks reporting only — it does not force an offer to serve. Remove the header to go live.

RequestDirect link to Request

Authorization headersDirect link to Authorization headers

HeaderDescriptionTypeNote
AuthorizationBasic auth credentialsstringBasic base64(rpub:rsec) — the same public/secret API key pair used for the Offers call.
rokt-account-idYour Rokt account IDstringRequired on every call.

Required headersDirect link to Required headers

HeaderDescriptionTypeExample
Content-TypeMedia typestringapplication/json

Root/BodyDirect link to Root/Body

PropertyRequiredTypeDescription
channelYesobjectMust contain "type": "s2s".
single_sessionYesbooleanSet to true. Links every event in the request to the session identified by each event's session_id.
eventsYesEvent[]Collection of events to send to Rokt.

EventDirect link to Event

PropertyRequiredTypeDescription
event_typeYesstringThe kind of event. See Event types.
instance_idYesstring (UUID)Client-generated UUID identifying this event, used for deduplication.
session_idYesstringThe top-level session_id returned by the offers call.
timestampYesnumberUnix epoch milliseconds at which the event occurred.
dataYesobjectSee Event data.

Event dataDirect link to Event data

PropertyRequiredTypeDescription
parent_idYesstringThe instance_guid of the element this event is about, taken from the offers response (e.g. the creative's instance_guid for an impression; a response option's instance_guid for a response). Builds the session tree. Echo the value from the offers response verbatim — it may carry a type prefix (e.g. ad:<uuid>); send it exactly as returned.
page_instance_guidYesstringThe page_instance_guid from the offers response.
tokenYesstringThe event token for that element from the offers response.
capture_methodNostringHow the event was captured (e.g. ClientProvided).
note

Authenticate with the same Basic rpub:rsec credentials as the offers call, and identify the session with single_session: true plus a per-event session_id (the top-level session_id from the offers response).

Event typesDirect link to Event types

Eventevent_typeDescription
ImpressionimpressionRaised when a placement, slot, or creative is rendered and visible to the customer. If there is an appearance delay, this occurs upon unhiding the view. Required for each element that renders.
ViewedviewedRaised when a placement is ≥50% visible in the viewport for at least one continuous second. Matches the IAB viewability definition and should exclude bot/invalid traffic. Required for each creative that becomes viewable.
Responsesignal_responseRaised when a customer engages with a response option. Required for each response option interaction.
DismissaldismissalRaised when a customer dismisses an offer.
Conversionconversion_signalRaised when a conversion occurs.
PurchasepurchaseRaised when a purchase is completed.

Request exampleDirect link to Request example

POST https://api.rokt.com/v2/sessions/events
Authorization: Basic base64(rpub:rsec)
rokt-account-id: <your Rokt account ID>
Content-Type: application/json
{
"channel": { "type": "s2s" },
"single_session": true,
"events": [
{
"event_type": "impression",
"instance_id": "018f1234-5678-7abc-8def-0123456789ab",
"session_id": "018f2a1b-2222-7abc-8def-session00001",
"timestamp": 1751234567000,
"data": {
"parent_id": "018f2a1b-3333-7abc-8def-creative001",
"page_instance_guid": "018f2a1b-0000-7abc-8def-page00000001",
"token": "<event-token>",
"capture_method": "ClientProvided"
}
},
{
"event_type": "viewed",
"instance_id": "018f1234-5678-7abc-8def-0123456789ac",
"session_id": "018f2a1b-2222-7abc-8def-session00001",
"timestamp": 1751234568000,
"data": {
"parent_id": "018f2a1b-3333-7abc-8def-creative001",
"page_instance_guid": "018f2a1b-0000-7abc-8def-page00000001",
"token": "<event-token>"
}
},
{
"event_type": "signal_response",
"instance_id": "018f1234-5678-7abc-8def-0123456789ad",
"session_id": "018f2a1b-2222-7abc-8def-session00001",
"timestamp": 1751234572000,
"data": {
"parent_id": "018f2a1b-4444-7abc-8def-responseoption01",
"page_instance_guid": "018f2a1b-0000-7abc-8def-page00000001",
"token": "<event-token>"
}
}
]
}

ResponseDirect link to Response

Success response (202 Accepted)Direct link to Success response (202 Accepted)

A successful call returns 202 Accepted with a refreshed session token to use on subsequent calls, plus per-event results.

PropertyTypeDescription
session_tokenobjectRefreshed session token (session_token.token) for the next call.
event_idsstring[]IDs assigned to the accepted events, in request order.
errorsobject[]Per-event errors, each containing index, code, and message. Empty when every event is accepted.
warningsobject[]Per-event warnings, same index/code/message shape. Empty when there are none.

When every event is accepted, errors and warnings are empty and event_ids has one entry per submitted event:

{
"session_token": {
"token": "<session_token>"
},
"event_ids": [
"018f9c40-1a2b-7abc-8def-eventimpression",
"018f9c40-1a2b-7abc-8def-eventviewed0001",
"018f9c40-1a2b-7abc-8def-eventresponse01"
],
"errors": [],
"warnings": []
}

On a partial failure the call still returns 202; the accepted events appear in event_ids and each rejected event is reported in errors by its index in the request array:

{
"session_token": {
"token": "<session_token>"
},
"event_ids": [
"018f9c40-1a2b-7abc-8def-eventimpression",
"018f9c40-1a2b-7abc-8def-eventviewed0001"
],
"errors": [
{
"index": 2,
"code": "invalid_token",
"message": "token does not match the element identified by parent_id"
}
],
"warnings": []
}

Error responses (4xx / 5xx)Direct link to Error responses (4xx / 5xx)

Errors return a semantic HTTP status with a structured body:

{
"error": "<code>",
"message": "<detail>"
}

Common error codesDirect link to Common error codes

HTTP statusMeaning
400Malformed request body.
401Missing or invalid Authorization header.
422Request validation failed.
429Rate limited. Do not retry automatically — pause and contact your Rokt representative if 429s persist.
5xxUnexpected server error. Retry after a brief delay (1–2 seconds). If the problem persists, contact support@rokt.com.
Was this article helpful?