**Version: 202201**

# Data Analysis By SPU

**POST** `/openapi/2024-07/data-analysis/spu`

Provides merchants with detailed insights into sales data, enabling data-driven decision-making by analyzing products by SPU.

## Request

**application/json**

**Body | Example**

**Body**

- `type` string (required)

  Analysis mode
  - `product`: Displays sales by spu
  - `variant`: Queries sales by sku
  - `collection`: Album page report
- `begin_time` int64 (required)

  The starting timestamp (in seconds) for retrieving analysis data. Must be a valid Unix timestamp and less than end_time. Logic
- `end_time` int64 (required)

  The ending timestamp (in seconds) for retrieving analysis data. Must be a valid Unix timestamp and greater than begin_time.
- `tz` float (required)

  Time zone, e.g. `8`
- `page` int32

  Page number
- `limit` int32

  Limit per page, default `50`, max `500`
- `sort_by` string

  Sort field
- `sort_direction` string

  Sorting direction: `asc` (ascending) or `desc` (descending).
- `collection_id` string

  The Collection ID uniquely identifies a group of products within a collection. When the collection id is passed, it is filtered based on the collection ID
- `keyword` string

  When the keyword is not empty, the product is filtered. Keywords will vaguely match these fields of the product: `title`, `id`, `brief`, `sku`, `spu`, `tags`, `note`
- `search_model` string

  The filtering mode can be `base` or `advanced`. The default value is `base`. If you select `advanced`, the `filters` filter takes effect
- `filters` json

  Conditions for advanced filtering mode

```json
{
  "type": "string",
  "begin_time": 0,
  "end_time": 0,
  "tz": 0,
  "page": 0,
  "limit": 0,
  "sort_by": "string",
  "sort_direction": "string",
  "collection_id": "string",
  "keyword": "string",
  "search_model": "string",
  "filters": "string"
}
```

## Responses

**200 | 400**

200

**application/json**

**Schema | Example | Result**

**Schema**

- `code` string

  **Example:** `200`
- `message` string

  **Example:** `OK`
- `count` integer

  **Default value:** `0`

  **Example:** `3`
- `data` object[]

  *   Array [

  - `utm_source` string

    **Example:**
  - `utm_medium` string

    **Example:**
  - `utm_campaign` string

    **Example:**
  - `utm_term` string

    **Example:**
  - `utm_content` string

    **Example:**
  - `image` string

    **Example:** `free/5d4c48f9e65ffab9e73efbf1fd37a0f3.jpg`
  - `title` string

    **Example:** `test1`
  - `order_count_original` integer

    **Default value:** `0`

    **Example:** `1`
  - `sales_count_original` integer

    **Default value:** `0`

    **Example:** `1`
  - `sales_total_original` integer

    **Default value:** `0`

    **Example:** `20`
  - `net_sales_total_original` integer

    **Default value:** `0`

    **Example:** `19`
  - `discount_original` integer

    **Default value:** `0`

    **Example:** `1`
  - `tax_original` integer

    **Default value:** `0`

    **Example:** `0`
  - `views_count_original` integer

    **Default value:** `0`

    **Example:** `1`
  - `add_to_cart_count_original` integer

    **Default value:** `0`

    **Example:** `1`
  - `views_rate_original` integer

    **Default value:** `0`

    **Example:** `50`
  - `add_to_cart_rate_original` integer

    **Default value:** `0`

    **Example:** `25`
  - `view_client_count_original` integer

    **Default value:** `0`

    **Example:** `1`
  - `add_cart_client_count_original` integer

    **Default value:** `0`

    **Example:** `1`
  - `add_to_cart_conversion_rate_original` integer

    **Default value:** `0`

    **Example:** `100`
  - `transform_rate_original` integer

    **Default value:** `0`

    **Example:** `100`
  - `product_id` string

    **Example:** `e2da343c-182c-4908-b009-557cea226829`
  - `brief` string

    **Example:**
  - `spu` string

    **Example:** `123`
  - `collection` string

    **Example:** `Collectionx_2022-06-2709`
  - `created_at` string

    **Example:** `2022-03-24 19:18:44`
  - `first_published_at` string

    **Example:**
  - `published_at` string

    **Example:** `2022-03-24 19:18:44`
  - `product_op_updated_at` string

    **Example:** `2023-08-21 15:43:34`
  - `published` boolean

    **Default value:** `true`

    **Example:** `true`
  - `order_count` string

    **Example:** `1`
  - `sales_count` string

    **Example:** `1`
  - `sales_total` string

    **Example:** `20.00`
  - `net_sales_total` string

    **Example:** `19.00`
  - `discount` string

    **Example:** `1.00`
  - `tax` string

    **Example:** `0.00`
  - `views_count` string

    **Example:** `1`
  - `add_to_cart_count` string

    **Example:** `1`
  - `views_rate` string

    **Example:** `50.00%`
  - `add_to_cart_rate` string

    **Example:** `25.00%`
  - `view_client_count` string

    **Example:** `1`
  - `add_cart_client_count` string

    **Example:** `1`
  - `add_to_cart_conversion_rate` string

    **Example:** `100.00%`
  - `transform_rate` string

    **Example:** `100.00%`
  - `seo_url` string

    **Example:** `/products/test1`
  *   ]

