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

# Get user leaderboard

> Users ranked by **portfolio PnL** (equity change net of deposits, withdrawals, and vault flows) or **fill volume** over a time window.

### Parameters

| Parameter | Required | Type | Description |
| --------- | -------- | ---- | ----------- |
| startTime | yes | integer (int64) | Start timestamp in milliseconds (optional). Omit or pass 0 for all available history. |
| endTime | yes | integer (int64) | End timestamp in milliseconds (optional). Omit or pass 0 for the latest available data. |
| count | yes | integer | null | Maximum number of users to return (optional, defaults to 100, max 1000). |
| metric | yes | — | Ranking metric. `pnl` orders by portfolio PnL (equity change net of cash flows); `volume` orders by fill notional. |
| account | yes | string (hex) | Optional account whose leaderboard position should be returned even if outside `count`. |

### Response fields

| Parameter | Required | Type | Description |
| --------- | -------- | ---- | ----------- |
| `accountPosition` | no | object | — |
| `leaderboard` | yes | object[] | Users ranked by portfolio PnL (equity change net of deposits, withdrawals, and vault flows) and fill notional over the requested time range. |
| `leaderboard[].pnl` | yes | string | — |
| `leaderboard[].user` | yes | string (hex) | An Ethereum-style account address (20 bytes). |
| `leaderboard[].volume` | yes | string | — |

### Response example

A sample **`200`** response body is attached to this operation as an OpenAPI **example** — see the **Example** panel on this page.



## OpenAPI

````yaml /specs/indexer-openapi.json get /leaderboard
openapi: 3.1.0
info:
  title: Rocket Indexer API Documentation
  description: >-
    Welcome to the RocketChain Indexer API documentation!


    The indexer REST API serves historical and aggregated market data from
    ClickHouse. Endpoints cover candles, trades, order history, portfolio
    curves, funding events, bridge events, vault events, current/historical
    instruments, and live instrument details.
  license:
    name: MIT
    url: https://github.com/rocketfoundation/rocket-sdk-rust/blob/main/LICENSE
  version: '1.0'
  x-logo:
    altText: ROCKET
    backgroundColor: '#00000000'
    url: https://www.rocketfoundation.io/assets/rocket-logo.svg
servers:
  - url: https://beta.rocket-cluster-1.com/indexer
    description: Beta
  - url: https://testnet.rocket-cluster-1.com/indexer
    description: Testnet
  - url: https://devnet.rocket-cluster-1.com/indexer
    description: Devnet
security: []
tags:
  - name: Indexer REST-API
    description: >-
      Read-only REST endpoints backed by the RocketChain indexer. All routes are
      served over HTTP GET.
paths:
  /leaderboard:
    get:
      tags:
        - Indexer REST-API
      summary: Get user leaderboard
      description: >-
        Users ranked by **portfolio PnL** (equity change net of deposits,
        withdrawals, and vault flows) or **fill volume** over a time window.


        ### Parameters


        | Parameter | Required | Type | Description |

        | --------- | -------- | ---- | ----------- |

        | startTime | yes | integer (int64) | Start timestamp in milliseconds
        (optional). Omit or pass 0 for all available history. |

        | endTime | yes | integer (int64) | End timestamp in milliseconds
        (optional). Omit or pass 0 for the latest available data. |

        | count | yes | integer | null | Maximum number of users to return
        (optional, defaults to 100, max 1000). |

        | metric | yes | — | Ranking metric. `pnl` orders by portfolio PnL
        (equity change net of cash flows); `volume` orders by fill notional. |

        | account | yes | string (hex) | Optional account whose leaderboard
        position should be returned even if outside `count`. |


        ### Response fields


        | Parameter | Required | Type | Description |

        | --------- | -------- | ---- | ----------- |

        | `accountPosition` | no | object | — |

        | `leaderboard` | yes | object[] | Users ranked by portfolio PnL (equity
        change net of deposits, withdrawals, and vault flows) and fill notional
        over the requested time range. |

        | `leaderboard[].pnl` | yes | string | — |

        | `leaderboard[].user` | yes | string (hex) | An Ethereum-style account
        address (20 bytes). |

        | `leaderboard[].volume` | yes | string | — |


        ### Response example


        A sample **`200`** response body is attached to this operation as an
        OpenAPI **example** — see the **Example** panel on this page.
      operationId: getLeaderboard
      parameters:
        - name: startTime
          in: path
          description: >-
            Start timestamp in milliseconds (optional). Omit or pass 0 for all
            available history.
          required: true
          schema:
            oneOf:
              - type: 'null'
              - $ref: '#/components/schemas/u64'
          example: 0
        - name: endTime
          in: path
          description: >-
            End timestamp in milliseconds (optional). Omit or pass 0 for the
            latest available data.
          required: true
          schema:
            oneOf:
              - type: 'null'
              - $ref: '#/components/schemas/u64'
          example: 1710086400000
        - name: count
          in: path
          description: >-
            Maximum number of users to return (optional, defaults to 100, max
            1000).
          required: true
          schema:
            type:
              - integer
              - 'null'
            default: 100
            minimum: 0
          example: 100
        - name: metric
          in: path
          description: >-
            Ranking metric. `pnl` orders by portfolio PnL (equity change net of
            cash flows); `volume` orders by fill notional.
          required: true
          schema:
            oneOf:
              - type: 'null'
              - 3f1a82c1-3258-47f7-b2d0-03dadcce1d28
            default: pnl
          example: pnl
        - name: account
          in: path
          description: >-
            Optional account whose leaderboard position should be returned even
            if outside `count`.
          required: true
          schema:
            type: string
            format: hex
          example: '0xf19e16fe3cf25c630f55f66d6c6cbf64f84fc86b'
      responses:
        '200':
          description: Leaderboard
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetLeaderboardResponse'
              example:
                leaderboard:
                  - pnl: '12.34'
                    user: '0xf19e16fe3cf25c630f55f66d6c6cbf64f84fc86b'
                    volume: '1000.25'
        '400':
          description: Invalid query parameters
          content:
            text/plain:
              schema:
                type: string
        '500':
          description: Internal server error
          content:
            text/plain:
              schema:
                type: string
components:
  schemas:
    u64:
      type: integer
      format: int64
      minimum: 0
    GetLeaderboardResponse:
      type: object
      required:
        - leaderboard
      properties:
        accountPosition:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/LeaderboardPositionResponseItem'
              description: >-
                Requested account's 1-based leaderboard position, if `account`
                was provided and ranked.
        leaderboard:
          type: array
          items:
            $ref: '#/components/schemas/LeaderboardResponseItem'
          description: >-
            Users ranked by portfolio PnL (equity change net of deposits,
            withdrawals, and vault flows) and fill notional over the requested
            time range.
      examples:
        - leaderboard:
            - pnl: '12.34'
              user: '0xf19e16fe3cf25c630f55f66d6c6cbf64f84fc86b'
              volume: '1000.25'
    LeaderboardPositionResponseItem:
      type: object
      required:
        - position
        - user
        - pnl
        - volume
      properties:
        pnl:
          type: string
        position:
          type: integer
          format: int64
          minimum: 0
        user:
          $ref: '#/components/schemas/AccountAddress'
        volume:
          type: string
    LeaderboardResponseItem:
      type: object
      required:
        - user
        - pnl
        - volume
      properties:
        pnl:
          type: string
        user:
          $ref: '#/components/schemas/AccountAddress'
        volume:
          type: string
    AccountAddress:
      type: string
      format: hex
      description: An Ethereum-style account address (20 bytes).
      example: '0xf19e16fe3cf25c630f55f66d6c6cbf64f84fc86b'

````