analytics37 ops

Analytics API

Earnings, performance metrics, and driver / merchant analytics.

Queries

QUERY

accountsByRole

#

Get distribution of accounts by role. Returns count and percentage of accounts for each role (Admin, Customer, Driver, Merchant, etc.)

Arguments

  • input!

    Default

    {
      "app": null
    }
Returns!
QUERY

activityDistribution

#

Get activity distribution (active vs inactive users). Shows breakdown of users by activity status based on configurable threshold.

Arguments

  • input!

    Default

    {
      "actorType": null,
      "app": null,
      "activityDays": 0
    }
Returns!
QUERY

adminListOnlineSessions

#

List online sessions with optional filtering. Useful for browsing all sessions across multiple accounts.

Arguments

  • input!
Returns!
QUERY

adminOnlineTimesheet

#

Get online timesheet for a specific account. Returns daily breakdown of online sessions within the specified date range. Sessions spanning midnight are automatically split across days. Active sessions are included with duration up to current time.

Arguments

  • input!
Returns!
QUERY

allDriverMetrics

#

Query all drivers metrics for the tenant.

Arguments

  • input!
Returns[!]!
QUERY

compareDrivers

#

Compare performance metrics for multiple drivers.

Arguments

  • input!
Returns[!]!
QUERY

countryDistribution

#

Get country distribution. Shows geographic breakdown of users by country.

Arguments

  • input!

    Default

    {
      "actorType": null,
      "app": null,
      "period": "LAST7_DAYS"
    }
Returns!
QUERY

dashboardStatistics

#

Get unified dashboard statistics for admin dashboards. Returns 4 key metrics (total earnings, active actors, average rating, completed orders) with current values, comparison to previous period, and sparkline data for trend visualization. # Arguments * input - Query parameters including actor type, time period, and currency # Returns Unified dashboard statistics for display

Arguments

  • input!
Returns!
QUERY

driverEarningsChart

#

Get earnings chart data for a specific driver (admin view, simple non-paginated). Returns data points suitable for chart visualization with the specified timeframe: - WEEKLY: Last 7 days with daily data points - MONTHLY: Last 30 days with daily data points - YEARLY: Last 365 days with monthly data points Each data point includes earnings, rides, avg earnings per ride, and online hours. # Security This endpoint is for admin use - requires appropriate permissions to view driver data. # Deprecation Consider using driverEarningsChartPaginated for better pagination and comparison support.

Arguments

  • driverId!

    Driver ID to query earnings for

  • timeframe!

    Timeframe for chart data

Returns!
QUERY

driverEarningsChartPaginated

#

Get paginated earnings chart data for a specific driver (admin view). Returns one "page" of earnings data aligned to period boundaries: - WEEKLY: One week (Monday to Sunday) with daily data points - MONTHLY: One calendar month with daily data points - YEARLY: One calendar year with monthly data points Use endBefore cursor to navigate to older periods. Use includePreviousPeriod to get comparison data (earnings/rides change vs previous period). # Security This endpoint is for admin use - requires appropriate permissions to view driver data.

Arguments

  • driverId!

    Driver ID to query earnings for

  • input!
Returns!
QUERY

driverMetrics

#

Query driver metrics for a specific driver.

Arguments

  • input!
Returns[!]!
QUERY

genderDistribution

#

Get gender distribution. Shows breakdown of users by gender (Male, Female, Other, Not Specified).

Arguments

  • input!

    Default

    {
      "actorType": null,
      "app": null,
      "period": "LAST7_DAYS"
    }
Returns!
QUERY

myEarningsChart

#

Get paginated earnings chart data for the authenticated driver. Returns one "page" of earnings data aligned to period boundaries: - WEEKLY: One week (Monday to Sunday) with daily data points - MONTHLY: One calendar month with daily data points - YEARLY: One calendar year with monthly data points Use endBefore cursor to navigate to older periods. Use includePreviousPeriod to get comparison data (earnings/rides change vs previous period). # Security This endpoint is scoped to the authenticated driver - drivers can only see their own data.

