Saltar al contenido principal
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"
  }
}
Límites de tasa

Autorizaciones

X-API-KEY
string
header
requerido

Parámetros de ruta

id
string
requerido

ID of the user to get.

Respuesta

Found user

A user of your application.

id
string
requerido

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

Ejemplo:

"user-id"

email
string | null
requerido

The user's email address.

Ejemplo:

"user@example.com"

name
string | null
requerido

The name of the user.

Ejemplo:

"John Doe"

tz
string | null
requerido

The user's timezone.

Ejemplo:

"Europe/London"

subscribeToEmails
boolean
requerido

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

Ejemplo:

true

attributes
object
requerido

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

Ejemplo:
{
"department": "engineering",
"role": "developer"
}
control
boolean
requerido

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

Ejemplo:

false

created
string<date-time>
requerido

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

Ejemplo:

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

updated
string<date-time>
requerido

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

Ejemplo:

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

deviceTokens
string[] | null

The user's device tokens.

The device token.

Ejemplo:
["token1", "token2"]