Analytics API
Overview
Section titled “Overview”Get real-time business metrics powered by ClickHouse.
Methods
Section titled “Methods”getAnalytics(params, options?)
Section titled “getAnalytics(params, options?)”Get business analytics metrics.
const analytics = await arky.analytics.getAnalytics({ period: '30d', interval: 'total'});Parameters:
metrics(string[], optional): Specific metrics to fetch (revenue, orders, reservations, etc.)period(string, optional): Time period ('7d','30d','90d','365d')startDate(string, optional): Custom start date (ISO 8601)endDate(string, optional): Custom end date (ISO 8601)interval(string, optional): Aggregation interval ('total','day','week','month')
Response:
{ period: { start: string, end: string }, interval: string, dates: string[], metrics: { [key: string]: { values: number[], unit?: string, displayName: string, description?: string } }}Available metrics:
revenue- Total revenueorders,pending_orders,shipped_orders,completed_orders,cancelled_ordersreservations,pending_reservations,confirmed_reservations,completed_reservations,cancelled_reservationsactive_services,inactive_servicesactive_providers,inactive_providersactive_products,inactive_productstotal_users,active_users
Endpoint
Section titled “Endpoint”Base URL: /v1/analytics/{businessId}
Authentication: Required