Skip to main content

Sessions Reference

The Sessions API provides insights into user interactions with your content, tracking reading sessions and engagement metrics. This feature allows you to retrieve detailed session data, including reading duration and page changes. This section will help you understand how to leverage session data to enhance user experience and content strategy.

warning

Not available by default in all plans. Contact [email protected] for more information about this endpoint.

info

Make sure you generated the api_token on your store. More info HERE

Retrieve

GET /integration-api/v1/consumption/sessions

Query Parameters

ParameterTypeExample
cursorstring/integration-api/v1/consumption/sessions?cursor=eyJzdGF....J1ZX0
issue_idinteger/integration-api/v1/consumption/sessions?issue_id=1125899910000160
user_idinteger/integration-api/v1/consumption/sessions?user_id=1125899911002602
reason_typestring/integration-api/v1/consumption/sessions?reason_type=free_issue
reason_valueinteger/integration-api/v1/consumption/sessions?reason_type=subscription_with_collectionsreason_value=3357
from_datestring/integration-api/v1/consumption/sessions?from_date=2022-09-21&to_date=2022-09-23
to_datestring/integration-api/v1/consumption/sessions?to_date=2022-09-23&to_date=2022-09-23
tip

Query parameters can be combined to achieve more specific filtering. All are optional, except the from_date and to_date fields which always go together, just as to send a reason_value you must specify reason_type.

tip

The cursor parameter can be used to paginate results.

Response

CodeDescription
200Success
403Feature disabled for your store
401Unauthenticated
{
"CODE": "success",
"current_page": 1,
"data": [
{
"uuid": "151:8000005:9000886:1734446548",
"issue_id": 8000005,
"issue_external_id": "9781234567890",
"user_id": 9000886,
"user_email": "[email protected]",
"user_name": "Maria Silva",
"user_external_id": "EXT-12345",
"client_type": "browser",
"device_os": "iOS",
"access_mode": "online",
"reason_type": "assigned_issue",
"reason_value": null,
"started_at": "2024-12-17 14:42:28",
"processed_at": "2024-12-17 14:42:28",
"last_heartbeat_at": null,
"seconds_reading": 125,
"page_changes": 12,
"page_views": 8,
"printed_pages": 2,
"notes": 1,
"highlights": 3,
"bookmarks": 0,
"resolved_captchas": 1
}
],
"path": "https://example.publica.la/integration-api/v1/consumption/sessions",
"per_page": 25,
"next_cursor": "eyJzdGFydGVkX2F0IjoiMjAyNC0wOS0xOCAxNjoxMzoxMCIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
"next_page_url": "https://example.publica.la/integration-api/v1/consumption/sessions?cursor=eyJzdGFydGVkX2F0IjoiMjAyNC0wOS0xOCAxNjoxMzoxMCIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
"prev_cursor": null,
"prev_page_url": null
}

The response is paginated with up to 25 sessions per page. Each session includes the following fields:

FieldTypeDescription
uuidstringUnique identifier for the session, combining tenant_id, issue_id, user_id, and timestamp.
issue_idintegerID of the edition associated with the session.
issue_external_idstring/nullExternal identifier of the edition, typically the ISBN. Null when the edition has no primary identifier.
user_idinteger/nullID of the user in the system. Null for guest sessions.
user_emailstring/nullEmail of the user. Null for guest sessions.
user_namestring/nullName of the user. Null for guest sessions.
user_external_idstring/nullExternal identifier of the user, set through integrations (e.g. SSO/LTI). Null when not provided.
client_typestringPlatform where the session occurred. Possible values: app, browser.
device_osstringOperating system the session started from. Possible values: iOS, Android, Windows, Mac, Linux, Unknown.
access_modestringHow the content was accessed. online when the session was processed as it occurred; offline when read from downloaded content and synced later.
reason_typestringReason the user accessed the content. Possible values are detailed below.
reason_valueinteger/nullAdditional data related to the reason, such as the subscription plan ID for certain types.
started_atdatetimeTimestamp when the session started (client occurrence time).
processed_atdatetime/nullTimestamp when the session was processed by the platform (server ingestion time). Null for sessions recorded before this field was introduced.
last_heartbeat_atdatetime/nullTimestamp of the last activity ping in the session.
seconds_readingintegerDuration of the session in seconds.
page_changesintegerNumber of page changes during the session.
page_viewsintegerNumber of page views recorded during the session.
printed_pagesintegerNumber of pages printed during the session.
notesintegerNumber of notes created during the session.
highlightsintegerNumber of highlights created during the session.
bookmarksintegerNumber of bookmarks created during the session.
resolved_captchasintegerNumber of captchas resolved during the session.

Possible reason_type Values

ValueDescription
license_retailContent accessed through a retail license.
administrator_userContent accessed by an administrator.
free_issueContent accessed because it is free.
preview_issueContent preview access enabled.
free_accessContent accessed via integration with free access enabled.
bought_issueContent purchased by the user.
assigned_issueContent assigned manually by an administrator.
gifted_issueContent gifted to the user.
external_permissionsAccess through integration of reading permissions.
subscription_with_collectionsAccess through a subscription with content collections.
global_subscriptionAccess through a subscription granting global content access.
lti_and_entry_point_free_accessAccess through LTI integration.
saml_and_entry_point_free_accessAccess through SAML integration.
ip_and_entry_point_free_accessAccess through IP range integration.

In cases where reason_type is subscription_with_collections or global_subscription, reason_value will contain the subscription plan ID.

info

The plan id can be found HERE

X

Graph View