Skip to main content
PUT
JavaScript

Authorizations

X-API-KEY
string
header
required

Headers

Tenant-ID
string

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

id
string
required

ID of the user to identify.

Body

application/json

The user object.

email
string

The user's email address. Required if subscribeToEmails is true.

Example:

"user@example.com"

name
string

The name to refer to the user by in emails.

Example:

"User"

tz
string | null

The user's timezone (used for email scheduling).

Example:

"Europe/London"

deviceTokens
string[] | null

The user's device tokens, used for push notifications.

The device token.

Example:
subscribeToEmails
boolean
default:true

Whether the user should receive Trophy-powered emails. If false, Trophy will not store the user's email address.

Example:

true

attributes
object

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

Example:

Response

Upserted 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"

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:
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"

deviceTokens
string[] | null

The user's device tokens.

The device token.

Example: