Skip to main content

SDK Read - Content Delivery

Endpoint

/o/sdk/content

Enterprise Only
This API is available exclusively in Countly Enterprise.

Overview

Returns the next eligible content item for an SDK user and calculated placement geometry.

Authentication

  • Authentication method: SDK authentication via app_key
  • Validation path: handled by SDK route (/o/sdk) before content handler logic

Permissions

  • No dashboard feature permission checks are applied in this endpoint flow.

Request Parameters

ParameterTypeRequiredDescription
app_keyStringYesApplication key
device_idStringYesDevice identifier used by SDK auth and user resolution
resolutionStringYesJSON stringified orientation object
laStringNoRequested language code
cly_wsStringNoWeb SDK identifier
cly_originStringNoForwarded web origin

Supported resolution formats before stringifying:

{
"l": {
"w": 1920,
"h": 1080
},
"p": {
"w": 1080,
"h": 1920
}
}
{
"landscape": {
"width": 1920,
"height": 1080
},
"portrait": {
"width": 1080,
"height": 1920
}
}

Response

Success Response

When content exists:

{
"html": "https://your-server.com/_external/content?app_id=5be987d7b93798516eb5289a&app_user_id=65b0f4a2c91d4f0012e3a001&id=65d1a3a8f7e7a700128b0042&uid=user_12345",
"geo": {
"l": {
"x": 120,
"y": 90,
"w": 1080,
"h": 640
},
"p": {
"x": 50,
"y": 120,
"w": 980,
"h": 700
}
}
}

When no content is eligible:

{
"result": "No content block found!"
}

Response Fields

FieldTypeDescription
htmlStringRender URL for content HTML/survey page
geoObjectPlacement geometry by orientation
geo.lObjectLandscape geometry
geo.l.xNumberX coordinate
geo.l.yNumberY coordinate
geo.l.wNumberWidth
geo.l.hNumberHeight
geo.pObjectPortrait geometry
geo.p.xNumberX coordinate
geo.p.yNumberY coordinate
geo.p.wNumberWidth
geo.p.hNumberHeight
resultStringReturned when no content is available

Error Responses

HTTP StatusResponse
400"Invalid resolution format"
400"Invalid content block"
500"Invalid app user"
500"App user not found"
500"Content block does not exist for this contentId"
500"Invalid device id" (survey flow)
500"Invalid app key" (survey flow)

Behavior/Processing

  1. Parses and validates resolution.
  2. Builds engagement queue context for current app user.
  3. Uses queue peek for next eligible content (does not remove queue item).
  4. Loads content definition from content_blocks or feedback_widgets (survey type).
  5. Calculates landscape/portrait geometry and returns html + geo.

Database Collections

CollectionUsed forData touched by this endpoint
countly.content_queueEndpoint data source** - Queue lookup
countly.content_blocksEndpoint data source** - Standard content definitions
countly.feedback_widgetsEndpoint data source** - Survey definitions
countly.app_users{app_id}Endpoint data source** - User lookup/state initialization for queue context
countly.appsEndpoint data source** - App-level cooldown config lookup

Examples

Example 1: Standard SDK Request

/o/sdk/content?app_key=YOUR_APP_KEY&device_id=device_abc_123&resolution=<JSON_STRING>&la=en

resolution object before stringifying:

{
"l": {
"w": 1170,
"h": 2532
},
"p": {
"w": 1170,
"h": 2532
}
}

Example 2: Alternative Resolution Format

/o/sdk/content?app_key=YOUR_APP_KEY&device_id=device_abc_123&resolution=<JSON_STRING>

resolution object before stringifying:

{
"landscape": {
"width": 1920,
"height": 1080
},
"portrait": {
"width": 1080,
"height": 1920
}
}

Ⓔ Enterprise

This feature is part of Countly Enterprise.

Get Access:

Already a Customer? Use support portal if you have any questions


Last Updated

2026-02-16