Sessions
Note
This section requires authentication.
Please refer to the Authentication section for more details.
Session Object
The session object is a representation of a user's session in the system.
It contains information about the session's start and end times, as well as the Consumer
associated with the session.
Session Object Structure
Field |
Type |
Description |
session_id |
integer |
Unique identifier for the session |
consumer_id |
integer |
Unique identifier of the Consumer associated with the session |
started_at |
date |
Timestamp when the session started in ISO8601 format |
ended_at |
date |
Timestamp when the session ended in ISO8601 format. If this field is null it means the session is still active |
Start Session
This endpoint allows to start a new session for a Consumer
.
When a session is started, it records the time it began and associates it with the Consumer
ID.
POST /api/session/start
Header |
Value |
Authorization |
Bearer {YOUR_AUTH_KEY} |
Content-Type |
application/json |
Accept |
application/json |
Example Response
JSON{
"session_id": 1,
"consumer_id": 1,
"started_at": "2025-05-01T15:30:00.000000Z",
"ended_at": null
}
End Session
This endpoint allows to end an existing session for a Consumer
. When a session is ended, it records the time it
ended and updates the session record in the database.
POST /api/session/end
Header |
Value |
Authorization |
Bearer {YOUR_AUTH_KEY} |
Content-Type |
application/json |
Accept |
application/json |
Body Parameters
Required Parameters
Field |
Type |
Description |
Example |
session_id |
string |
Unique identifier of the session to end. This value must be a valid active session |
1 |
Optional Parameters
Field |
Type |
Description |
Example |
timestamp |
string |
Timestamp when the session ended in ISO8601 format. If no value is provided the default server now will be assigned |
2025-05-13T14:30:00Z |
Example Request
JSON {
"timestamp": "2025-05-13T14:30:00Z",
"session_id": "1"
}
Example Response
JSON{
"session_id": 1,
"consumer_id": 1,
"started_at": "2025-05-13T11:08:00Z",
"ended_at": "2025-05-13T14:30:00Z"
}
Session Batch
This endpoint allows to save a batch of sessions for a Consumer
. The session objects will contain the session_id that will be
used for the event and log batching endpoints.
POST /api/session/batch
Header |
Value |
Authorization |
Bearer {YOUR_AUTH_KEY} |
Content-Type |
application/json |
Accept |
application/json |
Body Parameters
Required Parameters
Field |
Type |
Description |
Example |
sessions |
array |
Array of session objects to be saved. |
[{"started_at": "2025-05-13T11:08:00Z", "ended_at": "2025-05-13T14:30:00Z"}] |
sessions[].started_at |
string |
Timestamp when the session started in ISO8601 format. |
2025-05-13T11:08:00Z |
sessions[].ended_at |
string |
Timestamp when the session ended in ISO8601 format. |
2025-05-13T14:30:00Z |
Example Request
JSON{
"sessions": [
{
"started_at": "2025-05-13T11:08:00Z",
"ended_at": "2025-05-13T14:30:00Z"
},
{
"started_at": "2025-05-13T15:00:00Z",
"ended_at": "2025-05-13T15:20:00Z"
}
]
}
Example Response
JSON[
{
"session_id": 1281,
"started_at": "2025-05-31T07:00:00.000000Z",
"ended_at": "2025-05-31T07:10:00.000000Z"
},
{
"session_id": 1282,
"started_at": "2025-05-31T07:25:00.000000Z",
"ended_at": "2025-05-31T07:35:00.000000Z"
}
]