Skip to main content
POST
/
v1
/
server
/
playtime
/
sessions
Record Playtime Session
curl --request POST \
  --url https://sdk-api.playcamp.io/v1/server/playtime/sessions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "sessionId": "<string>",
  "userId": "<string>",
  "durationSeconds": 2,
  "startedAt": "2023-11-07T05:31:56Z",
  "endedAt": "2023-11-07T05:31:56Z",
  "campaignId": "<string>",
  "creatorKey": "<string>",
  "metadata": {},
  "callbackId": "<string>",
  "isTest": false
}
'
{
  "data": {
    "sessionId": "<string>",
    "userId": "<string>",
    "durationSeconds": 123,
    "recorded": true,
    "createdAt": "2023-11-07T05:31:56Z"
  }
}

Authorizations

Authorization
string
header
required

Server API Key (format: {keyId}:{secret})

Body

application/json
sessionId
string
required

Client-generated unique session ID

userId
string
required

User ID

durationSeconds
integer
required

Session duration in seconds

Required range: x >= 1
startedAt
string<date-time>
required

Session start time (ISO 8601 UTC format)

  • Format: YYYY-MM-DDTHH:mm:ss.sssZ
  • Example: 2024-01-15T10:30:00.000Z
endedAt
string<date-time>
required

Session end time (ISO 8601 UTC format, must be greater than or equal to startedAt)

  • Format: YYYY-MM-DDTHH:mm:ss.sssZ
  • Example: 2024-01-15T11:00:00.000Z
campaignId
string

Campaign ID (optional). If omitted, automatically attributed to the project's active campaign sponsor

creatorKey
string

Creator key (optional, exactly 5 uppercase alphanumeric characters)

Pattern: ^[A-Z0-9]{5}$
platform
enum<string>

Playtime platform (optional, server defaults to Other)

Available options:
iOS,
Android,
Web,
Roblox,
Other
metadata
object

Arbitrary key/value metadata

callbackId
string

Webhook tracking ID (included in webhook events triggered by this request)

isTest
boolean
default:false

Test mode (does not create actual data)

Response

Success

data
object
required

Recorded playtime session