Skip to main content
GET
/
streaks
/
rankings
JavaScript
import { TrophyApiClient } from '@trophyso/node';

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

const response = await trophy.streaks.rankings({
  limit: 20,
  type: 'active'
});
[
  {
    "userId": "user-123",
    "name": "Alice Johnson",
    "streakLength": 15
  },
  {
    "userId": "user-456",
    "name": "Bob Smith",
    "streakLength": 12
  },
  {
    "userId": "user-789",
    "name": "Charlie Brown",
    "streakLength": 8
  }
]

Authorizations

X-API-KEY
string
header
required

Query Parameters

limit
integer
default:10

Number of users to return. Must be between 1 and 100.

Required range: 1 <= x <= 100
type
enum<string>
default:active

Whether to rank users by active streaks or longest streaks ever achieved.

Available options:
active,
longest

Response

Successful operation

userId
string
required

The ID of the user.

Example:

"user-123"

name
string | null
required

The name of the user. May be null if no name is set.

Example:

"Alice Johnson"

streakLength
integer
required

The user's streak length (active or longest depending on query parameter).

Example:

15

I