# Dispatch message history

_Dispatch / Message_

`GET /dispatch_history/{bucketId}`

## Parameters

- `bucketId` (string, required) — Project (bucket) identifier
- `x-api-key` (string, required) — API key passed in the request header for authentication
- `email` (string, optional) — Filter by recipient email address
- `subject` (string, optional) — Filter by message subject (partial match)
- `fromDate` (number, optional) — Start of date range as Unix timestamp (milliseconds)
- `toDate` (number, optional) — End of date range as Unix timestamp (milliseconds)
- `tags` (string, optional) — Comma-separated list of tags to filter by (e.g. onboarding,welcome)
- `sort` (string, optional, default: `"TimeStampDesc"`) — Sort order: TimeStampAsc or TimeStampDesc. Defaults to TimeStampDesc
- `from` (number, optional, default: `"0"`) — Zero-based offset for pagination
- `to` (number, optional, default: `"10"`) — Maximum number of records to return

## Responses

### `200` — Paginated list of dispatch history records.

Type: `PagedApiResponse<DispatchHistoryDto>`


### `401` — Unauthorized — API key is missing or invalid.


### `500` — Unexpected server error.

Type: `ApiResponse<T>`

- `success` (boolean) — Always false
- `errors` (ErrorDetail[]) — Server-side errors
  - `correlationId` (string) — Trace ID
  - `message` (string) — Error message
  - `stack` (string) — Stack trace (non-production only)


## Code Examples

### curl

```curl
curl --request GET \
  --url 'https://apis-spb.konso.io/dispatch_history/{bucketId}?from=0&to=20&sort=TimeStampDesc' \
  --header 'x-api-key: <your-api-key>'
```

### javascript

```js
const params = new URLSearchParams({ from: 0, to: 20, sort: 'TimeStampDesc' });

fetch(`https://apis-spb.konso.io/dispatch_history/{bucketId}?${params}`, {
  headers: { 'x-api-key': '<your-api-key>' }
})
  .then(res => res.json())
  .then(console.log);
```

### dotnet

```dotnet
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("x-api-key", "<your-api-key>");

var response = await client.GetAsync("https://apis-spb.konso.io/dispatch_history/{bucketId}?from=0&to=20&sort=TimeStampDesc");
var result = await response.Content.ReadFromJsonAsync<PagedApiResponse<DispatchHistoryDto>>();
```

### python

```python
import requests

headers = {'x-api-key': '<your-api-key>'}
params = {'from': 0, 'to': 20, 'sort': 'TimeStampDesc'}
response = requests.get('https://apis-spb.konso.io/dispatch_history/{bucketId}', headers=headers, params=params)
print(response.json())
```

### Response Example (200)

```json
{
  "total": 1,
  "list": [
    {
      "id": "msg_a1b2c3d4e5f6",
      "projectId": "my-bucket-id",
      "correlationId": "req-abc-123",
      "env": "production",
      "recipient": "user@example.com",
      "subject": "Welcome to Konso",
      "createdOn": 1718620800000,
      "messageType": 1,
      "status": "Sent",
      "statusId": 2,
      "errorMsg": null,
      "providerName": "SendGrid",
      "providerId": "prv_xyz789",
      "tags": ["onboarding", "welcome"],
      "sentOn": 1718620801500
    }
  ]
}
```
