Report List API
Fetch a list of available reports (by slug) that your office can run.
Important: Use the
slug to run a report. Display names are derived and may change.
Endpoint
GET/report/list
Returns the list of SQL-based reports discoverable on the server.
Authentication
Provide your API token in the request headers:
X-Api-Token: your_token_prefix.your_token_secret
Parameters
This endpoint does not require any query parameters.
Usage Examples
List available reports
GET /report/list
Response Format
{
"success": true,
"data": {
"reports": [
{
"slug": "flight_bookings_summary",
"display_name": "Flight Bookings Summary",
"last_modified": "2025-08-22 10:55:00"
}
]
},
"timestamp": "2025-08-22T00:00:00+00:00"
}
Fields
Report Item
| Field | Type | Description |
|---|---|---|
| slug | string | Stable identifier used to run the report (filename without .sql) |
| display_name | string | Human-readable name derived from the slug |
| last_modified | datetime | Last modified timestamp of the SQL file |
How to Run a Report
Use the slug from this list with the run endpoint. You can pass filters as query parameters where supported by the SQL template.
Run with date and branch filters
GET /report/run?report=flight_bookings_summary&startDate=2024-01-01&endDate=2024-12-31&branchID=5
Code Examples
JavaScript (Fetch)
const response = await fetch('/report/list', {
headers: { 'X-Api-Token': 'your_token_prefix.your_token_secret' }
});
const data = await response.json();
if (data.success) {
data.data.reports.forEach(r => {
console.log(`${r.slug} — ${r.display_name} (updated: ${r.last_modified})`);
});
}
PHP (cURL)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '/report/list');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['X-Api-Token: your_token_prefix.your_token_secret']);
$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);
if ($data['success']) {
foreach ($data['data']['reports'] as $r) {
echo "{$r['slug']} — {$r['display_name']} ({$r['last_modified']})" . PHP_EOL;
}
}
Python (requests)
import requests
headers = {'X-Api-Token': 'your_token_prefix.your_token_secret'}
resp = requests.get('/report/list', headers=headers)
data = resp.json()
if data['success']:
for r in data['data']['reports']:
print(f"{r['slug']} — {r['display_name']} (updated: {r['last_modified']})")