Analytics API
The Analytics API returns sales, member, online-visitor and onsite-visitor figures for a date range, records storefront events, and manages reports that are generated and emailed on a schedule.
Resources¶
| Resource | What it is |
|---|---|
| Metric | A set of figures for a date range, such as total revenue or visitors by device, usually with a daily trend. |
| Dashboard | Orders, ticket groups, customers and recent notifications in one answer. |
| Event | One storefront interaction (for example a page view) recorded through the public tracking endpoint. |
| Report | A saved definition of which figures to send, to whom, how often and in which file formats. |
| Report file | A file (PDF, Excel or CSV) generated from a report. |
Authentication and permissions¶
All routes need an access token except event tracking. See Authentication.
| Action | Permission |
|---|---|
| Dashboard, sales, member, online-visitor and onsite-visitor figures | workspace:analytics:view |
| Create, read, update, delete, generate and preview reports; list, download and delete report files; list report options | workspace:reports:manage |
| Track an event | Public: no token needed |
The permission is checked in the ticketing workspace of your deployment, not in a workspace you pass in the path.
Base path¶
Analytics routes are served by CoreAPI without /v1 and without a workspace ID:
https://<API_HOST>/api/dashboard
https://<API_HOST>/api/analytics/…
https://<API_HOST>/api/report… and https://<API_HOST>/api/reports…
Capabilities¶
- Dashboard summary in one call
- Sales: revenue, orders, average order value, top ticket group, and splits by ticket group, age group, payment method, nationality and ticket variant
- Members: totals, new members, net growth, splits by age group and nationality
- Online visitors: unique visitors, new and returning, peak time, peak day, session duration, device
- Onsite visitors: gate scans, new and returning, average by weekday, and splits by attraction, age group and nationality
- Event tracking from the browser (public)
- Reports by email on a schedule, and generation on demand, as PDF, Excel or CSV
- Pagination of report lists (planned)
Object model¶
Metric requests¶
Every figure route is a GET with these query parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
startDate |
string | yes | First day of the period, YYYY-MM-DD. |
endDate |
string | yes | Last day of the period, YYYY-MM-DD, included. |
ticketGroupId |
integer | no | Only on salesByTicketVariant: limit the figures to one ticket group. |
Answers are { "respCode": 2000, "respDesc": "Success", "result": { … } }. For example totalRevenue:
{
"respCode": 2000,
"respDesc": "Success",
"result": {
"sumTotalRevenue": 12450.0,
"revenueTrend": [ { "date": "2026-07-01", "totalRevenue": 830.0 } ]
}
}
Report¶
| Field | Type | Required | Description |
|---|---|---|---|
reportId |
integer | read-only | ID of the report. |
title |
string | yes | Report name. |
type |
string | yes | What it covers, see Report types. Can't be changed later. |
dataOptions |
array of string | yes | Which figures to include. List the allowed values with GET /api/reports/data-options?type=<TYPE>. |
frequency |
string | yes | How often it is generated and emailed, see Frequencies. |
emailTo |
string | yes | Recipient email address. |
desc |
string | no | Free text. |
format |
array of string | yes | File formats: excel, csv, pdf. |
attractionIds |
array of integer | no | Limit to these ticket groups. Empty means all. |
productIds |
array of string | no | Limit to these products, <ticketGroupId>\|<name>. Empty means all. Values come from GET /api/reports/scope-options. |
reportingPeriodType |
string | yes | The dates it covers, see below. |
scheduleTime |
string | yes | Time of day it runs, HH:MM, Malaysia time (UTC+8). |
scheduleDayOfWeek |
integer | for weekly |
0 (Sunday) to 6 (Saturday). |
scheduleDayOfMonth |
string | for monthly |
1 to 28, or last. |
scheduleMonth, scheduleDay |
integer | for annual |
Month 1 to 12, day 1 to 28. |
isDeleted |
boolean | read-only | true after a delete. |
lastDateSeen |
string | read-only | When it was last generated and sent. |
attachments |
array | read-only | The report's files (below). |
createdAt, updatedAt |
string | read-only | ISO 8601 UTC. |
reportingPeriodType values: previous_day, previous_week, previous_month, previous_quarter and
previous_year (the last full period), and wtd, mtd, qtd, ytd (week, month, quarter or year to date, up to
yesterday).
Report types¶
type |
Covers |
|---|---|
sales |
Revenue and orders |
members |
Customer registrations |
online_visitors |
Storefront traffic |
onsite_visitors |
Gate scans |
Frequencies¶
frequency |
Runs |
|---|---|
daily |
Every day at scheduleTime |
weekly |
On scheduleDayOfWeek |
monthly |
On scheduleDayOfMonth |
quarterly |
On the 1st of January, April, July and October |
annual |
On scheduleMonth and scheduleDay |
Report file¶
| Field | Type | Description |
|---|---|---|
reportAttachmentId |
integer | ID of the file. Use it to download or delete. |
title, type |
string | The report's title and type. |
emailTo |
string | Where it was sent. |
attachmentName |
string | File name. |
attachmentSize |
integer | Size in bytes. |
contentType |
string | Media type of the file. |
generatedDate |
string | When it was generated. |
{
"reportId": 12,
"title": "Monthly sales",
"type": "sales",
"dataOptions": ["sales", "orders", "average_order_value"],
"frequency": "monthly",
"emailTo": "manager@example.com",
"desc": "Sent on the 1st of each month",
"format": ["pdf"],
"attractionIds": [],
"productIds": [],
"reportingPeriodType": "previous_month",
"scheduleTime": "08:00",
"scheduleDayOfWeek": 1,
"scheduleDayOfMonth": "1",
"scheduleMonth": 1,
"scheduleDay": 1,
"isDeleted": false,
"lastDateSeen": null,
"createdAt": "2026-07-01T02:00:00Z",
"updatedAt": "2026-07-01T02:00:00Z",
"attachments": []
}
Lists¶
The figure routes return one answer for the period, not a list. The report routes return arrays inside the usual
envelope, in result. None of them is paginated: each returns all items, newest first (highest ID first).
- List reports returns every report that isn't deleted. Add
typeorfrequencyto filter; when both are sent,typeis used andfrequencyis ignored. - List all report files returns the files of every report. List the files of a report returns one report's files.
{
"respCode": 2000,
"respDesc": "Success",
"result": [
{
"reportId": 12,
"title": "Monthly sales",
"type": "sales",
"dataOptions": ["sales", "orders", "average_order_value"],
"frequency": "monthly",
"emailTo": "manager@example.com",
"format": ["pdf"],
"reportingPeriodType": "previous_month",
"scheduleTime": "08:00",
"scheduleDayOfMonth": "1",
"isDeleted": false,
"attachments": []
}
]
}
The report is shortened here; each item has every field of the report object above.
Tracked event¶
Send this body to POST /api/analytics/track. The endpoint is public: no token, so call it directly from the browser.
| Field | Type | Required | Description |
|---|---|---|---|
timestamp |
string | yes | When the event happened, ISO 8601 UTC. |
event |
string | yes | Event name, for example page_view. |
user_id |
string | yes | An ID that identifies the visitor. |
session_id |
string | yes | An ID for the visitor's session. |
device_type |
string | yes | For example mobile or desktop. |
properties |
object | no | Any extra values to record. |
Errors¶
Successful answers use respCode 2000. Errors from these routes are plain JSON with an error text and, when it
helps, fields (a map of field name to message), details or message. They don't use respCode. Missing or wrong
tokens answer { "message": "…" }.
| Status | When it happens | What to do |
|---|---|---|
| 400 | startDate or endDate is missing; a report field is invalid; a tracked event misses a required field. |
Fix the request using error and fields. |
| 401 | No valid access token. | Sign in again. |
| 403 | Your role lacks workspace:analytics:view or workspace:reports:manage. |
Ask an admin for the permission. |
| 404 | The report or report file doesn't exist. | Check the ID. |
| 500 | The figures, report or event couldn't be produced or stored. On the sales routes this is also the answer for a date that isn't YYYY-MM-DD; message says which. |
Check the dates, then retry later. |
{ "error": "Validation failed", "fields": { "startDate": "startDate is required" } }
A missing report file answers 404 with { "error": "Attachment not found" }.
{ "error": "Failed to retrieve total revenue", "message": "invalid startDate format. Expected yyyy-MM-dd, got: 2026/07/01" }
Endpoints¶
Related¶
- Commerce API: the orders behind the sales figures
- Identity API: the customers behind the member figures
- API conventions
- Changelog