Arguments

  • input!
Returns!
QUERY

myPerformance

#

Get my performance metrics and trends Returns comprehensive performance data for the authenticated driver including: - All-time operational KPIs - Historical daily metrics for the specified period - Performance trends (recent 7 days vs previous 7 days) # Security This endpoint is scoped to the authenticated driver - drivers can only see their own data.

Arguments

  • periodDaysInt!

    Number of days of historical data to fetch

    Default

    30
Returns!
QUERY

myStatsSummary

#

Get a quick summary of my current stats Returns just the operational KPIs without historical data. Useful for dashboard widgets or quick status checks.

Returns!
QUERY

orderAuditTrail

#

Discrete order lifecycle events with location snapshots (from PostgreSQL). Returns events like DriverAccepted, DriverArrived, RideStarted, etc. with driver and passenger positions at each moment.

Arguments

  • orderId!
Returns[!]!
QUERY

orderLocationTrail

#

Continuous GPS breadcrumb trail during an active order (from ClickHouse). Returns the full movement path of the driver, with computed total distance.

Arguments

  • orderId!
  • from
  • to
Returns!
QUERY

orderMetricsSummary

#

Get summary metrics for order dashboard cards. Returns 4 key metrics (total orders, total revenue, completion rate, average order value) with current values, comparison to previous period, and sparkline data for trend visualization. # Arguments * input - Query parameters including order kind filter, time period, and optional currency # Returns Summary of order metrics for dashboard display

Arguments

  • input!

    Default

    {
      "kind": null,
      "period": "LAST7_DAYS",
      "fromDate": null,
      "toDate": null
    }
Returns!
QUERY

ordersByKind

#

Get distribution of orders by kind. Returns breakdown of orders grouped by kind (Taxi, Shop, Parking, Service) with counts, percentages, and comparison to previous period. # Arguments * input - Query parameters including time period and whether to include revenue # Returns Order kind distribution with counts, percentages, and period comparison

Arguments

  • input!

    Default

    {
      "period": "LAST7_DAYS",
      "includeRevenue": false
    }
Returns!
QUERY

orderStatusDistribution

#

Get distribution of orders by status. Returns breakdown of orders grouped by status (Finished, DriverCanceled, RiderCanceled, etc.) with counts and percentages for each status. # Arguments * input - Query parameters including order kind filter and time period # Returns Order status distribution with counts and percentages

Arguments

  • input!

    Default

    {
      "kind": null,
      "period": "LAST7_DAYS",
      "fromDate": null,
      "toDate": null
    }
Returns!
QUERY

orderVolumeByKind

#

Get order volume time series grouped by order kind. Returns time-bucketed order counts for each kind (Taxi, Shop, Parking, Service), along with aggregated totals and period-over-period comparisons. Ideal for rendering stacked area charts or line charts. The aggregation interval is automatically determined based on the period: - Today: hourly buckets - Last 7 days, Last 30 days, This month, Last month: daily buckets - This year: monthly buckets # Arguments * input - Query parameters including time period, kind filter, and optional custom dates # Returns Order volume time series with per-kind breakdown and aggregated totals

Arguments

  • input!

    Default

    {
      "period": "LAST7_DAYS",
      "kinds": null,
      "currency": null,
      "fromDate": null,
      "toDate": null
    }
Returns!
QUERY

platformDistribution

#

Get platform distribution (iOS, Android, Web). Shows how users are distributed across different platforms.

Arguments

  • input!

    Default

    {
      "actorType": null,
      "app": null,
      "period": "LAST7_DAYS"
    }
Returns!
QUERY

platformExpenseBreakdownHistory

#

Get expense breakdown by category over time. Groups expenses by category (PAYOUTS, REFUNDS, PROMOTIONS, PARTNER_SHARES, CHARGEBACKS, OTHER) and returns time-bucketed data. # Arguments * input - Query parameters including currency and chart filter (date range, period) # Returns Vector of expense entries, one per (category, time_bucket) combination

