> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Statistic Definition

> Update an existing entity statistic definition.

Allowed entity token types: title, game_server

## Error codes

This operation may return the following PlayFab errors:

| Error | Code |
| --- | --- |
| ApiNotEnabledForTitle | 1520 |
| InvalidBaseTimeForInterval | 1581 |
| MaxQueryableVersionsExceeded | 23015 |
| MaxQueryableVersionsValueNotAllowedForTier | 1591 |
| ResetIntervalCannotBeModified | 1598 |
| StatisticNotFound | 1195 |




## OpenAPI

````yaml /services/playfab/api-references/rest/progression/progression.openapi.json post /Statistic/UpdateStatisticDefinition
openapi: 3.0.0
info:
  version: '260922'
  title: PlayFab Progression API
  description: Manage entity statistics Manage entity leaderboards
  termsOfService: https://playfab.com/terms/
  contact:
    url: https://community.playfab.com/index.html
  license:
    name: Apache 2.0
    url: https://github.com/PlayFab/API_Specs/blob/master/LICENSE
servers:
  - url: https://{titleId}.playfabapi.com
    description: PlayFab title endpoint
    variables:
      titleId:
        default: your_title_id
        description: Your PlayFab title ID (hex).
security: []
tags:
  - name: Leaderboards
    description: Leaderboards APIs
  - name: Statistics
    description: Statistics APIs
paths:
  /Statistic/UpdateStatisticDefinition:
    post:
      tags:
        - Statistics
      summary: Update Statistic Definition
      description: |
        Update an existing entity statistic definition.

        Allowed entity token types: title, game_server

        ## Error codes

        This operation may return the following PlayFab errors:

        | Error | Code |
        | --- | --- |
        | ApiNotEnabledForTitle | 1520 |
        | InvalidBaseTimeForInterval | 1581 |
        | MaxQueryableVersionsExceeded | 23015 |
        | MaxQueryableVersionsValueNotAllowedForTier | 1591 |
        | ResetIntervalCannotBeModified | 1598 |
        | StatisticNotFound | 1195 |
      operationId: UpdateStatisticDefinition
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateStatisticDefinitionRequest'
      responses:
        '200':
          $ref: '#/components/responses/EmptyResponse'
        '400':
          $ref: '#/components/responses/ApiErrorWrapper'
      security:
        - EntityToken: []
components:
  schemas:
    UpdateStatisticDefinitionRequest:
      type: object
      properties:
        CustomTags:
          description: >-
            The optional custom tags associated with the request (e.g. build
            number, external trace identifiers, etc.).
          type: object
        EventEmissionConfig:
          allOf:
            - $ref: '#/components/schemas/StatisticsEventEmissionConfig'
          description: >-
            [In Preview]: Configurations for different Statistics events that
            can be emitted by the service.
        Name:
          description: >-
            Name of the statistic. Must be less than 150 characters. Restricted
            to a-Z, 0-9, '(', ')', '_', '-' and '.'.
          type: string
        VersionConfiguration:
          allOf:
            - $ref: '#/components/schemas/VersionConfiguration'
          description: The version reset configuration for the statistic definition.
      required:
        - Name
      example:
        Name: HighestScoresByLevel
        VersionConfiguration:
          MaxQueryableVersions: 2
        EventEmissionConfig:
          UpdateEventConfig:
            EventType: PlayStream
    StatisticsEventEmissionConfig:
      type: object
      properties:
        UpdateEventConfig:
          allOf:
            - $ref: '#/components/schemas/StatisticsUpdateEventConfig'
          description: Emitted when statistics are updated.
    VersionConfiguration:
      type: object
      properties:
        MaxQueryableVersions:
          description: >-
            The maximum number of versions of this leaderboard/statistic that
            can be queried. 
          type: number
          x-actualtype: int32
        ResetInterval:
          allOf:
            - $ref: '#/components/schemas/ResetInterval'
          description: >-
            Reset interval that statistics or leaderboards will reset on. When
            using Manual intervalthe reset can only be increased by calling the
            Increase version API. When using Hour interval the resetwill occur
            at the start of the next hour UTC time. When using Day interval the
            reset will occur at thestart of the next day in UTC time. When using
            the Week interval the reset will occur at the start ofthe next
            Monday in UTC time. When using Month interval the reset will occur
            at the start of the nextmonth in UTC time.
      required:
        - ResetInterval
        - MaxQueryableVersions
    EmptyResponse:
      type: object
      properties: {}
    ApiErrorWrapper:
      description: The basic wrapper around every failed API response
      type: object
      properties:
        code:
          description: Numerical HTTP code
          type: integer
        status:
          description: String HTTP code
          type: string
        error:
          description: Playfab error code
          type: string
        errorCode:
          description: Numerical PlayFab error code
          type: integer
        errorMessage:
          description: Description for the PlayFab errorCode
          type: string
        errorDetails:
          description: Detailed description of individual issues with the request object
          type: object
      required:
        - code
        - errorCode
    StatisticsUpdateEventConfig:
      type: object
      properties:
        EventType:
          allOf:
            - $ref: '#/components/schemas/EventType'
          description: The event type to emit when statistics are updated.
      required:
        - EventType
    ResetInterval:
      type: string
      enum:
        - Manual
        - Hour
        - Day
        - Week
        - Month
    EventType:
      type: string
      enum:
        - None
        - Telemetry
        - PlayStream
  responses:
    EmptyResponse:
      description: ''
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: integer
                description: >-
                  The Http status code. If X-ReportErrorAsSuccess header is set
                  to true, this will report the actual http error code.
              status:
                type: string
                description: The Http status code as a string.
              data:
                $ref: '#/components/schemas/EmptyResponse'
    ApiErrorWrapper:
      description: This is the outer wrapper for all responses with errors
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorWrapper'
  securitySchemes:
    EntityToken:
      type: apiKey
      in: header
      name: X-EntityToken
      description: >-
        This API requires an Entity Session Token, available from the Entity
        GetEntityToken method.

````

## Related topics

- [Update Statistic Definition](/services/playfab/api-references/rest/progression/statistics/update-statistic-definition.md)
- [PFStatisticsUpdateStatisticDefinitionAsync](/services/playfab/api-references/c/pfstatistics/functions/pfstatisticsupdatestatisticdefinitionasync.md)
- [PFStatisticsUpdateStatisticDefinitionRequest](/services/playfab/api-references/c/pfstatisticstypes/structs/pfstatisticsupdatestatisticdefinitionrequest.md)
- [API Statistics reference](/services/playfab/player-progression/statistics/api-reference.md)
- [Services C API overview - PFStatistics.h](/services/playfab/api-references/c/pfstatistics/pfstatistics_members.md)
