Leaderboards - Create Leaderboard Definition

Creates a new leaderboard definition.

POST https://titleId.playfabapi.com/Leaderboard/CreateLeaderboardDefinition

Request Header

Name Required Type Description
X-EntityToken True

string

This API requires an Entity Session Token, available from the Entity GetEntityToken method.

Request Body

Name Required Type Description
Columns True

LeaderboardColumn[]

Leaderboard columns describing the sort directions, cannot be changed after creation.

EntityType True

string

The entity type being represented on the leaderboard. If it doesn't correspond to the PlayFab entity types, use 'external' as the type.

Name True

string

A name for the leaderboard, unique per title.

SizeLimit True

number

Maximum number of entries on this leaderboard

VersionConfiguration True

VersionConfiguration

The version reset configuration for the leaderboard definition.

CustomTags

object

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

Responses

Name Type Description
200 OK

EmptyResponse

400 Bad Request

ApiErrorWrapper

This is the outer wrapper for all responses with errors

Security

X-EntityToken

This API requires an Entity Session Token, available from the Entity GetEntityToken method.

Type: apiKey
In: header

Definitions

Name Description
ApiErrorWrapper

The basic wrapper around every failed API response

CreateLeaderboardDefinitionRequest
EmptyResponse
LeaderboardColumn
LeaderboardSortDirection
LinkedStatisticColumn
ResetInterval
VersionConfiguration

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

CreateLeaderboardDefinitionRequest

Name Type Description
Columns

LeaderboardColumn[]

Leaderboard columns describing the sort directions, cannot be changed after creation.

CustomTags

object

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

EntityType

string

The entity type being represented on the leaderboard. If it doesn't correspond to the PlayFab entity types, use 'external' as the type.

Name

string

A name for the leaderboard, unique per title.

SizeLimit

number

Maximum number of entries on this leaderboard

VersionConfiguration

VersionConfiguration

The version reset configuration for the leaderboard definition.

EmptyResponse

LeaderboardColumn

Name Type Description
LinkedStatisticColumn

LinkedStatisticColumn

If the value for this column is sourced from a statistic, details of the linked column. Null if the leaderboard is not linked.

Name

string

A name for the leaderboard column, unique per leaderboard definition.

SortDirection

LeaderboardSortDirection

The sort direction for this column.

LeaderboardSortDirection

Name Type Description
Ascending

string

Descending

string

LinkedStatisticColumn

Name Type Description
LinkedStatisticColumnName

string

The name of the statistic column that this leaderboard column is sourced from.

LinkedStatisticName

string

The name of the statistic.

ResetInterval

Name Type Description
Day

string

Hour

string

Manual

string

Month

string

Week

string

VersionConfiguration

Name Type Description
MaxQueryableVersions

number

The maximum number of versions of this leaderboard/statistic that can be queried.

ResetInterval

ResetInterval

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.

Error Codes

Name Code
ApiNotEnabledForTitle 1520
DuplicateColumnNameFound 1585
DuplicateLinkedStatisticColumnNameFound 1589
ExternalEntityNotAllowedForTier 1580
InvalidBaseTimeForInterval 1581
LeaderboardCountLimitExceeded 1574
LeaderboardNameConflict 1569
LeaderboardSizeLimitExceeded 1575
LinkedStatisticColumnMismatch 1570
LinkedStatisticColumnNotFound 1586
LinkedStatisticColumnRequired 1587
LinkingStatsNotAllowedForEntityType 1573
MaxQueryableVersionsValueNotAllowedForTier 1591
MultipleLinkedStatisticsNotAllowed 1588
StatDefinitionAlreadyLinkedToLeaderboard 1572
StatisticNotFound 1195