GET
/
users
/
{id}
/
streak
JavaScript
import { TrophyApiClient } from '@trophyso/node';

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

const response = await trophy.users.streak("user-id", {
  historyPeriods: 14
});
{
  "length": 1,
  "frequency": "weekly",
  "started": "2025-04-02",
  "periodStart": "2025-03-31",
  "periodEnd": "2025-04-05",
  "expires": "2025-04-12",
  "rank": 5,
  "streakHistory": [
    {
      "periodStart": "2025-03-30",
      "periodEnd": "2025-04-05",
      "length": 1
    },
    {
      "periodStart": "2025-04-06",
      "periodEnd": "2025-04-12",
      "length": 2
    },
    {
      "periodStart": "2025-04-13",
      "periodEnd": "2025-04-19",
      "length": 3
    },
    {
      "periodStart": "2025-04-20",
      "periodEnd": "2025-04-26",
      "length": 0
    },
    {
      "periodStart": "2025-04-27",
      "periodEnd": "2025-05-03",
      "length": 1
    },
    {
      "periodStart": "2025-05-04",
      "periodEnd": "2025-05-10",
      "length": 2
    },
    {
      "periodStart": "2025-05-11",
      "periodEnd": "2025-05-17",
      "length": 3
    }
  ]
}

Authorizations

X-API-KEY
string
header
required

Path Parameters

id
string
required

ID of the user.

Query Parameters

historyPeriods
integer
default:7

The number of past streak periods to include in the streakHistory field of the response.

Response

200
application/json

Successful operation

An object representing the user's streak.