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

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

const response = await trophy.achievements.all();
[
  {
    "id": "5100fe51-6bce-6j44-b0hs-bddc4e123682",
    "trigger": "api",
    "name": "Finish onboarding",
    "description": "Complete the onboarding process.",
    "badgeUrl": "https://example.com/badge.png",
    "key": "finish-onboarding",
    "completions": 8,
    "rarity": 80
  },
  {
    "id": "5100fe51-6bce-6j44-b0hs-bddc4e123683",
    "trigger": "metric",
    "name": "500 words written",
    "description": "Write 500 words in the app.",
    "badgeUrl": "https://example.com/badge.png",
    "metricId": "5100fe51-6bce-6j44-b0hs-bddc4e123683",
    "metricName": "words written",
    "metricValue": 500,
    "completions": 6,
    "rarity": 60,
    "userAttributes": [
      {
        "key": "plan-type",
        "value": "premium"
      },
      {
        "key": "region",
        "value": "us-east"
      }
    ],
    "eventAttribute": {
      "key": "source",
      "value": "mobile-app"
    }
  },
  {
    "id": "5100fe51-6bce-6j44-b0hs-bddc4e123684",
    "trigger": "streak",
    "name": "10 days of exercise",
    "description": "Exercise at least once a day for 10 days in a row.",
    "badgeUrl": "https://example.com/badge.png",
    "streakLength": 10,
    "completions": 2,
    "rarity": 20,
    "userAttributes": [
      {
        "key": "plan-type",
        "value": "premium"
      }
    ]
  }
]

Authorizations

X-API-KEY
string
header
required

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

completions
integer
required

The number of users who have completed this achievement.

rarity
number
required

The percentage of all users who have completed this achievement.

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

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.