Skip to content

Analytics API

Access revenue and sales analytics data.

Revenue Statistics

http
GET /api/external/v1/analytics/revenue

Query Parameters

ParameterTypeDescription
fromstringStart date (YYYY-MM-DD)
tostringEnd date (YYYY-MM-DD)
granularitystringday, week, month (default: day)

Example Request

bash
curl -X GET "https://yourstore.pixlpay.net/api/external/v1/analytics/revenue?from=2025-01-01&to=2025-01-31&granularity=day" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Response

json
{
  "success": true,
  "data": {
    "total_revenue": "2499.85",
    "total_orders": 87,
    "average_order_value": "28.73",
    "currency": "USD",
    "timeline": [
      {
        "date": "2025-01-01",
        "revenue": "89.97",
        "orders": 3
      },
      {
        "date": "2025-01-02",
        "revenue": "149.95",
        "orders": 5
      }
    ]
  }
}

Sales Statistics

http
GET /api/external/v1/analytics/sales

Query Parameters

ParameterTypeDescription
fromstringStart date (YYYY-MM-DD)
tostringEnd date (YYYY-MM-DD)
limitintegerNumber of top products (default: 10)

Example Request

bash
curl -X GET "https://yourstore.pixlpay.net/api/external/v1/analytics/sales?from=2025-01-01&to=2025-01-31" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Response

json
{
  "success": true,
  "data": {
    "total_items_sold": 125,
    "unique_customers": 72,
    "top_products": [
      {
        "id": 1,
        "name": "VIP Rank",
        "quantity_sold": 45,
        "revenue": "449.55"
      },
      {
        "id": 2,
        "name": "MVP Rank",
        "quantity_sold": 28,
        "revenue": "839.72"
      }
    ],
    "sales_by_category": [
      {
        "category": "Ranks",
        "quantity": 73,
        "revenue": "1289.27"
      },
      {
        "category": "Items",
        "quantity": 52,
        "revenue": "519.48"
      }
    ]
  }
}

Customer Analytics

http
GET /api/external/v1/analytics/customers

Query Parameters

ParameterTypeDescription
fromstringStart date (YYYY-MM-DD)
tostringEnd date (YYYY-MM-DD)

Example Request

bash
curl -X GET "https://yourstore.pixlpay.net/api/external/v1/analytics/customers?from=2025-01-01&to=2025-01-31" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Response

json
{
  "success": true,
  "data": {
    "new_customers": 45,
    "returning_customers": 27,
    "total_customers": 72,
    "average_lifetime_value": "34.72",
    "customer_retention_rate": "37.5"
  }
}

Response Fields

Revenue Object

FieldTypeDescription
total_revenuestringTotal revenue in period
total_ordersintegerNumber of orders
average_order_valuestringAverage order amount
currencystringCurrency code
timelinearrayRevenue by date

Sales Object

FieldTypeDescription
total_items_soldintegerTotal items sold
unique_customersintegerUnique customers
top_productsarrayBest selling products
sales_by_categoryarraySales grouped by category

Errors

StatusErrorDescription
401UnauthorizedInvalid or missing token
403ForbiddenToken lacks analytics:read scope
422UnprocessableInvalid date range

Built for game developers, by game developers.