Documentation

UpdatePlayerStatistics

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.

Request Details

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.

UpdatePlayerStatisticsRequest
Request Properties
Statistics (required) List<StatisticUpdate>

Statistics to be updated with the provided values

POST https://{{TitleID}}.playfabapi.com/Client/UpdatePlayerStatistics
    Content-Type: application/json
    X-Authentication: <user_session_ticket_value>
{
  "Statistics": [
    {
      "StatisticName": "Points",
      "Version": 1,
      "Value": 600
    },
    {
      "StatisticName": "Wins",
      "Version": 0,
      "Value": 16
    },
    {
      "StatisticName": "Stars",
      "Value": 7
    }
  ]
}
        

Response Details

UpdatePlayerStatisticsResult
Result Properties

Sample Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8


Authentication

SessionTicket

Possible Error Codes

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