Hey! These docs are for version 7.0, which is no longer officially supported. Click here for the latest version, 9.0!

Update a device's session information

This method should be called when a device opens your app after they are already registered. This method will automatically increment the player's session_count, and should also be used to update any fields that may have changed (such as language or timezone).

If a player record is not found, a new one will be created if and only if the request includes a device_type.

Body Parameters - New session

ParameterTypeDescription
identifierStringRecommended Push notification identifier from Google or Apple. For Apple push identifiers, you must strip all non alphanumeric characters. Example: ce777617da7f548fe7a9ab6febb56
languageStringRecommended Language code. Typically lower case two letters, except for Chinese where it must be one of zh-Hans or zh-Hant. Example: en
timezoneIntRecommended Number of seconds away from UTC. Example: -28800
game_versionStringRecommended Version of your app. Example: 1.1
device_osStringRecommended Device operating system version. Example: 7.0.4
ad_idStringRecommended The ad id for the device's platform:
Android = Advertising Id
iOS = identifierForVendor
WP8.0 = DeviceUniqueId
WP8.1 = AdvertisingId
sdkStringRecommended Name and version of sdk/plugin that's calling this method.
tagsObjectCustom tags for the player. Only support string key value pairs. Does not support arrays or other nested objects. Example: {"foo":"bar","this":"that"}
device_typeIntIf included, will create a new player record if the one is not found. Possible values are the same as device_type in the add device call

Example Code - New session

curl --include \
     --request POST \
     --header "Content-Type: application/json" \
     --data-binary "{\"language\":\"es\",
\"timezone\":-28800,
\"game_version\":\"1.0\",
\"device_os\":\"7.0.4\"}" \
     https://onesignal.com/api/v1/players/:id/on_session

Result Format - New session

{"success": true }
Language
Authentication
Basic
base64
: