Get public statistics
GET
/public/triggers/{id}/stats
const url = 'https://localhost:3000/api/v1/public/triggers/example/stats';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://localhost:3000/api/v1/public/triggers/example/statsReturns the statistics of a public trigger (no authentication)
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”id
required
string
Trigger ID (UUID)
Query Parameters
Section titled “Query Parameters”from
string
Start (default: now-1h)
to
string
End (default: now)
interval
string
Interval (default: 1m)
filter
string
JSON filter on metadata (reserved _* keys rejected)
Responses
Section titled “Responses”Event statistics
Media typeapplication/json
object
buckets
required
Array<object>
object
count
required
Count is the number of events (with measure=sum:
integer
time
required
string
value
Value is the sum of the key over the bucket, present with measure=sum:
number
from
required
string
measure
Measure is count, or sum:
string
to
required
string
total
required
integer
total_value
TotalValue is the sum over the window, present with measure=sum:
number
trigger_id
required
string format: uuid
Example
{ "buckets": [ { "count": 152, "time": "2024-01-15T10:00:00Z", "value": 1.25 } ], "from": "2024-01-15T09:30:00Z", "measure": "sum:cost_usd", "to": "2024-01-15T10:30:00Z", "total": 1523, "total_value": 12.5, "trigger_id": "550e8400-e29b-41d4-a716-446655440000"}Invalid request
Media typeapplication/json
object
error
required
string
message
string
Example
{ "error": "invalid_request", "message": "Invalid request body"}Trigger not found or not public
Media typeapplication/json
object
error
required
string
message
string
Example
{ "error": "invalid_request", "message": "Invalid request body"}Stats query timed out
Media typeapplication/json
object
error
required
string
message
string
Example
{ "error": "invalid_request", "message": "Invalid request body"}