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

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

const response = await trophy.users.achievements("user-id");
[
  {
    "id": "d01dcbcb-d51e-4c12-b054-dc811dcdc625",
    "trigger": "api",
    "key": "completed-onboarding",
    "name": "Completed Onboarding",
    "achievedAt": "2021-01-01T00:00:00Z",
    "badgeUrl": "https://example.com/badge2.png",
    "completions": 10,
    "rarity": 90.13
  },
  {
    "id": "d01dcbcb-d51e-4c12-b054-dc811dcdc623",
    "trigger": "metric",
    "key": "novice-writer",
    "metricId": "d01dcbcb-d51e-4c12-b054-dc811dcdc619",
    "metricValue": 500,
    "metricName": "words written",
    "name": "Novice Writer",
    "achievedAt": "2021-02-01T00:00:00Z",
    "badgeUrl": "https://example.com/badge1.png",
    "completions": 8,
    "rarity": 22.98
  },
  {
    "id": "d01dcbcb-d51e-4c12-b054-dc811dcdc624",
    "trigger": "streak",
    "key": "3-day-streak",
    "streakLength": 3,
    "name": "3-Day Streak",
    "achievedAt": "2021-03-01T00:00:00Z",
    "badgeUrl": "https://example.com/badge2.png",
    "completions": 12,
    "rarity": 89.52
  }
]

Authorizations

X-API-KEY
string
header
required

Path Parameters

id
string
required

ID of the user.

Query Parameters

includeIncomplete
enum<string>

When set to 'true', returns both completed and incomplete achievements for the user. When omitted or set to any other value, returns only completed achievements.

Available options:
true

Response

Successful operation

id
string
required

The unique ID of the achievement.

name
string
required

The name of this achievement.

trigger
enum<string>
required

The trigger of the achievement.

Available options:
metric,
streak,
api
description
string | null
required

The description of this achievement.

badgeUrl
string | null
required

The URL of the badge image for the achievement, if one has been uploaded.

key
string
required

The key used to reference this achievement in the API (only applicable if trigger = 'api')

achievedAt
string<date-time>
required

The date and time the achievement was completed, in ISO 8601 format.

streakLength
integer

The length of the streak required to complete the achievement (only applicable if trigger = 'streak')

metricId
string

The ID of the metric associated with this achievement (only applicable if trigger = 'metric')

metricValue
number

The value of the metric required to complete the achievement (only applicable if trigger = 'metric')

metricName
string

The name of the metric associated with this achievement (only applicable if trigger = 'metric')