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

# Get Campaign Stats

> Returns analytics and statistics for a specific campaign, with optional date range filtering.

## Headers

<ParamField header="token" type="string" required>
  Your LinkedCamp API token.
</ParamField>

## Path Parameters

<ParamField path="campaignId" type="string" required>
  The ID of the campaign.
</ParamField>

## Query Parameters

<ParamField query="userId" type="string">
  Optional user ID to filter stats by a specific user.
</ParamField>

<ParamField query="range" type="string">
  Optional JSON string specifying a date range for filtering stats.

  Format: `{"from": "YYYY-MM-DD", "to": "YYYY-MM-DD"}`

  Example: `range={"from": "2024-01-01", "to": "2024-01-31"}`
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Whether the request was successful.
</ResponseField>

<ResponseField name="message" type="string">
  A human-readable result message.
</ResponseField>

<ResponseField name="campaignId" type="string">
  The campaign ID.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET 'https://api.linkedcamp.com/campaigns/60f7a1b2c3d4e5f6a7b8c9d0/stats?range={"from":"2024-01-01","to":"2024-01-31"}' \
    -H "token: YOUR_API_TOKEN"
  ```

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

  response = requests.get(
      "https://api.linkedcamp.com/campaigns/60f7a1b2c3d4e5f6a7b8c9d0/stats",
      headers={"token": "YOUR_API_TOKEN"},
      params={"range": json.dumps({"from": "2024-01-01", "to": "2024-01-31"})},
  )
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const range = JSON.stringify({ from: "2024-01-01", to: "2024-01-31" });
  const url = `https://api.linkedcamp.com/campaigns/60f7a1b2c3d4e5f6a7b8c9d0/stats?range=${encodeURIComponent(range)}`;

  const response = await fetch(url, {
    headers: { "token": "YOUR_API_TOKEN" },
  });
  const data = await response.json();
  console.log(data);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "message": "Campaign stats found successfully!",
    "campaignId": "60f7a1b2c3d4e5f6a7b8c9d0"
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "message": "Invalid range format. Must be JSON: {\"from\": \"YYYY-MM-DD\", \"to\": \"YYYY-MM-DD\"}"
  }
  ```
</ResponseExample>
