Stats API
Overviewβ
Stats is the real-time connectivity performance dashboard of Travelgate. It is designed to monitor connection performance and quickly troubleshoot traffic issues by providing detailed data per connection and method.
This document details the steps to extract and query metrics using the Travelgate Stats API.
For all Stats API calls, it is required to first retrieve the bearer token using the admin { jwt } query. The returned token must be included in the header of subsequent requests: Authorization: Bearer <your_jwt>.
Considerations & Business Rulesβ
- "OK" Status vs. Reservation Status: The "OK" data in Stats only indicates that the transaction was technically successful. It does not reflect the actual booking status of a reservation. To know the real status, you must perform a BookingRead operation.
- The "Other" Operation: The
OTHERcategory covers operations outside the standard booking flow. For HotelX, these are equivalent to:- Hotels Query (HotelList, DescriptiveInfo)
- Booking Read and Booking List (ReservationRead, ReservationList)
- Rooms Query and Boards Query (RoomList, MealPlanList)
- Traffic Types: When filtering your Stats, you can use the
trafficType_inparameter:BASIC,SPEED,SCHEDULER, orOPTIMIZED.
Query Overviewβ
The Stats API offers several methods to retrieve information, depending on the level of detail and grouping you need:
1. getAggregationStatsβ
Primary query used to retrieve grouped statistical data (hits, time, errors) based on specific criteria. It is commonly used to render charts, graphs, and aggregated data tables.
2. getRealTimeRangeStatsβ
Used for real-time monitoring of requests and metrics in updated, smaller time blocks.
A. Where (Filters)β
The where input allows you to precisely filter the statistics based on time range, buyers, APIs, or traffic types.
{
"where": {
"mode": "BUYER",
"buyer_in": ["BUYER_CODE"],
"operationType_in": ["SEARCH"],
"timeRange": {
"absolute": {
"from": "2026-04-14 00:00:00",
"to": "2026-04-14 12:00:00"
}
}
}
}
Mandatory criteria:
mode(Search perspective, eitherBUYERorSELLER).timeRange(Absolute date range using the format"YYYY-MM-DD HH:mm:ss").
B. Group Byβ
The groupBy input defines how the returned data will be aggregated.
{
"groupBy": {
"data": ["OPERATION_TYPE"]
}
}
Optional grouping:
data: Fields by which to group the results (e.g.,OPERATION_TYPE,BUYER,SELLER).time: Temporal grouping likeMINUTE,HOUR,DAY.
Examplesβ
In the following examples, you can see how to extract different types of stats using the interactive playground.
Example 1: Aggregation Stats (getAggregationStats)β
Primary query used to retrieve grouped statistical data based on specific criteria.
Β
Example 2: Real Time Stats (getRealTimeRangeStats)β
Used for real-time monitoring of requests and metrics in small time blocks.
Β