Query a site's analytics events
post
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
organizationIdstringRequiredPattern:
A unique entity identifier
^[a-zA-Z0-9_-]+$siteIdstringRequired
The unique id of the site
Body
rangeone ofRequired
string · enumOptionalPossible values:
limitinteger · min: 1 · max: 1000OptionalDefault:
1000Responses
200
Aggregated events in the site.
application/json
post/orgs/{organizationId}/sites/{siteId}/insights/events/aggregate
POST /v1/orgs/{organizationId}/sites/{siteId}/insights/events/aggregate HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 297
{
"select": [
{
"column": "datetime",
"interval": "hour"
}
],
"where": [
{
"column": "datetime",
"values": [
"2026-01-01T00:00:00.000Z"
]
},
{
"operator": "in"
}
],
"groupBy": [
{
"column": "datetime",
"interval": "hour"
}
],
"order": {
"by": {
"column": "datetime",
"interval": "hour"
},
"direction": "asc"
},
"range": "lastYear",
"limit": 1000
}200
Aggregated events in the site.
{
"columns": [
{
"column": "datetime",
"values": [
"2026-01-01T00:00:00.000Z"
]
}
]
}Last updated
Was this helpful?