cURL
Python
JavaScript
PHP
Go
Java
curl --request POST \
--url https://api.trench.dev/events \
--header 'Content-Type: application/json' \
--data '{
"events": [
{
"anonymousId": "guest-1234567890",
"event": "UserSignedUp",
"timestamp": "2021-01-01T00:00:00Z",
"type": "track",
"userId": "user-1234567890",
"groupId": "group-1234567890",
"properties": {
"page": "/home",
"referrer": "https://www.google.com"
},
"traits": {
"email": "john.doe@example.com",
"name": "John Doe"
},
"instanceId": "customer-1234567890"
}
]
}'
Trench is fully compatible with the
Segment Spec schema.
You can use the track
, identify
, and group
methods to send events to Trench via the /events
endpoint.
The event name. Used only with type: "track"
.
The timestamp of the event. Autogenerated if not provided.
The type of the event. Possible values: page
, track
, identify
, group
.
The properties of the event. Only used with type: "track"
.
Example: {
"page": "/home",
"referrer": "https://www.google.com"
}
The traits of the user or group.
Example: {
"email": "john.doe@example.com",
"name": "John Doe"
}
Optional instance ID. Instance IDs are used to partition events by source. It is typically used for isolating data for the same customer. For instance, if you have a SaaS product, you may want to segment events by customer. In this case, you can set the instance ID to the customer's organizaiton ID.
The events have been successfully created.