Skip to main content
GET
/
users
/
{id}
JavaScript
import { TrophyApiClient } from '@trophyso/node';

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

const response = await trophy.users.get("user-id");
{
  "id": "user-id",
  "email": "user@example.com",
  "tz": "Europe/London",
  "subscribedToEmails": true,
  "created": "2021-01-01T00:00:00Z",
  "updated": "2021-01-01T00:00:00Z",
  "attributes": {
    "department": "engineering",
    "role": "developer"
  }
}

Authorizations

X-API-KEY
string
header
required

Path Parameters

id
string
required

ID of the user to get.

Response

Found user

A user of your application.

id
string
required

The ID of the user in your database. Must be a string.

Example:

"user-id"

email
string | null
required

The user's email address.

Example:

"user@example.com"

name
string | null
required

The name of the user.

Example:

"John Doe"

tz
string | null
required

The user's timezone.

Example:

"Europe/London"

deviceTokens
string[]
required

The user's device tokens.

The device token.

Example:
["token1", "token2"]
subscribeToEmails
boolean
required

Whether the user is opted into receiving Trophy-powered emails.

Example:

true

attributes
object
required

User attributes as key-value pairs. Keys must match existing user attributes set up in the Trophy dashboard.

Example:
{
"department": "engineering",
"role": "developer"
}
control
boolean
required

Whether the user is in the control group, meaning they do not receive emails or other communications from Trophy.

Example:

false

created
string<date-time>
required

The date and time the user was created, in ISO 8601 format.

Example:

"2021-01-01T00:00:00Z"

updated
string<date-time>
required

The date and time the user was last updated, in ISO 8601 format.

Example:

"2021-01-01T00:00:00Z"