Player Data Management - Update Player Statistics

Updates the values of the specified title-specific statistics for the user. By default, clients are not permitted to update statistics. Developers may override this setting in the Game Manager > Settings > API Features.

POST https://titleId.playfabapi.com/Client/UpdatePlayerStatistics

Request Header

Name Required Type Description
X-Authorization True

string

This API requires a client session ticket, available from any Client Login function.

Request Body

Name Required Type Description
Statistics True

StatisticUpdate[]

Statistics to be updated with the provided values

CustomTags

object

The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).

Responses

Name Type Description
200 OK

UpdatePlayerStatisticsResult

400 Bad Request

ApiErrorWrapper

This is the outer wrapper for all responses with errors

Security

X-Authorization

This API requires a client session ticket, available from any Client Login function.

Type: apiKey
In: header

Definitions

Name Description
ApiErrorWrapper

The basic wrapper around every failed API response

StatisticUpdate
UpdatePlayerStatisticsRequest

Enable this option with the 'Allow Client to Post Player Statistics' option in PlayFab GameManager for your title. However, this is not best practice, as this data will no longer be safely controlled by the server. This operation is additive. Statistics not currently defined will be added, while those already defined will be updated with the given values. All other user statistics will remain unchanged. Note that if the statistic is intended to have a reset period, the UpdatePlayerStatisticDefinition API call can be used to define that reset period. Once a statistic has been versioned (reset), the now-previous version can still be written to for up a short, pre-defined period (currently 10 seconds), using the Version parameter in this call.

UpdatePlayerStatisticsResult

ApiErrorWrapper

The basic wrapper around every failed API response

Name Type Description
code

integer

Numerical HTTP code

error

string

Playfab error code

errorCode

integer

Numerical PlayFab error code

errorDetails

object

Detailed description of individual issues with the request object

errorMessage

string

Description for the PlayFab errorCode

status

string

String HTTP code

StatisticUpdate

Name Type Description
StatisticName

string

unique name of the statistic

Value

number

statistic value for the player

Version

number

for updates to an existing statistic value for a player, the version of the statistic when it was loaded. Null when setting the statistic value for the first time.

UpdatePlayerStatisticsRequest

Enable this option with the 'Allow Client to Post Player Statistics' option in PlayFab GameManager for your title. However, this is not best practice, as this data will no longer be safely controlled by the server. This operation is additive. Statistics not currently defined will be added, while those already defined will be updated with the given values. All other user statistics will remain unchanged. Note that if the statistic is intended to have a reset period, the UpdatePlayerStatisticDefinition API call can be used to define that reset period. Once a statistic has been versioned (reset), the now-previous version can still be written to for up a short, pre-defined period (currently 10 seconds), using the Version parameter in this call.

Name Type Description
CustomTags

object

The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).

Statistics

StatisticUpdate[]

Statistics to be updated with the provided values

UpdatePlayerStatisticsResult

Error Codes

Name Code
APINotEnabledForGameClientAccess 1082
DuplicateStatisticName 1253
StatisticCountLimitExceeded 1203
StatisticNameConflict 1196
StatisticNotFound 1195
StatisticValueAggregationOverflow 1308
StatisticVersionClosedForWrites 1197
StatisticVersionInvalid 1198