Skip to main content
GET
/
events
Get events based on a query. Requires private API key in Bearer token.
curl --request GET \
  --url https://api.trench.dev/events
import requests

url = "https://api.trench.dev/events"

response = requests.get(url)

print(response.text)
const options = {method: 'GET'};

fetch('https://api.trench.dev/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.trench.dev/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.trench.dev/events"

req, _ := http.NewRequest("GET", url, nil)

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.trench.dev/events")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.trench.dev/events")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
{
  "limit": 123,
  "offset": 123,
  "total": 123,
  "results": [
    {
      "uuid": "123",
      "type": "track",
      "event": "user_signed_up",
      "userId": "user-123",
      "groupId": "group-456",
      "anonymousId": "anon-789",
      "instanceId": "instance-101112",
      "properties": {
        "key": "value"
      }
    }
  ]
}
This endpoint requires your private API key.

Query Parameters

event
string

The event name to filter by.

Example:

"Created Account"

uuid
string

The UUID to filter by.

Example:

"123e4567-e89b-12d3-a456-426614174000"

userId
string

The user ID to filter by.

Example:

"user-123"

groupId
string

The group ID to filter by.

Example:

"group-456"

anonymousId
string

The anonymous ID to filter by.

Example:

"anon-789"

instanceId
string

The instance ID to filter by.

Example:

"instance-101112"

startDate
string

The start date to filter by.

Example:

"2022-01-01T00:00:00Z"

endDate
string

The end date to filter by.

Example:

"2022-12-31T23:59:59Z"

limit
number

The limit of records to return.

Example:

100

offset
number

The offset of records to return.

Example:

0

orderByField
string

The field to order by.

Example:

"timestamp"

orderByDirection
enum<string>

The direction to order by.

Available options:
ASC,
DESC
Example:

"ASC"

Response

200 - application/json

The events have been successfully retrieved.

limit
number | null
required

The limit of the pagination.

offset
number | null
required

The offset of the pagination.

total
number | null
required

The total number of results. If null, the total is unknown.

results
object[]
required

The events found based on the query.

Example:
[
{
"uuid": "123",
"type": "track",
"event": "user_signed_up",
"userId": "user-123",
"groupId": "group-456",
"anonymousId": "anon-789",
"instanceId": "instance-101112",
"properties": { "key": "value" }
}
]