Skip to main content
POST
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. Pass your own internal customer ID for the tenant. Ignored for single-tenant organisations.

Body

application/json
Required array length: 1 - 1000 elements
key
string
required

Unique reference of the metric as set when created.

Example:

"words-written"

user
BatchMetricEventUser · object
required

The user that triggered the event.

value
number<double>
required

The value to add to the user's current total for the given metric.

Example:

750

attributes
object

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

Example:
idempotencyKey
string

Optional idempotency key for this event. When provided, the event is ignored if another event with the same idempotency key has already been processed.

Example:

"e4296e4b-8493-4bd1-9c30-5a1a9ac4d78f"

Response

Events accepted into the processing queue

Response returned when a batch of metric events is accepted.

accepted
integer
required

The number of events accepted into the processing queue.

Example:

1