# General statistics

The `/api/stats` endpoint of the Collective Audience™ api is providing entity based stats

You can request statistics for your

* campaigns
* insertions
* contents

## General object in the /api/stats endpoint

The general stat object in this openned API is represented by the following schema :

* **date** : the day of the statistics (present if `&by_day=true`)
* **{entity}_id** : the id of the entity
* **{entity}_name** : the name of the entity
* **impressions** : the number of impressions
* **visible_impressions** : the number of visible impressions
* **engagements** : the number of first clicks on creatives
* **votes** : the number of votes on creatives
* **clicks** : the number of exit clicks on creatives
* **video_impressions** : number of video impressions
* **video_visible_impressions** : number of video visible impressions
* **video_starts** : number of video starts
* **video_first_quartiles** : number of video first quartiles (25% of video completion)
* **video_midpoints** : number of video midpoints (50% of video completion)
* **video_third_quartiles** : number of video third quartiles (75% of video completion)
* **video_completes** : number of video completes (100% of video completion)

### Campaigns

#### List

```http
GET https://data.collectiveaudience.co/api/stats/campaigns?api_key={yourToken}

RESPONSE LIST OF CAMPAIGNS
```

#### Get one

```http
GET https://data.collectiveaudience.co/api/stats/campaigns/{campaign_id}?api_key={yourToken}

RESPONSE ONE CAMPAIGN ITEM identified by {campaign_id}
```

### Insertions

#### List

```http
GET https://data.collectiveaudience.co/api/stats/insertions?api_key={yourToken}

RESPONSE LIST OF INSERTIONS
```

#### Get one

```http
GET https://data.collectiveaudience.co/api/stats/insertions/{insertion_id}?api_key={yourToken}

RESPONSE ONE INSERTION ITEM identified by {insertion_id}
```

### Contents

#### List

```http
GET https://data.collectiveaudience.co/api/stats/contents?api_key={yourToken}

RESPONSE LIST OF CONTENTS
```

#### Get one

```http
GET https://data.collectiveaudience.co/api/stats/contents/{content_id}?api_key={yourToken}

RESPONSE ONE CONTENT ITEM identified by {content_id}
```

## Params

You can pass query params to the request

* `api_key` (**required**) : your api token
* `date_from` (**optional** default **today**) : first day of statistics lookup (`YYYY-MM-DD`)
* `date_to` (**optional** default **today** ): last day of statistics lookup (`YYYY-MM-DD`)
* `by_day` (**optional** default **false**) : breakdown by day


:::info
If you omit the `date_to` param in your call, or if you set it to **today**, the response will **include real-time data** ! Enjoy it !

:::