> ## 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.

# List logs

> Read a profile’s DNS query history and filter it by time, device, domain, or status.

Read recent DNS activity, newest first. Use `raw=1` to see individual queries across all recorded types. To follow new queries as they arrive, [stream logs](https://docs.nextdns.io/api-reference/logs/stream.md). For a full export, [download a CSV](https://docs.nextdns.io/api-reference/logs/download.md).

**profile** `string` *required*

Profile ID.

## Query parameters

**from** `string`

Start of the time range, inclusive. For example, `-6h` selects the last six hours. If you log queries without domain names, use `raw=1` for exact time boundaries. See [Dates and time zones](https://docs.nextdns.io/api-reference/time-ranges.md) for supported formats.

**to** `string`

Include queries earlier than this time. Use a fixed end time to page through a historical range.

**sort** `string` (default: desc)

Use `desc` for newest first or `asc` for oldest first.

**limit** `integer` (default: 100)

Maximum entries per page, from `10` to `1000`.

**cursor** `string`

Pass the previous response’s `meta.pagination.cursor` to continue with the same filters and sort order.

**device** `string`

Filter by the `device.id` in a log entry. Use `__UNIDENTIFIED__` to select queries from unidentified devices.

**status** `string`

Accepts one of `default`, `error`, `blocked`, `allowed`, `rewritten`, or `relayed`.

**search** `string`

Match a case-sensitive substring of the recorded domain. For example, `example` matches both `api.example.com` and `myexample.org`.

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

Language for the display names in `reasons`, such as `fr`. Use the reason’s `id` to identify it across languages.

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

Set to `1` or `true` to see all recorded queries. The default view includes `A`, `AAAA`, `HTTPS`, and entries whose type was omitted for privacy. It hides background lookups such as health checks and groups repeat lookups of the same domain within five seconds, by device ID or client IP when available.

## Log entries

The `data` array contains one object per entry. A profile’s logging settings determine which details are available.

| Field | Meaning |
| - | - |
| `timestamp` | When NextDNS recorded the query, in UTC. |
| `domain`, `root` | The requested domain and its root domain, when recorded. |
| `status`, `reasons` | How NextDNS handled the query. Each reason contains an `id` and a display `name`. The array can be empty. |
| `matched`, `tracker` | The domain that matched a rule and the recognized tracker identifier, when available. |
| `protocol`, `encrypted` | The DNS transport and whether it was encrypted. |
| `clientIp`, `client` | The client’s public IP address and DNS client identifier, when available. |
| `device` | For an identified device, its `id` and any available `name`, `model`, and `localIp`. |
| `type`, `dnssec` | In raw mode, the recorded DNS record type when available and a boolean indicating whether NextDNS recorded a DNSSEC-authenticated response. |

A nonempty first page in descending order also includes `meta.stream.id` when you omit `to`. Use it to [stream subsequent entries](https://docs.nextdns.io/api-reference/logs/stream.md). For another page of history, use the [pagination cursor](https://docs.nextdns.io/api-reference/responses.md).

When reading raw queries oldest first, set `to` to a fixed time in the past for a finite export. With an open-ended range, a request can return an empty page and repeat your cursor while it waits for newer entries.

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

```json 200 theme={null}
{
  "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" }
      ]
    }
  ],
  "meta": {
    "pagination": { "cursor": null },
    "stream": { "id": "64vkjdhg6ctkechm60v3g" }
  }
}
```


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