---
title: Account PnL Rank
description: Query a single account's leaderboard rank and percentile
url: https://docs.intuition.systems/docs/v1/graphql-api/queries/leaderboard/account-rank
markdown_url: https://docs.intuition.systems/docs/v1/graphql-api/queries/leaderboard/account-rank.md
version: V1
llms_index: https://docs.intuition.systems/docs/v1/llms.txt
---

Look up a single account's leaderboard rank and percentile using `get_account_pnl_rank`. Returns `account_pnl_rank` rows.

## Account PnL Rank - Query Structure

```graphql
query GetAccountPnlRank {
  get_account_pnl_rank(
    args: {
      p_account_id: "0x88D0aF73508452c1a453356b3Fac26525aEc23A2"
      p_sort_by: "total_pnl"
    }
  ) {
    account_id
    account_label
    account_image
    rank
    percentile
    total_pnl_formatted
    pnl_pct
    total_volume_formatted
    total_position_count
    win_rate
    total_accounts
  }
}
```

## Function Arguments

| Argument | Type | Description |
|----------|------|-------------|
| `p_account_id` | `String` | Account address to look up |
| `p_sort_by` | `String` | Ranking metric (e.g. `"total_pnl"`, `"pnl_pct"`, `"win_rate"`) |
| `p_term_id` | `String` | Optional term filter |
| `p_time_filter` | `String` | Optional time filter preset |

## Response Fields (`account_pnl_rank`)

| Field | Type | Description |
|-------|------|-------------|
| `account_id` | `String` | Account address |
| `account_label` | `String` | Display name |
| `account_image` | `String` | Profile image URL |
| `rank` | `bigint` | Leaderboard rank position |
| `percentile` | `numeric` | Percentile ranking (0-100) |
| `total_pnl_formatted` | `numeric` | Total profit/loss (formatted) |
| `total_pnl_raw` | `numeric` | Total profit/loss (raw) |
| `pnl_pct` | `numeric` | PnL percentage |
| `total_volume_formatted` | `numeric` | Total trading volume (formatted) |
| `total_volume_raw` | `numeric` | Total trading volume (raw) |
| `total_position_count` | `bigint` | Total number of positions |
| `win_rate` | `numeric` | Win rate across positions |
| `total_accounts` | `bigint` | Total accounts on the leaderboard |

## Interactive Example

    id: 'account-rank',
    title: 'Account Rank Lookup',
    query: `query GetAccountPnlRank {
  get_account_pnl_rank(
    args: {
      p_account_id: "0x88D0aF73508452c1a453356b3Fac26525aEc23A2"
      p_sort_by: "total_pnl"

  ) {
    account_id
    account_label
    rank
    percentile
    total_pnl_formatted
    pnl_pct
    win_rate
    total_accounts

}`,
    variables: {}

];

## Use Cases

### Profile Rank Badge

Display a user's rank on their profile:

```typescript
import { GraphQLClient } from 'graphql-request'
import { API_URL_PROD } from '@0xintuition/graphql'

const client = new GraphQLClient(API_URL_PROD)

async function getAccountRank(accountId: string) {
  const query = `
    query GetAccountPnlRank {
      get_account_pnl_rank(
        args: {
          p_account_id: "${accountId}"
          p_sort_by: "total_pnl"
        }
      ) {
        rank
        percentile
        total_pnl_formatted
        pnl_pct
        total_accounts
      }
    }
  `

  const data = await client.request(query)
  return data.get_account_pnl_rank[0]
}
```

## Related

- [PnL Leaderboard](https://docs.intuition.systems/docs/v1/graphql-api/queries/leaderboard/pnl-leaderboard) - Full leaderboard rankings
- [Leaderboard Stats](https://docs.intuition.systems/docs/v1/graphql-api/queries/leaderboard/leaderboard-stats) - Aggregate protocol statistics
- [Account PnL Current](https://docs.intuition.systems/docs/v1/graphql-api/queries/pnl/account-pnl-current) - Detailed PnL snapshot
