JavaScript
import { TrophyApiClient } from '@trophyso/node';
const trophy = new TrophyApiClient({
apiKey: 'YOUR_API_KEY'
});
const response = await trophy.users.wrapped("user-123", {
year: 2024
});from trophy import TrophyApi
client = TrophyApi(api_key='YOUR_API_KEY')
response = client.users.wrapped(id="user-123", year=2024)import (
"context"
api "github.com/trophyso/trophy-go"
trophyclient "github.com/trophyso/trophy-go/client"
"github.com/trophyso/trophy-go/option"
)
client := trophyclient.NewClient(
option.WithApiKey("YOUR_API_KEY"),
)
response, err := client.Users.Wrapped(
context.TODO(),
"user-123",
&api.UsersWrappedRequest{Year: api.Int(2024)},
)curl --request GET \
--url https://api.trophy.so/v1/users/{id}/wrapped \
--header 'X-API-KEY: <api-key>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.trophy.so/v1/users/{id}/wrapped",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.trophy.so/v1/users/{id}/wrapped")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trophy.so/v1/users/{id}/wrapped")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"user": {
"id": "user-123",
"email": "user@example.com",
"name": "John Doe",
"tz": "America/New_York",
"subscribeToEmails": true,
"created": "2024-01-15T10:30:00Z",
"updated": "2024-06-20T14:45:00Z",
"control": false,
"attributes": {
"plan-type": "premium",
"region": "us-east"
}
},
"activity": {
"daysActive": 156,
"weeksActive": 42,
"monthsActive": 11,
"mostActiveDay": {
"date": "2024-03-15",
"metrics": {
"words-written": {
"name": "Words Written",
"units": "words",
"currentTotal": 15000,
"changeThisPeriod": 2500,
"percentChange": 20,
"byAttribute": {}
}
},
"points": {
"xp-system": {
"name": "Experience Points",
"description": "Points earned through activity",
"currentTotal": 5000,
"changeThisPeriod": 500,
"percentChange": 11.1
}
},
"achievements": [
{
"id": "5100fe51-6bce-6j44-b0hs-bddc4e123682",
"name": "500 Words Written",
"trigger": "metric",
"description": "Write 500 words in a single day",
"badgeUrl": "https://example.com/badge.png",
"key": "500-words",
"metricId": "metric-123",
"metricValue": 500,
"metricName": "Words Written",
"achievedAt": "2024-03-15T14:30:00Z",
"completions": 150,
"rarity": 15
}
],
"leaderboards": {
"weekly-words": {
"id": "leaderboard-123",
"name": "Weekly Word Count",
"key": "weekly-words",
"rankBy": "metric",
"metricKey": "words-written",
"metricName": "Words Written",
"description": "Weekly writing competition",
"start": "2024-03-11",
"end": "2024-03-17",
"maxParticipants": 100,
"runUnit": "day",
"runInterval": 7,
"rank": 3,
"value": 2500
}
}
},
"mostActiveWeek": {
"start": "2024-03-11",
"end": "2024-03-17",
"metrics": {
"words-written": {
"name": "Words Written",
"units": "words",
"currentTotal": 15000,
"changeThisPeriod": 8500,
"percentChange": 130,
"percentileThisPeriod": 95,
"byAttribute": {}
}
},
"points": {
"xp-system": {
"name": "Experience Points",
"description": "Points earned through activity",
"currentTotal": 5000,
"changeThisPeriod": 1200,
"percentChange": 31.5,
"percentileThisPeriod": 88
}
},
"achievements": [],
"leaderboards": {}
},
"mostActiveMonth": {
"month": 2,
"metrics": {
"words-written": {
"name": "Words Written",
"units": "words",
"currentTotal": 15000,
"changeThisPeriod": 12000,
"percentChange": 400,
"percentileThisPeriod": 92,
"byAttribute": {}
}
},
"points": {
"xp-system": {
"name": "Experience Points",
"description": "Points earned through activity",
"currentTotal": 5000,
"changeThisPeriod": 2000,
"percentChange": 66.6,
"percentileThisPeriod": 85
}
},
"achievements": [],
"leaderboards": {}
},
"entireYear": {
"metrics": {
"words-written": {
"name": "Words Written",
"units": "words",
"currentTotal": 150000,
"changeThisPeriod": 150000,
"percentChange": 100,
"percentileThisPeriod": 78,
"byAttribute": {}
}
},
"points": {
"xp-system": {
"name": "Experience Points",
"description": "Points earned through activity",
"currentTotal": 25000,
"changeThisPeriod": 25000,
"percentChange": 100,
"percentileThisPeriod": 82
}
},
"achievements": [
{
"id": "5100fe51-6bce-6j44-b0hs-bddc4e123682",
"name": "500 Words Written",
"trigger": "metric",
"description": "Write 500 words in a single day",
"badgeUrl": "https://example.com/badge.png",
"key": "500-words",
"metricId": "metric-123",
"metricValue": 500,
"metricName": "Words Written",
"achievedAt": "2024-03-15T14:30:00Z",
"completions": 150,
"rarity": 15
}
],
"leaderboards": {},
"longestStreak": {
"length": 45,
"frequency": "daily",
"periodStart": "2024-02-01",
"periodEnd": "2024-03-17",
"started": "2024-02-01"
}
}
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Users
Get a user's wrapped data
Get a user’s year-in-review wrapped data.
GET
/
users
/
{id}
/
wrapped
JavaScript
import { TrophyApiClient } from '@trophyso/node';
const trophy = new TrophyApiClient({
apiKey: 'YOUR_API_KEY'
});
const response = await trophy.users.wrapped("user-123", {
year: 2024
});from trophy import TrophyApi
client = TrophyApi(api_key='YOUR_API_KEY')
response = client.users.wrapped(id="user-123", year=2024)import (
"context"
api "github.com/trophyso/trophy-go"
trophyclient "github.com/trophyso/trophy-go/client"
"github.com/trophyso/trophy-go/option"
)
client := trophyclient.NewClient(
option.WithApiKey("YOUR_API_KEY"),
)
response, err := client.Users.Wrapped(
context.TODO(),
"user-123",
&api.UsersWrappedRequest{Year: api.Int(2024)},
)curl --request GET \
--url https://api.trophy.so/v1/users/{id}/wrapped \
--header 'X-API-KEY: <api-key>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.trophy.so/v1/users/{id}/wrapped",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.trophy.so/v1/users/{id}/wrapped")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trophy.so/v1/users/{id}/wrapped")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"user": {
"id": "user-123",
"email": "user@example.com",
"name": "John Doe",
"tz": "America/New_York",
"subscribeToEmails": true,
"created": "2024-01-15T10:30:00Z",
"updated": "2024-06-20T14:45:00Z",
"control": false,
"attributes": {
"plan-type": "premium",
"region": "us-east"
}
},
"activity": {
"daysActive": 156,
"weeksActive": 42,
"monthsActive": 11,
"mostActiveDay": {
"date": "2024-03-15",
"metrics": {
"words-written": {
"name": "Words Written",
"units": "words",
"currentTotal": 15000,
"changeThisPeriod": 2500,
"percentChange": 20,
"byAttribute": {}
}
},
"points": {
"xp-system": {
"name": "Experience Points",
"description": "Points earned through activity",
"currentTotal": 5000,
"changeThisPeriod": 500,
"percentChange": 11.1
}
},
"achievements": [
{
"id": "5100fe51-6bce-6j44-b0hs-bddc4e123682",
"name": "500 Words Written",
"trigger": "metric",
"description": "Write 500 words in a single day",
"badgeUrl": "https://example.com/badge.png",
"key": "500-words",
"metricId": "metric-123",
"metricValue": 500,
"metricName": "Words Written",
"achievedAt": "2024-03-15T14:30:00Z",
"completions": 150,
"rarity": 15
}
],
"leaderboards": {
"weekly-words": {
"id": "leaderboard-123",
"name": "Weekly Word Count",
"key": "weekly-words",
"rankBy": "metric",
"metricKey": "words-written",
"metricName": "Words Written",
"description": "Weekly writing competition",
"start": "2024-03-11",
"end": "2024-03-17",
"maxParticipants": 100,
"runUnit": "day",
"runInterval": 7,
"rank": 3,
"value": 2500
}
}
},
"mostActiveWeek": {
"start": "2024-03-11",
"end": "2024-03-17",
"metrics": {
"words-written": {
"name": "Words Written",
"units": "words",
"currentTotal": 15000,
"changeThisPeriod": 8500,
"percentChange": 130,
"percentileThisPeriod": 95,
"byAttribute": {}
}
},
"points": {
"xp-system": {
"name": "Experience Points",
"description": "Points earned through activity",
"currentTotal": 5000,
"changeThisPeriod": 1200,
"percentChange": 31.5,
"percentileThisPeriod": 88
}
},
"achievements": [],
"leaderboards": {}
},
"mostActiveMonth": {
"month": 2,
"metrics": {
"words-written": {
"name": "Words Written",
"units": "words",
"currentTotal": 15000,
"changeThisPeriod": 12000,
"percentChange": 400,
"percentileThisPeriod": 92,
"byAttribute": {}
}
},
"points": {
"xp-system": {
"name": "Experience Points",
"description": "Points earned through activity",
"currentTotal": 5000,
"changeThisPeriod": 2000,
"percentChange": 66.6,
"percentileThisPeriod": 85
}
},
"achievements": [],
"leaderboards": {}
},
"entireYear": {
"metrics": {
"words-written": {
"name": "Words Written",
"units": "words",
"currentTotal": 150000,
"changeThisPeriod": 150000,
"percentChange": 100,
"percentileThisPeriod": 78,
"byAttribute": {}
}
},
"points": {
"xp-system": {
"name": "Experience Points",
"description": "Points earned through activity",
"currentTotal": 25000,
"changeThisPeriod": 25000,
"percentChange": 100,
"percentileThisPeriod": 82
}
},
"achievements": [
{
"id": "5100fe51-6bce-6j44-b0hs-bddc4e123682",
"name": "500 Words Written",
"trigger": "metric",
"description": "Write 500 words in a single day",
"badgeUrl": "https://example.com/badge.png",
"key": "500-words",
"metricId": "metric-123",
"metricValue": 500,
"metricName": "Words Written",
"achievedAt": "2024-03-15T14:30:00Z",
"completions": 150,
"rarity": 15
}
],
"leaderboards": {},
"longestStreak": {
"length": 45,
"frequency": "daily",
"periodStart": "2024-02-01",
"periodEnd": "2024-03-17",
"started": "2024-02-01"
}
}
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Headers
The tenant identifier for multi-tenant organisations. Required when the organisation has multi-tenancy enabled. The value should be your internal ID for the tenant. Ignored for single-tenant organisations.
Path Parameters
The user's ID in your database.
Query Parameters
The year to get wrapped data for. Defaults to the current year. Must be an integer between 1 and the current year.
Required range:
x >= 1Response
Successful operation
A user's year-in-review wrapped data including activity summaries, metrics, points, achievements, streaks, and leaderboard rankings.
Was this page helpful?
⌘I