Player Data Management - Update Player Statistics

Updates the values of the specified title-specific statistics for the user

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

Request Body

Name Required Type Description
ForceUpdate
  • boolean

Indicates whether the statistics provided should be set, regardless of the aggregation method set on the statistic. Default is false.

PlayFabId True
  • string

Unique PlayFab assigned ID of the user on whom the operation will be performed.

Statistics True

Statistics to be updated with the provided values

Responses

Name Type Description
200 OK
400 Bad Request

This is the outer wrapper for all responses with errors

Security

SecretKey

This API requires a title secret key, available to title admins, from PlayFab Game Manager.

Type: apiKey
In: header

Definitions

ApiErrorWrapper

The basic wrapper around every failed API response

StatisticUpdate
UpdatePlayerStatisticsRequest

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.

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

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.

Name Type Description
ForceUpdate
  • boolean

Indicates whether the statistics provided should be set, regardless of the aggregation method set on the statistic. Default is false.

PlayFabId
  • string

Unique PlayFab assigned ID of the user on whom the operation will be performed.

Statistics

Statistics to be updated with the provided values

UpdatePlayerStatisticsResult

Error Codes

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