Skip to main content
Version: 2.2.0

API Guide

This guide provides an overview of the MSR (Multi-Session Replay) module's API endpoints. The API is used for managing recorded sessions, querying session metadata, and controlling the replay process.

Authentication

All API endpoints require a valid JWT access token from IAMs. The token must be included in the Authorization header of each request.

Headers:

  • Content-Type: application/json
  • Authorization: Bearer {token}

Session API


1. Create a session

POST /session

Request

No request body.

Response

NameTypeDescription
iduuidThe ID of the session
user_iduuidThe user_id that session belongs to
tenant_iduuidThe tenant_id that session belongs to
created_atstringThe timestamp in RFC3339 format
update_atstringThe timestamp in RFC3339 format
created_byuuidThe ID of the user who created the session
updated_byuuidThe ID of the user who updated the session
statusstringThe status of the session: ACTIVE, INACTIVE
occ_locknumberThe occ lock of the session
{
"data": {
"id": "4a966973-2131-4521-be48-e3d79306a847",
"user_id": "f67cb8f5-0645-444d-a4bd-c61aaf1b2db0",
"tenant_id": "2878ac59-ad8b-4a94-bd97-2d9ef371fc06",
"created_at": "2025-08-05T17:13:24+07:00",
"update_at": "2025-08-05T17:19:05+07:00",
"created_by": "f67cb8f5-0645-444d-a4bd-c61aaf1b2db0",
"updated_by": "f67cb8f5-0645-444d-a4bd-c61aaf1b2db0",
"status": "ACTIVE",
"occ_lock": 0
},
"message": "Created session successfully",
"sent_at": "2025-08-05T10:19:05Z"
}

2. Get initial state

  • Return the state of the session at the given timestamp. If the timestamp is not provided, return the current state of the session.
  • Returns the full, reconstructed state of all entities at a specific point in time.
GET /replay/state?timestamp={timestamp}
Timestamp Validation

The requested timestamp must be within the available data range. If the timestamp is:

  • Too early: Returns an error with the earliest available timestamp based on EARLIEST_VALID_TIMESTAMP or snapshot cutoff
  • In the future: Returns an error indicating future timestamps are not supported
  • Outside MAX_PLAYBACK_RANGE: Returns an error with the configured playback limit (default: 7 days)

Response

NameTypeDescription
entity_idstringThe unique id of the entity
entity_stateJSONBThe state of the entity
opstringThe operation: c, r, u, d
event_timestampstringThe timestamp in RFC3339 format
{
"data": [
{
"entity_id": "655e82ca-678c-47f5-8d81-5091c39f8d63",
"entity_state": {
"id": "611f2472-d781-4870-b5fc-69b90bafc067",
"geojson": "{\"type\": \"Feature\", \"geometry\": {\"type\": \"Polygon\", \"coordinates\": [[[103.8493269960454, 1.391235132350934], [103.8493269960454, 1.391235132350934]]]}, \"properties\": {\"kind\": \"task\", \"name\": \"ST Engineering\"}}",
"occ_lock": 0,
"tenant_id": "2878ac59-ad8b-4a94-bd97-2d9ef371fc06",
"created_at": "2025-06-09T03:58:14.762000Z",
"created_by": "f67cb8f5-0645-444d-a4bd-c61aaf1b2db0",
"updated_at": "2025-06-09T03:58:14.762000Z",
"updated_by": "f67cb8f5-0645-444d-a4bd-c61aaf1b2db0",
"entity_type": "static"
},
"op": "r",
"event_timestamp": "2025-08-01T14:15:14+07:00"
},
{
"entity_id": "8fbeedce-cbca-4aee-a01f-0ee23b583797",
"entity_state": {
"id": "e10e029a-6971-41af-9791-0378fe6f699b",
"geojson": "{\"type\": \"Feature\", \"geometry\": {\"type\": \"Point\", \"coordinates\": [103.8493269960454, 1.391235132350934]}, \"properties\": {\"kind\": \"task\", \"name\": \"ST Engineering\"}}",
"occ_lock": 0,
"tenant_id": "2878ac59-ad8b-4a94-bd97-2d9ef371fc06",
"created_at": "2025-06-09T04:00:31.229000Z",
"created_by": "f67cb8f5-0645-444d-a4bd-c61aaf1b2db0",
"updated_at": "2025-06-09T04:00:31.229000Z",
"updated_by": "f67cb8f5-0645-444d-a4bd-c61aaf1b2db0",
"entity_type": "static"
},
"op": "r",
"event_timestamp": "2025-08-01T14:15:14+07:00"
}
],
"message": "Get initial state successfully",
"sent_at": "2025-08-07T02:25:38Z"
}

3. Get transaction logs

  • Returns the transaction logs between the start and end timestamps.
GET /replay/events?start={timestamp}&end={timestamp}

Response

