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

# Get A/B Test Stats

> Get aggregate and per-variant A/B test stats

Get aggregate A/B test stats and per-variant stats for the authenticated company. Open and click metrics exclude detected email-security scanners and tracked brand assets by default.

## Request

<ParamField path="abTestId" type="string" required>
  A/B test ID.
</ParamField>

<ParamField query="period" type="string">
  Optional period: `1h`, `24h`, `7d`, `30d`, or `90d`.
</ParamField>

<ParamField query="start" type="string">
  Custom range start as ISO 8601. Requires `end`.
</ParamField>

<ParamField query="end" type="string">
  Custom range end as ISO 8601. Requires `start`.
</ParamField>

<ParamField query="includeMachineEngagement" type="boolean" default="false">
  Set to `true` to include detected scanner, preview, and tracked asset
  open/click events in A/B test metrics.
</ParamField>

```bash theme={null}
curl "https://api.sequenzy.com/api/v1/ab-tests/ab_abc123/stats?period=30d" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Responses

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "abTestId": "ab_abc123",
    "period": "30d",
    "stats": {
      "sent": 200,
      "delivered": 198,
      "opened": 92,
      "clicked": 18,
      "openRate": 46.46,
      "clickRate": 9.09
    },
    "variants": [
      {
        "id": "var_a",
        "label": "A",
        "subject": "Welcome",
        "isWinner": false,
        "stats": {
          "sent": 100,
          "delivered": 99,
          "opened": 42,
          "clicked": 7,
          "openRate": 42.42,
          "clickRate": 7.07
        }
      }
    ]
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "error": "Invalid period. Must be one of: 1h, 24h, 7d, 30d, 90d"
  }
  ```

  ```json 401 theme={null}
  {
    "success": false,
    "error": "Unauthorized"
  }
  ```

  ```json 404 theme={null}
  {
    "success": false,
    "error": "A/B test not found"
  }
  ```
</ResponseExample>
