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

# Get all leaderboards

> Get all leaderboards for your organization. Finished leaderboards are excluded by default.



## OpenAPI

````yaml https://api.trophy.so/v1/openapi get /leaderboards
openapi: 3.1.0
info:
  title: Trophy
  version: 1.19.0
servers:
  - x-fern-server-name: Application API
    url: https://api.trophy.so/v1
    description: Application API
security: []
paths:
  /leaderboards:
    servers:
      - url: https://api.trophy.so/v1
        description: Application API
    parameters:
      - $ref: '#/components/parameters/TenantId'
    get:
      tags:
        - Leaderboards
      summary: Get all leaderboards
      description: >-
        Get all leaderboards for your organization. Finished leaderboards are
        excluded by default.
      operationId: leaderboards_all
      parameters:
        - name: includeFinished
          in: query
          description: >-
            When set to 'true', leaderboards with status 'finished' will be
            included in the response. By default, finished leaderboards are
            excluded.
          required: false
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  allOf:
                    - $ref: '#/components/schemas/LeaderboardResponse'
                    - type: object
                      properties:
                        status:
                          type: string
                          enum:
                            - active
                            - scheduled
                            - finished
                          description: The status of the leaderboard.
                          example: active
                      required:
                        - status
              examples:
                Successful operation:
                  value:
                    - id: 5100fe51-6bce-6j44-b0hs-bddc4e123682
                      name: Weekly Word Count Challenge
                      key: weekly-words
                      rankBy: metric
                      metricKey: words-written
                      metricName: Words Written
                      description: Compete weekly to see who writes the most words
                      status: active
                      start: '2025-01-01'
                      end: null
                      maxParticipants: 100
                      breakdownAttribute: null
                      breakdownAttributes:
                        - country
                        - plan
                      runUnit: day
                      runInterval: 7
                    - id: 5100fe51-6bce-6j44-b0hs-bddc4e123683
                      name: XP Leaderboard
                      key: xp-board
                      rankBy: points
                      pointsSystemKey: xp-system
                      pointsSystemName: Experience Points
                      description: Overall ranking by XP earned
                      status: active
                      start: '2025-01-01'
                      end: null
                      maxParticipants: 50
                      breakdownAttribute: null
                      breakdownAttributes: []
                      runUnit: null
                      runInterval: null
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '422':
          description: Unprocessible Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: javascript
          source: |
            import { TrophyApiClient } from '@trophyso/node';

            const trophy = new TrophyApiClient({
              apiKey: 'YOUR_API_KEY'
            });

            const response = await trophy.leaderboards.all();
        - lang: python
          source: |
            from trophy import TrophyApi

            client = TrophyApi(api_key='YOUR_API_KEY')

            response = client.leaderboards.all()
        - lang: go
          source: |
            import (
              "context"

              api "github.com/trophyso/trophy-go"
              trophyclient "github.com/trophyso/trophy-go/client"
              "github.com/trophyso/trophy-go/option"
            )

            client := trophyclient.NewClient(
              option.WithApiKey("YOUR_API_KEY"),
            )

            response, err := client.Leaderboards.All(
              context.TODO(),
              &api.LeaderboardsAllRequest{},
            )
components:
  parameters:
    TenantId:
      name: Tenant-ID
      in: header
      description: >-
        The tenant identifier for multi-tenant organisations. Required when the
        organisation has multi-tenancy enabled. The value should be your
        internal ID for the tenant. Ignored for single-tenant organisations.
      required: false
      schema:
        type: string
      example: customer_12345
  schemas:
    LeaderboardResponse:
      title: LeaderboardResponse
      type: object
      description: A leaderboard with its configuration details.
      properties:
        id:
          type: string
          description: The unique ID of the leaderboard.
          example: 5100fe51-6bce-6j44-b0hs-bddc4e123682
        name:
          type: string
          description: The user-facing name of the leaderboard.
          example: Weekly Word Count Challenge
        key:
          type: string
          description: The unique key used to reference the leaderboard in APIs.
          example: weekly-words
        rankBy:
          type: string
          enum:
            - points
            - streak
            - metric
          description: What the leaderboard ranks by.
          example: metric
        breakdownAttribute:
          type:
            - string
            - 'null'
          description: >-
            Deprecated. The key of the attribute to break down this leaderboard
            by.
          deprecated: true
          example: country
        breakdownAttributes:
          type: array
          description: The user attribute keys that this leaderboard is broken down by.
          items:
            type: string
            description: The key of a user attribute in this leaderboard breakdown.
            example: country
        metricKey:
          type: string
          description: The key of the metric to rank by, if rankBy is 'metric'.
          example: words-written
        metricName:
          type: string
          description: The name of the metric to rank by, if rankBy is 'metric'.
          example: Words Written
        pointsSystemKey:
          type: string
          description: The key of the points system to rank by, if rankBy is 'points'.
          example: xp-system
        pointsSystemName:
          type: string
          description: The name of the points system to rank by, if rankBy is 'points'.
          example: Experience Points
        description:
          type:
            - string
            - 'null'
          description: The user-facing description of the leaderboard.
          example: Compete weekly to see who writes the most words
        start:
          type: string
          format: date
          description: The start date of the leaderboard in YYYY-MM-DD format.
          example: '2025-01-01'
        end:
          type:
            - string
            - 'null'
          format: date
          description: >-
            The end date of the leaderboard in YYYY-MM-DD format, or null if it
            runs forever.
          example: '2025-12-31'
        startTime:
          type:
            - string
            - 'null'
          pattern: ^([01][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$
          description: >-
            When set, ranking only counts activity at or after this time of day
            in the user's timezone (HH:mm format).
          example: '09:00'
        endTime:
          type:
            - string
            - 'null'
          pattern: ^([01][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$
          description: >-
            When set, ranking only counts activity before this time of day in
            the user's timezone (HH:mm format).
          example: '17:00'
        maxParticipants:
          type:
            - integer
            - 'null'
          description: The maximum number of participants in the leaderboard.
          example: 100
        runUnit:
          type:
            - string
            - 'null'
          enum:
            - day
            - month
            - year
            - null
          description: >-
            The repetition type for recurring leaderboards, or null for one-time
            leaderboards.
          example: day
        runInterval:
          type:
            - integer
            - 'null'
          description: >-
            The interval between repetitions, relative to the start date and
            repetition type. Null for one-time leaderboards.
          example: 7
      required:
        - id
        - name
        - key
        - status
        - description
        - rankBy
        - breakdownAttribute
        - breakdownAttributes
        - start
        - end
        - startTime
        - endTime
        - maxParticipants
        - runUnit
        - runInterval
    ErrorBody:
      title: ErrorBody
      type: object
      properties:
        error:
          type: string
      required:
        - error
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````