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

# Fetch Campaign Statistics by Date Range

> Fetch campaign statistics using the campaign's ID filtered by date range

## Path Parameters

<ParamField path="campaign_id" type="integer" required>
  The ID of the campaign
</ParamField>

## Query Parameters

<ParamField query="api_key" type="string" required>
  Your API key
</ParamField>

<ParamField query="start_date" type="string" required>
  Start date in YYYY-MM-DD format
</ParamField>

<ParamField query="end_date" type="string" required>
  End date in YYYY-MM-DD format
</ParamField>

<ParamField query="time_zone" type="string">
  IANA timezone string (e.g. "America/New\_York")
</ParamField>

<Warning>
  The range between `start_date` and `end_date` must be **30 days or less**. A wider range returns `400 Bad Request`.
</Warning>

## Reply Fields

| Field | What it counts |
| - | - |
| `total_reply_count` | Every reply, with no exclusions |
| `non_ooo_reply_count` | Replies from leads not categorised as out-of-office |
| `reply_count` | Replies excluding any flagged as ignored |

Out-of-office replies are `total_reply_count - non_ooo_reply_count`.

`non_ooo_reply_count` comes from reply categorisation alone, so it does **not** depend on the per-campaign *ignore out-of-office* setting.

<Warning>
  `non_ooo_reply_count` can be higher than `reply_count`. `reply_count` also drops manually-ignored replies and replies whose sender is not the lead, neither of which is out-of-office. Compare `non_ooo_reply_count` against `total_reply_count`.
</Warning>

See [Get Campaign Analytics by Date Range](/api-reference/campaigns/get-analytics-by-date) for the full field list.

<RequestExample>
  ```bash cURL theme={null}
  curl "https://server.smartlead.ai/api/v1/campaigns/12345/analytics-by-date?api_key=YOUR_API_KEY&start_date=2024-01-01&end_date=2024-01-31"
  ```

  ```python Python theme={null}
  import requests

  API_KEY = "YOUR_API_KEY"
  CAMPAIGN_ID = 12345

  response = requests.get(
      f"https://server.smartlead.ai/api/v1/campaigns/{CAMPAIGN_ID}/analytics-by-date",
      params={
          "api_key": API_KEY,
          "start_date": "2024-01-01",
          "end_date": "2024-01-31"
      }
  )

  result = response.json()
  print(result)
  ```

  ```javascript JavaScript theme={null}
  const API_KEY = 'YOUR_API_KEY';
  const CAMPAIGN_ID = 12345;

  const response = await fetch(
    `https://server.smartlead.ai/api/v1/campaigns/${CAMPAIGN_ID}/analytics-by-date?api_key=${API_KEY}&start_date=2024-01-01&end_date=2024-01-31`
  );

  const result = await response.json();
  console.log(result);
  ```
</RequestExample>

## Response Codes

<ResponseField name="200" type="Success">
  Request successful
</ResponseField>

<ResponseField name="400" type="Bad Request">
  Invalid request parameters or malformed request body
</ResponseField>

<ResponseField name="401" type="Unauthorized">
  Invalid or missing API key. Check your authentication.
</ResponseField>

<ResponseField name="404" type="Not Found">
  The requested resource does not exist or you don't have access to it
</ResponseField>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "id": 123,
    "user_id": 456,
    "created_at": "2025-01-04T08:32:34.138Z",
    "status": "ACTIVE",
    "name": "Q1 Outbound",
    "start_date": "2025-01-01",
    "end_date": "2025-01-31",
    "sent_count": "23918",
    "unique_sent_count": "18262",
    "open_count": "7420",
    "unique_open_count": "5133",
    "click_count": "612",
    "unique_click_count": "489",
    "reply_count": "3929",
    "total_reply_count": "3929",
    "non_ooo_reply_count": "1502",
    "block_count": "0",
    "bounce_count": "1234",
    "unsubscribed_count": "18",
    "total_count": "122108",
    "drafted_count": "96904"
  }
  ```

  ```json 401 - Unauthorized theme={null}
  {
    "message": "Invalid API Key"
  }
  ```
</ResponseExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.