NameTypeDescription
entity_idstringThe unique id of the entity
entity_stateJSONBThe state of the entity
opstringThe operation: c, r, u, d
event_timestampstringThe timestamp in RFC3339 format
{
"data": [
{
"entity_id": "655e82ca-678c-47f5-8d81-5091c39f8d63",
"entity_state": {
"id": "611f2472-d781-4870-b5fc-69b90bafc067",
"geojson": "{\"type\": \"Feature\", \"geometry\": {\"type\": \"Polygon\", \"coordinates\": [[[103.8493269960454, 1.391235132350934], [103.8493269960454, 1.391235132350934]]]}, \"properties\": {\"kind\": \"task\", \"name\": \"ST Engineering\"}}",
"occ_lock": 0,
"tenant_id": "2878ac59-ad8b-4a94-bd97-2d9ef371fc06",
"created_at": "2025-06-09T03:58:14.762000Z",
"created_by": "f67cb8f5-0645-444d-a4bd-c61aaf1b2db0",
"updated_at": "2025-06-09T03:58:14.762000Z",
"updated_by": "f67cb8f5-0645-444d-a4bd-c61aaf1b2db0",
"entity_type": "static"
},
"op": "r",
"event_timestamp": "2025-08-01T14:15:14+07:00"
},
{
"entity_id": "8fbeedce-cbca-4aee-a01f-0ee23b583797",
"entity_state": {
"id": "e10e029a-6971-41af-9791-0378fe6f699b",
"geojson": "{\"type\": \"Feature\", \"geometry\": {\"type\": \"Point\", \"coordinates\": [103.8493269960454, 1.391235132350934]}, \"properties\": {\"kind\": \"task\", \"name\": \"ST Engineering\"}}",
"occ_lock": 0,
"tenant_id": "2878ac59-ad8b-4a94-bd97-2d9ef371fc06",
"created_at": "2025-06-09T04:00:31.229000Z",
"created_by": "f67cb8f5-0645-444d-a4bd-c61aaf1b2db0",
"updated_at": "2025-06-09T04:00:31.229000Z",
"updated_by": "f67cb8f5-0645-444d-a4bd-c61aaf1b2db0",
"entity_type": "static"
},
"op": "r",
"event_timestamp": "2025-08-01T14:15:14+07:00"
}
],
"message": "Successfully retrieved transaction logs.",
"sent_at": "2025-08-07T02:25:38Z"
}

4. Get sessions configuration

  • Returns the session configuration: max_active_sessions, max_playback_range, etc
GET /admin/settings

Response

NameTypeDescription
max_active_sessionsnumberThe maximum number of active sessions that can be created
max_playback_rangenumberThe max historical range allowed for playback (days)
{
"data": {
"max_active_sessions": 10,
"max_playback_range": 30
},
"sent_at": "2025-08-05T10:19:05Z"
}

5. Update the maximum number of sessions

  • Update the maximum number of active sessions that can be created.
PUT /admin/settings/max-active-sessions

Request

NameTypeDescription
max_active_sessionsnumberThe maximum number of active sessions that can be created
{
"max_active_sessions": 10
}

Response

No response body.


6. Terminate a session

POST /session/{session_id}/terminate

Response

HTTP status code 204.


7. Admin terminate multiple sessions

POST /admin/sessions/terminate

Request Body

NameTypeDescription
session_idsarrayArray of session IDs (UUIDs) to terminate
{
"session_ids": [
"468a27ed-f6d9-4c7c-8772-0dafd4e79ac3",
"8766a359-17a4-4dbe-b6e4-d0e73eabadc7"
]
}

Response

HTTP status code 204.


8. List sessions

GET /admin/sessions

Query params

NameTypeDescription
tenant_idstringThe tenant id to filter session that belongs to tenant
statusstringThe status to filter sessions (ACTIVE, INACTIVE)
pagenumberPagination page
sizenumberPagination size
sortnumberCondition for sorting the sessions data

Response

NameTypeDescription
iduuidThe unique id of the session
user_iduuidThe user id that session belongs to
statusstringThe session status: ACTIVE, INACTIVE
last_seen_atstringThe timestamp of the last API call using this session
tenant_idstringThe tenant id that session belongs to
occ_lockstringThe a mutex for optimistic concurrency control
created_atstringThe time this session was created
updated_atstringThe time this session was last updated
numberintThe page from request
sizeintThe size from request
total_recordsintThe total records that match request query
countintThe number of sessions in the current page
sortstringThe sort column and direction
{
"data": [
{
"id": "468a27ed-f6d9-4c7c-8772-0dafd4e79ac3",
"user_id": "f67cb8f5-0645-444d-a4bd-c61aaf1b2db0",
"status": "INACTIVE",
"last_seen_at": "2025-08-11T14:48:12+07:00",
"tenant_id": "6c17fb87-d715-439f-943f-69f01318adac",
"occ_lock": 2,
"created_at": "2025-08-11T14:47:38+07:00",
"update_at": "2025-08-11T14:48:12+07:00",
"created_by": "f67cb8f5-0645-444d-a4bd-c61aaf1b2db0",
"updated_by": "f67cb8f5-0645-444d-a4bd-c61aaf1b2db0"
},
{
"id": "8766a359-17a4-4dbe-b6e4-d0e73eabadc7",
"user_id": "f67cb8f5-0645-444d-a4bd-c61aaf1b2db1",
"status": "ACTIVE",
"last_seen_at": "2025-08-11T14:43:48+07:00",
"tenant_id": "6c17fb87-d715-439f-943f-69f01318adac",
"occ_lock": 1,
"created_at": "2025-08-11T14:43:48+07:00",
"update_at": "2025-08-11T14:46:55+07:00",
"created_by": "f67cb8f5-0645-444d-a4bd-c61aaf1b2db0",
"updated_by": "f67cb8f5-0645-444d-a4bd-c61aaf1b2db0"
}
],
"message": "Retrieved list sessions successfully",
"sent_at": "2025-08-12T02:53:24Z",
"page": {
"number": 1,
"size": 2,
"total_records": 7,
"count": 2,
"sort": ["last_seen_at,desc"]
}
}