# Message Statistics (GET)

Get message count statistics grouped by date.

## Endpoint

```
GET https://api.pocketalert.app/v1/messages/stat
```

## Authentication

> **Info: Required**
>
> Include one of these headers in your request:
> - `Token: <your-api-key>` — Get it from [API Keys](https://pocketalert.app/account/apikeys)
> - `Authorization: Bearer <jwt-token>` — From [Login](https://info.pocketalert.app/api/user/login.md)

## Request

### Example Request

**cURL**

```bash
curl -X GET "https://api.pocketalert.app/v1/messages/stat" \
  -H "Token: your-api-key"
```

**JavaScript**

```javascript
const response = await fetch('https://api.pocketalert.app/v1/messages/stat', {
  headers: { 'Token': 'your-api-key' }
});
const stats = await response.json();
```

**Python**

```python
import requests

response = requests.get(
    'https://api.pocketalert.app/v1/messages/stat',
    headers={'Token': 'your-api-key'}
)
print(response.json())
```

**PHP**

```php
$response = Http::withHeaders([
    'Token' => 'your-api-key',
])->get('https://api.pocketalert.app/v1/messages/stat');

return $response->json();
```

## Response

### Success Response

> **Tip: 200 OK**
>
> Returns an array of daily message counts

| Field | Type | Description |
|-------|------|-------------|
| `date` | string | Date in `YYYY-MM-DD` format |
| `count` | integer | Number of messages sent that day |

```json
[
  { "date": "2023-06-07", "count": 9 },
  { "date": "2023-06-08", "count": 14 },
  { "date": "2023-06-11", "count": 3 },
  { "date": "2023-06-12", "count": 23 },
  { "date": "2023-06-13", "count": 17 }
]
```

### Error Responses

| Status | Description |
|:------:|-------------|
| `401` | Unauthorized — Invalid or missing token |

> **Tip: Use Case**
>
> Use this endpoint to display message volume charts in your dashboard or to monitor notification activity over time.
