curl --no-buffer --get "https://api.nextdns.io/profiles/$PROFILE_ID/logs/stream" \
--header "X-Api-Key: $NEXTDNS_API_KEY" \
--data-urlencode 'status=blocked'
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"}]}
Logs
Stream logs
Follow new DNS queries as server-sent events and resume after a disconnect.
GET
/
profiles
/
{profile}
/
logs
/
stream
curl --no-buffer --get "https://api.nextdns.io/profiles/$PROFILE_ID/logs/stream" \
--header "X-Api-Key: $NEXTDNS_API_KEY" \
--data-urlencode 'status=blocked'
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"}]}
The API sends log entries 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.
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.Continue from recent history
- List logs in descending order, leaving
toandcursorunset. - If the list contains entries, open the stream with
idset tometa.stream.id. Use the samedevice,status,search, andrawfilters. - 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.
curl --no-buffer --get "https://api.nextdns.io/profiles/$PROFILE_ID/logs/stream" \
--header "X-Api-Key: $NEXTDNS_API_KEY" \
--data-urlencode 'status=blocked'
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"}]}