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

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

const response = await trophy.users.allMetrics("user-id");
[
  {
    "id": "d01dcbcb-d51e-4c12-b054-dc811dcdc623",
    "key": "words-written",
    "name": "Words written",
    "status": "active",
    "current": 4500,
    "achievements": [
      {
        "id": "abe3120f-5ca9-4344-92c8-5b891643a04b",
        "trigger": "metric",
        "name": "Novice Writer",
        "metricId": "d01dcbcb-d51e-4c12-b054-dc811dcdc623",
        "metricValue": 500,
        "achievedAt": "2021-01-01T00:00:00Z",
        "badgeUrl": "https://example.com/badge1.png"
      },
      {
        "id": "8a07f2d0-9c72-4de1-bf92-9530ae82b4b6",
        "trigger": "metric",
        "name": "Intermediate Writer",
        "metricId": "d01dcbcb-d51e-4c12-b054-dc811dcdc623",
        "metricValue": 1000,
        "achievedAt": "2021-01-02T00:00:00Z",
        "badgeUrl": "https://example.com/badge2.png"
      },
      {
        "id": "2090d038-aa04-4048-ab2e-e2b7bf2d3b9f",
        "trigger": "metric",
        "name": "Expert Writer",
        "metricId": "d01dcbcb-d51e-4c12-b054-dc811dcdc623",
        "metricValue": 2000,
        "achievedAt": null
      }
    ]
  }
]

Authorizations

X-API-KEY
string
header
required

Path Parameters

id
string
required

ID of the user

Response

Successful operation

id
string
required

The unique ID of the metric.

Example:

"d01dcbcb-d51e-4c12-b054-dc811dcdc623"

key
string
required

The unique key of the metric.

Example:

"words-written"

name
string
required

The name of the metric.

Example:

"Words written"

status
enum<string>
required

The status of the metric.

Available options:
archived,
active
current
number
required

The user's current total for the metric.

Example:

1500

achievements
CompletedAchievementResponse · object[]
required

A list of the metric's achievements and the user's progress towards each.