> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nextdns.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Stream logs

> Follow new DNS queries as server-sent events and resume after a disconnect.

The API sends [log entries](https://docs.nextdns.io/api-reference/logs/list.md) over a `text/event-stream` connection. Each event has a resume position in `id` and one JSON object in `data`. Multiple entries recorded in the same millisecond can share an ID. Lines beginning with `:` are keepalives.

**profile** `string` *required*

Profile ID.

**id** `string`

Resume after this position. The `Last-Event-ID` header takes precedence over the query parameter. With neither, the stream starts from the time you connect.

**device** `string`

A device ID, or `__UNIDENTIFIED__` for queries from unidentified devices.

**status** `string`

One of `default`, `error`, `blocked`, `allowed`, `rewritten`, or `relayed`.

**search** `string`

Match a case-sensitive substring of the recorded domain.

**locale** `string` (default: en)

Language for the display names in `reasons`, such as `fr`.

**raw** `boolean` (default: false)

Use `1` or `true` to include individual queries across all recorded types.

## Continue from recent history

1. [List logs](https://docs.nextdns.io/api-reference/logs/list.md) in descending order, leaving `to` and `cursor` unset.
2. If the list contains entries, open the stream with `id` set to `meta.stream.id`. Use the same `device`, `status`, `search`, and `raw` filters.
3. Save the last event ID you process. Public streams close after about 55 minutes and can close earlier. Reconnect with the saved ID to receive newer entries.

```bash cURL theme={null}
curl --no-buffer --get "https://api.nextdns.io/profiles/$PROFILE_ID/logs/stream" \
  --header "X-Api-Key: $NEXTDNS_API_KEY" \
  --data-urlencode 'status=blocked'
```

```text 200 theme={null}
id: 64vkjdhg6ctkechm60v3g
data: {"timestamp":"2026-11-30T10:15:24.068Z","domain":"ads.example.com","root":"example.com","encrypted":true,"protocol":"DNS-over-HTTPS","status":"blocked","reasons":[{"id":"denylist","name":"Denylist"}]}

```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.