/customers/trend - Get customers trend data

GET /customers/trend

Get trend analysis of customers over time with cumulative counts (Owner + Distributor + Reseller)

Query parameters

  • period integer

    Trend analysis period in days

    Values are 7, 30, 180, or 365. Default value is 7.

Responses

  • 200 application/json

    Customers trend data retrieved successfully

    Hide response attributes Show response attributes object
    • code integer
    • message string
    • data object
      Hide data attributes Show data attributes object
      • period integer

        Trend period in days

        Values are 7, 30, 180, or 365.

      • period_label string

        Human-readable period label

      • current_total integer

        Total count at the end of the period

      • previous_total integer

        Total count at the start of the period

      • delta integer

        Absolute change between start and end

      • delta_percentage number(float)

        Percentage change between start and end

      • trend string

        Trend direction

        Values are up, down, or stable.

      • data_points array[object]

        Time-series data points with cumulative counts

        Hide data_points attributes Show data_points attributes object
        • date string(date)

          Date for this data point

        • count integer

          Cumulative count at this date

  • 400 application/json

    Bad request - validation error

    Hide response attributes Show response attributes object
    • code integer

      HTTP error code

    • message string

      Error message

    • data object
      Hide data attributes Show data attributes object
      • type string

        Type of error

        Values are validation_error or external_api_error.

      • errors array[object]
        Hide errors attributes Show errors attributes object
        • key string

          Field name that failed validation

        • message string

          Error code or message

        • value string

          Value that failed validation

      • details

        Additional error details

  • 401 application/json

    Unauthorized - invalid or missing token

    Hide response attributes Show response attributes object
    • code integer
    • message string
    • data object | null
  • 403 application/json

    Forbidden - insufficient permissions

    Hide response attributes Show response attributes object
    • code integer
    • message string
    • data object | null
GET /customers/trend
curl \
 --request GET 'https://collect.your-domain.com/api/customers/trend' \
 --header "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
{
  "code": 200,
  "message": "customers trend retrieved successfully",
  "data": {
    "period": 7,
    "period_label": "7 days",
    "current_total": 15,
    "previous_total": 12,
    "delta": 3,
    "delta_percentage": 25.0,
    "trend": "up",
    "data_points": [
      {
        "date": "2025-10-28",
        "count": 15
      }
    ]
  }
}
Response examples (400)
{
  "code": 400,
  "message": "validation failed",
  "data": {
    "type": "validation_error",
    "errors": [
      {
        "key": "username",
        "message": "required",
        "value": "string"
      }
    ]
  }
}
Response examples (401)
{
  "code": 401,
  "message": "invalid token",
  "data": {}
}
Response examples (403)
{
  "code": 403,
  "message": "insufficient permissions",
  "data": {}
}