```json
{
  "code": "200",
  "message": "OK",
  "count": 3,
  "data": [
    {
      "utm_source": "",
      "utm_medium": "",
      "utm_campaign": "",
      "utm_term": "",
      "utm_content": "",
      "image": "free/5d4c48f9e65ffab9e73efbf1fd37a0f3.jpg",
      "title": "test1",
      "order_count_original": 1,
      "sales_count_original": 1,
      "sales_total_original": 20,
      "net_sales_total_original": 19,
      "discount_original": 1,
      "tax_original": 0,
      "views_count_original": 1,
      "add_to_cart_count_original": 1,
      "views_rate_original": 50,
      "add_to_cart_rate_original": 25,
      "view_client_count_original": 1,
      "add_cart_client_count_original": 1,
      "add_to_cart_conversion_rate_original": 100,
      "transform_rate_original": 100,
      "product_id": "e2da343c-182c-4908-b009-557cea226829",
      "brief": "",
      "spu": "123",
      "collection": "Collectionx_2022-06-2709",
      "created_at": "2022-03-24 19:18:44",
      "first_published_at": "",
      "published_at": "2022-03-24 19:18:44",
      "product_op_updated_at": "2023-08-21 15:43:34",
      "published": true,
      "order_count": "1",
      "sales_count": "1",
      "sales_total": "20.00",
      "net_sales_total": "19.00",
      "discount": "1.00",
      "tax": "0.00",
      "views_count": "1",
      "add_to_cart_count": "1",
      "views_rate": "50.00%",
      "add_to_cart_rate": "25.00%",
      "view_client_count": "1",
      "add_cart_client_count": "1",
      "add_to_cart_conversion_rate": "100.00%",
      "transform_rate": "100.00%",
      "seo_url": "/products/test1"
    }
  ]
}
```

```json
{
    "code": "200",
    "message": "OK",
    "count": 3,
    "data": [
        {
            "utm_source": "",
            "utm_medium": "",
            "utm_campaign": "",
            "utm_term": "",
            "utm_content": "",
            "image": "free/5d4c48f9e65ffab9e73efbf1fd37a0f3.jpg",
            "title": "test1",
            "order_count_original": 1,
            "sales_count_original": 1,
            "sales_total_original": 20,
            "net_sales_total_original": 19,
            "discount_original": 1,
            "tax_original": 0,
            "views_count_original": 1,
            "add_to_cart_count_original": 1,
            "views_rate_original": 50,
            "add_to_cart_rate_original": 25,
            "view_client_count_original": 1,
            "add_cart_client_count_original": 1,
            "add_to_cart_conversion_rate_original": 100,
            "transform_rate_original": 100,
            "product_id": "e2da343c-182c-4908-b009-557cea226829",
            "brief": "",
            "spu": "123",
            "collection": "Collectionx_2022-06-2709",
            "created_at": "2022-03-24 19:18:44",
            "first_published_at": "",
            "published_at": "2022-03-24 19:18:44",
            "product_op_updated_at": "2023-08-21 15:43:34",
            "published": true,
            "order_count": "1",
            "sales_count": "1",
            "sales_total": "20.00",
            "net_sales_total": "19.00",
            "discount": "1.00",
            "tax": "0.00",
            "views_count": "1",
            "add_to_cart_count": "1",
            "views_rate": "50.00%",
            "add_to_cart_rate": "25.00%",
            "view_client_count": "1",
            "add_cart_client_count": "1",
            "add_to_cart_conversion_rate": "100.00%",
            "transform_rate": "100.00%",
            "seo_url": "/products/test1"
        }
    ]
}
```

400

**application/json**

No schema