Arguments

  • input!
Returns[!]!
QUERY

platformRevenueExpenseHistory

#

Get revenue vs expense over time. Returns time-bucketed revenue and expense totals with net income for financial comparison charts. # Arguments * input - Query parameters including currency and chart filter (date range, period) # Returns Vector of revenue/expense entries, one per time bucket

Arguments

  • input!
Returns[!]!
QUERY

platformWalletBalanceHistory

#

Get platform wallet balance history over time. Returns time series of platform wallet balances with summary statistics (start, end, min, max, average, percent change). # Arguments * input - Query parameters including currency and chart filter (date range, period) # Returns Financial timeline with points and summary

Arguments

  • input!
Returns!
QUERY

popularRegionsByOrders

#

Get the most popular regions by taxi order count. Returns regions ranked by the number of completed taxi orders originating from each region, limited to the top 10.

Arguments

  • limitInt!

    Default

    10
Returns[!]!
QUERY

retentionMetrics

#

Get retention metrics for user cohorts. Shows retention rates at 1, 7, 30, and 90 days.

Arguments

  • input!

    Default

    {
      "actorType": null,
      "cohortPeriod": "LAST7_DAYS"
    }
Returns!
QUERY

revenueByApp

#

Get revenue breakdown by app. Shows revenue per app with optional filtering by actor type and time period.

Arguments

  • input!

    Default

    {
      "actorType": null,
      "app": null,
      "period": "LAST7_DAYS"
    }
Returns!
QUERY

revenueMetrics

#

Query revenue metrics for the authenticated tenant.

Arguments

  • input!
Returns[!]!
QUERY

rideMetrics

#

Query ride metrics for the authenticated tenant.

Arguments

  • input!
Returns[!]!
QUERY

topDrivers

#

Query top performing drivers by metric.

Arguments

  • input!
Returns[!]!
QUERY

topSpenders

#

Get top spenders/earners leaderboard. For customers: shows top spenders by total spending. For drivers/merchants: shows top earners by total earnings.

Arguments

  • input!
Returns!
QUERY

totalExpenses

#

Get total platform expenses with daily breakdown. Aggregates expenses including payouts, refunds, promotions, partner shares, and chargebacks from ledger entries. # Arguments * input - Query parameters including currency and time period # Returns Total expenses with daily sparkline and period comparison

Arguments

  • input!
Returns!
QUERY

totalOutstandingUserBalances

#

Get total outstanding user balances with daily breakdown. Sum of all customer wallet balances at the current time. Daily breakdown shows historical balance totals. # Arguments * input - Query parameters including currency and time period # Returns Total outstanding balances with daily sparkline

Arguments

  • input!
Returns!
QUERY

totalRevenue

#

Get total platform revenue with daily breakdown. Aggregates revenue from platform wallet credits with revenue-related ledger purposes (PLATFORM_REVENUE_CREDIT, etc.). # Arguments * input - Query parameters including currency and time period # Returns Total revenue with daily sparkline and period comparison

Arguments

  • input!
Returns!
QUERY

usersByApp

#

Get distribution of users by app (Taxi, Shop, Parking, etc.) Optionally filter by actor type (Customer, Driver, etc.)

Arguments

  • input!

    Default

    {
      "actorType": null,
      "app": null,
      "period": "LAST7_DAYS"
    }
Returns!

Mutations

MUTATION

naturalLanguageAnalyticsQuery

#

Run a natural-language analytics question. The model picks a structured plan from a closed enum; the application executes the plan against the existing analytics repos. Admin-only. Requires the tenant to have nl_analytics_enabled turned on under Settings → AI Features and at least one configured AI provider with a remaining monthly budget.

Arguments

  • input!
Returns!

Build the foundation once. Expand without limits.

BetterSuite is built for teams who see on-demand as a business — not a feature.