> ## 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.

# Video Stats

> Retrieve engagement statistics for a video.

Fetch view, lead, and link click counts for a specific video.

## Endpoint

```
GET /v1/videos/:id/stats
```

## Authentication

Pass your API key as a Bearer token in the `Authorization` header.

<ParamField header="Authorization" type="string" required>
  Your API key. Format: `Bearer <api_key>`.
</ParamField>

## Path parameters

<ParamField path="id" type="number" required>
  The ID of the video to retrieve stats for.
</ParamField>

## Response

<ResponseField name="data" type="object" required>
  <Expandable title="properties" defaultOpen>
    <ResponseField name="views" type="number" required>
      Total number of unique viewers.
    </ResponseField>

    <ResponseField name="leads" type="number" required>
      Number of CTA form submissions. This is `0` for videos with an external link CTA.
    </ResponseField>

    <ResponseField name="link_clicks" type="number" required>
      Number of CTA external link clicks. This is `0` for videos with a form CTA.
    </ResponseField>
  </Expandable>
</ResponseField>

<Note>
  `leads` and `link_clicks` are mutually exclusive based on your CTA type. A video with a form CTA will always have `link_clicks: 0`, and a video with an external link CTA will always have `leads: 0`.
</Note>

## Error responses

| Status | Description                                       |
| ------ | ------------------------------------------------- |
| `400`  | The provided `id` is not a valid number.          |
| `404`  | No video found with the given ID in your account. |

## Examples

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

  ```javascript JavaScript theme={null}
  const videoId = 123;

  const response = await fetch(`https://api.demomatic.tech/v1/videos/${videoId}/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": 142,
    "leads": 17,
    "link_clicks": 0
  }
}
```
