# Nachrichtenstatistik (GET)

Ruf Statistiken zur Anzahl der Nachrichten ab, gruppiert nach Datum.

## Endpunkt

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

## Authentifizierung

> **Info: Erforderlich**
>
> Füge eine dieser Header in deiner Anfrage hinzu:
> - `Token: <your-api-key>` — Hol ihn dir unter [API-Schlüssel](https://pocketalert.app/account/apikeys)
> - `Authorization: Bearer <jwt-token>` — Aus [Anmeldung](https://info.pocketalert.app/api/user/login.md)

## Anfrage

### Beispielanfrage

**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();
```

## Antwort

### Erfolgreiche Antwort

> **Tip: 200 OK**
>
> Gibt ein Array mit der täglichen Anzahl an Nachrichten zurück

| Feld | Typ | Beschreibung |
|-------|------|-------------|
| `date` | string | Datum im Format `YYYY-MM-DD` |
| `count` | integer | Anzahl der an diesem Tag gesendeten Nachrichten |

```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 }
]
```

### Fehlerantworten

| Status | Beschreibung |
|:------:|-------------|
| `401` | Nicht autorisiert — Token ungültig oder fehlt |

> **Tip: Anwendungsfall**
>
> Nutze diesen Endpunkt, um Diagramme zum Nachrichtenaufkommen in deinem Dashboard anzuzeigen oder die Benachrichtigungsaktivität über die Zeit zu überwachen.
