Skip to content
Bakhtarian edited this page May 14, 2026 · 1 revision

Stats

The stats resource exposes analytics and metrics for a Whop company — letting you discover available metrics, query aggregated metric values, fetch raw data points, and run ad-hoc SQL queries against your analytics dataset.

This resource has an unusual shape: three of its methods are GET requests that pass parameters as a query string, while sql is a POST request that sends a request body.

SDK access

$client->stats // Matchable\Whop\Resource\StatsResource

Endpoints

describe(array $query = []): array

HTTP GET stats/describe
Does Describes the available stats — metrics, dimensions, and schema you can query.
Parameters $query — optional query-string filters. Optional (defaults to []).
Returns array

metric(array $query): array

HTTP GET stats/metric
Does Retrieves an aggregated metric value (e.g. revenue, signups) over a time range.
Parameters $query — query-string parameters selecting the metric, range, and grouping. Required.
Returns array

raw(array $query): array

HTTP GET stats/raw
Does Retrieves raw, un-aggregated stat data points.
Parameters $query — query-string parameters selecting the dataset and filters. Required.
Returns array

sql(array $data): array

HTTP POST stats/sql
Does Runs an ad-hoc SQL query against the company's analytics dataset.
Parameters $data — request body containing the SQL query (and any parameters). Required.
Returns array

Note: describe, metric, and raw are GET calls whose array argument is serialized into the query string. sql is a POST call whose array argument is sent as the request body.

Example

// Discover what's available.
$schema = $client->stats->describe();

// Aggregated metric over a date range.
$revenue = $client->stats->metric([
    'metric' => 'revenue',
    'start' => '2026-01-01',
    'end' => '2026-01-31',
]);

// Ad-hoc SQL query (POST body).
$result = $client->stats->sql([
    'query' => 'SELECT date, revenue FROM daily_revenue ORDER BY date DESC LIMIT 30',
]);

Reference

Official Whop documentation: https://docs.whop.com

Clone this wiki locally