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

# Domain Stats

> Retrieve aggregate view, lead, and link-click counts across all videos in a domain.

Returns total views, CTA form submissions, and CTA external link clicks aggregated across every video in the specified domain.

<Note>
  These stats are domain-wide aggregates. To retrieve stats for a single video, use `GET /v1/videos/:id/stats`.
</Note>

## Endpoint

```
GET /v1/domains/:domain_id/stats
```

## Authentication

<ParamField header="Authorization" type="string" required>
  Bearer token. Pass your API key: `Authorization: Bearer <api_key>`
</ParamField>

## Path parameters

<ParamField path="domain_id" type="number" required>
  The numeric ID of the domain. Retrieve domain IDs from `GET /v1/domains`.
</ParamField>

## Response

<ResponseField name="data" type="object" required>
  <Expandable title="properties" defaultOpen>
    <ResponseField name="views" type="number" required>
      Total unique views across all videos in the domain.
    </ResponseField>

    <ResponseField name="leads" type="number" required>
      Total CTA form submissions across all videos in the domain.
    </ResponseField>

    <ResponseField name="link_clicks" type="number" required>
      Total CTA external link clicks across all videos in the domain.
    </ResponseField>
  </Expandable>
</ResponseField>

## Error responses

| Status            | Condition                                                 |
| ----------------- | --------------------------------------------------------- |
| `400 Bad Request` | `domain_id` is not a valid number.                        |
| `404 Not Found`   | Domain does not exist or does not belong to your account. |

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url https://api.demomatic.tech/v1/domains/45/stats \
    --header "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const domainId = 45;

  const response = await fetch(
    `https://api.demomatic.tech/v1/domains/${domainId}/stats`,
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
      },
    }
  );

  const { data } = await response.json();
  console.log(data.views, data.leads, data.link_clicks);
  ```
</CodeGroup>

### Response

```json 200 theme={null}
{
  "data": {
    "views": 1284,
    "leads": 37,
    "link_clicks": 92
  }
}
```
