> ## 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.

# Get Friend Leaderboard For Entity

> Get the friend leaderboard for the specified entity. A maximum of 25 friend entries are listed in the leaderboard.

Allowed entity token types: title, title_player_account, game_server

## Error codes

This operation may return the following PlayFab errors:

| Error | Code |
| --- | --- |
| AccountNotFound | 1001 |
| ApiNotEnabledForTitle | 1520 |
| DownstreamServiceUnavailable | 1127 |
| ExpiredXboxLiveToken | 1189 |
| FacebookAPIError | 1143 |
| InvalidEntityType | 1373 |
| InvalidSignature | 1273 |
| InvalidSignatureTime | 1324 |
| InvalidXboxLiveToken | 1188 |
| LeaderboardNotFound | 1567 |
| NoLeaderboardForStatistic | 1421 |
| PlayerSecretNotConfigured | 1323 |
| SpecifiedVersionLeaderboardNotFound | 1583 |
| StatisticNotFound | 1195 |
| XboxInaccessible | 1339 |
| XboxServiceTooManyRequests | 1505 |
| XboxXASSExchangeFailure | 1306 |




## OpenAPI

````yaml post /Leaderboard/GetFriendLeaderboardForEntity
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:
  /Leaderboard/GetFriendLeaderboardForEntity:
    post:
      tags:
        - Leaderboards
      summary: Get Friend Leaderboard For Entity
      description: >
        Get the friend leaderboard for the specified entity. A maximum of 25
        friend entries are listed in the leaderboard.


        Allowed entity token types: title, title_player_account, game_server


        ## Error codes


        This operation may return the following PlayFab errors:


        | Error | Code |

        | --- | --- |

        | AccountNotFound | 1001 |

        | ApiNotEnabledForTitle | 1520 |

        | DownstreamServiceUnavailable | 1127 |

        | ExpiredXboxLiveToken | 1189 |

        | FacebookAPIError | 1143 |

        | InvalidEntityType | 1373 |

        | InvalidSignature | 1273 |

        | InvalidSignatureTime | 1324 |

        | InvalidXboxLiveToken | 1188 |

        | LeaderboardNotFound | 1567 |

        | NoLeaderboardForStatistic | 1421 |

        | PlayerSecretNotConfigured | 1323 |

        | SpecifiedVersionLeaderboardNotFound | 1583 |

        | StatisticNotFound | 1195 |

        | XboxInaccessible | 1339 |

        | XboxServiceTooManyRequests | 1505 |

        | XboxXASSExchangeFailure | 1306 |
      operationId: GetFriendLeaderboardForEntity
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetFriendLeaderboardForEntityRequest'
      responses:
        '200':
          $ref: '#/components/responses/GetEntityLeaderboardResponse'
        '400':
          $ref: '#/components/responses/ApiErrorWrapper'
      security:
        - EntityToken: []
