Leaderboards - Get Leaderboard For Entities

Get the leaderboard limited to a set of entities.

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

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
EntityIds True

string[]

Collection of Entity IDs to include in the leaderboard.

LeaderboardName True

string

Name of the leaderboard.

CustomTags

object

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

Version

number

Optional version of the leaderboard, defaults to current.

Responses

Name Type Description
200 OK

GetEntityLeaderboardResponse

Leaderboard response

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

EntityKey

Combined entity type and ID structure which uniquely identifies a single entity.

EntityLeaderboardEntry

Individual rank of an entity in a leaderboard

GetEntityLeaderboardResponse

Leaderboard response

GetLeaderboardForEntitiesRequest

Request a leaderboard limited to a collection of entities.

LeaderboardColumn
LeaderboardSortDirection
LinkedStatisticColumn

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

EntityKey

Combined entity type and ID structure which uniquely identifies a single entity.

Name Type Description
Id

string

Unique ID of the entity.

Type

string

Entity type. See https://docs.microsoft.com/gaming/playfab/features/data/entities/available-built-in-entity-types

EntityLeaderboardEntry

Individual rank of an entity in a leaderboard

Name Type Description
DisplayName

string

Entity's display name.

Entity

EntityKey

Entity identifier.

LastUpdated

string

The time at which the last update to the entry was recorded on the server.

Metadata

string

An opaque blob of data stored on the leaderboard entry. Note that the metadata is not used for ranking purposes.

Rank

number

Position on the leaderboard.

Scores

string[]

Scores for the entry.

GetEntityLeaderboardResponse

Leaderboard response

Name Type Description
Columns

LeaderboardColumn[]

Leaderboard columns describing the sort directions.

EntryCount

number

The number of entries on the leaderboard.

Rankings

EntityLeaderboardEntry[]

Individual entity rankings in the leaderboard, in sorted order by rank.

Version

number

Version of the leaderboard being returned.

GetLeaderboardForEntitiesRequest

Request a leaderboard limited to a collection of entities.

Name Type Description
CustomTags

object

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

EntityIds

string[]

Collection of Entity IDs to include in the leaderboard.

LeaderboardName

string

Name of the leaderboard.

Version

number

Optional version of the leaderboard, defaults to current.

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.

Error Codes

Name Code
ApiNotEnabledForTitle 1520
LeaderboardNotFound 1567
NoLeaderboardForStatistic 1421
StatisticNotFound 1195