> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sales by channel

> Sales by channel

### Request body

`SalesByChannelRequest`

<ParamField body="from" type="string" required>
  Inclusive window start (`YYYY-MM-DD`).
</ParamField>

<ParamField body="records" type="SalesRecordRequest[]" required />

<ParamField body="to" type="string" required>
  Inclusive window end (`YYYY-MM-DD`).
</ParamField>

### Responses

<ResponseField name="200" type="SalesByChannelResponse" />

<ResponseField name="400" type="ErrorBody" />

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.stateset.com/api/v1/reports/sales-by-channel' \
    --header 'Authorization: Bearer YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
    "from": "string",
    "records": [
      {
        "channel": "string",
        "order_date": "string",
        "revenue": "string",
        "units": "string"
      }
    ],
    "to": "string"
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "from": "string",
    "rows": [
      {
        "channel": "string",
        "order_count": 1,
        "total_revenue": "string",
        "total_units": "string"
      }
    ],
    "to": "string",
    "total_orders": 1,
    "total_revenue": "string",
    "total_units": "string"
  }
  ```
</ResponseExample>