components:
  schemas:
    GetFriendLeaderboardForEntityRequest:
      type: object
      properties:
        CustomTags:
          description: >-
            The optional custom tags associated with the request (e.g. build
            number, external trace identifiers, etc.).
          type: object
        Entity:
          allOf:
            - $ref: '#/components/schemas/EntityKey'
          description: >-
            The optional entity to perform this action on. Defaults to the
            currently logged in entity.
        ExternalFriendSources:
          allOf:
            - $ref: '#/components/schemas/ExternalFriendSources'
          description: >-
            Indicates which other platforms' friends should be included in the
            response. In HTTP, it is represented as a comma-separated list of
            platforms.
        LeaderboardName:
          description: Name of the leaderboard.
          type: string
        Version:
          description: Optional version of the leaderboard, defaults to current version.
          type: number
          x-actualtype: uint32
        XboxToken:
          description: >-
            Xbox token if Xbox friends should be included. Requires Xbox be
            configured on PlayFab.
          type: string
      required:
        - LeaderboardName
      example:
        LeaderboardName: Points
    EntityKey:
      description: >-
        Combined entity type and ID structure which uniquely identifies a single
        entity.
      type: object
      properties:
        Id:
          description: Unique ID of the entity.
          type: string
        Type:
          description: >-
            Entity type. See
            https://learn.microsoft.com/gaming/playfab/features/data/entities/available-built-in-entity-types
          type: string
      required:
        - Id
    ExternalFriendSources:
      type: string
      enum:
        - None
        - Steam
        - Facebook
        - Xbox
        - Psn
        - All
    GetEntityLeaderboardResponse:
      description: Leaderboard response
      type: object
      properties:
        Columns:
          description: Leaderboard columns describing the sort directions.
          type: array
          items:
            $ref: '#/components/schemas/LeaderboardColumn'
          x-isclass: true
        EntryCount:
          description: The number of entries on the leaderboard.
          type: number
          x-actualtype: uint32
        NextReset:
          description: >-
            The time the next scheduled reset will occur. Null if the
            leaderboard does not reset on a schedule.
          type: string
        Rankings:
          description: >-
            Individual entity rankings in the leaderboard, in sorted order by
            rank.
          type: array
          items:
            $ref: '#/components/schemas/EntityLeaderboardEntry'
          x-isclass: true
        Version:
          description: Version of the leaderboard being returned.
          type: number
          x-actualtype: uint32
      required:
        - Version
        - EntryCount
      example:
        Version: 5
        Rankings:
          - Entity:
              Id: 1784371290HJA9
              Type: title_player_account
              TypeString: title_player_account
            DisplayName: FastHand
            Scores:
              - '4503'
            Rank: 1
          - Entity:
              Id: 1947109JA18412
              Type: title_player_account
              TypeString: title_player_account
            DisplayName: Mouse
            Scores:
              - '4502'
            Rank: 2
    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
    LeaderboardColumn:
      type: object
      properties:
        LinkedStatisticColumn:
          allOf:
            - $ref: '#/components/schemas/LinkedStatisticColumn'
          description: >-
            If the value for this column is sourced from a statistic, details of
            the linked column. Null if the leaderboard is not linked.
        Name:
          description: >-
            A name for the leaderboard column, unique per leaderboard
            definition.
          type: string
        SortDirection:
          allOf:
            - $ref: '#/components/schemas/LeaderboardSortDirection'
          description: The sort direction for this column.
      required:
        - Name
        - SortDirection
    EntityLeaderboardEntry:
      description: Individual rank of an entity in a leaderboard
      type: object
      properties:
        DisplayName:
          description: Entity's display name.
          type: string
        Entity:
          allOf:
            - $ref: '#/components/schemas/EntityKey'
          description: Entity identifier.
        LastUpdated:
          description: >-
            The time at which the last update to the entry was recorded on the
            server.
          type: string
        Metadata:
          description: >-
            An opaque blob of data stored on the leaderboard entry. Note that
            the metadata is not used for ranking purposes.
          type: string
        Rank:
          description: Position on the leaderboard.
          type: number
          x-actualtype: int32
        Scores:
          description: Scores for the entry.
          type: array
          items:
            type: string
      required:
        - Rank
        - LastUpdated
    LinkedStatisticColumn:
      type: object
      properties:
        LinkedStatisticColumnName:
          description: >-
            The name of the statistic column that this leaderboard column is
            sourced from.
          type: string
        LinkedStatisticName:
          description: The name of the statistic.
          type: string
      required:
        - LinkedStatisticName
        - LinkedStatisticColumnName
    LeaderboardSortDirection:
      type: string
      enum:
        - Descending
        - Ascending
  responses:
    GetEntityLeaderboardResponse:
      description: Leaderboard response
      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/GetEntityLeaderboardResponse'
            example:
              code: 200
              status: OK
              data:
                Version: 5
                Rankings:
                  - Entity:
                      Id: 1784371290HJA9
                      Type: title_player_account
                      TypeString: title_player_account
                    DisplayName: FastHand
                    Scores:
                      - '4503'
                    Rank: 1
                  - Entity:
                      Id: 1947109JA18412
                      Type: title_player_account
                      TypeString: title_player_account
                    DisplayName: Mouse
                    Scores:
                      - '4502'
                    Rank: 2
    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

- [Get Friend Leaderboard For Entity](/api-reference/leaderboards/get-friend-leaderboard-for-entity.md)
- [PFLeaderboardsGetFriendLeaderboardForEntityAsync](/services/playfab/api-references/c/pfleaderboards/functions/pfleaderboardsgetfriendleaderboardforentityasync.md)
- [PFLeaderboardsGetFriendLeaderboardForEntityRequest](/services/playfab/api-references/c/pfleaderboardstypes/structs/pfleaderboardsgetfriendleaderboardforentityrequest.md)
- [PFLeaderboardsGetFriendLeaderboardForEntityGetResult](/services/playfab/api-references/c/pfleaderboards/functions/pfleaderboardsgetfriendleaderboardforentitygetresult.md)
- [PFLeaderboardsGetFriendLeaderboardForEntityGetResultSize](/services/playfab/api-references/c/pfleaderboards/functions/pfleaderboardsgetfriendleaderboardforentitygetresultsize.md)
