Skip to main content
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",
    "name": "Completed Onboarding",
    "trigger": "api",
    "key": "completed-onboarding",
    "achievedAt": "2021-01-01T00:00:00Z",
    "badgeUrl": "https://example.com/badge2.png",
    "completions": 100,
    "rarity": 50
  },
  {
    "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": 100,
    "rarity": 50
  },
  {
    "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": 100,
    "rarity": 50
  }
]

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.

completions
integer
required

The number of users who have completed this achievement.

rarity
number<double>
required

The percentage of all users who have completed this achievement.

achievedAt
string<date-time> | null
required

The date and time the achievement was completed, in ISO 8601 format. Null if the achievement has not been completed.

key
string

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

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<double>

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')

userAttributes
object[]

User attribute filters that must be met for this achievement to be completed. Only present if the achievement has user attribute filters configured.

eventAttribute
object

Event attribute filter that must be met for this achievement to be completed. Only present if the achievement has an event filter configured.